week of 13 may

13 May 2019

13 may

Monday! Fresh week without any mistakes in yet, right? Ha.

docker mariaDB data

I struggled this morning to get the data I managed to dump out of the webapps_hours database on Friday into the docker container, but I did it!

First, dumping the SQL:

Then, importing the SQL:

I struggled forever because I kept trying to put this data into the database the docker container created, testdb. BUT the dump file is set up so it creates a new database. I only figure that out after trying forever to use mysql -u username -p testdb < filename.sql and nothing happening, so I finally opened the SQL file. The CREATE statement was right at the top, so, my bad.

To enter the database, mysql -u username -p webapps_hours. Then show tables; to verify there’s stuff in there. Boom!

helpful articles

16 may

Tuesday was lots of treehouse tutorials, which helped reinforce my understanding of PDO, connecting to database, querying database, and retrieving results via PHP.

Yesterday was abysmal. We’re trying to ramp up the speed on migrating to PHP 7, so I struggled pretty much all day yesterday to get my docker containers to connect to a database. I created at least 7 different images/containers, and none of them worked. I left here pretty dejected.

Today!

PHP <-> MySQL connection success!

It took me a few more hours to work through some things this morning, but I have officially connected successfully to the database and retrieved results/spit them out in localhost. :tada::tada:

This article is what (somehow) did the trick: Create your first PHP/MySQL application in Docker.

I think my issues had to do with exposing ports and container names? Something I didn’t realize is that instead of using “localhost” in the PDO connection statement, you need to use your database container name. Also, in all of my failed attempts, I didn’t have an EXPOSE statement in my Dockerfile because I was using ports statements, but that’s another change that might’ve made a difference. I don’t want to test out that theory right now because it’s working, and I’m good with that.

Next up: connecting the alerts app/API, superGlobalPHP API, and docker and seeing what blows up. If everything connects and seems to be doing well, I’ll set up phan in the same container to run a migration analysis.