สำนักวิทยบริการและเทคโนโลยีสารสนเทศ (สวส.)

Office of Academic Resources and Information Technology

เปลี่ยนรหัสผ่าน root MySQL Server สำหรับ Linux

เปิด terminal หรือ โปรแกรม putty remote เข้า server 
1. หยุด Service MySQL Server 

/etc/init.d/mysql stop   หรือ sudo /etc/init.d/mysql stop

2.Start the mysqld configuration

mysqld --skip-grant-tables &  หรือ  sudo mysqld --skip-grant-tables &

3.เปิด terminal อีก tap  Login to MySQL as root

mysql -u root mysql

4.คำสั่งการเปลี่ยนรหัสผ่าน YOURNEWPASSWORD คือรหัสผ่านใหม่ ใส่ไปได้เลย
UPDATE user SET Password=PASSWORD('YOURNEWPASSWORD') WHERE User='root'; FLUSH PRIVILEGES; exit

 

ที่มา : http://dev.mysql.com/doc/refman/5.0/en/resetting-permissions.html