[2002] PDOException in Connection.php line 293

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 293
  2. at PDO->__construct('mysql:host=127.0.0.1...', 'xcygsc_cn', 'aALh44yXyyPpxtdz', [0, 2, 0, ...]) in Connection.php line 293
  3. at Connection->connect() in Connection.php line 998
  4. at Connection->initConnect(false) in Connection.php line 347
  5. at Connection->query('SHOW COLUMNS FROM `t...', [], false, true) in Mysql.php line 65
  6. at Mysql->getFields('tp_config') in Query.php line 1749
  7. at Query->getTableInfo('tp_config', 'type') in Query.php line 1797
  8. at Query->getFieldsType('tp_config') in Query.php line 1803
  9. at Query->getFieldsBind('tp_config') in Builder.php line 263
  10. at Builder->buildWhere([], ['table' => 'tp_config', 'where' => [], 'field' => '*', ...]) in Builder.php line 233
  11. at Builder->parseWhere([], ['table' => 'tp_config', 'where' => [], 'field' => '*', ...]) in Builder.php line 697
  12. at Builder->select(['table' => 'tp_config', 'where' => [], 'field' => '*', ...]) in Query.php line 2332
  13. at Query->select() in Base.php line 51
  14. at Base->public_assign() in Base.php line 43
  15. at Base->_initialize() in Controller.php line 85
  16. at Controller->__construct(object(Request))
  17. at ReflectionClass->newInstanceArgs([object(Request)]) in App.php line 362
  18. at App::invokeClass('app\home\controller\...') in Loader.php line 459
  19. at Loader::controller('Goods', 'controller', false, 'Error') in App.php line 580
  20. at App::module(['Home', 'Goods', 'goodsList'], ['app_host' => '', 'app_debug' => true, 'app_trace' => false, ...], null) in App.php line 460
  21. at App::exec(['type' => 'module', 'module' => ['Home', 'Goods', 'goodsList']], ['app_host' => '', 'app_debug' => true, 'app_trace' => false, ...]) in App.php line 142
  22. at App::run() in start.php line 19
  23. at require('/www/wwwroot/xcygsc....') in index.php line 60

Environment Variables

GET Data

id
52
POST Data
empty
Files
empty

Cookies

is_mobile
0
Session
empty

Server/Request Data

USER
www
HOME
/home/www
FCGI_ROLE
RESPONDER
SCRIPT_FILENAME
/www/wwwroot/xcygsc.cn/index.php
QUERY_STRING
REQUEST_METHOD
GET
CONTENT_TYPE
CONTENT_LENGTH
SCRIPT_NAME
/index.php
REQUEST_URI
/index.php/Home/Goods/goodsList/id/52
DOCUMENT_URI
/index.php/Home/Goods/goodsList/id/52
DOCUMENT_ROOT
/www/wwwroot/xcygsc.cn
SERVER_PROTOCOL
HTTP/1.1
REQUEST_SCHEME
http
GATEWAY_INTERFACE
CGI/1.1
SERVER_SOFTWARE
nginx/1.18.0
REMOTE_ADDR
18.234.232.228
REMOTE_PORT
45498
SERVER_ADDR
10.0.16.7
SERVER_PORT
80
SERVER_NAME
xcygsc.com
REDIRECT_STATUS
200
PATH_INFO
/Home/Goods/goodsList/id/52
HTTP_ACCEPT
*/*
HTTP_USER_AGENT
claudebot
HTTP_HOST
www.xcygsc.com
PHP_SELF
/index.php/Home/Goods/goodsList/id/52
REQUEST_TIME_FLOAT
1711670194.7396
REQUEST_TIME
1711670194
Environment Variables
empty

ThinkPHP Constants

PLUGIN_PATH
/www/wwwroot/xcygsc.cn/plugins/
UPLOAD_PATH
public/upload/
TPSHOP_CACHE_TIME
31104000
SITE_URL
http://www.xcygsc.com
HTTP
http
INSTALL_DATE
1463741583
SERIALNUMBER
20160520065303oCWIoa
APP_PATH
/www/wwwroot/xcygsc.cn/application/
NOW_TIME
1711670194
THINK_VERSION
5.0.15
THINK_START_TIME
1711670194.7401
THINK_START_MEM
275144
EXT
.php
DS
/
THINK_PATH
/www/wwwroot/xcygsc.cn/thinkphp/
LIB_PATH
/www/wwwroot/xcygsc.cn/thinkphp/library/
CORE_PATH
/www/wwwroot/xcygsc.cn/thinkphp/library/think/
TRAIT_PATH
/www/wwwroot/xcygsc.cn/thinkphp/library/traits/
ROOT_PATH
/www/wwwroot/xcygsc.cn/
EXTEND_PATH
/www/wwwroot/xcygsc.cn/extend/
VENDOR_PATH
/www/wwwroot/xcygsc.cn/vendor/
RUNTIME_PATH
/www/wwwroot/xcygsc.cn/runtime/
LOG_PATH
/www/wwwroot/xcygsc.cn/runtime/log/
CACHE_PATH
/www/wwwroot/xcygsc.cn/runtime/cache/
TEMP_PATH
/www/wwwroot/xcygsc.cn/runtime/temp/
CONF_PATH
/www/wwwroot/xcygsc.cn/application/
CONF_EXT
.php
ENV_PREFIX
PHP_
IS_CLI
false
IS_WIN
false
ADDON_PATH
/www/wwwroot/xcygsc.cn/addons/
EXTEND_MODULE
1
EXTEND_ANDROID
2
EXTEND_IOS
3
EXTEND_ENTRUST
4
EXTEND_MINIAPP
5
EXTEND_H5
6
TIME_MOUTH
4
IS_AJAX
false
IS_GET
true
IS_POST
false
MODULE_NAME
home
CONTROLLER_NAME
Goods
ACTION_NAME
goodsList
PREFIX
tp_
SESSION_ID