Debian服务器上的Apache连接到外部mysql

I have servers :

  • a Sql server
  • a VPS

I installed apache on my debian server. I want to access my SQL server through PDO. But an error occurs :

SQLSTATE[HY000] [2003] Can't connect to MySQL server on 'my_sql_server_ip' (110)'

However, I can access my SQL server from local apache server (MAMP). So I think the problem is client side.

Any suggestion ?

On MAMP , click File Menu > Edit Template > MySQL my.cnf

and change bind-address = 127.0.0.1 by bind-address = 0.0.0.0

(don't edit directly /Applications/MAMP/tmp/mysql/my.cnf because MAMP will overwrite the file on restart)