原因是没有连接数据库。加上下面代码:

$link = mysql_connect(DB_HOST,DB_USER,DB_PWD);
mysql_select_db(DB_NAME) or die('Could not select database');

业务全部完毕后记得手动关闭连接:

<?php
  mysql_close($link);
?>

PHP使用MySQL报no such file or directory的更多相关文章

  1. ubuntu安装了mysql 但是编译报错 mysql.h: No such file or directory

    在Ubuntu体系中,已经安装了mysql,即应用sudo apt-get install mysql-server mysql-client 但是用C编译mysql数据库时,报错fatal erro ...

  2. Centos 7.5源码编译安装zabbix4.0报fatal error: mysql.h: No such file or directory

    系统环境:CentOS 7.5是最小化安装的 编译信息 编译选项: root@Server01 zabbix-]# ./configure --prefix=/usr/share/applicatio ...

  3. ubuntu系统mysql.h no such file or directory

    在Ubuntu系统中,你已经安装了mysql,即你使用sudo apt-get install mysql-server mysql-client然而使用C语言访问mysql数据库时,却发现出现了如下 ...

  4. fatal error: mysql.h: No such file or directory

    在ubuntu系统下安装mysql之后,和数据库连接的时候,出现如下错误:fatal error: mysql.h: No such file or directory 是因为缺少链接库,执行如下命名 ...

  5. centos7数据库连接使用127.0.0.1报permission denied,使用localhost报No such file or directory

    安装lamp环境后,测试数据库连接. 当host使用127.0.0.1时,报错:(HY000/2002): Permission denied. 把host换成localhost后,又报错:SQLST ...

  6. ClouderaManager中Event Server报No such file or directory

    错误日志如下: 2015-06-24 06:13:10,176 ERROR com.cloudera.cmf.eventcatcher.server.EventCatcherService: Erro ...

  7. centos在线安装mysql报错:file /etc/my.cnf conflicts between attempted installs of mysql-community-server-8.0.16-2.el7.x86_64 and MariaDB-common-10.4.6-1.el7.centos.x86_64

    错误提示:file /etc/my.cnf conflicts between attempted installs of mysql-community-server-8.0.16-2.el7.x8 ...

  8. CentOS 'mysql/mysql.h': No such file or directory

    需要安装mysql-devel # yum install mysql-devel

  9. YCSB报": No such file or directory"异常

    异常信息如下: 文件路径.权限都没有问题. 上网遍寻无果,安装流程与官网一致,开始怀疑是环境问题,后来用别人能用的YCSB复制到本地,却能正常运行. 后来修改了ycsb文件,加了个空格,保存退出,再运 ...

随机推荐

  1. matplotlib学习笔记(四)

    利用matplotlib可以显示图像 imread()和imshow()提供了简单的图像载入和显示功能. img = plt.imread("xxx.jpg") imread()可 ...

  2. java 中 静态泛型方法书写

    public class SpringBean { /** * */ public static <T> T getBean(Class<T> clazz,String nam ...

  3. [转载]jQuery中的html,val,text区别

    在jquery中 text() 返回目标元素所包含的所有文本内容,注意不包含html标签 alert($("#shuru").text()); 1 html() 返回目标元素所包含 ...

  4. Go语言基础之17--Redis基本操作

    一.介绍与连接 1.1 介绍 使用第三方的redis库, github.com/garyburd/redigo/redis github地址:https://github.com/gomodule/r ...

  5. Python 基础学习之if语句

    cars=['audi','xiali','bwm','benz',] ##根据要求bmw全部为大写,其他的首字母为大写 for car in cars: if car=='bmw': print(c ...

  6. tcp发送缓冲区学习

    https://blog.csdn.net/ysu108/article/details/7764461 Nginx 模块开发书上有内容   陶辉博客也可以

  7. Python + Selenium 练习篇 - 获取页面所有邮箱

    代码如下: # coding=utf-8import re    #python中利用正则,需要导入re模块from selenium import webdriverdriver = webdriv ...

  8. 使用Dockerfile docker tomcat部署

    在百度上试很多文章都不行,只有这篇可以. 宿主机为:centos64位 //安装docker 1:yum install docker //启动docker 2:systemctl start  do ...

  9. windows当代理服务器-CCProx的使用

    参考 https://jingyan.baidu.com/article/0f5fb099ef3a2c6d8234ea75.html 在ubuntu下设置网络代理,选择手动方式

  10. Murano Weekly Meeting 2016.06.07

    Meeting time: 2016.June.7 1:00~2:00 Chairperson:  Kirill Zaitsev, from Mirantis Meeting summary: 1.A ...