zoukankan      html  css  js  c++  java
  • SQLSTATE[HY000] [2002] 错误

    http://www.thinkphp.cn/topic/36194.html

    使用tp框架 3.2.3 ,在windows上跑的时候没有任何问题,但是部署到linux系统和是哪个,就会报这个错,不知道什么原因,求大神解答
    
    
    :(
    SQLSTATE[HY000] [2002] No such file or directory
    错误位置
    
    FILE: /phpstudy/www/mmm/ThinkPHP/Library/Think/Db/Driver.class.php  LINE: 109
    TRACE
    
    #0 /phpstudy/www/mmm/ThinkPHP/Library/Think/Db/Driver.class.php(109): E('SQLSTATE[HY000]...')
    #1 /phpstudy/www/mmm/ThinkPHP/Library/Think/Db/Driver.class.php(1075): Think\Db\Driver->connect()
    #2 /phpstudy/www/mmm/ThinkPHP/Library/Think/Db/Driver/Mysql.class.php(47): Think\Db\Driver->initConnect(true)
    #3 /phpstudy/www/mmm/ThinkPHP/Library/Think/Model.class.php(138): Think\Db\Driver\Mysql->getFields('inkks_xin')
    #4 /phpstudy/www/mmm/ThinkPHP/Library/Think/Model.class.php(126): Think\Model->flush()
    #5 /phpstudy/www/mmm/ThinkPHP/Library/Think/Model.class.php(1458): Think\Model->_checkTableInfo()
    #6 /phpstudy/www/mmm/ThinkPHP/Library/Think/Model.class.php(101): Think\Model->db(0, '', true)
    #7 /phpstudy/www/mmm/ThinkPHP/Common/functions.php(621): Think\Model->__construct('xin', '', '')
    #8 /phpstudy/www/mmm/appx/Home/Controller/IndexController.class.php(9): M('xin')
    #9 [internal function]: Home\Controller\IndexController->index()
    #10 /phpstudy/www/mmm/ThinkPHP/Library/Think/App.class.php(173): ReflectionMethod->invoke(object(Home\Controller\IndexController))
    #11 /phpstudy/www/mmm/ThinkPHP/Library/Think/App.class.php(110): Think\App::invokeAction(object(Home\Controller\IndexController), 'index')
    #12 /phpstudy/www/mmm/ThinkPHP/Library/Think/App.class.php(204): Think\App::exec()
    #13 /phpstudy/www/mmm/ThinkPHP/Library/Think/Think.class.php(120): Think\App::run()
    #14 /phpstudy/www/mmm/ThinkPHP/ThinkPHP.php(97): Think\Think::start()
    #15 /phpstudy/www/mmm/index.php(7): require('/phpstudy/www/m...')
    #16 {main}
    

     要保证在php.ini和mysql配置文件my.conf 中,关于mysql.sock的路径的定义统一
    php.ini

    pdo_mysql.default_socket=/var/lib/mysql/mysql.sock
    

     my.conf

    socket=/var/lib/mysql/mysql.sock
    

     配置中的 localhost 改成 127.0.0.1 或者其他的 ip再试试?http://www.thinkphp.cn/topic/27457.html

  • 相关阅读:
    解决安装mysql 到start service出现未响应问题
    【日历】自定义(上下月切换)
    html2canvas 无法渲染网络图片及本地 解决方案
    css 弹性盒子--“垂直居中”--兼容写法
    CSS垂直居中
    window.postMessage 在iframe父子页面数据传输
    小程序 rich-text 处理显示
    前端规范
    CSS技巧(一):清除浮动
    博客地址迁移
  • 原文地址:https://www.cnblogs.com/lxwphp/p/15454579.html
Copyright © 2011-2022 走看看