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.

Reply

Please enter an answer
Tips:

You can mention users to notify them: @username

You can use Markdown to format your question. For more examples see the Markdown Cheatsheet.

> I’m a blockquote.

I’m a blockquote.

[I'm a link] (https://www.google.com)

I'm a link

**I am bold** I am bold

*I am italicized* I am italicized

Community Code of Conduct