无法使用 PDO 连接到 MySQL 服务器
本文介绍了无法使用 PDO 连接到 MySQL 服务器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有一个用于连接 MySQL 数据库的 PHP 脚本.通过 mysql_connect 进行的连接可以完美运行,但是在尝试使用 PDO 时出现以下错误:
I have a PHP script which I use to connect to a MySQL database. Connection through mysql_connect works perfectly, but when trying with PDO I get the following error:
我用来连接的代码如下:
the code I use to connect is below:
提前致谢
推荐答案
遇到了同样的问题.我的解决方案是另一个数据库端口.我写了 localhost:1234 得到了这个错误.
Got the same problem. Mine solution was another database port. I wrote localhost:1234 and got this error.
固定为:
这篇关于无法使用 PDO 连接到 MySQL 服务器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!