Ou comment pouvoir se connecter en root à mysql quand on ne connait pas le mot de passe :
Voici les différentes étapes à suivre :
! Attention toutes les commandes devront être excécuter en tant que root système
- Arrêt du service mysql
/etc/init.d/mysql stop
Stopping MySQL database server: mysqld.
- Lancer mysql sans mot de passe
mysqld_safe --skip-grant-tables &
[1] 4388
Starting mysqld daemon with databases from /var/lib/mysql
mysqld_safe[605]: started
- Connexion à mysql server à l’aide du client
mysql -u root
Welcome to the MySQL monitor. Commands end with ; or g.
Your MySQL connection id is 1 to server version: 5.0.13-Debian_1-log
Type 'help;' or 'h' for help. Type 'c' to clear the buffer.
mysql>
- Mise en place du nouveau mot de passe root
mysql> use mysql;
mysql> UPDATE user SET Password=PASSWORD('LE-MOT-DE-PASSE') WHERE user='root';
mysql> flush privileges;
mysql> quit;
- Restart de MySQL Server:
/etc/init.d/mysql stop
Stopping MySQL database server: mysqld
STOPPING server from pid file /var/run/mysqld/mysqld.pid
mysqld_safe[6186]: ended
[1]+ Done mysqld_safe --skip-grant-tables
/etc/init.d/mysql start
mysql -u root -p