• 欢迎访问搞代码网站,推荐使用最新版火狐浏览器和Chrome浏览器访问本网站!
  • 如果您觉得本站非常有看点,那么赶紧使用Ctrl+D 收藏搞代码吧

请问windows下用Navicat能连,用PHP无法连接远程mysql的有关问题!

php 搞代码 4年前 (2022-01-23) 17次浏览 已收录 0个评论

请教windows下用Navicat能连,用PHP无法连接远程mysql的问题!急!!!

PHP@本文来源gaodaimacom搞#代%码@网-搞代gaodaima码 code

<!---ecms Code highlighting produced by Actipro CodeHighlighter (freeware)http://www.CodeHighlighter.com/-->$user="user_test";$pass="12345";$server="172.17.1.15";$port="3306";$con=mysql_connect($server,$user,$pass);

PHP版本是 5.3 Mysql版本是 5.077 使用IIS7

显示的是如下错误:
Warning: mysql_connect(): Premature end of data (mysqlnd_wireprotocol.c:554) in D:\WwwRoot\AutoDial\mysql_connect_test.php on line 7 Warning: mysql_connect(): OK packet 1 bytes shorter than expected in D:\WwwRoot\AutoDial\mysql_connect_test.php on line 7 Warning: 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

奇怪的是,使用 navicat可以连接到mysql,但使用代码不行,想请问下该如何解决啊?!谢谢各位了!

——解决方案——————–
自mysql 4.1开始,不能再用明码的password连接mysql,你上面至少涉及这个问题


搞代码网(gaodaima.com)提供的所有资源部分来自互联网,如果有侵犯您的版权或其他权益,请说明详细缘由并提供版权或权益证明然后发送到邮箱[email protected],我们会在看到邮件的第一时间内为您处理,或直接联系QQ:872152909。本网站采用BY-NC-SA协议进行授权
转载请注明原文链接:请问windows下用Navicat能连,用PHP无法连接远程mysql的有关问题!
喜欢 (0)
[搞代码]
分享 (0)
发表我的评论
取消评论

表情 贴图 加粗 删除线 居中 斜体 签到

Hi,您需要填写昵称和邮箱!

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址