Lost my mysql root password… not such a pain…

Stop Mysql

service mysql stop

wait until MySQL shuts down. Then run

mysqld_safe --skip-grant-tables &

then you will be able to login as root with no assword.

mysql -u root mysql

In MySQL command line prompt issue the following command:

UPDATE user SET password=PASSWORD('abcd') WHERE user=`root`@`localhost`; FLUSH PRIVILEGES; EXIT

Restart Mysql:

/etc/init.d/mysqld restart

Now your root password is reset to  »abcd » and you’ll be able to login with your new password:

mysql -u root -p

Auteur/autrice : Chrystophe Vergnaud

Prendre du recul pour identifier les réels besoins et faire un choix technologique en fonction de ces besoins.

Laisser un commentaire