I have a very simple wish, to dump all databases so I can lock up a backup of the databases, tables, users and so on.
It looked like

mysqldump -v --all-databases -u root -p secret > "${directory2}""$h"_mysql_dumpall.sql

worked, however the file contained a little error message telling me I had the options messed up.

Usage: mysqldump [OPTIONS] database [tables]
OR     mysqldump [OPTIONS] --databases [OPTIONS] DB1 [DB2 DB3...]
OR     mysqldump [OPTIONS] --all-databases [OPTIONS]
For more options, use mysqldump --help

Using MySQL on Ubuntu however I want to use the same script on Debian as well at some point.

Your MySQL connection id is 12599
Server version: 5.1.41-3ubuntu12.10 (Ubuntu)

The directory location variables ${directory2} and file-naming variable ${h} work.
I could make the code simpler by putting the *.sql file into /var/lib/mysql/ then compress it into a tarball then transfer the tarball to where it will be staged for backup. This has worked with postgresql pg_dumpall.

I feel like the issue may be small, but my googling around has not found me an answer.

-Wolf

I have a very simple wish, to dump all databases so I can lock up a backup of the databases, tables, users and so on.
It looked like

mysqldump -v --all-databases -u root -p secret > "${directory2}""$h"_mysql_dumpall.sql

worked, however the file contained a little error message telling me I had the options messed up.

Usage: mysqldump [OPTIONS] database [tables]
OR     mysqldump [OPTIONS] --databases [OPTIONS] DB1 [DB2 DB3...]
OR     mysqldump [OPTIONS] --all-databases [OPTIONS]
For more options, use mysqldump --help

Using MySQL on Ubuntu however I want to use the same script on Debian as well at some point.

Your MySQL connection id is 12599
Server version: 5.1.41-3ubuntu12.10 (Ubuntu)

The directory location variables ${directory2} and file-naming variable ${h} work.
I could make the code simpler by putting the *.sql file into /var/lib/mysql/ then compress it into a tarball then transfer the tarball to where it will be staged for backup. This has worked with postgresql pg_dumpall.

I feel like the issue may be small, but my googling around has not found me an answer.

-Wolf

This turned out to be much easier than I thought. I put everything in front of "--all-databases" and removed the space between -p and the password.

mysqldump -v -u root -p--secret-- --all-databases > "${directory2}""$h"_mysql_dumpall.sql
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.