How to Reset MySQL Admin Password via Windows Plesk. Cách này dùng khi các bạn quên password để gõ câu lệnh mysql với quyền admin riêng đế set user hay pass mới !
- Hiện mình đang dùng plesk và win 2008 !
Bước 1:
C:\Program Files\SWsoft\Plesk\Databases\MySQL\Data\my.ini ( tuỳ mỗi server link khác nhau )
- Under “[mysqld]” in “my.ini”, add the following line:
skip-grant-tables
- Restart “MySql Server”.
- Login to MySql:
cd C:\Program Files\SWsoft\Plesk\MySQL\bin
C:\Program Files\SWsoft\Plesk\MySQL\bin>mysql -u admin
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 7 to server version: 4.1.18-nt
Type 'help;' or '\h' for help. Type '\c' to clear the buffer.
Bước 2 gõ dòng sau:
mysql> use mysql;
mysql> UPDATE mysql.user SET Password=PASSWORD('newpwd') WHERE User='admin';
mysql> FLUSH PRIVILEGES;
mysql> quit;
- Remove “skip-grant-tables” from the “my.ini” file. Restart “MySql” after re-saving the “my.ini” file.
cuối cùng là hoàn thành !
cách khác từ Plesk
To solve the problem and reconnect Plesk with the MySQL server, follow these steps:
-
Stop the MySQL server (but not "Plesk SQL Server") from running on port 3306 using the Plesk Services Monitor tray utility.
-
Edit the MySQL configuration file, %plesk_dir%\Databases\MySQL\Data\my.ini
, and add the line skip-grant-tables
to the [mysqld]
section.
-
Start the MySQL server.
-
Log into MySQL without the password:
"%plesk_dir%\Databases\MySQL51\bin\mysql.exe"
-
Change the password for the MySQL administrator:
UPDATE mysql.user SET Password = password('newpassword') WHERE User = 'admin';
-
Remove skip-grant-tables
from the MySQL configuration file and restart the service.
- Log into the Plesk interface, go to the database server management settings (Tools & Settings > Database Servers), and change the password for the corresponding database server to the one set in Step 5. Plesk will re-establish the connection to the server.