PHP mySQL server name for different website

Asked by:
BreachofMind
Time:
2012-03-05 8:05 pm
Category:
Databases
Hits:
619
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).

mysql_connect("localhost",$user,$pass);

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

You must login before you can ask a follow up question.

You must login before you can submit an answer.

Best answer chosen by User

0

ChristiNi
2012-03-05 8:28 pm
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.

Regards,

Christi N.

You must login before you can post a comment about this answer.

Like this Question?

Support Center Search

Current Customers

Email: support@WebHostingHub.com 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.