Setting up Remote MySQL in cPanel

Tuesday July 8thTutorial, Web Hosting, cPanel Category



Today my client was facing problem to setup a remote mysql connection. He wanted to connect a database which belongs to another server and domain. Its fairly simple. But most of the tasks remains on the remote server.

Suppose, your remote domain/server is www.remote.com and your scripts are running in mydomain.com. I assume that you already have a database in the remote.com. We just need to access it from remote server. Also assuming that your database name is remoteco_main. Note, all databases & also usernames (for database connection) in cPanel are prefixed by your username of cPanel and _ (underscore). So remoteco in remoteco_main is the username of cPanel. So you have a complete database, username & password setup which works on remote.com.

  • Login to cPanel of remote.com.
  • Click Manage Remote MySQL Access
  • Enter the IP Address of in the box “Host (% wildcard is allowed):“. It’s the IP address where your mydomain.com is hosted. Usually it is the server shared IP unless you have a dedicated IP address. You can also enter the domain name as Host.
  • Click Add Hosts
  • Now open your database configuration file in mydomain.com. In normal cases,the host was localhost.That is you may get the code as $dbhost=’localhost’ or $db_host=’localhost’.
  • Now you need to replace the term localhost with actual domain or IP address. You enter remote.com or the IP of remote.com as host in the database configuration file.

An Example:

<?php

$dbhost=’205.75.28.29′; //ip of the remote.com. you can also put remote.com here.

$dbname = ‘remoteco_db’; //database name

$dbuser= ‘remoteco_main’; //user name to access database

$dbpass = ‘123456′; //password of the database

?>

Thats it, you should now be able to connect to your remote mysql server.

Bookmark: bookmark bookmark bookmark bookmark bookmark bookmark bookmark bookmark bookmark bookmark bookmark bookmark bookmark bookmark bookmark bookmark bookmark bookmark bookmark

No related posts.

4 Comments

  1. Scott
    September 17, 2008

    thanks for the nifty tutorial.
    still confused on how to set up the mysql user.

  2. andy
    January 23, 2009

    I am trying to connect remote mysql db from my home. I added my IP address in access list, other parts are the same as you wrote. still I cannot connect to remote db. anyone could help?

  3. admin
    January 25, 2009

    What is your IP that you added to mysql remote server? it is highly possible that you are connecting to internet using ISP’s gateway. so that ip needs to be added to mysql server.

    visit http://www.hungrycoders.com and see what is your ip. Add this ip to mysql server. If you still face problem, try to add a range.

    suppose, there u get 204.211.223.10. so you may try adding 204.211.223.* that is a wild card for last part. but remember to delete this after works are done otherwise it may be a security risk.

  4. Alwahsh
    August 26, 2009

    Thanks for the great info but it didn’t work , gives me error :
    can’t connect to MySQL server on “ip adress” . is there solution ??

Leave a comment

remote mysql cpanel - cpanel remote mysql - cpanel Setup Remote MySQL server - cpanel remote mysql access - cpanel remote mysql - "Remote MySQL Access" cpanel - Manage Remote MySQL Access in cpanel - mysql cpanel connect - cpanel mysql underscore - cpanel cannot connect remote mysql - how to connect to remote mysql database cpanel - cpanel remote mysql connection setup - cpanel remote mysql server - remote mysql connection cpanel - configuring Cpanel for remote MySQL connection - cpanel mysql cannot connect remotely - Cpanel domains cant connect to Remote MySQL server - cpanel remote mysql connection - access remote mysql database cpanel - access database connection object from remote domain - cpanel remote mysql login - dbhost cpanel - how to enable remote mysql cpanel - Manage Remote MySQL Access cpanel no-ip.com - % wildcard in cpanel remote mysql - cannot connect cpanel dedicated ip - cpanel mysql in another server - remote mysql access cpanel - cpanel remote database mysql - how to set up MySQL remote server - nginx remote mysql - connecting to remote mysql cpanel - joomla access remote mysql - tutorial remote mysql cpanel - how to open remote connection of mysql in cpanel - cpanle remote connection to mysql - how to connect to mysql remotely +cpanel - remote mysql access wildcard in cpanel - remote mysql in cpanel - remote access mysql $dbhost = - tutorial tentang remote mysql cpanel - Удаленный mysql cpanel - cPanel Remote Database Access Hosts - remote mySQL + cpanel - connect to remote mysql cpanel - how to find dbhost of a mysql database in cpanel - cannot setup remote mysql database cpanel - setting remote mysql - remote access mysql cpanel - allow remote mysql connections + cpanel server -

Size

Colors