How to Reset MySQL Root Password
We will show you, how to reset MySQL root password. If you assigned a
root password previously but have forgotten it, you can assign a new password. Resetting the root password of MySQL server, is fairly east task, and it can be accomplished in less then 10 minutes.
1.Login as root via ssh and stop the MySQL server.
debian-ubuntu# /etc/init.d/mysql stop centos-fedora# /etc/init.d/mysqld stop
2. Start the MySQL server with “skip-grant-tables” option.
# mysqld_safe --skip-grant-tables &
This will disable the MySQL authentication and run the process in the background.
3. Login to MySQL as root.
# mysql -u root mysql
4. Reset the MySQL password.
UPDATE user SET Password=PASSWORD('NEW_PASSWORD') WHERE User='root'; FLUSH PRIVILEGES; exit;
Replace NEW_PASSWORD with your new password!
5. After the password has been reset, start the MySQL server in normal mode.
debian-ubuntu# /etc/init.d/mysql restart centos-fedora# /etc/init.d/mysqld restart
Now you can connect to MySQL as a root user using the new password.
Type “mysql -u root -p” in the terminal, and enter the password when prompted.
Of course, you don’t have to Reset MySQL Root Password, if you use one of our Database VPS Hosting Services, in which case you can simply ask our expert Linux admins to help you or show you, how to reset Reset MySQL Root Password, yourself. They are available 24×7 and will take care of your request immediately.
PS. If you liked this post, on how to Reset MySQL Root Password, please share it with your friends on the social networks using the buttons on the left or simply leave a reply below. Thanks.