How-to reset password root on Mysql ?

Stop Mysql service mysqld stop

Restart with mysqld_safe --defaults-file=/etc/my.cnf --pid-file=/var/run/mysqld/mysqld.pid --skip-grant-tables

Connexion mysql -u root mysql

Change passwd UPDATE user SET password=PASSWORD('newpasswd') WHERE user="root"; exit

Restart service mysqld restart

Connexion with mysql -u root -p

Follow me on Mastodon FR Follow me on Mastodon EN

Subscribe RSS