无法从PHP中的其他服务器连接远程MySQL服务器

I created a PHP script on my local machine and created database connection from remote server. It is working fine on my localhost. But when I upload that script on server, script is unable to connect with server.

Codebase server and MySQL server are different but on same LAN. I am getting below error:

Warning: mysqli_connect(): (HY000/2002): Permission denied

Try to do this:

  • Firewall of the server must be set-up to enable incomming connections on port 3306
  • You must have a user in MySQL who is allowed to connect from % (any host) (see manual for details)