0
votes

I am trying to connect my Cakephp project (2.3.8) to a remote mySQL database. My connection the MySQL command line on the same computer

mysql -u testconection -p -h someserver.somewhere.net
works perfectly. But this connection in database.php:

public $default = array(
    'datasource' => 'Database/Mysql',
    'persistent' => false,
    'host' => 'someserver.somewhere.net',
    'login' => 'testconnection',
    'password' => 'testpassword',
    'database' => 'db10',
    'prefix' => '',
    //'encoding' => 'utf8',
)

fails with this error in Cake:

SQLSTATE[HY000] [2003] Can't connect to MySQL server on 'someserver.somewhere.net' (13)

according to the the docs error 13 is a permission denied error.

Thanks

1
did you checked login and password? In your example your login is 'test4' but in your code is 'testconection' (with a single 'n') - arilia
Hi Its mysql problem, Contact your support for more help. Check tables are there in that database and ports are opened for access - AnNaMaLaI
Are you using selinux ? - savedario
HI, airila it was the same login and password. I was double checked that (in my post I didnt use a real username and password for security reasons) I will check in SeLinux - my deve machine is CentOS which definitly uses SELinux. the server is Ubuntu Server 12.04 I will double check on that - user2372869
If you Google "SQLSTATE[HY000] [2003] Can't connect to MySQL", without 13, you will get a few links to similar problems related to selinux. - savedario

1 Answers

0
votes

You have to make httpd can make network connection (to MySQL)

[roo@web ~]# setsebool -P httpd_can_network_connect=1