Please Help! Can't connect to remote MySQL server using PHP

Hello,

I am trying to connect to a remote mysql server through php. Here's the
code:

mysql_connect("my.hostname.edu", "username", "password") or die
(mysql_error());
mysql_select_db("db_name") or die ("unable to select
db".mysql_error());
$r1 = mysql_query('SELECT * FROM table') ;

Using the mysql prompt on the remote server, the mysql -h -u -p works
just fine with the parameters i've specified here. According to the
user table I have the proper permissions. I just can't figure out what
could be preventing the connection here, although I am no expert...can
anyone help?!

BTW, I am using PHP 4.4.1 and mysql 5.0.

Thanks in advance...
courtney.machi [ Di, 23 Mai 2006 22:09 ] [ ID #1326004 ]

Re: Please Help! Can't connect to remote MySQL server using PHP

courtney.machi [at] gmail.com wrote:

> I am trying to connect to a remote mysql server through php. Here's the
> code:
>
> mysql_connect("my.hostname.edu", "username", "password") or die
> (mysql_error());
> mysql_select_db("db_name") or die ("unable to select
> db".mysql_error());
> $r1 = mysql_query('SELECT * FROM table') ;

What error message your code prints out?
Aggro [ Di, 23 Mai 2006 22:40 ] [ ID #1326005 ]

Re: Please Help! Can't connect to remote MySQL server using PHP

Hello,

The error (actually warning) message says:
Warning: mysql_connect(): Lost connection to MySQL server during query
in /cm/data.php on line 23
Lost connection to MySQL server during query
courtney.machi [ Mi, 24 Mai 2006 17:22 ] [ ID #1327693 ]

Re: Please Help! Can't connect to remote MySQL server using PHP

courtney.machi [at] gmail.com wrote:

> The error (actually warning) message says:
> Warning: mysql_connect(): Lost connection to MySQL server during query
> in /cm/data.php on line 23

Here are some cases which could cause this:
http://dev.mysql.com/doc/refman/5.0/en/gone-away.html
Aggro [ Mi, 24 Mai 2006 18:37 ] [ ID #1327694 ]
Datenbanken » mailing.database.mysql » Please Help! Can't connect to remote MySQL server using PHP

Vorheriges Thema: Looking for a bit of hacking help
Nächstes Thema: Dreamweaver MySQL connection using PHP and Apache on XP