⭐ If you would like to buy me a coffee, well thank you very much that is mega kind! : https://www.buymeacoffee.com/honeyvig Hire a web Developer and Designer to upgrade and boost your online presence with cutting edge Technologies
Showing posts with label Remote Access. Show all posts
Showing posts with label Remote Access. Show all posts

Monday, March 7, 2011

How to access MySQL database remotely in cPanel - Remote MySQL Database Access(Access Host)

I have rectly encountered a problem with MySQL database connectivity,what was that see it

I'm having problem with accessing database from one of my site to another..

I have one site say a.com and I want to replicate the database from this site to my another site say b.com...

I'm using Cpanel in both the sites. In site A.com, I have created a user with required privileges and also added the other website (b.com) in the access hosts..

Now to access a.com database from b.com, I can use the username and password I have created on a.com but I'm not sure what hostname should I use..

Website a.com use localhost as the hostname..what should I use with b.com..


Solution:

-If a.com and b.com are on the same server, then you can use localhost.

-If they are on different servers, then use the IP address or domain name instead of localhost.

If the site with the database is a cPanel account, then you will need to give permission for remote access. This is done in cPanel>>MySQL databases

Look towards the bottom for a section called Access Hosts.

Start with % (wildcard). Once it works then

Add the IP address of the server that is wishing to access the database.
Then delete the wildcard (%)

-If already changed the "access hosts"
but this mysql error shows up


GRANT ALL PRIVILEGES ON `the_DB` . * TO 'username'@ 'domain_ip';


Try above sql query from MySQL prompt. and flush the prvileges. Check from your end.