Mysql Connection

liunx

Guest
If I have two domains, and one has a MySQL database, can't I have a page on the other domain that accesses the DB at the first domain???<br /><br />I thought this was possible, and you substituted the first domain name instead of "LOCALHOST" for the server; but that's not working very well for me...<br /><br />I just need to know if this is possible, so I can stop wasting time trying if it's not.<br /><br />Thanks,<br />Dan<!--content-->
Assuming the two domains are on different servers, you would need to go into your CPanel / MySQL Databases page for the first domain and authorize access from the second domain's server by adding it under "Access Hosts" (near the bottom of the page).<!--content-->
Well, I thought you could do it! Thanks.<br /><br />I'm still missing something though... I just did what you said, and I'm still getting access denied.<br /><br />Either I'm not naming Domain2 correctly when I add it to the Access Hosts list, or I'm not naming Domain1 correctly as my server in the page I'm making. Would I simply use the domain name in each case, or is there more required?<br /><br />Dan<!--content-->
In your script, the hostname can be specified as 'domain1.com' - I don't see any problems with this. <br /><br />Granting permission for the script to access the MySQL server at domain1.com -<br /><br />If 'domain2.com' does not work in "Access Hosts", I'd suggest trying one of the following:<br />1) %.domain2.com<br />2) serverXX.totalchoicehosting.com (where "XX" is your domain2.com server number)<br />3) IP address of domain2.com server<br /><br />You should be getting an error message in your script indicating what hostname your script is using to connect with. That host name has to match what is in the "Access Hosts" list on the domain1.com server if you're not specifying the "Access Host" by IP address.<br /><br />In addition, you should make sure you are trying to access the MySQL with correct database name, username, and password, The database name and username should be specified as 'cpanelName_database' and 'cpanelName_username' in your script.<br /><br />Hope this helps...<!--content-->
Thanks a lot... you got me through it!<br /><br />serverXX.totalchoicehosting.com was the key.<br /><br />Dan<!--content-->
 
Top