How to Connect to the MySQL Database Remotely

Connect via ScriptConnect Remotely Allowing remote MySQL connections is often done to enable a program on your personal computer to access a database on the server.

Configuration Settings

Use the following configuration settings for connecting to your database:

  • Host name = (use the server IP address)
  • Database name = (cpanelUsername_databaseName)
  • Database username = (cpanelUsername_databaseUsername)
  • Database password = (the password you entered for that database user)
  • MySQL Connection Port = 3306
  • TCP or UDP, either is fine.

To learn more about adding a connection string to your Perl or PHP code using these configuration settings, please see the following article:

MySQL Connection Strings
Enable Your Computer as an Access Host

By default, all IPs are blocked and must be added to an access list in order to access the server. So, before connecting to MySQL from another computer, the connecting computer must be enabled as an Access Host.

When Using cPanel X3 Theme

  • Log into cPanel.
  • Under Databases, click the Remote MySQL icon.
  • In the Host field, type in the connecting IP address.
  • Click Add Host.
  • You should now be able to connect remotely to your database.