0

I googled a while but couldn't find an answer. Although it is often explained, how you simply could put a .my.cnf into your /root and make your funny full database dumps without having to enter a password.

Example:

mysqldump --complete-insert --opt -Q -h example.com -u db_user -p databasename > dump.sql

Now, the following would help me with this - and only this - user:

[mysqldump]
host=example.com
user=db_user
password=password

I expected it would be possible to define several users and passwords for different hosts. Maybe by using the block multiple times? Couldn't find anything written about this.

1 Answer 1

2

You can do it by define another .cnf file:

[mysqldump]
host=example2.com
user=db_user2
password=password2

and use --defaults-extra-file option:

mysqldump --defaults-extra-file=/path/to/another.cnf --complete-insert --opt -Q > dump.sql
1
  • Thx, it worked!
    – Leif
    Aug 26, 2011 at 12:26

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .