Wednesday, December 8, 2010

Resetting root password for mysql

As luck would have it, I messed up and lost the password on day 0! Found a handy tip here on how to reset it.


# stop running mysql daemon
pkill mysqld

# start mysql without security info loaded
mysqld_safe --skip-grant-tables &

# this allows login without any password
mysql -u root mysql

# update passwords
UPDATE user SET password=PASSWORD("ualue=42") WHERE user="root";
FLUSH PRIVILEGES;

# stop running mysql daemon
pkill mysqld

# do a normal start
/etc/init.d/mysql start

No comments:

Post a Comment