doudu9652 2017-06-19 22:51
浏览 73
已采纳

使用XAMPP 1.6.2附带的PHP独立MySQL安装

I have installed XAMPP 1.6.2 (need this use this specific version) at /opt/lampp in Ubuntu 16.0.4. I have installed Mysql 5.7.18-0ubuntu0.16.04.1 using apt-get. I need to use the installed version of MySQL with PHP that came with XAMPP.

When I try to connect PHP with MySQL (independent installation), I get this error:

Can't connect to local MySQL server through socket '/opt/lampp/var/mysql/mysql.sock'

I am still getting this error after trying the following things:

  1. Replaced all occurrences of '/opt/lampp/var/mysql/mysql.sock' with '/var/run/mysqld/mysqld.sock' in /opt/lampp directory.
  2. Restarted Apache, MySQL.
  3. Rebooted system.
  4. Searched on Stackoverflow, and tried existing solutions (eg. edit my.cnf)

Please help me out; Thanks.

  • 写回答

1条回答 默认 最新

  • dongshi6528 2017-08-22 01:40
    关注

    I solved this issue simply by replacing localhost with 127.0.0.1 in my.cnf file.
    As Fmashiro pointed out, this could have happened due to missing / corrupted socket file.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
编辑
预览

报告相同问题?

悬赏问题

  • ¥15 PADS Logic 原理图
  • ¥15 PADS Logic 图标
  • ¥15 电脑和power bi环境都是英文如何将日期层次结构转换成英文
  • ¥20 气象站点数据求取中~
  • ¥15 如何获取APP内弹出的网址链接
  • ¥15 wifi 图标不见了 不知道怎么办 上不了网 变成小地球了
手机看
程序员都在用的中文IT技术交流社区

程序员都在用的中文IT技术交流社区

专业的中文 IT 技术社区,与千万技术人共成长

专业的中文 IT 技术社区,与千万技术人共成长

关注【CSDN】视频号,行业资讯、技术分享精彩不断,直播好礼送不停!

关注【CSDN】视频号,行业资讯、技术分享精彩不断,直播好礼送不停!

客服 返回
顶部