unidox Posted May 12, 2007 Share Posted May 12, 2007 I need some help. I have an admin panel, and I like it, however I dont want to give my script out. So I was just wondering how I set my panel up so I add a domain, which has their own mysql files on it, and can login on the panel and edit their site without having to have the files on their webserver, and just mine. Link to comment https://forums.phpfreaks.com/topic/51030-remote-mysql/ Share on other sites More sharing options...
neel_basu Posted May 12, 2007 Share Posted May 12, 2007 So I was just wondering how I set my panel up so I add a domain, which has their own mysql files on it, and can login on the panel and edit their site without having to have the files on their webserver, and just mine. I am confused and didn't understand. If you want to access another MySQL Server on another domain use mysql_connect('other-domain.com', 'user_name', 'Password') Link to comment https://forums.phpfreaks.com/topic/51030-remote-mysql/#findComment-251122 Share on other sites More sharing options...
chigley Posted May 12, 2007 Share Posted May 12, 2007 Yes you can just use: <?php $conn = mysql_connect("1.1.1.1", "user", "pass"); ?> But you may need to alter the MySQL settings on the remote server to allow the server you're running the site on to access the database remotely. Link to comment https://forums.phpfreaks.com/topic/51030-remote-mysql/#findComment-251173 Share on other sites More sharing options...
unidox Posted May 12, 2007 Author Share Posted May 12, 2007 Would I put it in my admin panel script or what? how do u make it connect to many databases and edit only the one that is logged in Link to comment https://forums.phpfreaks.com/topic/51030-remote-mysql/#findComment-251543 Share on other sites More sharing options...
unidox Posted May 13, 2007 Author Share Posted May 13, 2007 is there no way to do that? Link to comment https://forums.phpfreaks.com/topic/51030-remote-mysql/#findComment-251726 Share on other sites More sharing options...
PC Nerd Posted May 13, 2007 Share Posted May 13, 2007 i sort of need to do the same thing ,but through visual basic ( thats another story) what my host says is that you either need a static IP, and they can allow that through their firewall, or ican use SSH tunneling please dont ask what either mean, i havent really looked into either, but though tthose things might help you with your site. good luck Link to comment https://forums.phpfreaks.com/topic/51030-remote-mysql/#findComment-251741 Share on other sites More sharing options...
unidox Posted May 13, 2007 Author Share Posted May 13, 2007 Thanks, but thats not really what i am looking for. Link to comment https://forums.phpfreaks.com/topic/51030-remote-mysql/#findComment-251770 Share on other sites More sharing options...
unidox Posted May 13, 2007 Author Share Posted May 13, 2007 Anyone? Link to comment https://forums.phpfreaks.com/topic/51030-remote-mysql/#findComment-252038 Share on other sites More sharing options...
unidox Posted May 14, 2007 Author Share Posted May 14, 2007 bump Link to comment https://forums.phpfreaks.com/topic/51030-remote-mysql/#findComment-252950 Share on other sites More sharing options...
unidox Posted May 16, 2007 Author Share Posted May 16, 2007 example? Link to comment https://forums.phpfreaks.com/topic/51030-remote-mysql/#findComment-254086 Share on other sites More sharing options...
unidox Posted May 24, 2007 Author Share Posted May 24, 2007 bump Link to comment https://forums.phpfreaks.com/topic/51030-remote-mysql/#findComment-260424 Share on other sites More sharing options...
hitman6003 Posted May 24, 2007 Share Posted May 24, 2007 $conn1 = mysql_connect("1.1.1.1", "user", "pass"); $conn2 = mysql_connect("2.2.2.2", "user", "pass"); $query = "SELECT * FROM table1"; $results_from_conn1 = mysql_query($query, $conn1); $results_from_conn2 = mysql_query($query, $conn2); Same query, two different servers, presumably two different results. You can connect to as many database servers as your php server has resources for (each connection does take memory and such), and you can query each one independently in the same script. Link to comment https://forums.phpfreaks.com/topic/51030-remote-mysql/#findComment-260427 Share on other sites More sharing options...
unidox Posted May 24, 2007 Author Share Posted May 24, 2007 how do I set it up on the other end. They will have the sql info Link to comment https://forums.phpfreaks.com/topic/51030-remote-mysql/#findComment-260456 Share on other sites More sharing options...
unidox Posted May 24, 2007 Author Share Posted May 24, 2007 hello? Link to comment https://forums.phpfreaks.com/topic/51030-remote-mysql/#findComment-260723 Share on other sites More sharing options...
trq Posted May 24, 2007 Share Posted May 24, 2007 how do I set it up on the other end. The user needs to login and give themselves permission to login from your domain. Something like... GRANT ALL PRIVILEGES ON *.* TO [email protected] IDENTIFIED BY "password"; There are serious security issues involved with what you are wanting to do. There is no way I would grant access permissions from someone elses domain. This makes it alot easier for you to break into there db. Link to comment https://forums.phpfreaks.com/topic/51030-remote-mysql/#findComment-260729 Share on other sites More sharing options...
unidox Posted May 24, 2007 Author Share Posted May 24, 2007 I dont get it. What I need is for my domain to hold the script. Then they goto my site and login to the admin panel. Then they can edit thir site. My admin panel only changes the sql. There server will have the non admin files like index.php and they will also have the sql on their server. Link to comment https://forums.phpfreaks.com/topic/51030-remote-mysql/#findComment-260732 Share on other sites More sharing options...
trq Posted May 24, 2007 Share Posted May 24, 2007 I understand what you want to do. But you need to grant permissions on there database server to allow a connection to be made to it from your domain. Link to comment https://forums.phpfreaks.com/topic/51030-remote-mysql/#findComment-260735 Share on other sites More sharing options...
unidox Posted May 24, 2007 Author Share Posted May 24, 2007 I dont get what you would have to grant. I will have the sql user pass and server. Thats all mine has now. Link to comment https://forums.phpfreaks.com/topic/51030-remote-mysql/#findComment-260737 Share on other sites More sharing options...
trq Posted May 24, 2007 Share Posted May 24, 2007 Thats all mine has now. No its not. By default, you also have permissions to connect from localhost. Link to comment https://forums.phpfreaks.com/topic/51030-remote-mysql/#findComment-260741 Share on other sites More sharing options...
unidox Posted May 24, 2007 Author Share Posted May 24, 2007 Yea, I use localhost. So all I have to do is $conn1 = mysql_connect("1.1.1.1", "user", "pass"); $conn2 = mysql_connect("2.2.2.2", "user", "pass"); $query = "SELECT * FROM table1"; $results_from_conn1 = mysql_query($query, $conn1); $results_from_conn2 = mysql_query($query, $conn2); but what is table1? Link to comment https://forums.phpfreaks.com/topic/51030-remote-mysql/#findComment-260909 Share on other sites More sharing options...
trq Posted May 24, 2007 Share Posted May 24, 2007 but what is table1? This code is an example. $query = "SELECT * FROM table1"; And this is an example of how to select all data from a table called table1. Link to comment https://forums.phpfreaks.com/topic/51030-remote-mysql/#findComment-260921 Share on other sites More sharing options...
unidox Posted May 24, 2007 Author Share Posted May 24, 2007 So how do I make table1? Link to comment https://forums.phpfreaks.com/topic/51030-remote-mysql/#findComment-260926 Share on other sites More sharing options...
trq Posted May 24, 2007 Share Posted May 24, 2007 So how do I make table1? This has nothing to do with your original question, but anyway... to make a table called table1 you would run a query such as.... CREATE TABLE table1; Link to comment https://forums.phpfreaks.com/topic/51030-remote-mysql/#findComment-260927 Share on other sites More sharing options...
unidox Posted May 24, 2007 Author Share Posted May 24, 2007 Oh lmfao. A sql table. Ok I will try when I get home Link to comment https://forums.phpfreaks.com/topic/51030-remote-mysql/#findComment-260930 Share on other sites More sharing options...
trq Posted May 24, 2007 Share Posted May 24, 2007 I will try when I get home Try what? This example... <?php $conn1 = mysql_connect("1.1.1.1", "user", "pass"); $conn2 = mysql_connect("2.2.2.2", "user", "pass"); $query = "SELECT * FROM table1"; $results_from_conn1 = mysql_query($query, $conn1); $results_from_conn2 = mysql_query($query, $conn2); ?> simply shows how to connect to two different database servers and run the same query on each. You still need to make sure both mysql servers (1.1.1.1 and 2.2.2.2) allow a connection to be made from your domain. Link to comment https://forums.phpfreaks.com/topic/51030-remote-mysql/#findComment-260934 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.