Reset MySQL 5.7 root password
- By Preneesh AV --
- 22-Jun-2019 --
- 153 Comments
Reset MySQL 5.7 root password
sudo /etc/init.d/mysql stop
sudo mysqld --skip-grant-tables $
sudo mkdir /var/run/mysqld; sudo chown mysql /var/run/mysqld
sudo mysqld_safe --skip-grant-tables&
Create a new ssh session and connect to mysql. Logged in to MySQL then reset your password with these commands:
mysql -uroot
use mysql;
update user set authentication_string=password('new_password') where user='root';
flush privileges;
exit;