I am new to Symfony and started doing some tutorials in order to get some things done. I am working on a Linux Mint 18 machine and a standard Symfony3-project.
I\'d
You don't have MySQL installed, Install MySQL first
if you use mamp test this:
sudo ln -s /Applications/MAMP/tmp/mysql /var/mysql
My knowledge of MySQL suggests one variant which might happen and explain this:
You had (old) mysqld running, then deleted out all files from datadir. Then probably new server wasn't able to start up Then you connected to that old mysqld, which is still running, but getting 'No such file or directory' error trying to access own system files (which were deleted).
May be It's too late but I had the same issue "SQLSTATE[HY000] [2002] No such file or directory" on my symfony 3.2.9 deployment
I fixed it by changing the database_host value from "localhost" to my server IP on my parameters.yml file
but I had this another error message when trying to run commandline by SSH:
[Doctrine\DBAL\Exception\ConnectionException]
An exception occured in driver: SQLSTATE[HY000] [2002] Connection refused
I finaly fix it by adding these 2 lines on my config.yml file in Doctrine configuration section :
unix_socket: /var/lib/mysql/mysql.sock
server_version: '5.5'
all my final doctrine configuration is like this:
doctrine:
dbal:
driver: pdo_mysql
host: '%database_host%'
port: '%database_port%'
dbname: '%database_name%'
user: '%database_user%'
password: '%database_password%'
unix_socket: /var/lib/mysql/mysql.sock
server_version: '5.5'
charset: UTF8
hopefully this helps someone
[PDOException] SQLSTATE[HY000] [2002] No such file or directory
This error occurs generally when your web application is not connected to the database. As per your parameter.yml it's searching for mysql server & wasn't getting connected because at that time mysql wasn't installed there at your machine.
In my case, I only changed localhost->127.0.0.1 and it worked!