Sections
Change a lost MySQL password
Procédure
-
Connect with the root user. Type:
/etc/init.d/mysql stopTo 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 mysqlTo 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: 0Exit MySQL engine, by typing:
quitWe just have, now, to relaunch MySQL in standard mode. Enter:
killall mysqldTo kill MySQL process, then enter:
/etc/init.d/mysql start