I wanted to check the PDO based frameworks and today I just happened to be wearing the very nice Symfony shirt I received as part of my presentation at Symfony USA. So I started with a fresh install of Symfony. All was going well until it came time to get it to work with MySQL 8 through Doctrine.
Doctrine
Symfony uses Doctrine as an ORM (Object Relational Mapper) and DBAL (Database Abstraction Layer) as an intermediary to the database. While I myself am not a big fan of ORMs Doctrine does manage version migration very nicely. When I tried to tie the frame work and the database together I received a stern connection refused error.
So I double checked the database connection parameters, making sure that I could get to where I wanted using the old MySQL shell. Yes, the account to be used is identified by the native passwords and I had spelled the account name correctly. Then I double checked for fat-fingering on my part on the .env file where the connection details are stored. Then I did some searching and found someone else had stumbled onto the answer.
What does not work:
DATABASE_URL=mysql://account:password@127.0.0.1:3306/databasename
What does work:
DATABASE_URL=mysql://account:password@localhost:3306/databasename
So a simple s/127.0.0.1/hostname/ got things going. I double checked the /etc/hosts file to make sure that alias was there (it was).
From then on I was able to create a table with VARCHAR and JSON columns and go about my merry way.