Saturday, 10. February 2007
I’ve had to look this up far too many times to not document it now. For user with user_id 1, execute the following on MySQL.
UPDATE user SET user_password =
md5(CONCAT('1-',md5('newpassword'))) WHERE user_id = 1;
or this for Postgres.
UPDATE user SET user_password =
md5('1-' || md5('newpassword')) WHERE user_id = 1;
Thursday, 21. September 2006
I recently ran across a mysql database I needed to do some work on only the root password didn’t seem to be recorded anywhere. On goes the hunt for password recovery solutions and here is what I found that did the trick.
# /etc/init.d/mysql stop
# mysqld_safe –skip-grant-tables &
# mysql -u root
mysql> use mysql;
mysql> update user set password=PASSWORD(“NEW-ROOT-PASSWORD”) where User=’root’;
mysql> flush privileges;
mysql> quit
# /etc/init.d/mysql stop
# /etc/init.d/mysql start
# mysql -u root -p