1add this to .my.cnf file
2user can be omitted
3
4[mysqldump]
5user=mysqluser
6password=secret
7
8The -p option must be excluded from the command in order to use the password in the config file.
9Correct:
10mysqldump –u my_username my_db > my_db.sql
11Wrong:
12mysqldump –u my_username -p my_db > my_db.sql