Recover (Change) Linux Mysql Root Password
Multiple passwords can sometimes be difficult to keep in mind. One of these is when we forget the MySql Linux root password. If you have forgotten the MySQL root password on Linux, you don’t have to worry about that, you can recover it by following the steps below;
First, restart MySQL by giving the following command.
1 | mysqld --skip-grant-tables |
Then connect to MySQL with MySQL utility without using the password.
1 2 | mysql> update mysql.user set Password=Password(‘new password’) where User=’root’; mysql> flush privileges; |
Finally, restart MySQL again normally without --skip-grant-tables
.
I hope it has been a useful article.