LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
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.

Notices


Reply
  Search this Thread
Old 10-24-2005, 06:57 AM   #1
jme
Member
 
Registered: Sep 2003
Location: Hull, UK
Distribution: Debian
Posts: 49

Rep: Reputation: 15
Connecting to MySQL from outside the network


Hey guys,

I have had my sql server running for ages now, but I now need to let a friend connect to it from outside my network. I have had no problems what-so-ever connecting from the actual server using host of localhost, however, my friend keep getting the following error messages within his code:

Code:
Warning: mysql_connect(): Lost connection to MySQL server during query in /home/s/a/savetherennets_com/includes/mysqldbc.php on line 8
Could not connect to MySQL: Lost connection to MySQL server during query
The code on what line is the connection to the database:

Code:
$dbc = mysql_connect (DB_HOST, DB_USER, DB_PASSWORD) OR die ('Could not connect to MySQL: ' . mysql_error() );
mysql_select_db (DB_NAME) OR die ('Could not select the database: ' . mysql_error() );
Any suggestions as to why this is happening? I have set up the username that my friend is using through phpMyadmin and granted access from all domains (%) so I can't see what the problem is.

Many thanks

Jamie
 
Old 10-25-2005, 03:39 AM   #2
fouldsy
Senior Member
 
Registered: Jan 2002
Location: St Louis, MO
Distribution: Ubuntu
Posts: 1,284

Rep: Reputation: 47
What is the connection string you're passing to connect into the database from your friend's machine. It would need to include IP address + port number of your router, and have the required ports forward to your machine running the MySQL server. I think you also need to enable an option within your mysql config file to permit remote access as it's disabled by default. Could be wrong though.
 
Old 10-25-2005, 05:32 AM   #3
jme
Member
 
Registered: Sep 2003
Location: Hull, UK
Distribution: Debian
Posts: 49

Original Poster
Rep: Reputation: 15
I have the router set up correctly to forward all mysql queries to the sql server. The only thing that I can think of is that it's a problem with external access not being allowed in a config file.

I have had a look throuhg the /etc/mysql/my.conf file but I can't see anything that would relate to this.

Could anybody point me in the right direction?

Many thanks.
 
Old 10-25-2005, 05:40 AM   #4
jme
Member
 
Registered: Sep 2003
Location: Hull, UK
Distribution: Debian
Posts: 49

Original Poster
Rep: Reputation: 15
All that's needed it to comment out the
#bind-address = 127.0.0.1
line in the my.conf file.

Many thanks for your help.
 
  


Reply



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 Mysql blood_omen Debian 6 07-23-2004 01:20 AM
Connecting to MySQL ksalopek Linux - Software 5 06-11-2004 09:07 AM
connecting to mysql dkc_ace Linux - General 2 03-22-2003 07:18 PM
Connecting to mysql webee Linux - Software 2 01-30-2003 02:47 PM
Mysql is not connecting from servlet.But connecting from java, help pls Harish_f Linux - General 0 05-08-2002 03:21 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 11:05 AM.

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