Resetting MySQL root password: Difference between revisions
From D3xt3r01.tk
Jump to navigationJump to search
m New page: ==WHY== Because you forgot or misstyped your password too many times. ==HOW== 1. Kill the mysql /etc/init.d/mysqld stop or Locate your mysql .pid file and do kill -9 `cat /path/to/p... |
m →HOW |
||
Line 20: | Line 20: | ||
5. Do this: | 5. Do this: | ||
<source lang="mysql"> | |||
mysql> UPDATE mysql.user SET Password=PASSWORD('l33tP4ssw0rd') WHERE User='root'; | mysql> UPDATE mysql.user SET Password=PASSWORD('l33tP4ssw0rd') WHERE User='root'; | ||
mysql> FLUSH PRIVILEGES; | mysql> FLUSH PRIVILEGES; | ||
</source> | |||
5. \q | 5. \q |
Latest revision as of 12:18, 11 October 2009
WHY
Because you forgot or misstyped your password too many times.
HOW
1. Kill the mysql
/etc/init.d/mysqld stop
or
Locate your mysql .pid file and do kill -9 `cat /path/to/pid.file`
2. Start again with --skip-grant-tables
3. Start mysqld
sudo -u mysql mysqld --skip-grant-tables &
4. Run mysql
5. Do this:
mysql> UPDATE mysql.user SET Password=PASSWORD('l33tP4ssw0rd') WHERE User='root';
mysql> FLUSH PRIVILEGES;
5. \q
6. Kill the mysqld and start it from the init script.