[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:dbname=xinyuan...', 'xinyuan', 'xinyuan07282518', [0, 2, 0, ...]) in Connection.php line 293
  3. at Connection->connect() in Connection.php line 972
  4. at Connection->initConnect(false) in Connection.php line 346
  5. at Connection->query('SHOW COLUMNS FROM `t...', [], false, true) in Mysql.php line 62
  6. at Mysql->getFields('tp_config') in Query.php line 1739
  7. at Query->getTableInfo('tp_config', 'pk') in Query.php line 1773
  8. at Query->getPk(['where' => ['AND' => ['id' => ['eq', 1]]], 'table' => 'tp_config', 'field' => '*', ...]) in Query.php line 2430
  9. at Query->find() in Index.php line 10
  10. at Index->_initialize() in Controller.php line 56
  11. at Controller->__construct(object(Request))
  12. at ReflectionClass->newInstanceArgs([object(Request)]) in App.php line 215
  13. at App::invokeClass('app\index\controller...') in Loader.php line 420
  14. at Loader::controller('index', 'controller', false, 'Error') in App.php line 392
  15. at App::module(['index', 'index', 'newslist'], ['app_host' => '', 'app_debug' => true, 'app_trace' => false, ...], false) in App.php line 295
  16. at App::exec(['type' => 'module', 'module' => ['index', 'index', 'newslist'], 'convert' => false], ['app_host' => '', 'app_debug' => true, 'app_trace' => false, ...]) in App.php line 123
  17. at App::run() in start.php line 19
  18. at require('/var/www/html/www_xy...') in index.php line 20

Environment Variables

GET Data

/newslist/33_html
POST Data
empty
Files
empty
Cookies
empty
Session
empty

Server/Request Data

REDIRECT_UNIQUE_ID
X5A8WkrEqnHmhHq9x6M2ZAAAADc
REDIRECT_STATUS
200
UNIQUE_ID
X5A8WkrEqnHmhHq9x6M2ZAAAADc
HTTP_USER_AGENT
Mozilla/5.0+(compatible;+Baiduspider/2.0;++http://www.baidu.com/search/spider.html)
HTTP_HOST
www.xyxmgl.com
HTTP_ACCEPT
*/*
HTTP_ACCEPT_ENCODING
deflate, gzip
PATH
/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin
SERVER_SIGNATURE
SERVER_SOFTWARE
Apache/2.4.6 (CentOS)
SERVER_NAME
www.xyxmgl.com
SERVER_ADDR
172.16.31.52
SERVER_PORT
80
REMOTE_ADDR
154.209.206.91
DOCUMENT_ROOT
/var/www/html/www_xyxmgl_com/public
REQUEST_SCHEME
http
CONTEXT_PREFIX
CONTEXT_DOCUMENT_ROOT
/var/www/html/www_xyxmgl_com/public
SERVER_ADMIN
root@localhost
SCRIPT_FILENAME
/var/www/html/www_xyxmgl_com/public/index.php
REMOTE_PORT
20001
REDIRECT_QUERY_STRING
/newslist/33.html
REDIRECT_URL
/newslist/33.html
GATEWAY_INTERFACE
CGI/1.1
SERVER_PROTOCOL
HTTP/1.1
REQUEST_METHOD
GET
QUERY_STRING
/newslist/33.html
REQUEST_URI
/newslist/33.html
SCRIPT_NAME
/index.php
PHP_SELF
/index.php
REQUEST_TIME_FLOAT
1603288154.24
REQUEST_TIME
1603288154
PATH_INFO
/newslist/33.html
Environment Variables
empty

ThinkPHP Constants

APP_PATH
/var/www/html/www_xyxmgl_com/public/../application/
PREFIX
tp_
THINK_VERSION
5.0.10
THINK_START_TIME
1603288154.2419
THINK_START_MEM
231504
EXT
.php
DS
/
THINK_PATH
/var/www/html/www_xyxmgl_com/thinkphp/
LIB_PATH
/var/www/html/www_xyxmgl_com/thinkphp/library/
CORE_PATH
/var/www/html/www_xyxmgl_com/thinkphp/library/think/
TRAIT_PATH
/var/www/html/www_xyxmgl_com/thinkphp/library/traits/
ROOT_PATH
/var/www/html/www_xyxmgl_com/
EXTEND_PATH
/var/www/html/www_xyxmgl_com/extend/
VENDOR_PATH
/var/www/html/www_xyxmgl_com/vendor/
RUNTIME_PATH
/var/www/html/www_xyxmgl_com/runtime/
LOG_PATH
/var/www/html/www_xyxmgl_com/runtime/log/
CACHE_PATH
/var/www/html/www_xyxmgl_com/runtime/cache/
TEMP_PATH
/var/www/html/www_xyxmgl_com/runtime/temp/
CONF_PATH
/var/www/html/www_xyxmgl_com/public/../application/
CONF_EXT
.php
ENV_PREFIX
PHP_
IS_CLI
false
IS_WIN
false