[2002] PDOException in Connection.php line 295

SQLSTATE[HY000] [2002] Connection refused

  1. $this->fetchType = $config['result_type'];
  2. }
  3. try {
  4. if (empty($config['dsn'])) {
  5. $config['dsn'] = $this->parseDsn($config);
  6. }
  7. if ($config['debug']) {
  8. $startTime = microtime(true);
  9. }
  10. $this->links[$linkNum] = new PDO($config['dsn'], $config['username'], $config['password'], $params);
  11. if ($config['debug']) {
  12. // 记录数据库连接信息
  13. Log::record('[ DB ] CONNECT:[ UseTime:' . number_format(microtime(true) - $startTime, 6) . 's ] ' . $config['dsn'], 'sql');
  14. }
  15. } catch (\PDOException $e) {
  16. if ($autoConnection) {
  17. Log::record($e->getMessage(), 'error');
  18. return $this->connect($autoConnection, $linkNum);
  19. } else {

Call Stack

  1. in Connection.php line 295
  2. at PDO->__construct('mysql:host=127.0.0.1...', 'lch5', 'Eegyo8xmZCPshmA0', [0, 2, 0, ...]) in Connection.php line 295
  3. at Connection->connect() in Connection.php line 995
  4. at Connection->initConnect(false) in Connection.php line 348
  5. at Connection->query('SHOW COLUMNS FROM `h...', [], false, true) in Mysql.php line 65
  6. at Mysql->getFields('`h5_install`') in Query.php line 1921
  7. at Query->getTableInfo('h5_install', 'pk') in Query.php line 1955
  8. at Query->getPk(['table' => 'h5_install', 'where' => [], 'field' => '*', ...]) in Query.php line 2639
  9. at Query->find() in Base.php line 16
  10. at Base->__construct()
  11. at ReflectionClass->newInstanceArgs([]) in App.php line 359
  12. at App::invokeClass('app\index\controller...') in Loader.php line 479
  13. at Loader::controller('index', 'controller', false, 'Error') in App.php line 580
  14. at App::module(['index', 'index', 'material'], ['app_host' => '', 'app_debug' => true, 'app_trace' => false, ...], true) in App.php line 456
  15. at App::exec(['type' => 'module', 'module' => ['index', 'index', 'material']], ['app_host' => '', 'app_debug' => true, 'app_trace' => false, ...]) in App.php line 139
  16. at App::run() in start.php line 19
  17. at require('/home/wwwroot/www.lc...') in index.php line 17

Environment Variables

GET Data
empty
POST Data
empty
Files
empty
Cookies
empty
Session
empty

Server/Request Data

USER
www
HOME
/home/www
HTTP_HOST
www.lch5.cn
HTTP_FA70FA2963857562386D2FACA596ECD3
tag
HTTP_X_NWS_LOG_UUID
11819063768274476232
HTTP_TENCENT_ACCELERATION_DOMAIN_NAME
www.lch5.cn
HTTP_8D785BF8FF69AB24724082A9F1F036BD
tag
HTTP_AEDE056E452085D6D12C55A2346B6D14
tag
HTTP_X_FORWARDED_PROTO
https
HTTP_X_FORWARDED_FOR
34.238.138.162
HTTP_X_TENCENT_UA
Qcloud
HTTP_CONNECTION
keep-alive
HTTP_6CF48BC6CAFA61A9DF2E09A782C4B3BF
tag
HTTP_USER_AGENT
claudebot
HTTP_ACCEPT
*/*
PATH_INFO
//index/index/material.html
PHP_ADMIN_VALUE
open_basedir=/home/wwwroot/www.lch5.cn/:/home/wwwroot/lottery.lch5.cn/:/home/wwwroot/lottery.main.lch5.cn/:/tmp/:/proc/:/home/wwwroot/1249/:/home/libs/tp60/:/home/wwwroot/shop.lch5.cn:/home/gitprojects/
REDIRECT_STATUS
200
SERVER_NAME
www.lch5.cn
SERVER_PORT
80
SERVER_ADDR
172.26.146.213
REMOTE_PORT
39516
REMOTE_ADDR
218.60.37.149
SERVER_SOFTWARE
nginx/1.14.1
GATEWAY_INTERFACE
CGI/1.1
REQUEST_SCHEME
http
SERVER_PROTOCOL
HTTP/1.1
DOCUMENT_ROOT
/home/wwwroot/www.lch5.cn
DOCUMENT_URI
/index.php
REQUEST_URI
/index/index/material.html
SCRIPT_NAME
/index.php
CONTENT_LENGTH
CONTENT_TYPE
REQUEST_METHOD
GET
QUERY_STRING
s=//index/index/material.html
SCRIPT_FILENAME
/home/wwwroot/www.lch5.cn/index.php
FCGI_ROLE
RESPONDER
PHP_SELF
REQUEST_TIME_FLOAT
1711655500.5283
REQUEST_TIME
1711655500
Environment Variables
empty

ThinkPHP Constants

APP_PATH
/home/wwwroot/www.lch5.cn/./application/
THINK_VERSION
5.0.24
THINK_START_TIME
1711655500.5288
THINK_START_MEM
403976
EXT
.php
DS
/
THINK_PATH
/home/wwwroot/www.lch5.cn/thinkphp/
LIB_PATH
/home/wwwroot/www.lch5.cn/thinkphp/library/
CORE_PATH
/home/wwwroot/www.lch5.cn/thinkphp/library/think/
TRAIT_PATH
/home/wwwroot/www.lch5.cn/thinkphp/library/traits/
ROOT_PATH
/home/wwwroot/www.lch5.cn/
EXTEND_PATH
/home/wwwroot/www.lch5.cn/extend/
VENDOR_PATH
/home/wwwroot/www.lch5.cn/vendor/
RUNTIME_PATH
/home/wwwroot/www.lch5.cn/runtime/
LOG_PATH
/home/wwwroot/www.lch5.cn/runtime/log/
CACHE_PATH
/home/wwwroot/www.lch5.cn/runtime/cache/
TEMP_PATH
/home/wwwroot/www.lch5.cn/runtime/temp/
CONF_PATH
/home/wwwroot/www.lch5.cn/./application/
CONF_EXT
.php
ENV_PREFIX
PHP_
IS_CLI
false
IS_WIN
false