Troubleshooting “No such file or directory” when running `php app/console doctrine:schema:create`

后端 未结 12 1273
臣服心动
臣服心动 2020-12-04 23:35

I am new to Symfony2 (beta4) and Doctrine and am having issues when i try to create the DB schema via command line.

Here\'s the error:

$ php app/cons         


        
12条回答
  •  既然无缘
    2020-12-05 00:24

    Had the same issue "SQLSTATE[HY000] [2002] No such file or directory" on symfony 3.2.9 on 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

提交回复
热议问题