2013/07/16

Reset root password for MySQL

1. find binary (mysqld)
2. launch it with options --skip-grant-tables --skip-networking
3. connect to mysql
4. change pass

For example, on Debian:
service mysql stop
mysqld --skip-grant-tables --skip-networking &
> [1] 12192
mysql -u root -e <<EOSQL "UPDATE mysql.user SET Password=PASSWORD('temp123') WHERE User='root'; FLUSH PRIVILEGES;"
EOSQL
kill -9 12192
service mysql stop
service mysql start
sleep 5
service mysql restart

No comments:

Post a Comment