ถ้าเกิดข้อผิดพลาด ใน Mysql เป็น 'Access denied for user 'root'@'localhost' (using password: YES)' แก้ไขโดย
ในกรณีที่ใช้ phpmyadmin แล้วไม่สามารถเข้าสู่ระบบได้ แล้วแสดงค่าความผิดพลาดเป็น
mysqladmin: connect to server at 'localhost' failed error:
'Access denied for user 'root'@'localhost' (using password: YES)'
'Access denied for user 'root'@'localhost' (using password: YES)'
ให้แก้ไขตามขั้นตอนนี้
- Open & Edit
/etc/my.cnfor/etc/mysql/my.cnf, depending on your distro. - Add
skip-grant-tablesunder[mysqld] - Restart Mysql
- You should be able to login to mysql now using the below command
mysql -u root -p - Run
mysql> flush privileges; - Set new password by
ALTER USER 'root'@'localhost' IDENTIFIED BY 'NewPassword'; - Go back to /etc/my.cnf and remove/comment skip-grant-tables
- Restart Mysql
- Now you will be able to login with the new password
mysql -u root -p
ถ้า user root ยังเข้าไม่ได้ ให้เข้าไปแก้ไขดังนี้
ซึ่ง user root จะเข้าได้เมื่อใช้คำสั่งด้านบน
use mysql;
update user set authentication_string=PASSWORD("") where User='root';
update user set plugin="mysql_native_password" where User='root'; # THIS LINE
flush privileges;
quit;
ไม่มีความคิดเห็น
แสดงความคิดเห็น