aloebys
aloebys

Reputation: 123

my server can't connect to mysql

I have server x that for gameserver. and I have mysql5.5. when I connect server to db i got this message

Client does not support authentication protocol requested by server; consider upgrading MySQL client

my.ini is set old_passwords=1

mysql> SHOW VARIABLES like 'old_passwords';
+---------------+-------+
| Variable_name | Value |
+---------------+-------+
| old_passwords | 1     |
+---------------+-------+
1 row in set

and when i try to use mysql 4.0.27-nt-max it can be connect successfully. but i can't use php to connect db mysql 4.0.27-nt-max

Upvotes: 1

Views: 279

Answers (2)

R.K123
R.K123

Reputation: 159

To deal with this problem, the preferred solution is to upgrade all client programs to use a 4.1.1 or higher client library. If that is not possible, use one of the following approaches:

To connect 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('new_password');

Substitute the password you want to use for “new_password” in the preceding example. 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 by default:

Start mysqld with the old_passwords system variable set to 1.

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 one of the methods described previously.

Upvotes: 0

Bill Karwin
Bill Karwin

Reputation: 562438

If you still have a copy of MySQL 4.0 around, I would guess you also have an ancient version of PHP.

https://support.zend.com/hc/en-us/articles/203838366-mysql-connect-Client-does-not-support-authentication-protocol

Many older PHP builds use the MySQL client API for MySQL 3.23.x. If you use an older PHP build (with the old MySQL API) then you will get the Client does not support authentication protocol error when trying to connect to a MySQL server 4.1.x or above.

The recommended solution is to upgrade your PHP to the latest ...

Upvotes: 1

Related Questions