Monday, February 7, 2011

MySql reseting root password

I was experimenting MySql yesterday and set some password for the root account. But today I forgot. Doing little bit of search on the net, I came across a simple way to reset the password. For this the root access of the OS is needed. Here are the steps:
- Log in as root on the SqlServer box
- stop the MySql server. command: /etc/init.d/mysqld stop
- start mySql in safe mode. command: mysqld_safe --skip-grant-tables
- The previous command will not free the terminal. So from other terminal (command prompt) do these-
mysql --user=root mysql
update user set Password=PASSWORD('new-password') where user='root';
flush privileges;
exit


- Kill the mySql daemon. Command: killall mysqld

- start the mysql daemon. Command: /etc/init.d/mysqld start

No comments:

Post a Comment