Home / Lập Trình / Reset Password Mysql

Reset Password Mysql

mysqld_safe –skip-grant-tables –old-passwords &

mysql -u root -p <enter and add new pass>

Hoạc là

1. Disable MySQL Monitoring

Go to WHM > Service Manager and uncheck monitor for MySQL (so it doesn’t restart while fixing the issue), then save the area

2. Stop MySQL in root SSH (if it is running, if not running at all, then this can be skipped)

Code:
/etc/init.d/mysql stop

3. Start MySQL without the password prompt

Code:
mysqld_safe --skip-grant-tables &

4. Get a copy of the current MySQL root password

Code:
cat /root/.my.cnf

Copy down what it shows for the password.

5. Log into mysql command line in root SSH and reset the password

Code:
mysql -u root
u mysql
update user set password=("NEW-ROOT-PASSWORD") where User='root';
flush privileges;
quit

Please replace NEW-ROOT-PASSWORD above with the actual password copied from /root/.my.cnf earlier.

6. Restart MySQL and check it’s working

Code:
/etc/init.d/mysql start
mysqladmin proc

If you can get a return of the processlist, it’s working (not to mention it would have started properly at that point to show it’s working).

7. Re-enable monitoring in WHM

Back in WHM > Service Manager, re-check monitor box for MySQL and save the area.

Print Friendly

About dongpolice

Check Also

sms-thuong-hieu

SMS Thương Hiệu

SMS thương hiệu, SMS Brandname Ngày nay, nhu cầu sử dụng sms, sms thương hiệu, …