-
Forget Mysql ROOT Password?
Posted on April 2nd, 2009 2 commentsYesterday my friend had ask me how he can reset the mysql password, because he had forget his password.
Here are the following steps that we made.
On *nix systems, type the following commands on console
1. on console: service mysqld stop
2. on console: start the mysql daemon process with –skip-grant-tables
3. on console: mysql -u root
4. on mysql: UPDATE mysql.user SET Password=PASSWORD(‘password’) WHERE user=’root’;
5. on mysql: FLUSH PRIVILEGES;
6. on console: service mysqld restart
Now write the new password on a piece of paper :O
2 responses to “Forget Mysql ROOT Password?”
-
Hi,
The tip is (almost) technically correct.
However, when you start a server with –skip-grant-tables, you should also specify –skip-networking, or else anyone could connect, with root powers!Step 1 will work on Red-Hat and Fedora systems, but not on Debian/Ubuntu, *BSD, Solaris. Each system should have its own command to stop the server.
A common way of stopping it is to find the process IDs of the mysqld and mysqld_safe daemons and then use ‘kill -15 ID1, ID2, ID3′ to stop them.Also step 5 is not necessary, since you have to restart. If you don’t restart, it’s useless, because you are skipping grants!
Cheers
Giuseppe
-
Awesome I love many of the articles which have been written, and especially the comments posted! I’ll come back!
Leave a reply
-
