在文档前面加上:
error_reporting(0);

解决方案 »

  1.   

    Client does not support authentication protocol requested
    by server; consider upgrading MySQL clientTo solve this problem, you should use one of the following approaches: Upgrade all client programs to use a 4.1.1 or newer client library. 
    When connecting to the server with a pre-4.1 client program, use an account that still has a pre-4.1-style password. 
    Reset the password to pre-4.1 style for each user that needs to use a pre-4.1 client program. This can be done using the SET PASSWORD statement and the OLD_PASSWORD() function: mysql> SET PASSWORD FOR
        -> 'some_user'@'some_host' = OLD_PASSWORD('newpwd');Alternatively, use UPDATE and FLUSH PRIVILEGES: mysql> UPDATE mysql.user SET Password = OLD_PASSWORD('newpwd')
        -> WHERE Host = 'some_host' AND User = 'some_user';
    mysql> FLUSH PRIVILEGES;Substitute the password you want to use for ``newpwd'' in the preceding examples. MySQL cannot tell you what the original password was, so you'll need to pick a new one. 
    Tell the server to use the older password hashing algorithm: 
    Start mysqld with the --old-passwords option. 
    Assign an old-format password to each account that has had its password updated to the longer 4.1 format. You can identify these accounts with the following query: mysql> SELECT Host, User, Password FROM mysql.user
        -> WHERE LENGTH(Password) > 16;For each account record displayed by the query, use the Host and User values and assign a password using the OLD_PASSWORD() function and either SET PASSWORD or UPDATE, as described earlier. 
      

  2.   

    我用的PHP5和MYSQL5。03在密码为空的情况下可以连接 ,不空则不能连接,后来我查到,可以用另外的命令,mysqli_connect(),这样就可以了
      

  3.   

    其英文原文为:
    3.3.2 mysqli: Making a Connection
    Under mysqli there are two different ways to connect to MySQL: the familiar mysqli_connect( ) and a new method, mysqli_real_connect( ).Don't feel that mysqli_real_connect( ) is somehow superior to mysqli_connect( ) because it contains the word real. It's not. This name comes simply from the underlying MySQL C API. Besides, mysqli_connect( ) uses the same C functions as mysqli_real_connect( ); it just wraps them in an easy-to-use form.Unfortunately, while mysqli_connect( ) looks similar to mysql_connect( ), it is not identical. For one, it now takes six parameters, all of them still optional:mysqli_connect(hostname, username, password, database, port, socket)
    The first three options—hostname, username, and password—are the same as mysql_connect( ), but the remaining three are different. The database parameter controls which database you want to query. Using this parameter is the same as calling mysql_select_database( ). This function is still available as mysqli_select_database( ), but you should not need to use it unless you are reusing the same connection to switch from one database to another on the same server.The port option controls which port to contact on the database server, and socket specifies which socket to use. This is identical to adding :port or :/path/to/socket after the hostname in mysql_connect( ). (You cannot use this syntax in mysqli.) These two parameters are mutually exclusive. If you use one, there's no purpose in using the other.Here's an example that uses the first five options:mysqli_connect('db.example.org', 'web', 'xyz@123', 'users', 3306);
    也就是说在PHP5中提供了新的连接函数!
    在使用之前,必须在PHP.INI 中extension=php_mysql.dll位置
    下增加extension=php_mysqli.dll,语句,而且php_mysqli.dll
    也要COPY到WINNT或WINDOWS的SYSTEM32目录下。重新启动APACHE
    即可使用新的CONNECT的命令,解决了当设置了用户密码后不能连接的
    问题。希望大家指正!
      

  4.   

    $link = mysql_connect("localhost", "root", "123456");=>$link = mysql_connect("localhost", "", "");应该可以通过。
      

  5.   

    或者修改Mysql的用户密码,可以解决客户端版本低的问题
    mysql>set password for 'user'@'localhost' = old_password('newpassword');