How to reset MySQL root Password

Here is how you can reset forgotten root password,
Be aware that following will reset your root password:

# /etc/init.d/mysql stop
# /usr/bin/mysqld_safe –skip-grant-tables –skip-networking &
# mysql -u root
mysql> use mysql;
mysql> UPDATE user SET Password=PASSWORD(“your password here”) WHERE User=”root”;
mysql> exit

# /etc/init.d/mysql stop
# /etc/init.d/mysql start

Pay attention that, mysql can be in different folders depending on the installation, for different linux version the way you can start or stop the mysql can very.

For fedora or CentOS:
#service mysqld start
#service mysqld stop
etc..

11 Responses to “How to reset MySQL root Password”

Leave a Reply

Get Adobe Flash playerPlugin by wpburn.com wordpress themes