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

后端 未结 12 1249
臣服心动
臣服心动 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:31

    Laravel .env add DB_SOCKET with path to mysql.sock

    DB_CONNECTION=mysql
    DB_HOST=localhost
    DB_PORT=3306
    DB_DATABASE=database
    DB_USERNAME=root
    DB_PASSWORD=mypassword
    
    DB_SOCKET=/Users/username/Library/Containers/MAMP/mysql/tmp/mysql.sock
    

    or add unix_socket in PDO

    PDO('mysql:host=localhost;port=3306;unix_socket=/Users/username/Library/Containers/MAMP/mysql/tmp/mysql.sock', root, mypassword);
    
    0 讨论(0)
  • 2020-12-05 00:33

    Worth checking to see if Mysql is running too.

    0 讨论(0)
  • 2020-12-05 00:38

    Too late but hope it can help someone as well.

    I am using Vagrant

    Just change localhost to 127.0.0.1 AND change the port to 3333

    worked perfectly.

    0 讨论(0)
  • 2020-12-05 00:39

    I fixed it by following this small tutorial: http://andreys.info/blog/2007-11-07/configuring-terminal-to-work-with-mamp-mysql-on-leopard

    [EDIT]: I modified the right php.ini and everything's working fine now.

    Now I get the following error:

    [Exception]                                                                                            
     DateTime::__construct(): It is not safe to rely on the system's timezone settings.
     You are *required* to use the date.timezone setting or the date_default_timezone_set() function.
     In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier.
     We selected 'Europe/Berlin' for 'CEST/2.0/DST' instead 
    

    Here's the date.timezone config in php.ini

    date.timezone = "Europe/Paris"
    

    I'll try to figure it out myself but if any of you know how to fix it don't hesitate to comment on this. Thanks!

    0 讨论(0)
  • 2020-12-05 00:39

    Restarting mysql worked for me:

    sudo /etc/init.d/mysql restart

    0 讨论(0)
  • 2020-12-05 00:40

    Try to add this line

    unix_socket: /tmp/mysql.sock
    

    into your config.yml file > doctrine > dbal just after the password line.

    0 讨论(0)
提交回复
热议问题