dongzenglin8292
2014-01-30 19:57
浏览 29
已采纳

动态数据PHP错误[重复]

This question already has an answer here:

I'm a inexperienced webmaster for my Boy Scout troop. I have recently set up MAMP on my map and then tried to use MySQL PHP server for dynamic data. When testing locally, everything worked. When I uploaded everything to my web server (for which I only have FTP access) I get this message when I try to access the php page.

Fatal error: Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2) in 

Can anyone tell me what I'm doing wrong?

More info:

  • Mac Pro 1,1 running 10.7
  • Dreamweaver CS6
  • MySQL Server 5.3.3
</div>

图片转代码服务由CSDN问答提供 功能建议

此问题已经存在 这里有一个答案:

  • 无法通过套接字'/var/mysql/mysql.sock'连接到本地MySQL服务器(38) 38 answers

    我是一名没有经验的童子军队长。 我最近在我的地图上设置了MAMP,然后尝试使用MySQL PHP服务器来获取动态数据。 在本地测试时,一切正常。 当我将所有内容上传到我的Web服务器(我只有FTP访问权限)时,当我尝试访问php页面时,我收到此消息。

     致命错误:无法通过套接字'/var/lib/mysql/mysql.sock'(2)连接到本地MySQL服务器
      <  / pre> 
     
     

    谁能告诉我我做错了什么?

    更多信息:

    • Mac Pro 1,1运行10.7
    • Dreamweaver CS6
    • MySQL Server 5.3.3
  • 写回答
  • 好问题 提建议
  • 关注问题
  • 收藏
  • 邀请回答

2条回答 默认 最新

  • dongshenyu4638 2014-02-02 01:49
    已采纳

    I solved this problem. My error was that I didn't have MAMP set up to allow connections from the outside. Google it, there are many good resources out there to help you set it up. After I did that and made sure root access from any IP was enabled, I was good to go. Thanks for everyones help.

    已采纳该答案
    评论
    解决 无用
    打赏 举报
  • dongzhuandian3292 2014-01-30 20:21

    IF you are sure that the server is UP and MySQL is running, the following may be true:

    When MySQL states it is trying to connect through a local socket, this typically means you are using "localhost" as the address for the MySQL server in your PHP code.

    Instead try using the IP Address of the MySQL server.

    If this does not fix the problem, then make sure your mysql user that your code is using has permissions to access the MySQL server from 'localhost'.

    Let me know if you have any questions about any of this.

    评论
    解决 无用
    打赏 举报

相关推荐 更多相似问题