Ads Top

How to reset the MySQL root password

How to reset the mysql root password on Linux.

Stop the mysql server:-
/etc/init.d/mysql stop
 

Start the mysql server manually without permission tables which allows us to login as root user without password:
 mysqld_safe --skip-grant-tables &

Login into mysql as root user without a password and switch to the “mysql” database:
mysql -u root mysql
Then execute this SQL query to set a new password for the mysql root user:
update user set Password=PASSWORD('mynewpassword') WHERE User='root';
(Replace “mynewpassword” with the new root password in the above command).

Then logout from the mysql prompt by typing:
exit

Start the mysql server again:-
/etc/init.d/mysql start

No comments:

'; (function() { var dsq = document.createElement('script'); dsq.type = 'text/javascript'; dsq.async = true; dsq.src = '//' + disqus_shortname + '.disqus.com/embed.js'; (document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(dsq); })();
© 2020 Vishal Vyas. All rights reserved. Theme images by Jason Morrow. Powered by Blogger.