0

I'm a fresh junior php developer and I'm building my first Symfony project.

When I used the command : php bin/console doctrine:database:create I get these errors :

In AbstractMySQLDriver.php line 93:
An exception occurred in driver: SQLSTATE[HY000] [2002] No such file or directory

In PDOConnection.php line 31:
SQLSTATE[HY000] [2002] No such file or directory

In PDOConnection.php line 27:
SQLSTATE[HY000] [2002] No such file or directory*


I'm actually using MAMP with default config "db_user" and "db_password" so I edited the .env file with this following code : DATABASE_URL=mysql://root:root@localhost:8889/mydbname

I know there is something wrong with my host or port, I saw on other topics that some users using MAMP keep Symfony default values for host and port : DATABASE_URL=mysql://root:[email protected]:3306/mydbname

Thanks for reading me and trying to help me.

1 Answer 1

1

I did more searches and some people are saying that localhost syntax is depreciated and prefer using : 127.0.0.1 instead of localhost.

In my case I checked and used Mamp config 'Connect using an UNIX socket'

So it's now working with :

DATABASE_URL=mysql://root:[email protected]:8889/mydbname

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.