0
votes

According to the resolution of this question...

What is the Symfony firewall doing that takes so long?

...I try to change in the .env file

DATABASE_URL=mysql://root:root@localhost/project

to

DATABASE_URL=mysql://root:[email protected]/project

to achieve better performance.

But then I get an error:

An exception occurred in driver: SQLSTATE[HY000] [2002] Connection refused

Uncaught PHP Exception Doctrine\DBAL\Exception\ConnectionException: "An exception occurred in driver: SQLSTATE[HY000] [2002] Connection refused" at /Users/work/project/vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/AbstractMySQLDriver.php line 112

1
try adding the used port number like 127.0.0.1:3306 and clear the cache.gp_sflover
I tested 127.0.0.1:3306 and cleared the cache after but this did not solve the problempeace_love
try surrounding the address with double quotes (as showed in the docs) like DATABASE_URL="mysql://root:[email protected]:3306/project" (and clear the cache) PS: Did that line works before?gp_sflover
No, this is also not working. Only thing that is actually working is DATABASE_URL=mysql://root:root@localhost/project Are you sure, this is the correct port?peace_love
I can't know which port are you using for mysql :-) in fact I wrote "try adding the used port" (3306 is the default one in local dev like, as example, XAMPP)gp_sflover

1 Answers

1
votes

Check the user permissions of the database itself, your user may only be allowed to access via localhost.

SELECT * FROM mysql.user where user = '<username>';

check the host column. If you only get one row back with the host 'localhost' then you could add another with the same details but for the 127.0.0.1 host

CREATE USER '<username>'@'127.0.0.1';
SET PASSWORD FOR '<username>'@'localhost' = PASSWORD('<password>');
FLUSH PRIVILEGES;

The sql is off the top of my head, you might need to double check it.