Backup problem

I’ve followed the instruction on the wiki to create tarball of the site and database with a script that run on cronjobs but i’m stuck with a problem: the mysql database is not accepting connections so the script can’t backup the database.

The error i keep getting is this:
mysqldump: Got error: 1045: Access denied for user ‘xxx’@‘’ (using password: YES) when trying to connect

I used same user and password as for the installation of zencart provided by dh that was successful and also added as an allowed host in the database settings, any suggestions?

Make sure you’re using the credentials for the MySQL user you created for that database. To check this, in the panel, go to Goodies>Manage MySQL. You should see a list of database and the users that have access to that database. If you click on the username in the panel you should be able to edit that user.

When you set up ZenCart, you should have entered the MySQL username and password for the new database user if you created a new database and user for that install. This is most likely what you did so you should look for this info in one of the confirmation emails you got sent for the One-click install.

Free unique IP and $67 off with code [color=#CC0000]LMIP67[/color] or use [color=#CC0000]LM97[/color] for $97 off. Click for more promo code discounts

Did you make sure that there are no spaces in the mysqldump syntax? The script snipped in the wiki:

mysqldump --opt -uUser -ppass -h db_nameA > mysql/db_nameA.$suffix.sql

There is no space between the -u switch an the username for example. I have often seen people make this mistake.

Did you try entering just the above command on the shell itself (with you data)?


Promo-Code: [color=#CC0000]SAVEMONEY97[/color] - Save [color=#CC0000]$97[/color] on your first year of hosting.
Use [color=#CC0000]SAVE2DOMAIN[/color] to save [color=#CC0000]$82[/color] and get a second domain for free

Well, I’ve seen people make lots of different mistakes with MySQL command lines, but that “space between the -u switch and the username” is not one that will break the query. :wink:

Actually, my tests show that it will work either way if every thing else is correct, and FWIW, the MySQL doucmentation examples use the space after the -u switch.

It is important however that you not put a space after the -p before you enter the password if entering the password from the command line.


That error message is exactly what you will get if you have either an incorrect password, or your syntax regarding the use of the password is wrong in your command line.

Are you trying to run this mysqldump from a machine other than the machine the dbuser user has the ssh account on?


Interestingly wasn’t there another user on this forum a few days ago who had connection problems using ‘mysql’ on the shell when not leaving a space between the -u and the username? He used a command from the wiki and later found a different string in the panel and then you corrected the wiki entry. Wasn’t that a similar situation where the space did make a difference? Just wondering.


Promo-Code: [color=#CC0000]SAVEMONEY97[/color] - Save [color=#CC0000]$97[/color] on your first year of hosting.
Use [color=#CC0000]SAVE2DOMAIN[/color] to save [color=#CC0000]$82[/color] and get a second domain for free


Thanks for reminding me of that; I had forgotten to reference, or correct that post. You are correct about what the other user reported. I did “test” what he said about the “space” working so I updated the wiki.

That said, it didn’t seem to jive with what I remembered about the command line use of MySQL so I subsequently tested it myself both ways, and then researched it in the MySQL documentation.

The end result was as I reported in my post in this thread. I can only assume that he had some other error, besides the space, that he corrected at the same time that allowed the command to work for him (or possibly he had a host that had not yet propagated that began to work).

At any rate, the wiki article is correct either way. :wink:



if I think about it, you’re right. I figured there might be some inconsistency between the mysql programs, some accepting the spaces and other don’t, but that might only be my wild imagination. My own backup scripts don’t use spaces between the switches and the values and for some reason I always use spaces when I type in commands manually on the shell. Anyway, it doesn’t seem to matter. :slight_smile:


Promo-Code: [color=#CC0000]SAVEMONEY97[/color] - Save [color=#CC0000]$97[/color] on your first year of hosting.
Get more promo codes here

Thanks for the reply,

i checked the user on the panel, made sure the password i was using was correct and that the user had all the permissions on the database, than tried to run the command from shell and still same problem:

mysqldump: Got error: 1045: Access denied for user ‘xxxx’@‘’ (using password: YES) when trying to connect.

The hostname i use bytheway is the hostname given to me on the email by the oneclick robot and yet installation of zencart went fine but mysqldump wont work

still no solution for this, i’ve tryed adding my ip address in the allowed host and after that i tryed connecting from home with navicatmysql and i was able to manage the database. I than added as an allowed host as my ssh access is on that box but still when i try to run the automatic backup it says that the user (which i double-triple checked is correct) is not allowed to connect. Quite annoying that noone can help specuially as on the wiki it’s given for granted that this method works.

If it’s working from your home box there’s almost certainly something wrong with your syntax for the command. Please post the exact command you’re using to backup the DB - just change your user and pass to XXX or whatever, but let me see the rest of the information.

It’s “given as granted that this method works” because it does - I wrote the original write up in the wiki, use the system weekly, and know bunches of other people do to. So take a step back, breathe, and let’s see if we can work you through this. Please keep in mind too, that we’re only customers like your self, we’re not paid by DH (though that would be nice - like $1 per post).

–Matttail - personal website

Sorry i’m just getting frustrated :frowning: the command is this:

mysqldump --opt -uXXX -pXXX -h shop > shop.$suffix.sql

mysqldump: Got error: 1045: Access denied for user ‘XXX’@‘’ (using password: YES) when trying to connect

For some closure here, if your password contains strange characters, the command may not work as part of a script. In my case, the bash script had parameters defined in " ", but any password with a $ would fail because the script would try to interpret it - changing it to single quotes ’ ’ fixed the problem with the script.

on the command line, you can even pass it as -p’ComplexPassword’ to avoid issues with pw characters

If you’ve got an unusual password, it may be easier to omit from the command line (just use “-p” instead of “-pMyWeirdPassword”). When you do this, MySQL will prompt you for the password on a separate line:

sh# mysql -umysqluser -p mydb Enter password: _

Same thing goes for “mysqldump”.

If you have a $ in there (i.e., Pas$word)… try entering -pPas$word

Yeah, I always use spaces when I type in commands manually on the shell. Anyway, it doesn’t seem to matter.