[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...', 'root', 'root', [0, 2, 0, ...]) in Connection.php line 293
  3. at Connection->connect() in Connection.php line 969
  4. at Connection->initConnect(false) in Connection.php line 346
  5. at Connection->query('SHOW COLUMNS FROM `c...', [], false, true) in Mysql.php line 65
  6. at Mysql->getFields('`carousel_map`') in Query.php line 1741
  7. at Query->getTableInfo('carousel_map', 'type') in Query.php line 1789
  8. at Query->getFieldsType('carousel_map') in Query.php line 1795
  9. at Query->getFieldsBind('carousel_map') in Builder.php line 256
  10. at Builder->buildWhere(['AND' => ['status' => 1, 'title' => ['like', '%首页%']]], ['multi' => ['AND' => ['status' => [1], 'title' => [['like', '%首页%']]]], 'where' => ['AND' => ['status' => 1, 'title' => ['like', '%首页%']]], 'table' => 'carousel_map', ...]) in Builder.php line 226
  11. at Builder->parseWhere(['AND' => ['status' => 1, 'title' => ['like', '%首页%']]], ['multi' => ['AND' => ['status' => [1], 'title' => [['like', '%首页%']]]], 'where' => ['AND' => ['status' => 1, 'title' => ['like', '%首页%']]], 'table' => 'carousel_map', ...]) in Builder.php line 690
  12. at Builder->select(['multi' => ['AND' => ['status' => [1], 'title' => [['like', '%首页%']]]], 'where' => ['AND' => ['status' => 1, 'title' => ['like', '%首页%']]], 'table' => 'carousel_map', ...]) in Query.php line 2308
  13. at Query->select() in CarouselMap.php line 33
  14. at CarouselMap->getCarouselMapByTitle('首页') in Home.php line 23
  15. at Home->index()
  16. at ReflectionMethod->invokeArgs(object(Home), []) in App.php line 197
  17. at App::invokeMethod([object(Home), 'index'], []) in App.php line 411
  18. at App::module(['', null, null], ['app_host' => '', 'app_debug' => true, 'app_trace' => false, ...], true) in App.php line 296
  19. at App::exec(['type' => 'module', 'module' => ['', null, null]], ['app_host' => '', 'app_debug' => true, 'app_trace' => false, ...]) in App.php line 124
  20. at App::run() in start.php line 18
  21. at require('/home/www-data/www/g...') in index.php line 23

Environment Variables

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

Server/Request Data

USER
www-data
HOME
/var/www
HTTP_ACCEPT_ENCODING
deflate, gzip
HTTP_ACCEPT
*/*
HTTP_HOST
www.syj166.cn
HTTP_USER_AGENT
Mozilla/5.0+(compatible;+Baiduspider/2.0;++http://www.baidu.com/search/spider.html)
REDIRECT_STATUS
200
SERVER_NAME
www.syj166.cn
SERVER_PORT
80
SERVER_ADDR
172.18.225.188
REMOTE_PORT
20000
REMOTE_ADDR
23.244.16.184
SERVER_SOFTWARE
nginx/1.10.3
GATEWAY_INTERFACE
CGI/1.1
REQUEST_SCHEME
http
SERVER_PROTOCOL
HTTP/1.1
DOCUMENT_ROOT
/home/www-data/www/gw.syj166.cn/source/public
DOCUMENT_URI
/index.php
REQUEST_URI
/
SCRIPT_NAME
/index.php
CONTENT_LENGTH
CONTENT_TYPE
REQUEST_METHOD
GET
QUERY_STRING
SCRIPT_FILENAME
/home/www-data/www/gw.syj166.cn/source/public/index.php
FCGI_ROLE
RESPONDER
PHP_SELF
/index.php
REQUEST_TIME_FLOAT
1566382145.1712
REQUEST_TIME
1566382145
Environment Variables
empty

ThinkPHP Constants

__PUBLIC__
/public
APP_PATH
/home/www-data/www/gw.syj166.cn/source/public/../application/
THINK_VERSION
5.0.11
THINK_START_TIME
1566382145.1713
THINK_START_MEM
355888
EXT
.php
DS
/
THINK_PATH
/home/www-data/www/gw.syj166.cn/source/thinkphp/
LIB_PATH
/home/www-data/www/gw.syj166.cn/source/thinkphp/library/
CORE_PATH
/home/www-data/www/gw.syj166.cn/source/thinkphp/library/think/
TRAIT_PATH
/home/www-data/www/gw.syj166.cn/source/thinkphp/library/traits/
ROOT_PATH
/home/www-data/www/gw.syj166.cn/source/
EXTEND_PATH
/home/www-data/www/gw.syj166.cn/source/extend/
VENDOR_PATH
/home/www-data/www/gw.syj166.cn/source/vendor/
RUNTIME_PATH
/home/www-data/www/gw.syj166.cn/source/runtime/
LOG_PATH
/home/www-data/www/gw.syj166.cn/source/runtime/log/
CACHE_PATH
/home/www-data/www/gw.syj166.cn/source/runtime/cache/
TEMP_PATH
/home/www-data/www/gw.syj166.cn/source/runtime/temp/
CONF_PATH
/home/www-data/www/gw.syj166.cn/source/public/../application/
CONF_EXT
.php
ENV_PREFIX
PHP_
IS_CLI
false
IS_WIN
false