Reset Password root MySQL (Windows)

วันก่อนอยากเปลี่ยน Password root ของ Mysql ก็เลยไปเปลี่ยนเอาดื้อๆๆเลย ผ่าน tools navicate อิอิ แล้วมานึกขึ้นได้ว่ามันเป็น password ที่เหมือนจะผ่าน MD5 ก็เลยไปหาวิธีเปลี่ยนแบบที่เค้าทำกัน งิงิ ได้ตามนี้เลยครับ ก็ได้อาจารย์กู แหละครับที่ไปช่วยหาข้อมูลมาให้

1. stop MySQL server โดยสั่งใน Services หรือ พิมพ์ net stop mysql ใน Command Prompt

2. start MySQL server โดยใส่ออพชัน –skip-grant-tables

mysqld-nt –skip-grant-tables

ถ้าสตาร์ทไม่ขึ้น อาจต้องใส่ออพชัน –defaults-file เข้าไปด้วย

mysqld-nt –skip-grant-tables –defaults-file=”C:\WINDOWS\my.ini”

3. connect เข้า MySQL ด้วย user root

mysql -u root

4. ตั้งพาสเวิร์ดใหม่ให้ root โดยพิมพ์คำสั่ง

mysql> use mysql;
mysql> update user set password=PASSWORD(“newpassword”) where user=’root’;
mysql> flush privileges;
mysql> quit

5. stop MySQL server อีกรอบ

6. start MySQL server ตามปกติ แล้วลองเทสต์ด้วยการล็อกอินเป็น root

mysql -u root -p

One Response to “Reset Password root MySQL (Windows)”

  1. recover deleted files Says:

    Hi to every one, the contents existing at this site
    are actually awesome for people experience, well, keep up the good work fellows.