Tell me more ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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
share|improve this question

3 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
share|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

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)

share|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

use below command if you are running command on server

mysqldump -uUSER -pPASS ebooklibrary > /fullpath.../_db_backups/openelibrary.sql

or you can use

mysqldump -h IP -uUSER -pPASS ebooklibrary > /fullpath.../_db_backups/openelibrary.sql

for this you should have global permissions (%) or permissions on that IP.

share|improve this answer
At least explain what you think the OP's error was and why you think your version should work (and is better than the already accepted answer). – SvW Feb 22 at 11:37

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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