首页 > 数据库技术 > 详细

SQLSTATE[HY000] [2002] No such file or directory

时间:2019-05-07 11:48:13      阅读:242      评论:0      收藏:0      [点我收藏+]

错误提示如下:

SQLSTATE[HY000] [2002] No such file or directory
错误位置

FILE: /var/www/baite/core/Library/Think/Db/Driver.class.php  LINE: 109
TRACE

#0 /var/www/baite/core/Library/Think/Db/Driver.class.php(109): E(SQLSTATE[HY000]...)
#1 /var/www/baite/core/Library/Think/Db/Driver.class.php(1061): Think\Db\Driver->connect()
#2 /var/www/baite/core/Library/Think/Db/Driver/Mysql.class.php(50): Think\Db\Driver->initConnect(true)
#3 /var/www/baite/core/Library/Think/Model.class.php(136): Think\Db\Driver\Mysql->getFields(qs_hooks)
#4 /var/www/baite/core/Library/Think/Model.class.php(124): Think\Model->flush()
#5 /var/www/baite/core/Library/Think/Model.class.php(1453): Think\Model->_checkTableInfo()
#6 /var/www/baite/core/Library/Think/Model.class.php(99): Think\Model->db(0, ‘‘, true)
#7 /var/www/baite/app/Common/Model/HooksModel.class.php(18): Think\Model->__construct(Hooks, ‘‘, ‘‘)
#8 /var/www/baite/core/Common/functions.php(595): Common\Model\HooksModel->__construct(Hooks)
#9 /var/www/baite/app/Behaviors/InitHookBehavior.class.php(20): D(Hooks)
#10 /var/www/baite/core/Library/Think/Hook.class.php(121): Behaviors\InitHookBehavior->run(NULL)
#11 /var/www/baite/core/Library/Think/Hook.class.php(91): Think\Hook::exec(Behaviors\\InitH..., run, NULL)
#12 /var/www/baite/core/Library/Think/App.class.php(191): Think\Hook::listen(app_init)
#13 /var/www/baite/core/Library/Think/Think.class.php(121): Think\App::run()
#14 /var/www/baite/core/ThinkPHP.php(96): Think\Think::start()
#15 /var/www/baite/tp.php(98): require(/var/www/baite/...)
#16 /var/www/baite/FrameSelector.php(6): require(/var/www/baite/...)
#17 /var/www/baite/www/index.php(5): FrameSelector::load()
#18 {main}

数据库配置文件如下:

APP_ENV=local
APP_DEBUG=True

DB_CONNECTION=mysql
DB_HOST=localhost
DB_PORT=3306
DB_DATABASE=baite
DB_USERNAME=root
DB_PASSWORD=root
DB_PREFIX=qs_

ELASTICSEARCH_HOSTS=

其实,是配置错误将DB_HOST的值改为mysql:

APP_ENV=local
APP_DEBUG=True

DB_CONNECTION=mysql
DB_HOST=mysql
DB_PORT=3306
DB_DATABASE=baite
DB_USERNAME=root
DB_PASSWORD=root
DB_PREFIX=qs_

ELASTICSEARCH_HOSTS=

ok,问题解决

 

SQLSTATE[HY000] [2002] No such file or directory

原文:https://www.cnblogs.com/hardykay/p/10824433.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!