mysqlnd无法使用旧的不安全身份验证连接到MySQL 4.1+ [英] mysqlnd cannot connect to MySQL 4.1+ using the old insecure authentication

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

问题描述

我在从PHP 5.3.5(WAMP安装)连接到MySQL 5.5.8时遇到问题.我收到以下错误:

I'm having issues with connecting to MySQL 5.5.8 from PHP 5.3.5 (WAMP install). I'm getting the error below:

mysqlnd cannot connect to MySQL 4.1+ using the old insecure authentication. 
Please use an administration tool to reset your password with the command 
SET PASSWORD = PASSWORD('your_existing_password'). This will store a new, and 
more secure, hash value in mysql.user. If this user is used in other scripts 
executed by PHP 5.2 or earlier you might need to remove the old-passwords flag 
from your my.cnf file

我尝试了所有可以在网上找到的建议,包括Stack Overflow的一些建议,以及以下建议:

I've tried every suggestion I could find on the web, including several from Stack Overflow and this one: http://engin.bzzzt.biz/2010/11/12/php-mysql-insecure-authentication/

我已经检查了设置,并且旧密码标志已关闭.我已经将密码更新为新的密码哈希,并在用户表和已刷新的特权中验证了哈希为41个字符.由于某些原因,我仍然会收到错误消息.有人有什么想法吗?

I've checked my settings and the old-passwords flag is off. I've updated my password to the new password hash and verified that the hash is 41 chars in the users table and flushed privileges. For some reason, I'm still getting the error. Anyone have any ideas?

更新:我正在使用ZenCart.这是建立连接并引发错误的行:

Update: I'm using ZenCart. This is the line where my connection is being made and where the error is being thrown:

$this->link = @mysql_connect($zf_host, $zf_user, $zf_password, true) or die (mysql_error());

推荐答案

想通了!我的疏忽大意.显然,在ZenCart中,必须设置2个文件来设置数据库配置.一种用于目录,一种用于管理区域.对我来说,这没有多大意义,因为它们都连接到同一数据库.出于安全原因,也许与可以使用一个db用户作为目录用户和一个db用户有关.我只是设置了一个本地副本并更改了一个配置文件,而没有更改另一个.导致问题的文件仍指向我的生产数据库.知道它必须很简单!

Figured it out! Was an oversight on my part. Apparently, in ZenCart there are 2 files where you have to set your database configuration. One is for the catalog and one for the admin area. Doesn't make a whole lot of sense to me since both of them connect to the same DB. Maybe it has something to do with being able to use one db user for the catalog and one for the admin for security reasons. I just setup a local copy and changed one of the config files without changing the other. The file causing the problems was still pointed at my production database. Knew it had to be something simple!

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

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