[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...', 'riyueguanxiang', 'Zsm123698', [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 `f...', [], false, true) in Mysql.php line 65
  6. at Mysql->getFields('`fa_cms_channel`') in Query.php line 1921
  7. at Query->getTableInfo('fa_cms_channel', 'type') in Query.php line 1969
  8. at Query->getFieldsType('fa_cms_channel') in Query.php line 1975
  9. at Query->getFieldsBind('fa_cms_channel') in Builder.php line 270
  10. at Builder->buildWhere(['AND' => ['parent_id' => ['>', 0], 'status' => ['eq', 'normal']]], ['multi' => ['AND' => ['parent_id' => [['>', 0]], 'status' => [['eq', 'normal']]]], 'where' => ['AND' => ['parent_id' => ['>', 0], 'status' => ['eq', 'normal']]], 'field' => ['parent_id'], ...]) in Builder.php line 240
  11. at Builder->parseWhere(['AND' => ['parent_id' => ['>', 0], 'status' => ['eq', 'normal']]], ['multi' => ['AND' => ['parent_id' => [['>', 0]], 'status' => [['eq', 'normal']]]], 'where' => ['AND' => ['parent_id' => ['>', 0], 'status' => ['eq', 'normal']]], 'field' => ['parent_id'], ...]) in Builder.php line 719
  12. at Builder->select(['multi' => ['AND' => ['parent_id' => [['>', 0]], 'status' => [['eq', 'normal']]]], 'where' => ['AND' => ['parent_id' => ['>', 0], 'status' => ['eq', 'normal']]], 'field' => ['parent_id'], ...]) in Query.php line 2462
  13. at Query->getPdo() in Query.php line 491
  14. at Query->column('parent_id') in Channel.php line 84
  15. at Channel->getHasChildAttr(null, ['id' => 17, 'type' => 'link', 'model_id' => 0, ...], []) in Model.php line 602
  16. at Model->getAttr('has_child') in Model.php line 2294
  17. at Model->offsetGet('has_child') in fc3774dde12c0a55cbb3cfa1ad928f99.php line 54
  18. at include('/www/wwwroot/gx.shan...') in File.php line 53
  19. at File->read('/www/wwwroot/gx.shan...', ['user' => null, 'site' => ['name' => '日月观象', 'beian' => '陇ICP备19003392号', 'cdnurl' => '', ...], 'config' => ['site' => ['name' => '日月观象', 'cdnurl' => '', 'version' => 1722068059, ...], 'upload' => ['cdnurl' => '', 'uploadurl' => 'ajax/upload', 'bucket' => 'local', ...], 'modulename' => 'index', ...], ...]) in Template.php line 188
  20. at Template->fetch('/www/wwwroot/gx.shan...', ['user' => null, 'site' => ['name' => '日月观象', 'beian' => '陇ICP备19003392号', 'cdnurl' => '', ...], 'config' => ['site' => ['name' => '日月观象', 'cdnurl' => '', 'version' => 1722068059, ...], 'upload' => ['cdnurl' => '', 'uploadurl' => 'ajax/upload', 'bucket' => 'local', ...], 'modulename' => 'index', ...], ...], []) in Think.php line 86
  21. at Think->fetch('/www/wwwroot/gx.shan...', ['user' => null, 'site' => ['name' => '日月观象', 'beian' => '陇ICP备19003392号', 'cdnurl' => '', ...], 'config' => ['site' => ['name' => '日月观象', 'cdnurl' => '', 'version' => 1722068059, ...], 'upload' => ['cdnurl' => '', 'uploadurl' => 'ajax/upload', 'bucket' => 'local', ...], 'modulename' => 'index', ...], ...], []) in View.php line 163
  22. at View->fetch() in User.php line 194
  23. at User->login()
  24. at ReflectionMethod->invokeArgs(object(User), []) in App.php line 343
  25. at App::invokeMethod([object(User), 'login'], []) in App.php line 611
  26. at App::module(['index', 'user', 'login'], ['app_host' => '', 'app_debug' => true, 'app_trace' => false, ...], true) in App.php line 456
  27. at App::exec(['type' => 'module', 'module' => ['index', 'user', 'login']], ['app_host' => '', 'app_debug' => true, 'app_trace' => false, ...]) in App.php line 139
  28. at App::run() in start.php line 19
  29. at require('/www/wwwroot/gx.shan...') in index.php line 24

Environment Variables

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

Server/Request Data

USER
www
HOME
/home/www
HTTP_HOST
gx.shanqiushanbu.com
HTTP_ACCEPT_ENCODING
gzip, br, zstd, deflate
HTTP_USER_AGENT
Mozilla/5.0 AppleWebKit/537.36 (KHTML, like Gecko; compatible; ClaudeBot/1.0; +claudebot@anthropic.com)
HTTP_ACCEPT
*/*
PATH_INFO
/index/user/login
REDIRECT_STATUS
200
SERVER_NAME
gx.shanqiushanbu.com
SERVER_PORT
80
SERVER_ADDR
172.17.0.17
REMOTE_PORT
10104
REMOTE_ADDR
18.119.28.184
SERVER_SOFTWARE
nginx/1.16.0
GATEWAY_INTERFACE
CGI/1.1
REQUEST_SCHEME
http
SERVER_PROTOCOL
HTTP/1.1
DOCUMENT_ROOT
/www/wwwroot/gx.shanqiushanbu.com/public
DOCUMENT_URI
/index.php
REQUEST_URI
/index/user/login
SCRIPT_NAME
/index.php
CONTENT_LENGTH
CONTENT_TYPE
REQUEST_METHOD
GET
QUERY_STRING
s=/index/user/login
SCRIPT_FILENAME
/www/wwwroot/gx.shanqiushanbu.com/public/index.php
FCGI_ROLE
RESPONDER
PHP_SELF
/index.php
REQUEST_TIME_FLOAT
1722068059.3716
REQUEST_TIME
1722068059
Environment Variables
empty

ThinkPHP Constants

APP_PATH
/www/wwwroot/gx.shanqiushanbu.com/public/../application/
THINK_VERSION
5.0.24
THINK_START_TIME
1722068059.3721
THINK_START_MEM
408656
EXT
.php
DS
/
THINK_PATH
/www/wwwroot/gx.shanqiushanbu.com/thinkphp/
LIB_PATH
/www/wwwroot/gx.shanqiushanbu.com/thinkphp/library/
CORE_PATH
/www/wwwroot/gx.shanqiushanbu.com/thinkphp/library/think/
TRAIT_PATH
/www/wwwroot/gx.shanqiushanbu.com/thinkphp/library/traits/
ROOT_PATH
/www/wwwroot/gx.shanqiushanbu.com/
EXTEND_PATH
/www/wwwroot/gx.shanqiushanbu.com/extend/
VENDOR_PATH
/www/wwwroot/gx.shanqiushanbu.com/vendor/
RUNTIME_PATH
/www/wwwroot/gx.shanqiushanbu.com/runtime/
LOG_PATH
/www/wwwroot/gx.shanqiushanbu.com/runtime/log/
CACHE_PATH
/www/wwwroot/gx.shanqiushanbu.com/runtime/cache/
TEMP_PATH
/www/wwwroot/gx.shanqiushanbu.com/runtime/temp/
CONF_PATH
/www/wwwroot/gx.shanqiushanbu.com/public/../application/
CONF_EXT
.php
ENV_PREFIX
PHP_
IS_CLI
false
IS_WIN
false
ADDON_PATH
/www/wwwroot/gx.shanqiushanbu.com/addons/