INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Jobs

mysqldump error

mysqldump error

(OP)
I am trying to set up a backup routine using windows task scheduler but the problem I am having starts before I even use task scheduler.

C:\Program Files\MySQL\MySQL Server 5.5\bin>mysqldump -h localhost -u root -pMypass mydatabase > c:\10am.txt
mysqldump: Got error: 1045: Access denied for user 'ODBC'@'localhost' (using password: YES) when trying to connect

if I enter the following
C:\Program Files\MySQL\MySQL Server 5.5\bin>mysqldump -h localhost -u root -p mydatabase > c:\10am.txt
and then enter the password it works, but I dont want to have to keep putting in the password manually because I want this to be automated by task scheduler.I dont understand why it would be complaining.

RE: mysqldump error

does it work with --password=PASSWORD ?

Chris.

Indifference will be the downfall of mankind, but who cares?
Time flies like an arrow, however, fruit flies like a banana.
Webmaster Forum

RE: mysqldump error

(OP)
Hi Chris

No it does not ... I get the same error. Very strange, my plan was to use task scheduler. I have been looking at the MYSQL Administrator console and there is an option for running backups there. I have created a backup user with grant all rights, but watching a youtube video the person mentions you must use the root user? surely the account I have created should be ok?

With regards to the problem, I can not for the life of my understand why it does not work. By the way, I have it installed on server 2012 running mysql 5.5.

Thanks,

RE: mysqldump error

you can use whatever user has appropriate privileges.

Quote:


C:\Program Files\MySQL\MySQL Server 5.5\bin>mysqldump -h localhost -u root -pMypass mydatabase > c:\10am.txt
mysqldump: Got error: 1045: Access denied for user 'ODBC'@'localhost' (using password: YES) when trying to connect

I find that very odd as you are not specifying the ODBC user in the connection string.

try using the long/explicit form

CODE

mysqldump --host=localhost --user=root --password=myPassword --opt mydatabasename > c:\10am.txt 

also be sure that you have properly created the user.

if you are using root, then remember that the root account is locked to the localhost only unless you have explicitly told mysql otherwise.

to create a backup user you might try the following

CODE

mysql --user=root --password=rootpassword --host=localhost
mysql> GRANT LOCK TABLES, SELECT ON *.* TO 'myBackupUser'@'%' IDENTIFIED BY 'myBackupUserPassword';
mysql> flush privileges; 

RE: mysqldump error

Aah, the wonders of YouTube where everyone is an "expert".

However the user having SELECT privileges on ALL databases and tables should be sufficient,

CODE --> sql

USE mysql;
GRANT SELECT ON *.* TO 'username'@'localhost' IDENTIFIED BY 'password'; 

but your script/command line is not even getting that far, so it is possibly the allowed hosts for the user that is tripping it up.

Check what hosts are allowed with:

CODE --> sql

USE mysql;
select User,Host from mysql.user; 



Chris.

Indifference will be the downfall of mankind, but who cares?
Time flies like an arrow, however, fruit flies like a banana.
Webmaster Forum

RE: mysqldump error

(OP)
Thank you both for the replies, I have achieved what I needed using the MySQL Administrator backup facility. I have set up hourly backups to run daily. Strangely trying both your methods did not work. By the way I am running this directly on the Mysql server with the root username and password and still get the same issue and as mentioned before if I run the command without the password and when it prompts me it works. That is just to prove it works but not what I want. My thinking is there must be something wrong with MySQL?

Thanks again.

RE: mysqldump error

occam's razor suggests that it's more likely to be something wrong with the way you are entering the commands or the way that your system is set up; or the way that you have granted perms to the users.

if mysql were unstable only in this one way I'd be very surprised indeed!

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members!

Resources

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close