Portal Home > Knowledgebase > Articles Database > Connecting to remote MySQL Database with CPanel
Connecting to remote MySQL Database with CPanel
Posted by Mr Tech, 12-10-2008, 10:30 PM |
Connecting to remote MySQL Database with CPanel
Is it possible for a remote server or even another account on the same server to access the MySQL Database of an account?
The reason I ask this is a I have a client who wants to set-up a second website but wants to pull a lot of the data from his existing website which is in a MySQL Database.
How would I go about doing this?
__________________Webmaster ResourcesWebmaster Forums
|
Posted by Mark Muyskens, 12-10-2008, 10:51 PM |
It under your cPanel as Remote Mysql
"You can allow external web servers to access your MySQL databases by adding their domain name to the list of hosts that are able to access databases on your web site."
|
Posted by ThatScriptGuy, 12-10-2008, 10:57 PM |
If his second site is on the same server as his first, there is nothing stopping him from connecting to his first site's database from his new site, using the same connection details he uses on his first site.
__________________
Kevin CacklerThat Script Guy, LLC
(501) 358-4064
|
Posted by Mr Tech, 12-10-2008, 11:14 PM |
So basically I just used localhost as the database host and then just use the login details to the other websites database?
__________________Webmaster ResourcesWebmaster Forums
|
Posted by ThatScriptGuy, 12-11-2008, 12:10 AM |
Yes - That should work just fine, as long as both sites are on the same server and MySQL is running on localhost.
__________________
Kevin CacklerThat Script Guy, LLC
(501) 358-4064
|
Posted by hostingubetter, 12-11-2008, 02:27 PM |
The remote MySQL Server piece the Mark mentioned is the first thing you do but wiithin PHP, you can access any dataabse on any site, you just put the domain instead of localhost and the host. You do have to setup the RemoteMYSQL though as mentioned by Mark.
__________________
Jesse, AllportPChttp://www.allportpc.com
Shopping Carts, Linux
|
Posted by ThatScriptGuy, 12-11-2008, 04:19 PM |
You're just going to confuse the original poster.
The answer to his question has already been posted here - If both websites are on the server, and the MySQL server is also on the same server, then you CAN use your mysql connection string on both sites without changing a thing.
__________________
Kevin CacklerThat Script Guy, LLC
(501) 358-4064
|
Posted by jamesprx, 12-18-2008, 03:09 AM |
RE
Both sites should be on same server then only can you connect them.
|
Posted by ThatScriptGuy, 12-18-2008, 04:54 AM |
Quote:
Originally Posted by jamesprx
Both sites should be on same server then only can you connect them.
WRONG!
He could have 15 sites strung across 13 servers - and they could ALL connect to the same database.
__________________
Kevin CacklerThat Script Guy, LLC
(501) 358-4064
|
Posted by Int-char, 12-18-2008, 07:57 AM |
It is problem, but I am master
|
Add to Favourites Print this Article
Also Read