MySQL – Reset root password

We stop the mysqld service and start it with the following keys:

sudo mysqld --skip-grant-tables --user=mysql &

 

Log in without a password:

mysql -u root

 

And run:

FLUSH PRIVILEGES;
ALTER USER 'root'@'localhost' IDENTIFIED BY 'YOUR_NEW_ROOT_PASSWORD';
\q;

 

Now the mysqld service running in the background needs to be stopped. We look at the process ID:

sudo ps aux | grep mysql

 

Kill the process:

sudo kill 12345

 

And start the mysqld service:

sudo systemctl start mysqld
0 0 vote
Article Rating

Tagged: Tags

Подписаться
Уведомление о
guest
0 Comments
Inline Feedbacks
View all comments