KKKK
KKKK

Reputation: 347

Reset Mysql workbench root password

I messed up something and I try creating a local server in the mysql workbench but an error message show up every time I test the connection.

enter image description here

I tried uninstalling the mysql workbench and installing again but the for user "root" is unknown. It did not tell anything about the root password during the installation process and I tried various password like empty string, my mac password etc but none of them works, I try researching in stackoverflow but I still cannot solve it.

Upvotes: 1

Views: 9717

Answers (2)

Ankit Agrawal
Ankit Agrawal

Reputation: 2454

For MAC user / OSX user

Try the command FLUSH PRIVILEGES when you log into the MySQL terminal. If that doesn't work, try the following set of commands while in the MySQL terminal

$ mysql -u root
mysql> USE mysql;
mysql> UPDATE user SET password=PASSWORD("NEWPASSWORD") WHERE User='root';
mysql> FLUSH PRIVILEGES;
mysql> quit

Change out NEWPASSWORD with whatever password you want. Should be all set!

Update: As of MySQL 5.7, the password field has been renamed authentication_string. When changing the password, use the following query to change the password. All other commands remain the same:

mysql> UPDATE user SET authentication_string=PASSWORD("NEWPASSWORD") WHERE User='root';

Upvotes: 4

Ankit Agrawal
Ankit Agrawal

Reputation: 2454

Mysql change forgotted password

0) shut down service mysql56

1) go to C:\ProgramData\MySQL\MySQL Server 5.6
 (note that ProgramData is a hidden folder)

2) look for file my.ini, open it and add one line skip-grant-tables below [mysqld],
      save  [mysqld]

skip-grant-tables
3) start service mysql56

4) by right, you can access the database, and use the query below to update the password

update mysql.user set password=PASSWORD('NEW PASSWORD') where user='root';
5) shun down the service again, remove the line skip-grant-tables save it, and start the service again. try to use the password you set to login.

Upvotes: 1

Related Questions