0

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

Edited by wolf29: Solved

1
Contributor
1
Reply
3
Views
5 Years
Discussion Span
Last Post by wolf29
0

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
This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.