So i bought a webhost/domain but i want it to connect to my hoster. Which means, how do i share mysql databases?
Printable View
So i bought a webhost/domain but i want it to connect to my hoster. Which means, how do i share mysql databases?
mysql_connect("host", "username", "password");
mysql_select_db("database");
Assuming you're gonna use php, if you're not, the syntax should still be very similar.
Could you put it in a noobish version?
yes, better?
PHP Code:<?php
mysql_connect("yourhost", "yourusername", "yourpassword");
mysql_select_db("yourdatabase");
?>
Where? On the original hosts computer?
On the computer which is connecting to the MySQL DB :winky:
Thanks for the help, ill see if this works :).
What do i put as host instead of "localhost". Wan IP?
url to your host's mysql server?
Be more specific? :/
usually localhost
Eg:
So what do i change?Code:$host['naam'] = 'localhost'; // my host
$host['gebruikersnaam'] = 'root'; // my database username
$host['wachtwoord'] = ''; // my database password
$host['databasenaam'] = 'odinms'; // my database name
$serverip = "127.0.0.1"; //Replace with your WAN IP if public
$loginport = "8484"; //Don't change
$sql_db = "odinms"; //DB Name
$sql_host = "localhost"; //DB Host
$sql_user = "root"; //DB User
$sql_pass = ""; //DB Password
99.244.125.141 is the Wan IP.
ah so you have an odinms server and you want to host files on your server and mysql on a diff one.
first make your computer's ip able to remote access from the mysql. if its something like a free mysql, they will have support for this.
then, just change the sql_host to whereever the mysql host is. =]
no hmm look if put what u connect to ur hoster pc.. like if
$host['naam'] = 'his wan ip'; // my host
$host['gebruikersnaam'] = 'user name u use to connect'; // my database username
$host['wachtwoord'] = 'pass?'; // my database password
$host['databasenaam'] = 'db name'; // my database name
well thats how it works.
but mysql has security to remote php scripts. otherwise if that wasnt there, hacking maplestory or something would be much easier. haha.
first allow your ip to connect to the mysql, then change the script
I'll try it out later. Thanks :).