How to use (access) a MySQL database on a different (remote) server (cPanel)

  • Step 1. Set up remote access hosts in WHM
    Step 2. Do the same in cPanel for the user that owns the databese
    if the above is not enough
    Step 3. edit /etc/my.cnf and remove skip-networking
    and if still doesn't work
    Step 4. Log into the server you will access the database from and open up port 3306 in the firewall for outgoing traffic

  • With SVC you may get some MySQL connection errors and after a certain number of interrupted connections between Server A (webService) to Server B (SQL Database), you may get blocked and your php scrips may come back with an error like the following:

    Host 'host_name' is blocked because of many connection errors.
    Unblock with 'mysqladmin flush-hosts'

    More info here:

    By default, mysqld blocks a host after 10 connection errors. You can adjust the value. Go to your SQL server (Server B) and

    • edit /etc/my.cnf and insert this value:
    • save my.cnf
    • restart mysqld ( /etc/init.d/mysqld restart )

    test your SQL connection (or SVC) and it should connect

Log in to reply