473,388 Members | 1,526 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,388 software developers and data experts.

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

May 23 '06 #1
4 2652
Carved in mystic runes upon the very living rock, the last words of
<co************@gmail.com> of comp.lang.php make plain:
I am trying to connect to a remote mysql server through php.

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.


1) What does mysql_error() say?

2) Is your database configured to allow remote connections?

--
Alan Little
Phorm PHP Form Processor
http://www.phorm.com/
May 23 '06 #2
Hi,

My error (actually a warning):
Warning: mysql_connect(): Lost connection to MySQL server during query
in /cm/sums/data.php on line 23
Lost connection to MySQL server during query

I'm not sure if it is configured to allow remote connections...where
would I look to find out?

Thanks :-)

May 24 '06 #3
Carved in mystic runes upon the very living rock, the last words of
<co************@gmail.com> of comp.lang.php make plain:
My error (actually a warning):
Warning: mysql_connect(): Lost connection to MySQL server during query
in /cm/sums/data.php on line 23
Lost connection to MySQL server during query
That's weird. I've seen connections time out when I'm in the mysql
monitor, but not a script connection.
I'm not sure if it is configured to allow remote connections...where
would I look to find out?


I'm afraid I don't know. MySQL administration is voodoo to me. I just
know such a setting exists.

You might be better off asking in a MySQL group.

--
Alan Little
Phorm PHP Form Processor
http://www.phorm.com/
May 24 '06 #4
Voodoo...quite an accurate comparison, hehe.
Thanks anyway, have a great day!

May 24 '06 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

14
by: TrvlOrm | last post by:
OK. After much playing around, I managed to get my frame page this far.. see code below. BUT...there are still errors with it, and what I would like to have happened is this: 1) On the Left...
1
by: funfair | last post by:
HI,EVERY ONE first problem, i have create a database in access 2003 it worked fine untill i have format my laptop . now im working on office 2003 on windows xp and i have norton 2006 but im...
1
by: KitKat | last post by:
With the help of kind, brilliant folks, I have been working on this program that uses a combo box selection to display six different jpgs. The jps are a time stamp, and the files are located in six...
17
by: cpptutor2000 | last post by:
Could some C guru please help me? I have a simple piece of code as: #include <stdio.h> #include <stdlib.h> #include <openssl/rand.h> int main(){ unsigned char temp; RAND_bytes(temp, 4);
5
by: sandyw | last post by:
I need help in two areas: Both are at the bottom of my program where a client has two choice to make, 1. When the client enter "Y" it takes him to the begin of the program. I would like to know...
14
by: helpfulmaid | last post by:
Hello, I want a function that when it detects the left mouse button is pressed down, will generate and cycle 5 random number/letter combinations as fast as it can in a printed space. If I let off...
62
by: vubaboota | last post by:
I HAVE SOME SERIOUS PROBLEM , HOW TO MAKE A PROGRAM IN C Q1: Write a program using malloc function. In which you take input from user and allocate memory equal to square of this number. Which...
4
by: cpptutor2000 | last post by:
Could someone please help me? I have the following C struct. typedef struct _FIREWALL_RULE_INFO { ULONG Precedence; BOOL bEnabled; BOOL ...
3
by: zabaladesign | last post by:
hello guys.. please help me i made a program for my thesis and i need a textbox which will only accept telephone number like this format (954)-854-2452 .. please... please help me guys i really...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.