CakePHP Database connection “Mysql” is missing, or could not be created

后端 未结 18 1383
暖寄归人
暖寄归人 2020-11-30 11:05

There have been several other posts about this, but none of the answers seemed to work for me.

When I navigate to the CakePHP page on my local machine, there is one

相关标签:
18条回答
  • 2020-11-30 11:34

    If you're on Godaddy (or any other shared hosting for that matter), they may be limiting outgoing connections to ports 80 and 443 only.

    0 讨论(0)
  • 2020-11-30 11:36

    Try adding the socket:

    'unix_socket' => '/Applications/MAMP/tmp/mysql/mysql.sock',
    
    0 讨论(0)
  • 2020-11-30 11:38

    What did it for me in the end was that I had created a table in my database, but there was no data in it.

    In order for CakePHP to recognize the MySql connection, there has to be a table with data in it.

    0 讨论(0)
  • 2020-11-30 11:39

    I have had this problem since upgrading to OSX Yosemite and inserting following line did the trick for me:

     'unix_socket' => '/tmp/mysql.sock'
    
    0 讨论(0)
  • 2020-11-30 11:39

    It's your model. Open that up and there must be the following line

    public $useDbConfig = 'local';
    

    This overwrites global config & set it back to local

    0 讨论(0)
  • 2020-11-30 11:40

    On Mac, using MAMP as a development platform, for cake the correct solution is using Domingo Casarrubio solution.

    Add the unix_socket parameter to your database configurations.

    'unix_socket' => '/Applications/MAMP/tmp/mysql/mysql.sock',
    
    0 讨论(0)
提交回复
热议问题