การเข้าใช้งาน phpMyAdmin บน AWS Lightsail
หากทดลองเรียก phpMyAdmin ด้วย IP จาก Server ที่เราสร้างขึ้นตรงๆ เช่น (3.0.16.5/phpmyadmin) จะพบกับข้อความประมาณนี้
For security reasons, this URL is only accessible using localhost (127.0.0.1) as the hostname.
ซึ่งหมายความว่า เราไม่สามารถเข้าใช้งาน phpMyAdmin ด้วย public IP ได้ แต่จะสามารถเข้าได้บน IP localhost หรือ 127.0.0.1 เท่านั้น
วิธีการคือ เราต้องเข้าผ่าน SSH tunnel ครับ
สำหรับ Ubuntu ดำเนินการตามนี้
ssh -N -L 8888:127.0.0.1:80 -i LightsailDefaultKey-ap-southeast-1.pem bitnami@3.0.16.5
- LightsailDefaultKey-ap-southeast-1.pem ไฟล์ Private Key ของ Server ระบุรวม Path ให้ครบถ้วนนะครับ
- 3.0.16.5 เปลี่ยนเป็น Server IP ของคุณบน AWS Lightsail
เสร็จแล้วทดสอบเรียก http://127.0.0.1:8888/phpmyadmin/ จะได้หน้าต่าง phpMyAdmin ดังรูป
cat /opt/bitnami/var/data/bitnami_credentials/credentials
รหัสผ่านของ phpMyAdmin อยู่ที่กรอบสีแดงตามรูปเลยครับ