Because we always forget the root password of mysql.
An old client of mine emailed me a while ago asking about the password of the MySQL server.
I have installed their VICIDIAL Predictive Dialer like a year ago. They only used it for manual dialing using eyebeam
. Anyhow so I tried to login to the MySQL server using the only password I l know and it didint work! So I have no choice but to reset the root password of the Mysql Server.
Ok what do you need in order to reset or change the root password of MySQL?
1) You need root access to the server. If you dont have it, then you are out of luck! Ask your server administrator to execute the next steps.
2) The reason why you need root access is, for you to be able to stop the MySQL daemon. Here’s how to stop the MySQL daemon in Centos:
service mysqld stop
3) Now the next part is to start the MySQL server and also we need to skip the grant tables because its where the password are stored. Here’s how:
mysqld_safe --skip-grant-tables
You thought you’re done? Not yet! You have to open or connect another ssh session in order to enter MySQL server. As what you are going to experience when you’re going to try this howto, is that you dont see any processes or what ever just the cursor blinking
. Just leave it at that and open up another connection.
So when you are connected to the shell again, log in to the MySQL server by typing this:
mysql -uroot mysql
And then VIOLA! you are now inside the mysql server and as root too! Let’s change the root password of the MySQL server now. You can do that by typing the following command in the MySQL cli or console. The new password of the MySQL server will be pK@t9l5? . Type this: (Change the pK@t9l5? to the password you want to be specified.)
update user set Password=PASSWORD('pK@t9l5?') where user='root';
Then type this command next.
flush privileges;
Last but not the least. We need to exit from the MySQL console:
exit;
That’s it! You have changed the root password of the MySQL server
.
Ok don’t forget to stop the process:
mysqld_safe --skip-grant-tables
Then turn on the MySQL server again by typing:
service mysqld start
Leave a comment (cancel)
[...] more: Because we always forget the root password of mysql. | Life as I … Share and [...]
Because we always forget the root password of mysql. | Life as I … | Predictive Dialer Info
February 7, 2010
I’ve read several good stuff here. Definitely worth bookmarking for revisiting. I wonder how much effort you put to create such a great informative website.
Carmine Mossberg
September 13, 2011