10-13-2007, 02:28 AM
If you ever loose your mysql root password (remember is not the same as the system root password) you can recover it following this steps
first, stop your mysql, by
/etc/init.d/mysqld stop
then,
Start MySQL in safe mode
mysqld_safe --skip-grant-tables
Enter the console as root
mysql -u root
Set the new password
UPDATE mysql.user SET Password=PASSWORD('new_password') WHERE User='root';
Update the privileges
FLUSH PRIVILEGES;
The mysqld_safe command could be different in your distribution this one is for CentOS, for you could be safe_mysql or just mysql with the --skip-grant-tables option.
first, stop your mysql, by
/etc/init.d/mysqld stop
then,
Start MySQL in safe mode
mysqld_safe --skip-grant-tables
Enter the console as root
mysql -u root
Set the new password
UPDATE mysql.user SET Password=PASSWORD('new_password') WHERE User='root';
Update the privileges
FLUSH PRIVILEGES;
The mysqld_safe command could be different in your distribution this one is for CentOS, for you could be safe_mysql or just mysql with the --skip-grant-tables option.