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)

/etc/init.d/mysql stop

3. Start MySQL without the password prompt

mysqld_safe --skip-grant-tables &

4. Get a copy of the current MySQL root password

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

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

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

6. Restart MySQL and check it’s working

/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, PDF & Email

About dongpolice

Check Also

How to build App Portable-dongpolice.com

How to Build App Portable with ThinApp of VM

How to Build App Portable with ThinApp of VM – Hướng dẫn làm App Portable …