Jumat, 28 Juni 2013

Resetting MySQL Root Password on CentOS

(Don’t forget that you need to login to your server as root in order to achieve this)

1) Start MySQL in safe mode.
2) Reset the root password.
3) Flush privileges.
4) Create a my.cnf file so that you can automatically log-in next time.
1# service mysqld stop
2# mysqld_safe --skip-grant-tables &
3# mysql -u root
4> update mysql.user set password=PASSWORD("newpass") where User='root';
5> flush privileges;
6> exit;
7# { echo "[client]"; echo "user=root"; echo "password=newpass"; } >> /root/.my.conf
8# service mysqld restart

Tidak ada komentar:

Posting Komentar