Connecting Tech Pros Worldwide Help | Site Map

MySQL 1045 Authentication error

Newbie
 
Join Date: Oct 2009
Posts: 4
#1: 3 Weeks Ago
I have very strange error

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

I have installed mysql freshly with blank password for user "root" when I am trying perform backup with mysqldump I am getting the strange error

I am trying with the folowing command

d:\xampp\mysql\bin\mysqldump -u [root] -p []

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

Any one please help me
best answer - posted by mwasif
samalphins,

In the first post you said that root does not have any password but in the command you are providing the password.

Are you connecting to MySQL remotely? In order to do so, you must give the permissions to root to connect remotely. If you are on the same system where you have installed MySQL then do not use host parameter, try the following command

Expand|Select|Wrap|Line Numbers
  1. D:\>xampp\mysql\bin\mysqldump -uroot -p db_name > dump.sql
code green's Avatar
Expert
 
Join Date: Mar 2007
Location: England
Posts: 1,076
#2: 3 Weeks Ago

re: MySQL 1045 Authentication error


Try with host
Expand|Select|Wrap|Line Numbers
  1. -u [root] -h host -p []
mysqldump is problematic and fairly buggy I have noticed.
I also use the full path to the backup file as well as mysqldump.exe.
If you do use a password there should be no space between -p and the password.
I also suffix with 2>&1 but I can't remember why
Newbie
 
Join Date: Oct 2009
Posts: 4
#3: 3 Weeks Ago

re: MySQL 1045 Authentication error


Dear green thanks for the reply

I tried with host but I am getting new error as below.

D:\>xampp\mysql\bin\mysqldump -u [root] -h 192.168.0.251 -p []
Enter password: *********
mysqldump: Got error: 2003: Can't connect to MySQL server on '192.168.0.251' (10060) when trying to connect

Any other please.
Newbie
 
Join Date: Oct 2009
Posts: 4
#4: 3 Weeks Ago

re: MySQL 1045 Authentication error


Dear green thanks for the reply

I tried with host but I am getting new error as below.

D:\>xampp\mysql\bin\mysqldump -u [root] -h 192.168.0.251 -p []
Enter password: *********
mysqldump: Got error: 2003: Can't connect to MySQL server on '192.168.0.251' (10060) when trying to connect

I uninstalled Norton internet security and disabled windows firewall even then i am facing the same issue

Any other suggestion please.
code green's Avatar
Expert
 
Join Date: Mar 2007
Location: England
Posts: 1,076
#5: 3 Weeks Ago

re: MySQL 1045 Authentication error


Can you actually connect to this database outside of mysqldump?
It looks like a permissions problem.

I think user of mysqldump needs all permissions granted to work.
Read alone is not enough
mwasif's Avatar
Moderator
 
Join Date: Jul 2006
Location: Pakistan
Posts: 718
#6: 3 Weeks Ago

re: MySQL 1045 Authentication error


samalphins,

In the first post you said that root does not have any password but in the command you are providing the password.

Are you connecting to MySQL remotely? In order to do so, you must give the permissions to root to connect remotely. If you are on the same system where you have installed MySQL then do not use host parameter, try the following command

Expand|Select|Wrap|Line Numbers
  1. D:\>xampp\mysql\bin\mysqldump -uroot -p db_name > dump.sql
Newbie
 
Join Date: Oct 2009
Posts: 4
#7: 3 Weeks Ago

re: MySQL 1045 Authentication error


Dear M W Asif,

It worked for me great help I got from you. Thanks for the support and reply.
mwasif's Avatar
Moderator
 
Join Date: Jul 2006
Location: Pakistan
Posts: 718
#8: 2 Weeks Ago

re: MySQL 1045 Authentication error


You are welcome samalphins.

I am just M Wasif not M W Asif -:)
Reply