You can create mysqldump like this:
mysqldump --defaults-extra-file=/path/to/config.cnf
Code language: JavaScript (javascript)
create config.cnf:
[client]
user = whatever
password = whatever
host = whatever
Now lets backup a database
mysqldump --defaults-extra-file=/path/to/config.cnf database > /root/export.sql
Code language: JavaScript (javascript)
mysqldump: [Warnings] Using a password on the command line interface can be insecure.
It’s not the best practice because the password is in a file and not encrypted!