Mysql error message 1044


#1

Hey all,

I’m trying to do a dump function in order to backup my database (i’m using the DH help file and following their code). when i click enter in SSH window, it asks me to enter password (even though i include my password in the code) when I enter my db password this is the error message that comes up:

mysqldump: Got error: 1044: Access denied for user: ‘UserName@ipNumber/ipNumber’ to database ‘DB’ when selecting the database

Another strange thing is that where it says “… to database ‘DB’…”, instead of referring to the db name, it show my password (so where you see ‘DB’ in the error it displays my password)

I thought it’s the chmod but I changed it and the error still comes up.

anyone knows what the problem is?
thanks.


#2

What’s the exact command you’re running? (omitting your password, of course).

You shouldn’t use your password on the command line anyway. Using just -p will cause the mysql client to prompt you for it.


If you want useful replies, ask smart questions.


#3

this is the command I’m running:

mysqldump -u USERNAME -p ‘PASSWD’ -h HOSTNAME DBNAME > db_backup.sql

Thanks


#4

and by the way, the file db_backup.sql is created but empty


#5

I had a similiar problem when I was setting up a database dump to be run to cron. I change the order of things around a bit from the Dreamhost K-base. I also had a issue with remembering the passowrds I had used. I ended up creating an additional user for a couple of my databases to work around this. You can always double check if you think this might be an issue by logging into phpmyadmin.

Also double check, if you’re using a text file, that the line is not wrapping. you can use nano -w textfile.sh to edit the file so it shouldn’t wrap.

Anyways, here’s the basics of the script I use, see if it helps you.

suffix=$(date %y%m%d)
mysqldump --opt -uUser -pPass -h host.domain.com database_name > file/locationl/database.$suffix.sql

(edit: the suffix thing creates the files with the current date in the file name string. Helpful if this is a regular process.)

-Matttail


#6

Don’t use a space between “-p” and your password (or better, try it without including your password, per my previous post).

Details (read the user comments about halfway down the page)


If you want useful replies, ask smart questions.


#7

Thanks much. it works now.
But the date part didn’t work for some reason. It keeps creating a file without including the date in its name.
When it didn’t work I tried to do this:

$suffix=‘date+%y%m%d’

(from an example I found online)
I also tried to put the date+… etc. directly in the file name (not using a variable) but still doesn’t appear in the file name.
why?

thanks


#8

Those single quotes should be backticks (on the ~ key), you don’t need the $ in that line, and you need a space after the ‘date’ command:

DATE=`date +%Y%m%d`

If you want useful replies, ask smart questions.