0

我刚刚将我的开发盒的 PHP 升级到了最新版本,5.4.5. 这台开发机器连接到远程MySQL 服务器,驻留在我从托管公司租用的共享服务器上。

尝试使用简单的方法连接到我的远程 MySQL 服务器mysql_connect('myserver.com', 'user', 'password')会导致以下错误:

警告:mysql_connect():mysqlnd 无法使用旧的不安全身份验证连接到 MySQL 4.1+。请使用管理工具通过命令 SET PASSWORD = PASSWORD('your_existing_password') 重置密码。这将在 mysql.user 中存储一个新的、更安全的哈希值。如果此用户在 PHP 5.2 或更早版本执行的其他脚本中使用,您可能需要从第 2 行 file.php 中的 my.cnf 文件中删除 old-passwords 标志

就像建议的那样,只需执行:

SET PASSWORD = PASSWORD('my-password');

不会改变任何东西。执行时同样适用

SET SESSION old_passwords=FALSE;

经过一番搜索,我意识到我需要对 MySQL 服务器进行相当深入的访问才能解决这个问题,而我没有。尝试执行此查询:

UPDATE mysql.user SET Password=PASSWORD('my-password')
  WHERE User='my_user' AND Host='my-server';
FLUSH PRIVILEGES;

简单地给我以下错误:

1142 - UPDATE command denied to user 'u0112918'@'www10.aname.net' for table 'user'

Requests to have the company execute the query for me has, so far, been unsuccessfull. So my question is if there's any way to fix this on the client side, without involving the MySQL server?

4

1 回答 1

1

Hm, try executing the following query through a tool other then PhpMyAdmin, such as Mysql Workbench or through a shell:

SET SESSION old_passwords=0; 
SET PASSWORD = PASSWORD('passwordString');

You should be allowed to change your own password without DML Rights on user-table.

Edit: since it did not resolve the issue - when "read_only" is enabled for the database then you need super rights to change (even your own) password ( http://dev.mysql.com/doc/refman/5.5/en/set-password.html )

于 2012-08-02T15:23:28.747 回答