###### On Linux
Lost MySQL Admin Password
1. First, stop current MySQL database server:
# /etc/init.d/mysqld stop
2. Now, start mysql server without password so that you can restart the password:
# mysqld_safe --skip-grant-tables &
3. Login without a password, enter:
# mysql -u root
4. Finally, setup a new MySQL root user password, enter::
mysql> USE mysql;
mysql> UPDATE user SET password=PASSWORD('NEW-ROOT-PASSWORD') WHERE User='root';
mysql> FLUSH privileges;
mysql> quit
# Replace NEW-ROOT-PASSWORD with actual password you want to use.
5. Restart running mysql server
# /etc/init.d/mysqld restart
6. test to connect.
# mysql -u root -p
#### กรณี On Windows
1.stop mysql ไปที่ contol panel > service >mysql กด stop
2.ไปที่ run พิมพ์ cmd >กด enter
3.พิมพ์ cd\
4.พิมพ์ cd appserv\mysql\bin กด enter
หมายเหตุ ที่เก็บ mysql จะแตกต่างกันแล้วแต่ว่าท่านเลือกใช้ web server ตัวใด
5.พิมพ์ mysqld-nt -u root --skip-grant-tables กด enter
ให้เปิดหน้าต่าง command อีกหน้าต่าง หน้าต่างเดิมไม่ต้องปิด โดย
ไปที่ run พิมพ์ cmd >กด enter
1.พิมพ์ cd\
2.พิมพ์ cd appserv\mysql\bin กด enter
หมายเหตุ ที่เก็บ mysql จะแตกต่างกันแล้วแต่ว่าท่านเลือกใช้ web server ตัวใด
3.พิมพ์ mysql กด enter
4.พิมพ์ use mysql
5.พิมพ์ UPDATE user SET Password = PASSWORD('NEW_PASSWORD') WHERE User = 'root'; กด enter
ไม่มีความคิดเห็น:
แสดงความคิดเห็น