How to connect a database remotely via remote server and script

0
502
How to Connect to the MySQL Database Remotely
Connect a Database Remotely via Remote Server Script

Remote Database

Remote Database Access technology allows you to connect the database server remotely, the below article will help you to access your database in a remote manner. Remote Database Access provides standard protocols for establishing a remote connection between a database client and a database server.

By default, all IP address was denied from accessing MySQL remotely in cPanel account, we need to whitelist or add it as remote host. This can be done by the below-stated steps.

Step 1: Login to your cPanel account and click on Remote MySQL.

Step 2: Now enter the host IP and use wildcard option if needed then click “Add host”

Remote MySql Database - Add Access Host

Third party application used for this remote access purpose, in such case the third party application software’s integrated and configured with cPanel account. These MySQL client applications are well needed some configuration to access the DB.

The configuration details are below:

Hostname: 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 and MS SQL connection port: 1433

Using script:

Consider your website hosted on the server and your database stored on another server in such cases the website opens to fail because of MySQL content fetch issue. So we cPanel remotely access the database to fetch the content.

The DB username, Hostname, and password must declare in its config file. This file differs for individual CMS. For example, find the below coding for access another host database in WordPress based website.

This coding has to be placed in Config.php file in WordPress CMS

// ** MySQL Settings ** //

/** The name of the database for WordPress */

define('DB_NAME', 'demo1337_wrdp1');

/** MySQL database username */

define('DB_USER', 'demo1337_wp1');

/** MySQL database password */

define('DB_PASSWORD', 'eHTb7%Pxa9');

/** MySQL hostname */

define('DB_HOST', 'localhost');

LEAVE A REPLY

Please enter your comment!
Please enter your name here