Overview
Often times we accidentally changed the root password of our mysql, this can be caused by some scripts that we used for any automation process.
Procedure
1. Login as root to the database server.
2. Stop the mysql daemon or service.
3 Start the mysql daemon and skip the grant tables which store the passwords.
mysqld_safe –skip-grant-tables
4. You should see mysqld start up successfully and you should be able to connect to mysql without a password.
mysql –user=root mysql
5. Update the mysql password by running:
mysql> update user set Password=PASSWORD(‘new-password’) where user=’root’;
mysql> flush privileges;
mysql> exit;
Now kill your running mysqld, then restart it normally. You should be good to go.
var _gaq = _gaq || []; _gaq.push(['_setAccount', 'UA-37138722-1']); _gaq.push(['_trackPageview']);
(function() { var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true; ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js'; var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s); })();