Change a lost MySQL password
Procédure
Connect with the root user. Type:
/etc/init.d/mysql stop
To stop MySQL server, then launch it, with the following command, to ignore user privileges:
/usr/sbin/mysqld --skip-grant-tables &
Enter the following command:
mysql mysql
To connect to MySQL database. To change root password, for example, enter:
update user set password=PASSWORD("my_new_password") where user='root';
The server returns:
Query OK, 1 rows affected (0.04 sec)
Rows matched: 1 Changed: 1 Warnings: 0
Exit MySQL engine, by typing:
quit
We just have, now, to relaunch MySQL in standard mode. Enter:
killall mysqld
To kill MySQL process, then enter:
/etc/init.d/mysql start
Go Back