Remote MySQL database connection using php

I'm trying to connect to a remote database on a server which is accessed through cPanel.

I created a user name and associated it with a database. I'm using:

I'm confused on the host name to use. I tried using the Main Domain name in the left menu panel in cPanel with the port number 3306 but it wouldn't work. I used the shared IP as well with the port number that that wouldn't work as well. I have added my local machine IP to the remote databases page in the cPanel as was told in a post but finally I'm not able to connect to the database.

On echoing the mysql_error(), I get:

Can't connect to MySQL server on 'host_name' (4)

Any help would be great!

Upvotes: 0

Views: 943

Answers (1)

Shinto Joseph
Shinto Joseph

Reputation: 1171

your hosting site will specify which name should be used for the host

in hostinghood.com they says that to use localhost itself as host name

so check what your hosting site says about it

Upvotes: 1

Related Questions