Wednesday, June 15, 2011

MySQL Reset Root Password


We can reset root Password using two techniques. First one is using the mysqladmin command and second one is using the mysql safemode technique. I have describe both the technique below. enjoy !!!!!!!!
Technique 1. Using Mysqladmin command
#mysqladmin -u root -p password ‘new-password’
Technique 2. Using Mysql safe mode 
# /etc/init.d/mysql stop
# mysqld_safe –skip-grant-tables  &
# mysql -u root
mysql> use mysql;
mysql> update user set  password=PASSWORD(“newpassword”) where User=’root’;
mysql> flush  privileges;
mysql> quit
# /etc/init.d/mysql stop
# /etc/init.d/mysql  start