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

查看:211
本文介绍了无法连接到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(...))。我希望我可以在code做些什么来连接到数据库在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.

任何人有什么想法?

推荐答案

编辑:这只是如果你是在MySQL服务器的控制权......如果你不来看看的Mysql密码散列法老VS新

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查询

SHOW VARIABLES LIKE 'old_passwords'

(在MySQL命令行客户端, HeidiSQL 或任何前端你喜欢)服务器是否被设置为使用旧密码模式默认。如果返回old_passwords,关你恰好有在用户表旧密码输入。在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

这将(不带密码的帐户和0可言,你可能要照顾的那些一样)返回16与旧密码的帐户和41与新密码的帐户。结果
既可以使用的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

(使用从previous查询得到的值替换用户和主机)。然后再检查密码的长度。它应该是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.

又见:<一href=\"http://dev.mysql.com/doc/refman/5.0/en/old-client.html\">http://dev.mysql.com/doc/refman/5.0/en/old-client.html

<一href=\"http://dev.mysql.com/doc/refman/5.0/en/password-hashing.html\">http://dev.mysql.com/doc/refman/5.0/en/password-hashing.html

<一href=\"http://dev.mysql.com/doc/refman/5.0/en/set-password.html\">http://dev.mysql.com/doc/refman/5.0/en/set-password.html

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

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