mysqldump: keep getting error 1045 Access denied

digital1stein used Ask the Experts™

I don't know what I'm doing wrong but I keep getting this error when attempting to mysqldump a database to a sql file:

C:\Users\dixi>mysqldump -u root -p mydatabase  > D:\test.sql
Enter password: ****
mysqldump: Got error: 1045: Access denied for user 'ODBC'@'localhost' (using pas
sword: YES) when trying to connect

Server is Windows 2008R2 with Mysql 5.1 installed.
The user is the root user and the password is certainly correct as I can login to the mysql prompt with these credentials.
Command works perfectly on my local mysql db, but not on the server.

Any advice?
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
This appears because you`re trying to connect as user ODBS  ('ODBC'@'localhost')
With root it must be a 'root'@'localhost'

Or add user ODBC and add privileges to him


No, that's not it.

I tried with
mysqldump -u 'root'@'localhost' -p mydatabase  > D:\test.sql
and still getting the same error.
Introduction to Web Design

Develop a strong foundation and understanding of web design by learning HTML, CSS, and additional tools to help you develop your own website.


The error I got with the 'root'@'localhost' attempt was:

mysqldump: Got error: 1045: Access denied for user 'root'@'localhost'@'localhost
' (using password: YES) when trying to connect

add user ODBC and add privileges to him

mysqldump -uroot -p -B mydatabase  > D:\test.sql
Dave BaldwinFixer of Problems
Most Valuable Expert 2014

If it was as simple as you say, you might get an error for 'root' but not for 'ODBC'.  Where is the actual database located?  Here is the page for 'mysqldump', there are a lot of options and some restrictions.


I found the solution meanwhile.

Logically, I had to omit whitespaces.
So mysqldump -u root -p mydatabase  > D:\test.sql is wrong
But mysqldump -uroot -p mydatabase  > D:\test.sql works fine

Or another way:
mysqldump --user=root --p mydatabase  > D:\test.sql

Thanks for putting me on the way.

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial