I ran into an issue today trying to perform a mysqldump with the following command

mysqldump --user=user --password=$0m#P@SSw0rd --host=localhost vbulletin | gzip -9 > vbulletin-db.sql.gz

I kept getting this error

###### WARNING ######
Errors reported during AutoMySQLBackup execution.. Backup failed
Error log below..
mysqldump: Got error: 1045: Access denied for user 'user'@'localhost' (using password: YES) when trying to connect

And re-runing it, I would get this error as well:

ERROR 1045 (28000): Access denied for user 'user'@'localhost' (using password: YES)

I spent a good deal of time searching for the reason for this issue, and stumbled across this posting
http://bytes.com/topic/mysql/answers/141960-strange-authentication-trouble-about-mysqldump-error-1045-a

Specifically:

Your password may contain shell metacharacters, such as !#'”`&;
or even whitespace. This could cause problems in the first command
example, even if the password works when you enter it interactively at a
password prompt.

The solution is that you may need to quote the password, and possibly
put backslashes in even if you quote it. For instance, if your password
is “I’m #1”, this might work:
bin/mysqldump –opt –user=xxx –password=’I\’m #1′ DB > DB.bak

So I quoted my password like:

mysqldump --user=user --password='$0m#P@SSw0rd' --host=localhost vbulletin | gzip -9 > vbulletin-db.sql.gz

and I finally got this to run with the correct permissions.

Mick Knutson

Java, JavaEE, J2EE, WebLogic, WebSphere, JBoss, Tomcat, Oracle, Spring, Maven, Architecture, Design, Mentoring, Instructor and Agile Consulting. http://www.baselogic.com/blog/resume

View all posts

Categories

BLiNC Adsense