PHP and MySQL cannot connect, the error is as follows:
Warning:mysql_connect () [Function.mysql-connect]: Client does not support authentication protocol requested by server; Consider upgrading MySQL client
In D:\XXXX\XXXX\apache-tomcat-8.0.5\webapps\Project\opendb.php on line 5
Could not connect:client does not the support authentication protocol requested by server; Consider upgrading MySQL client
The PHP version is php-4.4.9
The version of MYSLQ is 5.6
The version of Tomcat is 8.0.5
Want to build a PHP development environment (tomcat+mysql+php) locally.
Right now
1, Tomcat and PHP have been transferred, on the page can see phpinfo.
2, Tomcat and MySQL also transferred, with JSP page can query MySQL table information.
Note: The solution found on the Internet is not working. The following method has been tried, or the same error message.
----------------------------------------------------------------------------------------------------
The main is to change the encryption of the connection to the MySQL account, MySQL 4.1/5.0 is encrypted by PASSWORD this way. This can be resolved in two ways:
1) mysql->set PASSWORD for ' some_user ' @ ' some_host ' =old_password (' new_password ');
Mysql->flush privileges;
2) mysql->update mysql.user SET password=old_password (' New_password ') WHERE host= ' some_host ' and user= ' some_user ';
Mysql->flush privileges;
----------------------------------------------------------------------------------------------------
Reply to discussion (solution)
Is your MySQL installed on your own?
Tomcat, PHP, and MySQL are all installed on their own
Is your MySQL installed on your own?
Tomcat, PHP, and MySQL are all installed on their own
Background
Starting with PHP 5.3, PHP's MySQL operation only uses the built-in MySQL client
Obviously this client version is less than 5.6, but does not affect the use of
Reason
When you install MySQL, the installation program appends the MySQL installation path to the operating system environment variable path
This is the source of the unreachable
Remedy
So you need to remove the MySQL path from path
However, JDBC may not be able to connect to MySQL and may need to be reconfigured
Background
Starting with PHP 5.3, PHP's MySQL operation only uses the built-in MySQL client
Obviously this client version is less than 5.6, but does not affect the use of
Reason
When you install MySQL, the installation program appends the MySQL installation path to the operating system environment variable path
This is the source of the unreachable
Remedy
So you need to remove the MySQL path from path
However, JDBC may not be able to connect to MySQL and may need to be reconfigured
Thank you very much for your reply.
First of all, I'm using PHP 4.4.9, not 5.3 or later.
Second, there is no path to MySQL in path.
Background
Starting with PHP 5.3, PHP's MySQL operation only uses the built-in MySQL client
Obviously this client version is less than 5.6, but does not affect the use of
Reason
When you install MySQL, the installation program appends the MySQL installation path to the operating system environment variable path
This is the source of the unreachable
Remedy
So you need to remove the MySQL path from path
However, JDBC may not be able to connect to MySQL and may need to be reconfigured
There is another question, do not know whether it is related.
In my use: Mysql->set PASSWORD for ' some_user ' @ ' some_host ' =old_password (' new_password ');
Change password when prompted: ERROR 1372 (HY000): Password hash should be a 41-digit hexadecimal number
When changed to Mysql->set PASSWORD for ' some_user ' @ ' some_host ' =old_password ('), the time will be successful.
※ and the password is empty.
But I can change the password by mysqladmin-u root-p password, and JDBC can access it when the password is empty and not empty.
The problem is still unresolved, but I've been able to configure it by other means.
Install the mysql4.1 after uninstalling the mysql5.6. There's no such thing as a mistake.
But there is a new problem, in the PHP page I wrote the user is a, but the error indicates that b@localhost (b is my local user name) can not access MySQL.
Later, a user of B was added to the MySQL users table.
It's finally done.
or thanks to the moderator timely reply.