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

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

问题描述

我收到以下错误:

Database connection fialed: 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

我使用php 5.3.8和mysql 5.5.16在我的本地机器和我的主机(media temple)运行php 5.3 mysql 5.0.51a。

I using php 5.3.8 and mysql 5.5.16 on my local machine and my host (media temple) is running php 5.3 mysql 5.0.51a. The version on the live server is older than the one on my machine.

如何修复此错误并从本地计算机连接到MySQL?

How do I fix this error and connect to MySQL from my local machine?

我知道有这个类似的帖子,但我已经尝试过,没有人在工作。

I know there are similar posts to this one but I have tried them all and none are working.

推荐答案


  • 删除或注释my.cnf中的old_passwords = 1

  • 重新启动MySQL。如果你不这样做,MySQL将继续使用旧的密码格式,这意味着你不能使用内置的PASSWORD()哈希函数来升级密码。

    Restart MySQL. If you don’t, MySQL will keep using the old password format, which will mean that you cannot upgrade the passwords using the builtin PASSWORD() hashing function.

    旧密码散列值为16个字符,新密码散列值为41个字符。

    The old password hashes are 16 characters, the new ones are 41 characters.


    • 连接到数据库,并运行以下查询:

    • Connect to the database, and run the following query:

    SELECT用户,长度(密码 )FROM mysql 用户;

    SELECT user, Length(Password) FROM mysql.user;

    这将显示哪些密码是旧格式,例如:

    This will show you which passwords are in the old format, ex:

    
    +----------+--------------------+
    | user     | Length(`Password`) |
    +----------+--------------------+
    | root     |                 41 |
    | root     |                 16 |
    | user2    |                 16 |
    | user2    |                 16 |
    +----------+--------------------+

    请注意,每个用户可以有多行(每个不同的主机规范一个)。

    Notice here that each user can have multiple rows (one for each different host specification).

    要更新每个用户的密码,请运行以下命令:

    To update the password for each user, run the following:

    UPDATE mysql.user SET Password = PASSWORD('password') WHERE user = 'username';
    

    最后,刷新权限:

    FLUSH PRIVILEGES;
    

    Source

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

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