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

博客指出数据库出现错误,经检查是配置错误,将DB_HOST的值改为mysql后问题解决,还给出了转载链接。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

错误提示如下:

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,问题解决

 

转载于:https://www.cnblogs.com/hardykay/p/10824433.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值