Jump to content

Remote MySql


unidox

Recommended Posts

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

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')

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

$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.

 

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.

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.

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?

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.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.