kihA
kihA

Reputation: 13

Error when trying to create doctrine database with phpMyAdmin

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.

Upvotes: 0

Views: 258

Answers (1)

kihA
kihA

Reputation: 13

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

Upvotes: 1

Related Questions