Web Hosting Talk







View Full Version : PHP + MySQL


kaini
12-28-2004, 02:51 PM
When I use this code:
<?php
$user="root";
$password="********";
$database="employees";
mysql_connect("24.65.102.80",$user,$password);
@mysql_select_db($database) or die("Unable to select database");
$query="CREATE TABLE contacts (id int(6) NOT NULL auto_increment, first varchar(15) NOT NULL, last varchar(15) NOT NULL, phone varchar(20) NOT NULL, mobile varchar(20) NOT NULL, fax varchar(20) NOT NULL, email varchar(30) NOT NULL, web varchar(30) NOT NULL, PRIMARY KEY (id), UNIQUE id(id), KEY id_2(id))";
mysql_query($query);
mysql_close();
?>
the browser tellls me this:
Warning: mysql_connect(): Client does not support authentication protocol requested by server; consider upgrading MySQL client in C:\Program Files\Apache Group\Apache2\mybin\employees.php on line 5
Unable to select database.

Does anyone know how to solve this problem?
Does anyone know a better version of MySQL other than 4.1 and just command prompt, like more visual MySQL?

Redex
12-28-2004, 03:16 PM
kaini:

It seems that you've got some kind of issues with your connection... you mention that this happens on this script... does it happens with others?

Also I noticed that you use:
mysql_connect("24.65.102.80",$user,$password);
If you're using mysql on a local server you should use "localhost" or "127.0.0.1".

php + mysql works best on a Unix type OS like Linux or others.

All the best

kaini
12-28-2004, 05:01 PM
Is Windows Business server a type of Unix? Maybe not?

Hydrogen
12-28-2004, 05:06 PM
MySQL 4.1.x uses an authentication procedure that the standard php library does not support.
Use MySQL 4.0.x -or- install the improved mysql php extension ( http://www.php.net/manual/en/ref.mysqli.php )

sonicgroup
12-28-2004, 05:52 PM
Alternately, if you have access to the MySQL configuration file (my.cnf), you can change/add one of the environment variables in there to force the new server (4.1+) to use the older authentication (passwords) of 4.0.x and lower. See the MySQL manual for the exact procedure.