LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (https://www.linuxquestions.org/questions/linux-software-2/)
-   -   Connecting to MySQL from outside the network (https://www.linuxquestions.org/questions/linux-software-2/connecting-to-mysql-from-outside-the-network-376330/)

jme 10-24-2005 06:57 AM

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

fouldsy 10-25-2005 03:39 AM

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.

jme 10-25-2005 05:32 AM

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. :)

jme 10-25-2005 05:40 AM

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.


All times are GMT -5. The time now is 06:08 PM.