0
votes

I created a AWS Lightsail LAMP stack and I was able to create a database with several tables that I accessed using http://127.0.0.1:8888/phpmyadmin/index.php (must first create an SSH Tunnel with source port 8888 & destination localhost:80). After logging in to bitnami I obtained the application password using cat bitnami_application_password. Now I'm trying to access the db via PHP PDO object so that I could perform basic CRUD services needed by my website. I'm not sure how to do so. I enabled port 3306 on the AWS Lightsail instance

  $pdo = new PDO('<<HOST_NAME>>:<<PORT>>;dbname=<<DATABASE_NAME>>', 'root', 'pJ44xVRiUihT');

I don't know what to use for <>. I've seen a post to use a $dsn variable like "mysql:host=127.0.0.1;port=3306;dbname=mydb" Reference: PDO via SSH2 in PHP?

For username I use root. For password I used the output result of cat bitnami_application_password

1

1 Answers

0
votes

I discovered that using the host name: 127.0.0.1:3306 works