doufu4333 2014-04-12 07:53
浏览 51
已采纳

在OS X Mavericks上需要127.0.0.1的PHP / mysql

On Mac OS X 10.6, I am able to connect to mysql in php with

$mysql = mysql_connect(localhost,user,password)

However, if I use the same in Mac OS X 10.9 (Mavericks), I get the error message:

Warning: mysql_connect(): No such file or directory

if I use $mysql = mysql_connect("127.0.0.1",user,password), it works OK, but I'd rather not make the change everywhere.

I've read on this site that there is a socket issue, but I already have this in php.ini.default: pdo_mysql.default_socket=/tmp/mysql.sock

Any idea on how to make mysql_connect(localhost,user,password) work on 10.9 ?

  • 写回答

3条回答 默认 最新

查看更多回答(2条)

报告相同问题?

悬赏问题

  • ¥30 截图中的mathematics程序转换成matlab
  • ¥15 动力学代码报错,维度不匹配
  • ¥15 Power query添加列问题
  • ¥50 Kubernetes&Fission&Eleasticsearch
  • ¥15 有没有帮写代码做实验仿真的
  • ¥15 報錯:Person is not mapped,如何解決?
  • ¥15 c++头文件不能识别CDialog
  • ¥15 Excel发现不可读取的内容
  • ¥15 关于#stm32#的问题:CANOpen的PDO同步传输问题
  • ¥20 yolov5自定义Prune报错,如何解决?