MySQL equivalent to .pgpass, or automatic authentication in a cron job for mySQL
Posted
by Ibrahim
on Server Fault
See other posts from Server Fault
or by Ibrahim
Published on 2010-03-08T00:25:26Z
Indexed on
2010/03/08
3:32 UTC
Read the original article
Hit count: 661
I'm writing a bash script to back up my databases. Most are postgresql, and in postgres there's a way to avoid having to authenticate by creating a ~/.pgpass file which contains the postgres password. I put this in root's home directory and made it chmod 0600, so that root could dump the postgres databases without having to authenticate. Now I want to do something similar for mysql, although I only have one mysql database. How can I do this? I don't want to specify the password on the command line for mysqldump because this is part of a script that might be somewhat visible to other users. Is there a better way (i.e. built in to mysql) to do this than make a file that only root can read and then read that to get the mysql password, and then use that in the bash script as a variable?
© Server Fault or respective owner