写了个php脚本单独执行mysql_connect(),发现错误信息居然是“No such file or directory"!

首先确定是mysql_connect()和mysql_pconnect()的问题,故障现象就是函数返回空,而mysql_error()返回"No such file or directory"。
写个phpinfo页面,找到mysql.default_socket、mysqli.default_socket、pdo_mysql.default_socket。
启动mysql,执行命令 STATUS; 记下socket(/tmp/mysql.sock)的值。
则打开php.ini(可以从phpinfo页面中找到php.ini的位置),将2中提到的三个配置项的值改成3的值。
重启apache。

到/tmp/查看,发现没有真没有/tmp/mysql.sock这个文件。

由于mysql 默认的mysql.sock 是在/var/lib/mysql/mysql.sock,创建符号连接:
# ln -s /var/lib/mysql/mysql.sock /tmp/mysql.sock

Mysql_connect报告”No such file or directory”错误的解决方法的更多相关文章

  1. mkdir()提示No such file or directory错误的解决方法

    转自:http://www.02405.com/program/php/1692.html 在php中使用mkdir()方法创建文件夹时报错:No such file or directory,出错代 ...

  2. Linux运行shell脚本提示No such file or directory错误的解决办法

    Linux执行.sh文件,提示No such file or directory的问题: 原因:在windows中写好shell脚本测试正常,但是上传到 Linux 上以脚本方式运行命令时提示No s ...

  3. mininet *** Error: RTNETLINK answers: No such file or directory 问题及解决方法

    一.问题 按照mininet官网中从源码安装步骤进行安装后,运行命令sudo mn --link tc,bw=10,提示说*** Error: RTNETLINK answers: No such f ...

  4. 使用 EasyBCD 安装Ubuntu 14.04 Error 15: file not found错误的解决方法

    今天安装Window7 和 Ubuntu 14.04 双系统时,出现如下异常,记录一下. 安装过程是参考 http://www.linuxidc.com/Linux/2014-04/100369.ht ...

  5. failed to open stream: No such file or directory 报错解决方法

    1.首先检查是否是文件名错误(比如有空格):是否因为路径不完整(比如缺少http://,或者缺少文件扩展名.doc等): 2.若是在本地中文名文件打开报错,我就是因为编码不一致导致: Windows中 ...

  6. #import </usr/include/objc/objc-class.h> not such file or directory问题的解决方法

    近期在使用一些开源的demo,打开后出现这个错误,然后能够把 #import </usr/include/objc/objc-class.h> 改动为以下 #import <objc ...

  7. ubuntu 64bit “arm-linux-gcc: No such file or directory”问题的解决方法

    安装lsb-core sudo apt-get install lsb-core

  8. QMainWindow: No such file or directory 问题的解决方法

    这种问题往往是由于QT4的程序转换到QT5所导致的,在.pro文件中加上一句 greaterThan(QT_MAJOR_VERSION, 4): QT += widgets 就可以解决问题

  9. /etc/rc.d/init.d/iptables: No such file or directory 错误原因

    注:本文转载自cnblogs:一天学点的文章</etc/rc.d/init.d/iptables: No such file or directory 错误原因> RedHat Enter ...

随机推荐

  1. DOM文档对象模型

  2. python-day21--random模块

    >>> import random #随机整数 >>> random.randint(1,5) # 大于等于1且小于等于5之间的整数 >>> ra ...

  3. spring--mvc添加用户及用户头像上传

    spring--mvc添加用户及用户头像上传 添加用户步骤: 1.用ajax获取省份信息 2.添加用户 代码:register.jsp <meta http-equiv="Conten ...

  4. [Vue warn]: Invalid prop: custom validator check failed for prop "xxx".问题

    在用vue+ui框架(iview.elementui等)做项目,会遇到这种问题 这样的,点那都报错,千辛万苦的付出,却找不到问题在哪 其实很简单,报错都显示出那个组件的问题了  ‘<Form&g ...

  5. ubuntu下安装go语言;sublime+gocode搭建;go的卸载和环境变量配个人.bashrc;2空位3个网

    https://blog.csdn.net/needkane/article/details/36891949 https://www.jianshu.com/p/4f79ae4f081c http: ...

  6. Win10取消密码

       

  7. 告别.NET生成报表统计图的烦恼

    告别.NET生成报表统计图的烦恼 标签: 报表.netstatistics图形数据库文档 2009-10-09 12:00 635人阅读 评论(0) 收藏 举报  分类: .net程序设计(C#)(2 ...

  8. Android中aar和jar文件的认识

    在Android开发中,我们总是会引入其他第三方的库或者资源等,有时候是添加一个jar文件,有时候添加一个aar文件,那么这两种类型的文件有什么区别吗?详情请看下文. 一.描述. 1.   *.jar ...

  9. 读书笔记 C# Linq查询之group关键字浅析

    在C#中,自从有了Linq查询表达式后,程序员对可被迭代的序列或列表执行一系列的筛选.排序.过滤.分组.查询等操作.本文章所要讲述的是group关键字. Linq查询表达式,是以from关键字开头,以 ...

  10. ipython与sublime调用其shell出现的问题

    本机电脑 win10 已安装python3.5 1.    直接在命令行运行 pip install ipython[all] 安装 ipython 安装完成后 在命令行输入 jupyter note ...