Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > PHP/MySQL > MySQL
Password Reminder
| FAQ | Members List | Search | Today's Posts | Mark Forums Read
MySQL General discussion about the MySQL database.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the MySQL section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old November 16th, 2006, 09:44 PM
Authorized User
Join Date: Oct 2006
Location: Jakarta, , Indonesia.
Posts: 16
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via Yahoo to Nicholsen
Default Connect php to mysql

I want to connect to database from PHP to MySQL.
MySQL version is 4.1
If I compile the php code below:

$link_id = mysql_connect("localhost", "phpuser", "phppass");
$result = mysql_list_dbs($link_id);
$num_rows = mysql_num_rows($result);

while($db_data = mysql_fetch_row($result)) {
        echo $db_data[0]. "<BR>";
        $result2 = mysql_list_tables($db_data[0]);
        $num_rows2 = mysql_num_rows($result2);
        while($table_data = mysql_fetch_row($result2)) echo "--" . $table_data[0]. "<BR>";
        echo "==> $num_rows2 table(s) in " . $db_data[0] . "<P>";

The error occurred:
Warning: mysql_connect(): Client does not support authentication protocol requested by server; consider upgrading MySQL client in c:\inetpub\wwwroot\ch11\list_db.php on line 4

Warning: mysql_list_dbs(): supplied argument is not a valid MySQL-Link resource in c:\inetpub\wwwroot\ch11\list_db.php on line 5

Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in c:\inetpub\wwwroot\ch11\list_db.php on line 6

Warning: mysql_fetch_row(): supplied argument is not a valid MySQL result resource in c:\inetpub\wwwroot\ch11\list_db.php on line 8

What’s the problem! Is there any configuration on mysql after I install it! And How can I connent PHP to Microsoft SQL Server and Microsoft Access!
Can somebody give me the solution. Thank You

Reply With Quote
  #2 (permalink)  
Old December 3rd, 2006, 02:34 AM
Registered User
Join Date: Dec 2006
Location: , , .
Posts: 7
Thanks: 0
Thanked 0 Times in 0 Posts

What version of PHP have you installed? You might consider PHP5 if using MySQL 4.1, or note that PHP4 (while it works) is considered an old client to MySQL 4.1 and above - see the following regarding a change in MySQL 4.1 for passwords: http://dev.mysql.com/doc/refman/5.0/en/old-client.html. You can resolve the "old client" issue be following the instructions outlines.

I'm assuming you're environment is Windows (and I'm comparing to my 5.1.6 PHP install) - to connect to MS-SQL, uncomment the line "extension=php_mssql.dll" in php.ini and restart IIS.

Regarding MS Access - I think there may be fancier ways, but the short and easy answer is to connect over ODBC. Here's an article that might help: http://www.phpfreaks.com/tutorials/61/0.php

Reply With Quote

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
connect to mysql db from php 5 crmpicco PHP Databases 1 September 26th, 2007 05:14 PM
unable to connect PHP with Mysql bhavna MySQL 1 June 5th, 2007 07:52 PM
php connect to mySql parrot face PHP Databases 3 March 20th, 2007 03:42 AM
Connect php to mysql using dreamweaver Nicholsen MySQL 1 December 14th, 2006 07:26 AM
php connect to mysql p2ptolu Beginning PHP 2 February 24th, 2005 10:43 AM

All times are GMT -4. The time now is 07:59 PM.

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.