[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=127.0.0.1...', 'yiyuan', 'Yiyuan@163.com', [0, 2, 0, ...]) in Connection.php line 295
  3. at Connection->connect() in Connection.php line 995
  4. at Connection->initConnect(false) in Connection.php line 348
  5. at Connection->query('SHOW COLUMNS FROM `w...', [], false, true) in Mysql.php line 65
  6. at Mysql->getFields('ws_conf') in Query.php line 1921
  7. at Query->getTableInfo('ws_conf', 'type') in Query.php line 1969
  8. at Query->getFieldsType('ws_conf') in Query.php line 1975
  9. at Query->getFieldsBind('ws_conf') in Builder.php line 270
  10. at Builder->buildWhere([], ['field' => ['enname', 'cnname', 'value'], 'table' => 'ws_conf', 'where' => [], ...]) in Builder.php line 240
  11. at Builder->parseWhere([], ['field' => ['enname', 'cnname', 'value'], 'table' => 'ws_conf', 'where' => [], ...]) in Builder.php line 719
  12. at Builder->select(['field' => ['enname', 'cnname', 'value'], 'table' => 'ws_conf', 'where' => [], ...]) in Query.php line 2511
  13. at Query->select() in Conf.php line 9
  14. at Conf->getAllConf() in Common.php line 12
  15. at Common->_initialize() in Controller.php line 59
  16. at Controller->__construct(object(Request))
  17. at ReflectionClass->newInstanceArgs([object(Request)]) in App.php line 359
  18. at App::invokeClass('app\index\controller...') in Loader.php line 479
  19. at Loader::controller('index', 'controller', false, 'Error') in App.php line 581
  20. at App::module(['', null, null], ['app_host' => '', 'app_debug' => true, 'app_trace' => false, ...], null) in App.php line 457
  21. at App::exec(['type' => 'module', 'module' => ['', null, null]], ['app_host' => '', 'app_debug' => true, 'app_trace' => false, ...]) in App.php line 139
  22. at App::run() in start.php line 19
  23. at require('/home/www/web1/yiyua...') in index.php line 17

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
proxy-nokeepalive
1
HTTP_ACCEPT
*/*
HTTP_USER_AGENT
claudebot
HTTP_HOST
www.healthyeyes.cn
PATH
/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin
LD_LIBRARY_PATH
/www/server/apache/lib
SERVER_SIGNATURE
<address>Apache Server at www.healthyeyes.cn Port 80</address>
SERVER_SOFTWARE
Apache
SERVER_NAME
www.healthyeyes.cn
SERVER_ADDR
172.16.133.116
SERVER_PORT
80
REMOTE_ADDR
54.166.234.171
DOCUMENT_ROOT
/home/www/web1/yiyuan/public
REQUEST_SCHEME
http
CONTEXT_PREFIX
CONTEXT_DOCUMENT_ROOT
/home/www/web1/yiyuan/public
SERVER_ADMIN
webmaster@example.com
SCRIPT_FILENAME
/home/www/web1/yiyuan/public/index.php
REMOTE_PORT
36488
GATEWAY_INTERFACE
CGI/1.1
SERVER_PROTOCOL
HTTP/1.1
REQUEST_METHOD
GET
QUERY_STRING
REQUEST_URI
/
SCRIPT_NAME
/index.php
PHP_SELF
/index.php
REQUEST_TIME_FLOAT
1710846816.9851
REQUEST_TIME
1710846816
Environment Variables
empty

ThinkPHP Constants

APP_PATH
/home/www/web1/yiyuan/public/../application/
THINK_VERSION
5.0.24
THINK_START_TIME
1710846816.9855
THINK_START_MEM
259744
EXT
.php
DS
/
THINK_PATH
/home/www/web1/yiyuan/thinkphp/
LIB_PATH
/home/www/web1/yiyuan/thinkphp/library/
CORE_PATH
/home/www/web1/yiyuan/thinkphp/library/think/
TRAIT_PATH
/home/www/web1/yiyuan/thinkphp/library/traits/
ROOT_PATH
/home/www/web1/yiyuan/
EXTEND_PATH
/home/www/web1/yiyuan/extend/
VENDOR_PATH
/home/www/web1/yiyuan/vendor/
RUNTIME_PATH
/home/www/web1/yiyuan/runtime/
LOG_PATH
/home/www/web1/yiyuan/runtime/log/
CACHE_PATH
/home/www/web1/yiyuan/runtime/cache/
TEMP_PATH
/home/www/web1/yiyuan/runtime/temp/
CONF_PATH
/home/www/web1/yiyuan/public/../application/
CONF_EXT
.php
ENV_PREFIX
PHP_
IS_CLI
false
IS_WIN
false