[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=expo-re...', 'root', '!@#$qxy22', [0, 2, 0, ...]) in Connection.php line 293
  3. at Connection->connect() in Connection.php line 968
  4. at Connection->initConnect(false) in Mysql.php line 54
  5. at Mysql->getFields('res_type') in Query.php line 1739
  6. at Query->getTableInfo('res_type', 'type') in Query.php line 1787
  7. at Query->getFieldsType(['soft_delete' => ['__TABLE__.delete_tim...', ['null', '']], 'table' => 'res_type', 'where' => ['AND' => ['type_id' => 200]], ...]) in Query.php line 1793
  8. at Query->getFieldsBind(['soft_delete' => ['__TABLE__.delete_tim...', ['null', '']], 'table' => 'res_type', 'where' => ['AND' => ['type_id' => 200]], ...]) in Builder.php line 254
  9. at Builder->buildWhere(['AND' => ['type_id' => 200]], ['soft_delete' => ['__TABLE__.delete_tim...', ['null', '']], 'table' => 'res_type', 'where' => ['AND' => ['type_id' => 200]], ...]) in Builder.php line 224
  10. at Builder->parseWhere(['AND' => ['type_id' => 200]], ['soft_delete' => ['__TABLE__.delete_tim...', ['null', '']], 'table' => 'res_type', 'where' => ['AND' => ['type_id' => 200]], ...]) in Builder.php line 673
  11. at Builder->select(['soft_delete' => ['__TABLE__.delete_tim...', ['null', '']], 'table' => 'res_type', 'where' => ['AND' => ['type_id' => 200]], ...]) in Query.php line 2451
  12. at Query->find(200) in Model.php line 1470
  13. at Model::get(200) in Index.php line 32
  14. at Index->index()
  15. at ReflectionMethod->invokeArgs(object(Index), []) in App.php line 196
  16. at App::invokeMethod([object(Index), 'index'], []) in App.php line 408
  17. at App::module(['index', null, null], ['app_debug' => true, 'app_trace' => false, 'app_status' => '', ...], false) in App.php line 295
  18. at App::exec(['type' => 'module', 'module' => ['index', null, null]], ['app_debug' => true, 'app_trace' => false, 'app_status' => '', ...]) in App.php line 123
  19. at App::run() in start.php line 18
  20. at require('/home/wwwroot/expo_r...') in index.php line 28

Environment Variables

GET Data
empty
POST Data
empty
Files
empty

Cookies

_vstime
1587933039
Session
empty

Server/Request Data

USER
www
HOME
/home/www
HTTP_COOKIE
_vstime=1587933039
HTTP_REFERER
/
HTTP_ACCEPT
*/*
HTTP_HOST
www.ncs-expo.com
PHP_ADMIN_VALUE
open_basedir=/home/wwwroot/expo_res/:/tmp/:/proc/
REDIRECT_STATUS
200
SERVER_NAME
www.ncs-expo.com
SERVER_PORT
80
SERVER_ADDR
114.215.199.178
REMOTE_PORT
59487
REMOTE_ADDR
156.237.189.186
SERVER_SOFTWARE
nginx/1.14.1
GATEWAY_INTERFACE
CGI/1.1
REQUEST_SCHEME
http
SERVER_PROTOCOL
HTTP/1.1
DOCUMENT_ROOT
/home/wwwroot/expo_res
DOCUMENT_URI
/index.php
REQUEST_URI
/
SCRIPT_NAME
/index.php
CONTENT_LENGTH
CONTENT_TYPE
REQUEST_METHOD
GET
QUERY_STRING
SCRIPT_FILENAME
/home/wwwroot/expo_res/index.php
FCGI_ROLE
RESPONDER
PHP_SELF
/index.php
REQUEST_TIME_FLOAT
1587933040.0748
REQUEST_TIME
1587933040
Environment Variables
empty

ThinkPHP Constants

__PUBLIC__
/public
__STATIC__
/public/static
__COMMON__
/public/static/common
APP_PATH
/home/wwwroot/expo_res/application/
DATA_PATH
/home/wwwroot/expo_res/runtime/Data/
THINK_VERSION
5.0.9
THINK_START_TIME
1587933040.0756
THINK_START_MEM
414152
EXT
.php
DS
/
THINK_PATH
/home/wwwroot/expo_res/thinkphp/
LIB_PATH
/home/wwwroot/expo_res/thinkphp/library/
CORE_PATH
/home/wwwroot/expo_res/thinkphp/library/think/
TRAIT_PATH
/home/wwwroot/expo_res/thinkphp/library/traits/
ROOT_PATH
/home/wwwroot/expo_res/
EXTEND_PATH
/home/wwwroot/expo_res/extend/
VENDOR_PATH
/home/wwwroot/expo_res/vendor/
RUNTIME_PATH
/home/wwwroot/expo_res/runtime/
LOG_PATH
/home/wwwroot/expo_res/runtime/log/
CACHE_PATH
/home/wwwroot/expo_res/runtime/cache/
TEMP_PATH
/home/wwwroot/expo_res/runtime/temp/
CONF_PATH
/home/wwwroot/expo_res/application/
CONF_EXT
.php
ENV_PREFIX
PHP_
IS_CLI
false
IS_WIN
false
UPLOAD_PATH
./Uploads/