Saturday, September 15, 2007

How to reset mysql root password

เคยเขียนไปแล้วรอบหนึ่ง ตอนนี้วิธีที่เคยเขียนใช้ไม่ได้ ดังนั้นต้องเขียนใหม่
ให้ทำตาม step ดังนี้
[root@host]# /etc/init.d/mysqld stop

[root@host]# mysqld --skip-grant-tables --user=root
แล้วก็ login mysql ใหม่โดยใช้ mysql client

[root@host]# mysql
mysql> USE mysql
mysql> UPDATE user SET password=password("newpassword") WHERE user="root";
mysql> flush privileges;
mysql> exit;
[root@host]# /etc/init.d/mysqld restart

No comments: