Sarfaraz Makandar
Sarfaraz Makandar

Reputation: 6743

MySQL Error: Access denied for user root@localhost

I am new to MySQL. I have installed MySQL 5.6 in Windows 7 with user root and given password to it. But when I start MySQL Workbench and try to connect database, I am getting an error.

My try:

Connect to Database:

enter image description here

Connect to MySQL Server:

enter image description here

Error:

enter image description here

Then I tried to reset password with command prompt:

enter image description here

Please help me, I am new to MySQL, not getting what to do.
Thanks

Upvotes: 1

Views: 3469

Answers (3)

janadari ekanayaka
janadari ekanayaka

Reputation: 5156

You can resolve this issue using these steps.

1.open the terminal

2.exectute the command - sudo mysql -u root

3.then,execute - ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY 'new_password';(*replace the "new_password" with your new password"

4.exit;

5.now check the connection...It will work :)

Upvotes: 1

Daniel Scott
Daniel Scott

Reputation: 7961

It's possible that your setup is not listening for IP connections and is only listening on a local socket. Try:

mysql -u root

If you have already set a root password, try:

mysql -u root -p

on the command prompt. Or try removing the hostname from workbench.

Upvotes: 1

Abdul Qayyum
Abdul Qayyum

Reputation: 1052

It seems you do not have access for such task, exit the application and re-start it as administrator . Run As Administrator

Upvotes: 0

Related Questions