加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 综合聚焦 > 服务器 > Windows > 正文

Windows 7 PHP MySQL连接问题

发布时间:2020-12-13 22:37:42 所属栏目:Windows 来源:网络整理
导读:参见英文答案 Cannot connect to MySQL 4.1+ using old authentication????????????????????????????????????7个 当我运行$conn = mysql_connect($host,$user,$pass);我能够获得与数据库的连接,但是当我执行var_dump($conn)时,我回到bool(true),这限制了我与
参见英文答案 > Cannot connect to MySQL 4.1+ using old authentication????????????????????????????????????7个
当我运行$conn = mysql_connect($host,$user,$pass);我能够获得与数据库的连接,但是当我执行var_dump($conn)时,我回到bool(true),这限制了我与多个服务器的多个连接.

这台计算机上的原始设置是XAMPP,其PHP版本通过PHP安装程序升级到PHP 5.3.4.它可以毫无问题地连接到其本地数据库(除了返回布尔值而不是资源链接标识符),但无法连接到任何远程计算机(并且已确认连接到远程计算机的能力).在没有能够提出解决方案的情况下,我升级到了内置PHP 5.3.1的XAMPP版本.在重新安装XAMPP之后我得到完全相同的错误,这让我相信这是一个更大的问题.

编辑1 **

转到干净的Windows安装并安装XAMPP并尝试运行mysql_connect到远程服务器(PHP 5.3.1)我得到相同的错误:

Warning: mysql_connect() [function.mysql-connect]: Premature end of data (mysqlnd_wireprotocol.c:554) in [Removed] on line 2

Warning: mysql_connect() [function.mysql-connect]: OK packet 1 bytes shorter than expected in [Removed]p on line 2

Warning: mysql_connect() [function.mysql-connect]: 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 in [Removed] on line 2

解决方法

检查my.cnf文件中的old_passwords选项.

http://dev.mysql.com/doc/refman/5.0/en/server-options.html#option_mysqld_old-passwords

如果由于某种原因您无法切换到新密码,则不能将mysqlnd用作MySQL驱动程序,并且需要切换回较旧的密码.

有关mysqlnd的更多信息

http://dev.mysql.com/downloads/connector/php-mysqlnd/

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读