Symfony3 - SQLSTATE[HY000] [2002] No such file or directory

后端 未结 8 1428
夕颜
夕颜 2020-12-19 16:26

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

相关标签:
8条回答
  • 2020-12-19 17:15

    Symphony mysql connection

    1. Start your mamp, xamp or other alternative for my sql

    2. go to http://localhost:8888/phpMyAdmin/ and get these informations, bd_name : can be root bd_pass : can be root or nothing host : can be localhost port : attention the default port in the URL is 8888 but it's not the port that you should use in your .env file, check at the top of your admin phpmyAdmin page for Server:localhost:the_port_is_here. So it can be 8889

    3. write your Server version it can be 5.7.26

    4. Go back to your .env file on your symphony project and change the line DATABASE_URL= ex : DATABASE_URL="mysql://root:root@127.0.0.1:8889/mybddname?serverVersion=5.7"

    5. Open the integrated terminal of your project and write if it the first time

      php bin/console doctrine:database:create

    if you wan to drop the data base

    php bin/console doctrine:database:drop --force
    

    PS : I'm using nmap on Mac OS for symphony project

    0 讨论(0)
  • 2020-12-19 17:23

    Had the same error.

    OS: macOS High Sierra. MAMP 5.0.1

    The problem was that the default MySQL port on MAMP was 8889 and in parameters.yml it was 3306

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