PHP mySQL server name for different website

Asked by:
BreachofMind / 16 Points
2012-03-05 4:05 pm EST
I'm creating a website for a client with a different web host. However, they don't have mySQL support yet. I would like to build a PHP site that can connect to a mySQL database with my host site with the Hub (for now).


Usually I use "localhost" for the server name when the mySQL db is on my site. However, if this site is on a different web host's server, that won't work. What should be there? I've tried my IP, IP:port, servername:port and servername and it won't connect.

Any suggestions? Thanks

To ask this user for more information, please first login.

To submit an answer, please login.

Best answer chosen by User


13,688 Points
2012-03-05 4:28 pm EST
Hi BreachofMind,

In order to connect a site hosted elsewhere to a database here, the first step will be to set up a remote MySQL connection through cPanel. Since you will be connecting from another website, you can enter in the domain name or IP address for the domain in the Remote Database Access Hosts page in cPanel. In your PHP file, you can use any of the following:

  • Your domain hosted here on Web Hosting Hub (as long as it is different from the domain you are connecting from)

  • The shared IP of your account's server (listed in the stats on the left side of the cPanel home page)

  • The name of the server your account is located on

Please let us know if you have any additional questions or need further assistance.


Christi N.

To submit a comment on this answer, please first login.

Want to share this Question?

Related Articles

It looks like there are no related articles.
Would you like to ask a question about this page? If so, click the button below!

Help Center Search

Current Customers

Email: Ticket: Submit a Support Ticket
Call: 877-595-4HUB (4482)
757-416-6627 (Intl.)
Chat: Click To Chat Now

Ask the Community

Get help with your questions from our community of like-minded hosting users and Web Hosting Hub Staff.

Not a Customer?

Get web hosting from a company that is here to help.