DBI connect failed : Access denied for user ''@'localhost' to database 'mysql'

2 posts / 0 new
Last post
#1 Fri, 05/25/2012 - 04:42

DBI connect failed : Access denied for user ''@'localhost' to database 'mysql'

Hi Forum,

I've mistakenly changed MYSQL root user name from "root" to "xyz" using COMMAND :

update mysql.user set user='xyz' where user='root'; flush privileges;

But after exiting from MySql when I tried to reopen command prompt of MySql I could not enter using the previous password and whenevr I was trying to use mysql database it was showing : Access denied for user ''@'localhost' to database 'mysql'

I have also tried with changing root password and finally reinstalled the mysql but same thing is happening till now.

Till now using Command :

select user(),current_user(); I am getting user - root@localhost and current_user - ''@localhost

Please help me in that so that I can connect mysql and proceed with my work.

Thanks in advance


Fri, 05/25/2012 - 08:21


Are you able to connect to MySQL using something like this from the command line:

mysql -u xyz -p

If so, then you should have root privileges when you connect, which would allow you to correct your root username.


Topic locked