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

$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. CodeForces - 593A -2Char(思维+暴力枚举)

    Andrew often reads articles in his favorite magazine 2Char. The main feature of these articles is th ...

  2. A. The number of positions

    A. The number of positions time limit per test 0.5 second memory limit per test 256 megabytes input ...

  3. 简单的Web日志分析脚本

    前言 长话短说,事情的起因是这样的,由于工作原因需要分析网站日志,服务器是windows,iis日志,在网上找了找,github找了找,居然没找到,看来只有自己动手丰衣足食. 那么分析方法我大致可分为 ...

  4. js Form表单转json格式,及后台接收(多种方法)

    转载:https://blog.csdn.net/qq_40138785/article/details/81533015 一.serialize()方法格式:var data = $("# ...

  5. idea(1)-idea初装

    1.安装插件 Alibaba Java Coding Guidelines Free Mybatis plugin MyBatis Log Plugin Lombok pluginGsonFormat ...

  6. OpenCV属性页配置问题~

    详细的OpenCV属性页的安装流程,参考这个网站:http://m.bubuko.com/infodetail-793518.html 运行例子时候,如果遇到这个问题,可能配置环境时候出现问题了. 此 ...

  7. canvas基础入门(一)canvas的width、height于css样式中的宽高区别

    canvas的width.height于css样式中的宽高对画布的内容显示是有所区别的 1.在canvas标签下调用他的width和height,而且是没有单位的宽高,这种指定canvas大小的方法也 ...

  8. vue.js入门环境搭建

    1.node.js环境(npm包管理器) 2.vue-cli手脚架构建工具 3.cnpm npm的淘宝镜像 安装node.js 从node.js官网下载并安装node,安装过程一路“下一步”就可以 安 ...

  9. 10-----BBS论坛

    BBS论坛(十) 10.1.客户端权限验证功能完成 (1)cms/cms_profile 显示当前用户的角色和权限 <tr> <td>角色:</td> <td ...

  10. Subarray Sum K

    Given an nonnegative integer array, find a subarray where the sum of numbers is k. Your code should ...