[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...', 'root', '', [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 `m...', [], false, true) in Mysql.php line 65
  6. at Mysql->getFields('membership_unit') in Query.php line 1921
  7. at Query->getTableInfo('membership_unit', 'type') in Query.php line 1969
  8. at Query->getFieldsType('membership_unit') in Query.php line 1975
  9. at Query->getFieldsBind('membership_unit') in Builder.php line 270
  10. at Builder->buildWhere(['AND' => ['type' => ['eq', '2'], 'id' => ['eq', '45']]], ['multi' => ['AND' => ['type' => [['eq', '2']], 'id' => [['eq', '45']]]], 'where' => ['AND' => ['type' => ['eq', '2'], 'id' => ['eq', '45']]], 'table' => 'membership_unit', ...]) in Builder.php line 240
  11. at Builder->parseWhere(['AND' => ['type' => ['eq', '2'], 'id' => ['eq', '45']]], ['multi' => ['AND' => ['type' => [['eq', '2']], 'id' => [['eq', '45']]]], 'where' => ['AND' => ['type' => ['eq', '2'], 'id' => ['eq', '45']]], 'table' => 'membership_unit', ...]) in Builder.php line 719
  12. at Builder->select(['multi' => ['AND' => ['type' => [['eq', '2']], 'id' => [['eq', '45']]]], 'where' => ['AND' => ['type' => ['eq', '2'], 'id' => ['eq', '45']]], 'table' => 'membership_unit', ...]) in Query.php line 2511
  13. at Query->select() in Index.php line 634
  14. at Index->show5()
  15. at ReflectionMethod->invokeArgs(object(Index), []) in App.php line 343
  16. at App::invokeMethod([object(Index), 'show5'], []) in App.php line 611
  17. at App::module(['index', 'index', 'show5'], ['app_host' => '', 'app_debug' => true, 'app_trace' => false, ...], null) in App.php line 457
  18. at App::exec(['type' => 'module', 'module' => ['index', 'index', 'show5']], ['app_host' => '', 'app_debug' => true, 'app_trace' => false, ...]) in App.php line 139
  19. at App::run() in start.php line 19
  20. at require('/phpstudy/www/TP5/th...') in index.php line 8

Environment Variables

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

Server/Request Data

REDIRECT_STATUS
200
HTTP_ACCEPT
*/*
HTTP_USER_AGENT
claudebot
HTTP_HOST
sdrcxh.com
PATH
/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:/root/bin
LD_LIBRARY_PATH
/phpstudy/server/httpd/lib
SERVER_SIGNATURE
SERVER_SOFTWARE
Apache/2.4.7 (Unix) PHP/5.5.10
SERVER_NAME
sdrcxh.com
SERVER_ADDR
172.17.55.12
SERVER_PORT
80
REMOTE_ADDR
44.201.64.238
DOCUMENT_ROOT
/phpstudy/www/TP5/public/
REQUEST_SCHEME
http
CONTEXT_PREFIX
CONTEXT_DOCUMENT_ROOT
/phpstudy/www/TP5/public/
SERVER_ADMIN
you@example.com
SCRIPT_FILENAME
/phpstudy/www/TP5/public/index.php
REMOTE_PORT
55100
REDIRECT_URL
/index/index/show5/TBname/membership_unit/id/45/type/2.html
GATEWAY_INTERFACE
CGI/1.1
SERVER_PROTOCOL
HTTP/1.1
REQUEST_METHOD
GET
QUERY_STRING
REQUEST_URI
/index/index/show5/TBname/membership_unit/id/45/type/2.html
SCRIPT_NAME
/index.php
PATH_INFO
/index/index/show5/TBname/membership_unit/id/45/type/2.html
PATH_TRANSLATED
redirect:/index.php/index/index/show5/TBname/membership_unit/id/45/type/2.html/index/show5/TBname/membership_unit/id/45/type/2.html
PHP_SELF
/index.php/index/index/show5/TBname/membership_unit/id/45/type/2.html
REQUEST_TIME_FLOAT
1711619395.589
REQUEST_TIME
1711619395
Environment Variables
empty

ThinkPHP Constants

APP_PATH
/phpstudy/www/TP5/public/../application/
THINK_VERSION
5.0.24
THINK_START_TIME
1711619395.5898
THINK_START_MEM
256440
EXT
.php
DS
/
THINK_PATH
/phpstudy/www/TP5/thinkphp/
LIB_PATH
/phpstudy/www/TP5/thinkphp/library/
CORE_PATH
/phpstudy/www/TP5/thinkphp/library/think/
TRAIT_PATH
/phpstudy/www/TP5/thinkphp/library/traits/
ROOT_PATH
/phpstudy/www/TP5/
EXTEND_PATH
/phpstudy/www/TP5/extend/
VENDOR_PATH
/phpstudy/www/TP5/vendor/
RUNTIME_PATH
/phpstudy/www/TP5/runtime/
LOG_PATH
/phpstudy/www/TP5/runtime/log/
CACHE_PATH
/phpstudy/www/TP5/runtime/cache/
TEMP_PATH
/phpstudy/www/TP5/runtime/temp/
CONF_PATH
/phpstudy/www/TP5/public/../application/
CONF_EXT
.php
ENV_PREFIX
PHP_
IS_CLI
false
IS_WIN
false
SITE_NAME
SITE_URL
http://sdrcxh.com