Sunday, March 24, 2024

Authentication plugin 'caching_sha2_password' cannot be loaded

  • ประเด็นมีอยู่ว่า mysql client บน Window 10 จะ remote connect MySQL บน Ubuntu 22.04 ซึ่งน่าจะติดตั้ง MySQL 8.0 ไว้นะคิดว่า

mysql -h remote_host -u user -p

  • แล้วได้ error ดังหัวเรื่อง

Authentication plugin 'caching_sha2_password' cannot be loaded

  • แต่ลองทดสอบ remote  connect ด้วย navicat client กลับเชื่อมต่อได้ซะงั้น
  • ทดสอบบน window เครื่องอื่น ก็ได้ error แบบเดียวกัน
  • สรุปคือ MySQL ตอนสร้าง user และ password ค่าเริ่มต้นการเข้ารหัสจะเป็น sha2 แน่เลย
  • ซึ่งทำให้ mysql client ที่ใช้ version เก่าอยู่ไม่มีตัว plugin sha2 authen แน่ๆ เลย
  • แก้ปัญหาโดย เปลี่ยนการ authen ของ user นั้นเป็นแบบ standard

Solved

mysql> ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY 'newrootpassword';

Ref

  • https://stackoverflow.com/questions/49194719/authentication-plugin-caching-sha2-password-cannot-be-loaded

Popular Posts