[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=47.105.16...', 'huanwei', 'RTYxHLHHGMWNhbin', [0, 2, 0, ...]) in Connection.php line 295
  3. at Connection->connect() in Connection.php line 1006
  4. at Connection->initConnect(false) in Connection.php line 348
  5. at Connection->query('SHOW COLUMNS FROM `c...', [], false, true) in Mysql.php line 65
  6. at Mysql->getFields('cmf_portal_post') in Query.php line 1883
  7. at Query->getTableInfo('cmf_portal_post', 'pk') in Query.php line 1917
  8. at Query->getPk(['alias' => ['cmf_portal_post' => 'post'], 'field' => ['post.*'], 'multi' => ['AND' => ['post.post_type' => [1], 'post.published_time' => [[['< time', 1571385709], ['> time', 0]]], 'post.post_status' => [1], ...]], ...]) in Query.php line 2592
  9. at Query->find() in PostService.php line 94
  10. at PostService->publishedArticle('337', 0) in ArticleController.php line 21
  11. at ArticleController->index()
  12. at ReflectionMethod->invokeArgs(object(ArticleController), []) in App.php line 343
  13. at App::invokeMethod([object(ArticleController), 'index'], []) in App.php line 606
  14. at App::module(['portal', 'article', 'index'], ['app_host' => '', 'app_debug' => true, 'app_trace' => false, ...], null) in App.php line 457
  15. at App::exec(['type' => 'module', 'module' => ['portal', 'article', 'index']], ['app_host' => '', 'app_debug' => true, 'app_trace' => false, ...]) in App.php line 139
  16. at App::run() in index.php line 34

Environment Variables

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

Server/Request Data

USER
www
HOME
/home/www
FCGI_ROLE
RESPONDER
REDIRECT_SCRIPT_URL
/portal/article/index/id/337.html
REDIRECT_SCRIPT_URI
http://htreschina.com/portal/article/index/id/337.html
REDIRECT_STATUS
200
SCRIPT_URL
/portal/article/index/id/337.html
SCRIPT_URI
http://htreschina.com/portal/article/index/id/337.html
proxy-nokeepalive
1
HTTP_HOST
htreschina.com
HTTP_USER_AGENT
Mozilla/5.0 (compatible; Baiduspider/2.0; +http://www.baidu.com/search/spider.html)
HTTP_ACCEPT
*/*
HTTP_ACCEPT_ENCODING
gzip,deflate
HTTP_REFERER
http://htreschina.com/portal/article/index/id/337.html
HTTP_CLIENT_IP
66.119.248.241
HTTP_X_FORWARDED_FOR
64.225.245.118
PATH
/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin
LD_LIBRARY_PATH
/www/server/apache/lib
SERVER_SIGNATURE
<address>Apache Server at htreschina.com Port 80</address>
SERVER_SOFTWARE
Apache
SERVER_NAME
htreschina.com
SERVER_ADDR
172.31.132.126
SERVER_PORT
80
REMOTE_ADDR
23.235.191.74
DOCUMENT_ROOT
/www/wwwroot/default/public
REQUEST_SCHEME
http
CONTEXT_PREFIX
CONTEXT_DOCUMENT_ROOT
/www/wwwroot/default/public
SERVER_ADMIN
webmaster@example.com
SCRIPT_FILENAME
/www/wwwroot/default/public/index.php
REMOTE_PORT
38188
REDIRECT_URL
/portal/article/index/id/337.html
REDIRECT_QUERY_STRING
s=portal/article/index/id/337.html
GATEWAY_INTERFACE
CGI/1.1
SERVER_PROTOCOL
HTTP/1.1
REQUEST_METHOD
GET
QUERY_STRING
s=portal/article/index/id/337.html
REQUEST_URI
/portal/article/index/id/337.html
SCRIPT_NAME
/index.php
PHP_SELF
/index.php
REQUEST_TIME_FLOAT
1571385709.2993
REQUEST_TIME
1571385709
PATH_INFO
portal/article/index/id/337.html
Environment Variables
empty

ThinkPHP Constants

APP_DEBUG
true
CMF_ROOT
/www/wwwroot/default/public/../
APP_PATH
/www/wwwroot/default/public/../app/
CMF_PATH
/www/wwwroot/default/public/../simplewind/cmf/
PLUGINS_PATH
/www/wwwroot/default/public/plugins/
EXTEND_PATH
/www/wwwroot/default/public/../simplewind/extend/
VENDOR_PATH
/www/wwwroot/default/public/../simplewind/vendor/
RUNTIME_PATH
/www/wwwroot/default/public/../data/runtime/
THINKCMF_VERSION
5.0.180901
THINK_VERSION
5.0.20
THINK_START_TIME
1571385709.2999
THINK_START_MEM
270848
EXT
.php
DS
/
THINK_PATH
/www/wwwroot/default/simplewind/thinkphp/
LIB_PATH
/www/wwwroot/default/simplewind/thinkphp/library/
CORE_PATH
/www/wwwroot/default/simplewind/thinkphp/library/think/
TRAIT_PATH
/www/wwwroot/default/simplewind/thinkphp/library/traits/
ROOT_PATH
/www/wwwroot/default/
LOG_PATH
/www/wwwroot/default/public/../data/runtime/log/
CACHE_PATH
/www/wwwroot/default/public/../data/runtime/cache/
TEMP_PATH
/www/wwwroot/default/public/../data/runtime/temp/
CONF_PATH
/www/wwwroot/default/public/../app/
CONF_EXT
.php
ENV_PREFIX
PHP_
IS_CLI
false
IS_WIN
false
HTMLPURIFIER_PREFIX
/www/wwwroot/default/simplewind/vendor/ezyang/htmlpurifier/library
QINIU_FUNCTIONS_VERSION
7.2.5