If you have an error like this:
mysqldump: [Warnings] Using a password on the command line interface can be insecure.
You can create mysqldump like this:

Code: Select all

mysqldump --defaults-extra-file=/path/to/config.cnf
create config.cnf:

Code: Select all

[client]
user = whatever
password = whatever
host = whatever
Now lets backup a database

Code: Select all

mysqldump --defaults-extra-file=/path/to/config.cnf database > /root/export.sql
It's not the best practice because the password is in a file and not encrypted!