MySQL 5.7 – reset root password

So there’s been a change in the way you reset the MySQL root password in MySQL 5.7 as in the “password” field got removed, so the old way of resetting the password doesn’t work anymore:

| authentication_string | text | YES | | NULL | |

So let’s go:

1 – stop the mysqld:

systemctl mysqld stop

2 – start mysqld with skip-grant so it doesn’t ask for your password:

mysqld –skip-grant-tables &

3 – change the pw:

use mysql;

update user set authentication_string=password(‘yourNewPwHere’) where user=’root’;

flush privileges;

quit

4 – stop the mysql

5 – start the mysql with the new root pw

systemctl start mysqld

Enjoy!

Leave a Reply

Your email address will not be published. Required fields are marked *

CommentLuv badge