Sujal Patel
Sujal Patel

Reputation: 624

Set Cron Auto Backup mysql Databases

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...

Upvotes: 0

Views: 746

Answers (2)

Álvaro González
Álvaro González

Reputation: 146450

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.

Upvotes: 0

Mayank Pandeyz
Mayank Pandeyz

Reputation: 26258

Try this:

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

Upvotes: 0

Related Questions