无法使用旧身份验证连接到MySQL 4.1+ [英] Cannot connect to MySQL 4.1+ using old authentication

查看:1208
本文介绍了无法使用旧身份验证连接到MySQL 4.1+的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我尝试在 http://bluesql.net 连接到mySQL数据库,但当我尝试连接错误:

I'm trying to connect to a mySQL database at http://bluesql.net, but when I try to connect, it gives this error:

Connect Error (2000) mysqlnd cannot connect to MySQL 4.1+ using old authentication

我研究过这个,它与MySQL 4.1之前使用的旧密码方案有关。较新的版本可以选择使用旧密码,我已阅读可能会导致此问题。

I've looked into this, and it has to do with some old password scheme used before MySQL 4.1. Newer versions have the option to use old passwords, which I've read may cause this problem.

我运行php 5.3,并与mySQLi(新mysqli(...))连接。我希望我可以做一些代码连接到数据库bluesql.net - 显然我不控制他们的数据库如何设置。降级php版本不是一个选项。

I'm running php 5.3, and connecting with mySQLi (new mysqli(...)). I'm hoping I can do something in the code to connect to the DB at bluesql.net - clearly I don't control how their database is set up. Downgrading php versions isn't an option.

任何人都有什么想法?

推荐答案

edit:这仅适用于您控制MySQL服务器的情况...如果您不了解 Mysql密码散列方法old vs new

edit: This only applies if you are in control of the MySQL server... if you're not take a look at Mysql password hashing method old vs new

首先使用SQL查询检查

First check with the SQL query

SHOW VARIABLES LIKE 'old_passwords'

(在MySQL命令行客户端, a href =http://www.heidisql.com/ =nofollow noreferrer> HeidiSQL 或任何您喜欢的前端)服务器是否设置为默认使用旧密码模式。如果这返回old_passwords,你只是碰巧在 users 表中有旧密码条目。 MySQL将对这些帐户使用旧的身份验证程序。但是你可以简单地为该帐户设置一个新的密码,并使用新的例程。

你可以通过查看 mysql.users 表(具有可访问该表的帐户)

(in the MySQL command line client, HeidiSQL or whatever frontend you like) whether the server is set to use the old password schema by default. If this returns old_passwords,Off you just happen to have old password entries in the users tables. The MySQL will use the old authentication routine for these accounts. But you can simply set a new password for the account and the new routine will be used.
You can check which routine will be used by taking a look at the mysql.users table (with an account that has access to that table)

SELECT `User`, `Host`, Length(`Password`) FROM mysql.user

41对于具有新密码的帐户(对于没有密码的帐户,则为0,您也可以考虑使用这些密码)。

使用MySQL前端的用户管理工具(如果有是任何)或

This will return 16 for accounts with old passwords and 41 for accounts with new passwords (and 0 for accounts with no password at all, you might want to take care of those as well).
Either use the user managements tools of the MySQL front end (if there are any) or

SET PASSWORD FOR 'User'@'Host'=PASSWORD('yourpassword');
FLUSH Privileges

(用您从上一个查询中获得的值替换User和Host )。然后再次检查密码的长度。现在应该是41,而mysqlnd应该能够连接到服务器。

(replace User and Host with the values you' got from the previous query). Then check the length of the password again. It should be 41 now and mysqlnd should be able to connect to the server.

另请参见: http://dev.mysql.com/doc/refman/5.0/en/old-client.html

http://dev.mysql.com/ doc / refman / 5.0 / en / password-hashing.html

http://dev.mysql.com/doc/refman/5.0/en/set-password.html

这篇关于无法使用旧身份验证连接到MySQL 4.1+的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆