My cakephp database setup looks like this:
array(
'datasource' => 'Database/Mysql',
'persistent' => false,
'host' => '127.0.0.1',
'login' => 'dbUser',
'password' => '*********',
'database' => '*********',
'prefix' => '',
//'encoding' => 'utf8',
);
I can connect to local mysql using the same host, user and password on the command line:
mysql -u dbUser -p -h 127.0.0.1
No problem. I can the USE the same database on the command line, call SELECT using the same user on the mysql cli.
BUT cakephp keeps giving me the error 111. Why?
I installed mysql 5.6 on Ubuntu 14.04:
apt-get install mysql-server-5.6 mysql-client-5.6 mysql-common-5.6
And phpinfo() shows that PDO and PDO_mysql is installed: PDO
PDO support enabled
PDO drivers mysql
pdo_mysql
PDO Driver for MySQL enabled
Client API version 5.5.47
Directive Local Value Master Value
pdo_mysql.default_socket /var/run/mysqld/mysqld.sock /var/run/mysqld/mysqld.sock
The error cakephp gives me is this:
Error: [MissingConnectionException] Database connection "Mysql" is missing, or could not be created.
Exception Attributes: array (
'class' => 'Mysql',
'message' => 'SQLSTATE[HY000] [2003] Can\'t connect to MySQL server on \'127.0.0.1\' (111)',
'enabled' => true,
)
What am I missing? I have set up at least 10 other cakephp servers, and many of them run on mysql 5.6 using the same PDO driver version - the setups look the same, but I must be missing something.