473,624 Members | 2,104 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

mysql_connect error Apache Web server to Windows hosted database

GD
Hi All,

I've got MySQL 5.0.21 running on Windows Server 2003, and php running
on Apache on a Linux box (Fedora Core 4).

Previously when the pages were running on an IIS server the connection
was succesful, now I get:

Can't connect to MySQL server on 'SERVER' (13)

I'm connecting using:

$db = mysql_connect(" SERVER", "USER", "PASSWORD")
or die("Could not connect to database:
".mysql_error() );
mysql_select_db ("DATABASE", $db)
or die("Could not select database: ".mysql_error() );

However from the linux box I can connect no problems using:
mysql --host=SERVER -u USER -p

Can anyone help point me in the right direction to solve this one?
Cheers
Dan

Jul 24 '06 #1
6 3355
GD wrote:
Hi All,

I've got MySQL 5.0.21 running on Windows Server 2003, and php running
on Apache on a Linux box (Fedora Core 4).

Previously when the pages were running on an IIS server the connection
was succesful, now I get:

Can't connect to MySQL server on 'SERVER' (13)

I'm connecting using:

$db = mysql_connect(" SERVER", "USER", "PASSWORD")
or die("Could not connect to database:
".mysql_error() );
mysql_select_db ("DATABASE", $db)
or die("Could not select database: ".mysql_error() );

However from the linux box I can connect no problems using:
mysql --host=SERVER -u USER -p

Can anyone help point me in the right direction to solve this one?
Cheers
Dan
Which version of the MySQL client libraries are being used by
Apache/PHP? If it's pre-MySQL 4.1, it will use a different password
hashing algorithm.

--
=============== ===
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
js*******@attgl obal.net
=============== ===
Jul 24 '06 #2
GD

Jerry Stuckle wrote:
>
Which version of the MySQL client libraries are being used by
Apache/PHP? If it's pre-MySQL 4.1, it will use a different password
hashing algorithm.
>From phpinfo():
Active Persistent Links 0
Active Links 0
Client API version 4.1.11
MYSQL_MODULE_TY PE external
MYSQL_SOCKET /var/lib/mysql/mysql.sock
MYSQL_INCLUDE -I/usr/include/mysql
MYSQL_LIBS -L/usr/lib/mysql -lmysqlclient

So this is post-MySQL 4.1?

Thanks
Dan

Jul 24 '06 #3
GD wrote:
Jerry Stuckle wrote:

>>Which version of the MySQL client libraries are being used by
Apache/PHP? If it's pre-MySQL 4.1, it will use a different password
hashing algorithm.

>>From phpinfo():

Active Persistent Links 0
Active Links 0
Client API version 4.1.11
MYSQL_MODULE_TY PE external
MYSQL_SOCKET /var/lib/mysql/mysql.sock
MYSQL_INCLUDE -I/usr/include/mysql
MYSQL_LIBS -L/usr/lib/mysql -lmysqlclient

So this is post-MySQL 4.1?

Thanks
Dan
Yes, that's post 4.1. In that case I would check your server, userid
and password in the mysql_connect() statement very closely.

The fact you can connect from the linux box to the Windows box with
mysql command line utility indicates MySQL on the Windows box is set up
for networking OK, no firewalls in place, etc. The mysql_connect()
statement on the Linux box should use the same type of call.

The only other possibility I can think of is your command line MySQL on
the Linux box might be an older version and you're using pre-4.1
passwords on the Windows MySQL box. "mysql -V" would tell you the
version you're running on the Linux command line.

--
=============== ===
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
js*******@attgl obal.net
=============== ===
Jul 24 '06 #4
GD
Jerry Stuckle wrote:
GD wrote:
Jerry Stuckle wrote:
The only other possibility I can think of is your command line MySQL on
the Linux box might be an older version and you're using pre-4.1
passwords on the Windows MySQL box. "mysql -V" would tell you the
version you're running on the Linux command line.
Hi Jerry,

thanks for your suggestions, mysql -V reports that I'm running version:

mysql Ver 14.7 Distrib 4.1.11, for redhat-linux-gnu (i386)

so again it's post-v4.1.
I've looked at the servername, user and password and tried all
permutations, but with no success.
The only other thing I can think of is there's some sort of permissions
problem on the files, rather than the database, but I'm just clutching
at straws now. Any help very gratefully received.

Cheers
Dan

Jul 25 '06 #5
GD wrote:
Jerry Stuckle wrote:
>>GD wrote:
>>>Jerry Stuckle wrote:

>>The only other possibility I can think of is your command line MySQL on
the Linux box might be an older version and you're using pre-4.1
passwords on the Windows MySQL box. "mysql -V" would tell you the
version you're running on the Linux command line.


Hi Jerry,

thanks for your suggestions, mysql -V reports that I'm running version:

mysql Ver 14.7 Distrib 4.1.11, for redhat-linux-gnu (i386)

so again it's post-v4.1.
I've looked at the servername, user and password and tried all
permutations, but with no success.
The only other thing I can think of is there's some sort of permissions
problem on the files, rather than the database, but I'm just clutching
at straws now. Any help very gratefully received.

Cheers
Dan
Dan,

Hmmm, that's possible, I guess. On Linux 13 is "permission denied".
However, I would think you'd have problems even starting Apache if it
couldn't read the mysql libs.

Do you have anything in the [mysql] section of your php.ini?

Also, looking back through your first message - you indicate you get the
message:

Can't connect to MySQL server on 'SERVER' (13)

But your code puts out the messages:

"Could not connect to database: ".mysql_error() ;
and
"Could not select database: ".mysql_error() ;

Is this actually the case (your message isn't generated by your code),
or did you just mistype the message? Just want to make sure we're going
down the right path :-).

--
=============== ===
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
js*******@attgl obal.net
=============== ===
Jul 25 '06 #6
GD

Jerry Stuckle wrote:
Dan,

Do you have anything in the [mysql] section of your php.ini?

Also, looking back through your first message - you indicate you get the
message:

Can't connect to MySQL server on 'SERVER' (13)

But your code puts out the messages:

"Could not connect to database: ".mysql_error() ;
and
"Could not select database: ".mysql_error() ;

Is this actually the case (your message isn't generated by your code),
or did you just mistype the message? Just want to make sure we're going
down the right path :-).
The actual message is:

Could not connect to database: Can't connect to MySQL server on
'SERVER' (13)

MySQL section of php.ini copied below.

[MySQL]
; Allow or prevent persistent links.
mysql.allow_per sistent = On

; Maximum number of persistent links. -1 means no limit.
mysql.max_persi stent = -1

; Maximum number of links (persistent + non-persistent). -1 means no
limit.
mysql.max_links = -1

; Default port number for mysql_connect() . If unset, mysql_connect()
will use
; the $MYSQL_TCP_PORT or the mysql-tcp entry in /etc/services or the
; compile-time value defined MYSQL_PORT (in that order). Win32 will
only look
; at MYSQL_PORT.
mysql.default_p ort =

; Default socket name for local MySQL connects. If empty, uses the
built-in
; MySQL defaults.
mysql.default_s ocket =

; Default host for mysql_connect() (doesn't apply in safe mode).
mysql.default_h ost =

; Default user for mysql_connect() (doesn't apply in safe mode).
mysql.default_u ser =

; Default password for mysql_connect() (doesn't apply in safe mode).
; Note that this is generally a *bad* idea to store passwords in this
file.
; *Any* user with PHP access can run 'echo
get_cfg_var("my sql.default_pas sword")
; and reveal this password! And of course, any users with read access
to this
; file will be able to reveal the password as well.
mysql.default_p assword =

; Maximum time (in secondes) for connect timeout. -1 means no limit
mysql.connect_t imeout = 60

; Trace mode. When trace_mode is active (=On), warnings for table/index
scans and
; SQL-Errors will be displayed.
mysql.trace_mod e = Off

Thanks for your help!
Dan

Jul 25 '06 #7

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

Similar topics

1
17010
by: Justin | last post by:
Hi, I am continualy receiving the following type of error in my browser from programs using php/mysql Warning: mysql_connect(): Can't create a new thread (errno 11). If you are not out of available memory, you can consult the manual for a possible OS-dependent bug in /home/httpd/vhosts/netvantage.com.au/httpdocs/cacti/lib/adodb/drivers/adodb-mysql.inc.php on line 318
0
2064
by: W i l l | last post by:
I have Apache 2 parsing and serving PHP files just fine on my winXP box, however, when I try to add some mysql database functionality I get a warning that looks like this: Fatal error: Call to undefined function mysql_connect() in D:\SITES\mysql.php on line 3 I am able to connect to mysql via the terminal just fine. Due to the error "undefined function" I wonder if I set PHP up wrong or something. Any ideas?
6
4693
by: Allen Guan | last post by:
Hello all, I am running MYSQL 4.1.17, PHP 4.3.9 under apache 2.0.52 on solaris. PHP seems to work fine, except that it can't connect to mysql database. I got this error: Warning: mysql_connect(): Client does not support authentication protocol requested by server; consider upgrading MySQL client
8
1490
by: Brett | last post by:
I'm developing with CF 5 and SQL Server 2000. I think they are both great products. The major draw is their cost. I don't develop stand alone products because anyone that wants to purchase them must also purchase CF Server and SQL Server. So I run them as a hosted service. MySQL is supposed to be free. If you are using this product, how do you like it? What are you using for a front end? I'd like to move toward developing software that...
0
1690
by: Justin | last post by:
Hi, I am continualy receiving the following type of error in my browser from programs using php/mysql Warning: mysql_connect(): Can't create a new thread (errno 11). If you are not out of available memory, you can consult the manual for a possible OS-dependent bug in /home/httpd/vhosts/netvantage.com.au/httpdocs/cacti/lib/adodb/drivers/adodb-mysql.inc.php on line 318
19
8098
by: Michael | last post by:
Hi, I'm trying to do something which should be very simple - connect to the MySQL database. Here is the call, followed by the error msg. $conn = mysql_connect("localhost", "root", ""); Warning: mysql_connect(): Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (13) in /var/www/html/buildhw.php on line 13
14
2117
by: farhan | last post by:
Hi, Please divert me if this is not the right group to be posting this question. I am a Linux client trying to connect to a mysql windows server via php, upon hitting the mysql_connect line in my php script, it simply stops executing. In other words anything or'ed with it, like echo does not end up in the html source. I'm not entirely sure on the inner workings of php scripting so I can't explain why echo commands
5
4376
by: cglobal25 | last post by:
Here is the output from phpinfo() on my laptop running windows vista. As you can see mysql is mentioned several times in the output. I'm not sure why i get this error. Php scripts that i save in the htdocs folder seem to work as long as mysql is not called. Any ideas? Thanks System Windows NT ELMEU 6.0 build 6001 Build Date May 2 2008 18:01:20 Configure Command cscript /nologo configure.js "--enable-snapshot-
8
8251
by: Kjell Pettersen | last post by:
Hello! I have installed PHP and MySql 5.0 on Win XP. Database created ok. Installation ok. PHP scripts runs ok. But when I am trying some mysql calls in the script I get an "Error 500" from explorer. // Connect to the database server echo ('Trying to connect to db');
0
8234
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
1
8335
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8474
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
5563
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4079
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4174
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2605
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1784
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1482
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.