0
votes

i have try to set cron file for get auto backup to all my database table.

i was using following mysqldump command :

sudo mysqldump -u username -p password --all-databases | gzip > mysqldb_`date +%F`.sql.gz

but it's show following error :

mysqldump: Got error: 1049: Unknown database 'password' when selecting the database

any other option to get automatic mysql database backup

thank you...

2
Possible duplicate of PHP regular backup of mysql datae4c5
first time i have set cron file.Sujal Patel

2 Answers

0
votes

Try this:

sudo mysqldump -u root -p<mysql-password> --all-databases | gzip > mysqldb_date +%F.sql.gz
0
votes

From docs (emphasis mine):

--password[=password], -p[password]

The password to use when connecting to the server. If you use the short option form (-p), you cannot have a space between the option and the password. If you omit the password value following the --password or -p option on the command line, mysql prompts for one.