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

后端 未结 18 1390
暖寄归人
暖寄归人 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:21

    I had the same problem and found out eventually that it was caused by CakePhp not accepting that I used a user with a password, even if that user was created in PHPMyAdmin. I had to use the user 'root' with no password.

    I found this out after making the following change to the file /lib/Cake/Error/exceptions.php.

    The original line:

    protected $_messageTemplate = 'Database connection "%s" is missing, or could not be created.';
    

    is changed into this instead:

    protected $_messageTemplate = "Database connection \"%s\" is missing, or could not be created:\n    %s";
    

    This will give you the reason for the problem so that you may change the cause properly.

提交回复
热议问题