Friday, 22 June 2012

Password reset in Mysql

How to reset Mysql root password in Centos


#  /etc/init.d/mysqld stop

 Start MYSQL server without password
 #  mysqld_safe --skip-grant-tables &

Connect MYSQL server using the following command
# mysql -u root

Then, you will get MYSQL prompt

mysql>

Then, we have to set up new MYSQL root Password

mysql> use mysql;
mysql> update user set password=PASSWORD(“newrootpassword”) where user=’root’;
mysql> flush privileges;
mysql> quit

# /etc/init.d/mysqld stop
 Then, connect to MYSQL database using new password
# mysql -u root -p

No comments:

Post a Comment