Error when trying to run a mysqldump
Hi there,
I have already created a ~/.my.cnf file with the below content:
[mysqldump]
user=databaseuser
password=password
But I still getting the below error when trying to run mysqldump:
mysqldump: [ERROR] Failed to open required defaults file: /home/my_user/.my.cnf
mysqldump: [ERROR] Fatal error in defaults handling. Program aborted!
The command I am trying to use to do that is as follows:
mysqldump --defaults-file=~/.my.cnf -u root database_name | gzip -c > /var/backups_mysql/database.sql.gz
Someone could help me here, if possible?
P.S.: the .my.cnf file is already with chmld 600 .
2 Replies
You wrote:
mysqldump: [ERROR] Failed to open required defaults file: /home/my_user/.my.cnf
mysqldump: [ERROR] Fatal error in defaults handling. Program aborted!
You also wrote:
P.S.: the .my.cnf file is already with chmld [sic] 600.
Permissions are only half of the picture… Who owns /home/my_user/my.cnf? I'll bet it ain't the mysql user! Also, you prob want the permissions to be 0640 (-rw-r-----).
-- sw
Hi,
Thank you. I'll take a look.