Google
 

Linux Distro Counter

Welcome to Open Source Software and Linux Blog.

Hi, everyone!. I just created this blog to share knowledge about open source software and Linux. If you all have knowledge and info related to open source / Linux, please share or send me an email. Thanks ^_^

Thursday, September 6, 2007

How to: Resetting Mysql root password

Sometimes, you cannot remember the mysql password. After try many time to login, you still cannot login to database. This is the solution.

1. You need to open 2 terminal/shell.

At terminal 1:
2. At terminal 1, stop your mysql deamon if it running: $ /etc/init.d/mysqld stop and enter. The mysql deamon is stop now.
3.
Type $ mysqld_safe --skip-grant-tables


Terminal 2:
4.
Change root password to new password: mysql> update user set password=password('newpassword') where user='root';
5. Flush mysql privileges: mysql> flush privileges;
6.
Exit mysql: mysql> exit
7. Restart mysql: $ /etc/init.d/mysqld start

After finish all process, go to your terminal 1 and press Ctrl-C on your keyboard.

Thats all.


No comments: