Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Problem with connecting to MySQL through PHP code

Status
Not open for further replies.

WebBoyo

MIS
Jul 23, 2005
13
YU
Hi! I'm running PHP 4.4.0, MySQL Server 4.1 and Apache 2.0.54 on Windows XP and everything works just fine except accessing to MySQL through PHP code.
After "mysql_connect("host", "user", "password")" lines I get "Warning: mysql_connect(): Client does not support authentication protocol requested by server; consider upgrading MySQL client in C:\..." (I used correct host name, user name and password).
When I tryed to connect to the server through "Command Prompt" with: "mysql -u user_name -password ", or with "MySQL Command Line Client" by inserting the password- I get connected. In MySQL manual I have found that this symptom indicates that I have problem with program, not with access privileges.
Can anyone help me to solve this problem with program?
 
It's the fact that you're running MySQL version 4.1.3 or newer.

The communication protocol has changed, so the old communications libraries don't work with the newer versions of MySQL. Also, I don't think the old mysql_* family of functions works with the new libraries.

You're probably going to have to activate the Improved MySQL family of functions and use that.


Want the best answers? Ask the best questions!

TANSTAAFL!!
 
Hi: In order to get php_mysqli.dll extension file I have replaced PHP 4.4.0 with PHP 5.0.4.
Again everything is working fine except "mysql_connect()". This time I get mesage:
"Fatal error: Call to undefined function mysql_connect() in C:\...".
Can You help?
 
In my previous post, I provided a link to the Improved MySQL family of functions. The PHP online manual chapter to which I provided a link states in its first paragraph:

The mysqli extension allows you to access the functionality provided by MySQL 4.1 and above.


The Improved MySQL family of functions is a completely new set of functions, completely different from the original mysql_* family of functions. The notably immediate difference between members of the two function families is that the old family's functions begin with "mysql_" and the new functions begin with "mysql[red]i[/red]_". The way the members of this new function family take parameters is also different, so I strongly recommend you read the Improved MySQL function family online documentation.


Want the best answers? Ask the best questions!

TANSTAAFL!!
 
To SLEIPNR214:
Thank you for your effort to help me. When you mentioned that problem lies in mysqli, I tryed different combinations of MySQL and PHP versions. At last I instaled MySQL 3.23 and PHP 4.4.1 and "mysql_connect" is WORKING!
 
As a general rule, it is better to tailor your code to your environment than it is to keep reinstalling stuff. This is particularly true of PHP's MySQL families of functions, as eventually PHP will only support the new family as the older versions of MySQL that use the old libraries go by the wayside.

You were probably better off with PHP 5, as it is the route PHP will take in future development.


Want the best answers? Ask the best questions!

TANSTAAFL!!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top