cPanel - Inbound Remote MySQL Connections Print

  • 6

To enable a MySQL Database on a LAMP server to receive incoming connections from a remote location you will need to setup the following:
  1. LAMP Server configured with MySQL
  2. Incoming port (3306 by default) configured to allow connections
  3. Incoming port (3306 by default) configured within MySQL
  4. Database & User created
    - in cPanel this id done on a per account basis from the MySQL Databases screen
  5. Remote Access Hosts configured
    - in cPanel this is done on a per account basis from the Remote Database Access Hosts screen
    - if you do not have a specific IP address for the remote server that will be connecting, you can use %.%.%.% to represent all IP's

Once the above is completed you can use a local copy of phpMyAdmin to connect to the remote server.  An example of the config.inc.php file would be:

/*
* First server
*/
$i++;
$cfg['Servers'][$i]['host'] = '127.0.0.1';
$cfg['Servers'][$i]['port'] = '3306';
$cfg['Servers'][$i]['auth_type'] = 'config';
$cfg['Servers'][$i]['user'] = 'dbuser';
$cfg['Servers'][$i]['password'] = 'dbpass';
$cfg['Servers'][$i]['connect_type'] = 'tcp';
$cfg['Servers'][$i]['compress'] = false;

If you receive an 2000 error "mysqlnd cannot connect to MySQL 4.1+ using old authentication" then you will need to follow the instructions found on this thread (http://stackoverflow.com/questions/1575807/cannot-connect-to-mysql-4-1-using-old-authentication)

  1. Login to server as root user
  2. Login to mysql as the user that you created for remote access
  3. # mysql -u dbuser -h localhost -p
  4. Once logged in as the remote user, change the password to a legacy format
    SET SESSION old_passwords=FALSE;
    SET PASSWORD = PASSWORD('dbpass');



        

Was this answer helpful?

« Back