If you already have the root password, but just want to change it. Then it's simple and can be
done when MySQL Database is up & running.
/usr/bin/mysqladmin -u root password 'new-password’
But If ROOT password is lost then following steps needs to be performed and requires reboot of
MySQL Database:
STOP MySQL Service:
/etc/init.d/mysql stop
START MySQL Without grants:
mysqld_safe --skip-grant-tables &
Connect to mysql server using mysql client:
mysql -u root
Setup new MySQL root user password
mysql> use mysql;
mysql> update user set password=PASSWORD("NEW-PASSWORD") where User='root';
mysql> flush privileges;
mysql> quit
mysql> update user set password=PASSWORD("NEW-PASSWORD") where User='root';
mysql> flush privileges;
mysql> quit
Stop MySQL Server:
# /etc/init.d/mysql stop
Start MySQL server and test it
# /etc/init.d/mysql start
# mysql -u root -p
No comments:
Post a Comment