Cooper94 Posted April 1, 2009 Share Posted April 1, 2009 I'm trying to connect to an ip to get sql information the code is below. Any help would be fantastic thank you! <?php $database = "test"; $hostname = "69.113.255.195"; $port = "3306"; $username = "root"; $password = '147171'; ?> Quote Link to comment https://forums.phpfreaks.com/topic/152113-sql-connect-ip/ Share on other sites More sharing options...
premiso Posted April 1, 2009 Share Posted April 1, 2009 mysql_connect $database = "test"; $hostname = "69.113.255.195"; $port = "3306"; $username = "root"; $password = '147171'; $con = mysql_connect($hostname . ":" . $port, $username, $password); if (is_resource($con)) { mysql_select_db($database, $con) or die("Unable to connect to database"); }else { echo "Unable to connect to DB"; } echo "Mysql connected just fine!"; Quote Link to comment https://forums.phpfreaks.com/topic/152113-sql-connect-ip/#findComment-798909 Share on other sites More sharing options...
Cooper94 Posted April 1, 2009 Author Share Posted April 1, 2009 The error came up as: Warning: mysql_connect() [function.mysql-connect]: Host '78.129.167.15' is not allowed to connect to this MySQL server in /home/republi1/public_html/medievalages/med/db.php on line 7 Unable to connect to DBMysql connected just fine! Quote Link to comment https://forums.phpfreaks.com/topic/152113-sql-connect-ip/#findComment-798917 Share on other sites More sharing options...
premiso Posted April 1, 2009 Share Posted April 1, 2009 Your database is not setup to receive remote connections. Google how to setup your SQL server to receive remote connections. You will also have to forward ports. If you intend to go this route, I would highly suggest changing the root password and creating a new account that only has access to that one table. You have some reading/googling to do now. Quote Link to comment https://forums.phpfreaks.com/topic/152113-sql-connect-ip/#findComment-798918 Share on other sites More sharing options...
Cooper94 Posted April 1, 2009 Author Share Posted April 1, 2009 Is there anyway you can help me in this process, I have checked google and it was unsuccessful. I am using XAMPP which includes Apache and MySql. I have opened the ports 3306 and 80. Is there something I am missing? Thank You Quote Link to comment https://forums.phpfreaks.com/topic/152113-sql-connect-ip/#findComment-798954 Share on other sites More sharing options...
Cooper94 Posted April 2, 2009 Author Share Posted April 2, 2009 Anyone? Quote Link to comment https://forums.phpfreaks.com/topic/152113-sql-connect-ip/#findComment-799101 Share on other sites More sharing options...
PFMaBiSmAd Posted April 2, 2009 Share Posted April 2, 2009 Is the remote mysql server under your administrative control so that you can change its' settings? Quote Link to comment https://forums.phpfreaks.com/topic/152113-sql-connect-ip/#findComment-799104 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.