I have a godaddy hosting account (shared hosting). On it I have a MySql database that I want to backup to a file daily. (Which I will later download for off-server backup).

I have set up the following command in my cron file (ran daily):

mysqldump -–opt -Q -h [myhost] -u myusername -–password=***** ebooklibrary > /fullpath.../_db_backups/openelibrary.sql

The database name is ebooklibrary.

I am constantly getting this error:

mysqldump: Got error: 1045: Access denied for user 'myusername'@'97.74.144.139' (using password: NO) when trying to connect

How can I fix this, or do it properly, so that mysqldump will run daily?

Thanks.


Using the shell, the following command worked:

 mysql -h myhost -u myusername -p"*****" ebooklibrary
link|improve this question
feedback

2 Answers

up vote 3 down vote accepted

I believe the matter is with how you specify the password. Try

mysqldump –opt -Q -h [myhost] -u myusername –p"*****" ebooklibrary > /fullpath.../_db_backups/openelibrary.sql
link|improve this answer
tnx, I will check it this solves it – Am. Feb 4 '10 at 5:23
hi, still getting the same problem. is there something i am missing? – Am. Feb 5 '10 at 6:45
What command line can you use to connect to the database with using the mysql client? – Brian De Smet Feb 7 '10 at 4:54
I'v updated the question with the command – Am. Feb 7 '10 at 12:24
this got on me on tracks, tried the dump manually, and all it took was some options change. – Am. Feb 8 '10 at 16:09
feedback

When specifying a password on the command line, you need to use

--password="xxx"

rather than

-password="xxx"

Note the double dash on the first command.

EDIT: Do you know if the DB server is the same server as the web server? If so, have you tried omitting the host? With that thought, have you also tried --host=127.0.0.1 (Just tried that on my machine - it seems very anal about the correct host name)

link|improve this answer
copy&paste error, it was double-dashed in the cron. – Am. Feb 7 '10 at 22:59
tnx for the help, fixed. was the options after all. – Am. Feb 8 '10 at 16:09
feedback

Your Answer

 
or
required, but never shown

Not the answer you're looking for? Browse other questions tagged or ask your own question.