alim1990
alim1990

Reputation: 4972

Access denied for user 'root'@'localhost' (using password: YES)

I know the title looks familiar but no. I was working on a web app, and when I ran it, it says: Access denied for user 'root'@'localhost' (using password: NO). I searched some sites and they said that I should use a password. So I changed the password using mysql console. Than I got this message Access denied for user 'root'@'localhost' (using password: YES). And when I reenter the mysql console and put the password it makes a beep than it is closed. I got this event log:

Log Name:      Application

Source: .NET Runtime Date: 10/18/2015 7:12:51 PM Event ID: 1026 Task Category: None Level: Error Keywords: Classic User: N/A Computer: TOSHIBA-TOSH Description: Application: MySQLWorkbench.exe Framework Version: v4.0.30319 Description: The process was terminated due to an unhandled exception. Exception Info: System.Runtime.Remoting.RemotingException Stack: at System.Runtime.Remoting.Channels.Ipc.IpcServerChannel.StartListening(System.Object) at MySQL.Workbench.ApplicationInstanceManager.RegisterRemoteType(System.String) at MySQL.Workbench.ApplicationInstanceManager.CreateSingleInstance(System.String, System.String[], System.EventHandler`1)
at MySQL.GUI.Workbench.Program.Main(System.String[])

Event Xml:
1026 2 0 0x80000000000000 537897 Application TOSHIBA-TOSH Application: MySQLWorkbench.exe Framework Version: v4.0.30319 Description: The process was terminated due to an unhandled exception. Exception Info: System.Runtime.Remoting.RemotingException Stack: at System.Runtime.Remoting.Channels.Ipc.IpcServerChannel.StartListening(System.Object) at MySQL.Workbench.ApplicationInstanceManager.RegisterRemoteType(System.String) at MySQL.Workbench.ApplicationInstanceManager.CreateSingleInstance(System.String, System.String[], System.EventHandler`1<MySQL.Workbench.InstanceCallbackEventArgs>) at MySQL.GUI.Workbench.Program.Main(System.String[])

Any help ? I uninstalled everything (wamp, mysql, dreamweaver,.........) but still got the same problem. And mysql workbench give this error when i enter the password This error.

I tried to use config.inc.php solutions but still the same.

Upvotes: -1

Views: 8822

Answers (2)

Zafar Malik
Zafar Malik

Reputation: 6854

Please follow below steps:

Go to mysql server console and follow below steps:

Step1: open your config file and add below lines in [mysqld] section and save file.

skip-grant-tables
skip-networking

Step2: Restart your mysql service, you can use below command if using linux.

service mysqld restart 

Step3: Now connect mysql by below command-

mysql -uroot

Step4: Above command will connect you with mysql and will show mysql prompt like below-

mysql>

Step5: Now change root password as per below-

mysql> update mysql.user set password = password('root123') where user='root';
OR 
mysql> update mysql.user set password = password('root123') where user='root' and host = 'localhost';

mysql> flush privileges;

mysql> exit;

Step6: Now remove newly added lines from config file and restart mysql service again as per step2.

Finally now you can connect your web or phpmyadmin with root user.

Upvotes: 1

Luca Truffarelli
Luca Truffarelli

Reputation: 85

Maybe root from localhost has not the required grant to access the DB.

Try to run the following on a mysql console:

GRANT ALL ON <yourdb>.* TO 'root'@'localhost';
FLUSH PRIVILEGES;

Upvotes: 0

Related Questions