Share your knowledge at the LQ Wiki.
Go Back > Forums > Linux Forums > Linux - Software
User Name
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.


  Search this Thread
Old 02-18-2005, 03:30 AM   #1
Registered: Sep 2004
Posts: 37

Rep: Reputation: 15
connecting to MYSQL remote database

I have 3 different hosts. One host contains a mysql database and the other 2 hosts (are supposed to anyway) connect to the database remotely. However, only one of them does. The other one does not. It just spits out an error at me. Here is the code I am using to connect. It is identical on both machines which leads me to believe that I have to do something to the host machine, (or maybe something iptables related? i'm not sure). Does anyone know how to fix this? TIA.

// hostname or ip of server

// username and password to log onto db server

// name of database

////////////// Do not edit below/////////

function connecttodb($servername,$dbname,$dbuser,$dbpassword)
global $link;
$link=mysql_connect ("$servername","$dbuser","$dbpassword");
if(!$link){die("Could not connect to MySQL");}
mysql_select_db("$dbname",$link) or die ("could not open db".mysql_error());
Old 02-18-2005, 05:52 AM   #2
Senior Member
Registered: Dec 2002
Location: Atlantic City, NJ
Distribution: Ubuntu & Arch
Posts: 3,503

Rep: Reputation: 57
Let me know if this tutorial works. I haven't tried it but it looks like it would do the job.


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
connecting to a MySQL database hsa Linux - General 3 09-16-2005 06:34 AM
probs with connecting to mysql database using php ankscorek Linux - Software 4 08-16-2005 07:40 PM
MySQL and remote database inspleak Linux - Networking 3 09-17-2004 01:00 AM
connecting to remote MySQL server acos7 Linux - Software 2 01-30-2004 11:37 PM
Connecting Mysql Database on remote server akamol Programming 4 10-16-2003 11:46 AM > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 03:56 PM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration