Php and mysql cannot connect to mysql_connect () [function. mysql-connect]: Clientdoesnotsuppor

Source: Internet
Author: User
Tags php development environment
Php and mysql cannot connect to mysql_connect () [function. mysql-connect]: Clientdoesnotsuppor php and mysql cannot be connected. the error message 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 \ apache-tomcat-8.0.5 \ webapps \ Project \ opendb. php on line 5
Cocould not connect: Client does not support authentication protocol requested by server; consider upgrading MySQL client


Php version is php-4.4.9
Myslq version is 5.6
Tomcat version 8.0.5

I want to build a local php development environment (tomcat + mysql + php ).
Now
1. Tomcat and php have been called. you can see phpinfo on the page.
2. tomcat and mysql can also be called. you can use the jsp page to query the table information in mysql.

Note: No solution can be found online. The method below has been tried, and the same error message is returned.
Bytes ----------------------------------------------------------------------------------------------------
The encryption method for connecting to the MySQL account is changed. MySQL 4.1/5.0 is encrypted using PASSWORD. You can solve the problem by using the following two methods:

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;

Bytes ----------------------------------------------------------------------------------------------------


Reply to discussion (solution)

Is your mysql installed by yourself?

Tomcat, php, and mysql are all self-installed.

Is your mysql installed by yourself?



Tomcat, php, and mysql are all self-installed.

Background
Starting from php 5.3, php mysql operations only use the built-in mysql client
Obviously, the client version is lower than 5.6, but it does not affect the use

Cause
When you install mysql, the installer adds the installation PATH of mysql to the PATH of the operating system environment variable.
This is the root cause of access failure.

Remedy
So you need to remove the mysql PATH from the PATH
However, jdbc may be unable to connect to mysql, and you may need to reconfigure it.

Background
Starting from php 5.3, php mysql operations only use the built-in mysql client
Obviously, the client version is lower than 5.6, but it does not affect the use

Cause
When you install mysql, the installer adds the installation PATH of mysql to the PATH of the operating system environment variable.
This is the root cause of access failure.

Remedy
So you need to remove the mysql PATH from the PATH
However, jdbc may be unable to connect to mysql, and you may need to reconfigure it.




Thank you very much for your reply.
First, I use php 4.4.9 instead of version 5.3 or later.
Second, there is no mysql PATH in the PATH.

Background
Starting from php 5.3, php mysql operations only use the built-in mysql client
Obviously, the client version is lower than 5.6, but it does not affect the use

Cause
When you install mysql, the installer adds the installation PATH of mysql to the PATH of the operating system environment variable.
This is the root cause of access failure.

Remedy
So you need to remove the mysql PATH from the PATH
However, jdbc may be unable to connect to mysql, and you may need to reconfigure it.



There is another problem. I don't know if it is related.
In my usage: MySQL-> set password for 'some _ user' @ 'some _ host' = OLD_PASSWORD ('New _ password ');
ERROR 1372 (HY000): Password hash shocould be a 41-digit hexadecimal number
It succeeds when you change to MySQL-> set password for 'some _ user' @ 'some _ host' = OLD_PASSWORD.
※And the password is empty.

However, you can change the password through mysqladmin-u root-p password. jdbc can be accessed when the password is blank or not.

This problem still persists, but I have successfully configured it through other methods.

Uninstall mysql5.6 and install mysql4.1. There is no such error.
However, there is A new problem. on the php page, the user I wrote is A, but the error message says B @ localhost (B is the user name of my local machine) cannot access mysql.
Later, a user B was added to the mysql user table.
Finally.

Thank you for your prompt reply ..

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.