Fatal error: Uncaught PDOException: SQLSTATE[HY000] [2002] Connection refused

エラーメッセージFatal error

問題発生

 状態:-  閲覧数:2,391  投稿日:2018-10-15  更新日:2018-10-15  

昨日まで表示されていたWebページでエラー発生


デバッグ表示した結果
Fatal error: Uncaught PDOException: SQLSTATE[HY000] [2002] Connection refused

MySQLへログイン出来ない


いつの間にかMySQLへログイン出来なくなっている
$ mysql -u root -p
Enter password: 
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (111)



エラーログ確認

 閲覧数:649 投稿日:2018-10-15 更新日:2018-10-15 

エラーログ確認


$ less /var/log/mysqld.log
2018-10-14T06:49:21.522899+09:00 0 [Note] InnoDB: page_cleaner: 1000ms intended loop took 11173ms. The settings might not be optimal. (flushed=134 and evicted=0, during the time.)
2018-10-14T06:51:29.257647+09:00 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
2018-10-14T06:51:29.448835+09:00 0 [Warning] 'NO_ZERO_DATE', 'NO_ZERO_IN_DATE' and 'ERROR_FOR_DIVISION_BY_ZERO' sql modes should be used with strict mode. They will be merged with strict mode in a future release.
2018-10-14T06:51:29.570831+09:00 0 [Note] /usr/sbin/mysqld (mysqld 5.7.21) starting as process 28844 ...
2018-10-14T06:51:29.778503+09:00 0 [Note] InnoDB: PUNCH HOLE support available
2018-10-14T06:51:29.778597+09:00 0 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
2018-10-14T06:51:29.778609+09:00 0 [Note] InnoDB: Uses event mutexes
2018-10-14T06:51:29.778641+09:00 0 [Note] InnoDB: GCC builtin __atomic_thread_fence() is used for memory barrier
2018-10-14T06:51:29.778650+09:00 0 [Note] InnoDB: Compressed tables use zlib 1.2.3
2018-10-14T06:51:29.778662+09:00 0 [Note] InnoDB: Using Linux native AIO
2018-10-14T06:51:29.779597+09:00 0 [Note] InnoDB: Number of pools: 1
2018-10-14T06:51:29.779940+09:00 0 [Note] InnoDB: Using CPU crc32 instructions
2018-10-14T06:51:29.788826+09:00 0 [Note] InnoDB: Initializing buffer pool, total size = 128M, instances = 1, chunk size = 128M
2018-10-14T06:51:29.823086+09:00 0 [Note] InnoDB: Completed initialization of buffer pool
2018-10-14T06:51:29.834727+09:00 0 [Note] InnoDB: If the mysqld execution user is authorized, page cleaner thread priority can be changed. See the man page of setpriority().
2018-10-14T06:51:29.906550+09:00 0 [Note] InnoDB: Highest supported file format is Barracuda.
2018-10-14T06:51:31.422589+09:00 0 [Note] InnoDB: Log scan progressed past the checkpoint lsn 3891279506
2018-10-14T06:51:31.422699+09:00 0 [Note] InnoDB: Doing recovery: scanned up to log sequence number 3891279959
2018-10-14T06:51:31.522988+09:00 0 [Note] InnoDB: Database was not shutdown normally!
2018-10-14T06:51:31.523036+09:00 0 [Note] InnoDB: Starting crash recovery.
2018-10-14T06:51:32.732037+09:00 0 [Note] InnoDB: Starting an apply batch of log records to the database...
InnoDB: Progress in percent: 91 92 93 94 95 96 97 98 99
2018-10-14T06:51:33.328528+09:00 0 [Note] InnoDB: Apply batch completed
2018-10-14T06:52:12.919127+09:00 0 [Note] InnoDB: Removed temporary tablespace data file: "ibtmp1"
2018-10-14T06:52:13.011842+09:00 0 [Note] InnoDB: Creating shared tablespace for temporary tables
2018-10-10T17:57:30.977173+09:00 0 [Note] Event Scheduler: Loaded 0 events
2018-10-10T17:57:30.977640+09:00 0 [Note] /usr/sbin/mysqld: ready for connections.
Version: '5.7.21'  socket: '/var/lib/mysql/mysql.sock'  port: 3306  MySQL Community Server (GPL)
2018-10-10T17:57:31.486220+09:00 0 [Note] InnoDB: Buffer pool(s) load completed at 181010 17:57:31
2018-10-12T03:02:21.094866+09:00 0 [Note] InnoDB: page_cleaner: 1000ms intended loop took 6958ms. The settings might not be optimal. (flushed=0 and evicted=0, during the time.)
2018-10-12T05:01:23.673353+09:00 0 [Note] InnoDB: page_cleaner: 1000ms intended loop took 4515ms. The settings might not be optimal. (flushed=0 and evicted=0, during the time.)
2018-10-12T06:34:29.659837+09:00 0 [Note] InnoDB: page_cleaner: 1000ms intended loop took 4820ms. The settings might not be optimal. (flushed=4 and evicted=0, during the time.)
2018-10-12T06:45:22.227098+09:00 0 [Note] InnoDB: page_cleaner: 1000ms intended loop took 4631ms. The settings might not be optimal. (flushed=0 and evicted=0, during the time.)
2018-10-12T11:36:26.509037+09:00 0 [Note] InnoDB: page_cleaner: 1000ms intended loop took 5165ms. The settings might not be optimal. (flushed=29 and evicted=0, during the time.)
2018-10-12T14:15:58.875740+09:00 0 [Note] InnoDB: page_cleaner: 1000ms intended loop took 5114ms. The settings might not be optimal. (flushed=0 and evicted=0, during the time.)
2018-10-12T15:32:00.146300+09:00 0 [Note] InnoDB: page_cleaner: 1000ms intended loop took 4225ms. The settings might not be optimal. (flushed=0 and evicted=0, during the time.)
2018-10-12T22:20:39.556244+09:00 0 [Note] InnoDB: page_cleaner: 1000ms intended loop took 5591ms. The settings might not be optimal. (flushed=0 and evicted=0, during the time.)
2018-10-13T06:47:21.273807+09:00 0 [Note] InnoDB: page_cleaner: 1000ms intended loop took 4584ms. The settings might not be optimal. (flushed=13 and evicted=0, during the time.)
2018-10-13T10:21:51.835972+09:00 0 [Note] InnoDB: page_cleaner: 1000ms intended loop took 4214ms. The settings might not be optimal. (flushed=0 and evicted=0, during the time.)
2018-10-14T06:49:21.522899+09:00 0 [Note] InnoDB: page_cleaner: 1000ms intended loop took 11173ms. The settings might not be optimal. (flushed=134 and evicted=0, during the time.)
2018-10-14T06:51:29.257647+09:00 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
2018-10-14T06:51:29.448835+09:00 0 [Warning] 'NO_ZERO_DATE', 'NO_ZERO_IN_DATE' and 'ERROR_FOR_DIVISION_BY_ZERO' sql modes should be used with strict mode. They will be merged with strict mode in a future release.
2018-10-14T06:51:29.570831+09:00 0 [Note] /usr/sbin/mysqld (mysqld 5.7.21) starting as process 28844 ...
2018-10-14T06:51:29.778503+09:00 0 [Note] InnoDB: PUNCH HOLE support available
2018-10-14T06:51:29.778597+09:00 0 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
2018-10-14T06:51:29.778609+09:00 0 [Note] InnoDB: Uses event mutexes
2018-10-14T06:51:29.778641+09:00 0 [Note] InnoDB: GCC builtin __atomic_thread_fence() is used for memory barrier
2018-10-14T06:51:29.778650+09:00 0 [Note] InnoDB: Compressed tables use zlib 1.2.3
2018-10-14T06:51:29.778662+09:00 0 [Note] InnoDB: Using Linux native AIO
2018-10-14T06:51:29.779597+09:00 0 [Note] InnoDB: Number of pools: 1
2018-10-14T06:51:29.779940+09:00 0 [Note] InnoDB: Using CPU crc32 instructions
2018-10-14T06:51:29.788826+09:00 0 [Note] InnoDB: Initializing buffer pool, total size = 128M, instances = 1, chunk size = 128M
2018-10-14T06:51:29.823086+09:00 0 [Note] InnoDB: Completed initialization of buffer pool
2018-10-14T06:51:29.834727+09:00 0 [Note] InnoDB: If the mysqld execution user is authorized, page cleaner thread priority can be changed. See the man page of setpriority().
2018-10-14T06:51:29.906550+09:00 0 [Note] InnoDB: Highest supported file format is Barracuda.
2018-10-14T06:51:31.422589+09:00 0 [Note] InnoDB: Log scan progressed past the checkpoint lsn 3891279506
2018-10-14T06:51:31.422699+09:00 0 [Note] InnoDB: Doing recovery: scanned up to log sequence number 3891279959
2018-10-14T06:51:31.522988+09:00 0 [Note] InnoDB: Database was not shutdown normally!
2018-10-14T06:51:31.523036+09:00 0 [Note] InnoDB: Starting crash recovery.
2018-10-14T06:51:32.732037+09:00 0 [Note] InnoDB: Starting an apply batch of log records to the database...
InnoDB: Progress in percent: 91 92 93 94 95 96 97 98 99
2018-10-14T06:51:33.328528+09:00 0 [Note] InnoDB: Apply batch completed
2018-10-14T06:52:12.919127+09:00 0 [Note] InnoDB: Removed temporary tablespace data file: "ibtmp1"
2018-10-14T06:52:13.011842+09:00 0 [Note] InnoDB: Creating shared tablespace for temporary tables
2018-10-14T06:52:13.012120+09:00 0 [Note] InnoDB: Setting file './ibtmp1' size to 12 MB. Physically writing the file full; Please wait ...
2018-10-14T06:52:14.008354+09:00 0 [Note] InnoDB: File './ibtmp1' size is now 12 MB.
2018-10-14T06:52:14.119824+09:00 0 [Note] InnoDB: 96 redo rollback segment(s) found. 96 redo rollback segment(s) are active.
2018-10-14T06:52:14.119890+09:00 0 [Note] InnoDB: 32 non-redo rollback segment(s) are active.
2018-10-14T06:52:14.121335+09:00 0 [Note] InnoDB: Waiting for purge to start
2018-10-14T06:52:14.171763+09:00 0 [Note] InnoDB: Waiting for purge to start
2018-10-14T06:52:14.221942+09:00 0 [Note] InnoDB: Waiting for purge to start
2018-10-14T06:52:14.272169+09:00 0 [Note] InnoDB: Waiting for purge to start
2018-10-14T06:52:14.322391+09:00 0 [Note] InnoDB: Waiting for purge to start
2018-10-14T06:52:15.175901+09:00 0 [Note] InnoDB: page_cleaner: 1000ms intended loop took 45341ms. The settings might not be optimal. (flushed=0 and evicted=0, during the time.)
2018-10-14T06:52:15.209390+09:00 0 [Note] InnoDB: 5.7.21 started; log sequence number 3891279959
2018-10-14T06:52:15.411491+09:00 0 [Note] Plugin 'FEDERATED' is disabled.
2018-10-14T06:52:15.412187+09:00 0 [Note] InnoDB: Loading buffer pool(s) from /var/lib/mysql/ib_buffer_pool
2018-10-14T06:52:15.911183+09:00 0 [ERROR] Can't open shared library '/usr/lib64/mysql/plugin/ha_mroonga.so' (errno: 2 /usr/lib64/mysql/plugin/ha_mroonga.so: cannot open shared object file: No such file or directory)
2018-10-14T06:52:15.911416+09:00 0 [Warning] Couldn't load plugin named 'Mroonga' with soname 'ha_mroonga.so'.
2018-10-14T06:52:15.913913+09:00 0 [Note] Plugin 'validate_password' is disabled.
2018-10-14T06:52:15.914451+09:00 0 [Note] Mecab: Trying createModel(--rcfile=/usr/lib64/mysql/mecab/etc/mecabrc)
2018-10-14T06:52:15.921024+09:00 0 [ERROR] Mecab: createModel() failed: param.cpp(69) [ifs] no such file or directory: /path/to/mysql/lib/mecab/lib/mecab/dic/ipadic_euc-jp/dicrc
2018-10-14T06:52:15.921055+09:00 0 [ERROR] Plugin 'mecab' init function returned error.
2018-10-14T06:52:16.132012+09:00 0 [Note] Found ca.pem, server-cert.pem and server-key.pem in data directory. Trying to enable SSL support using them.
2018-10-14T06:52:16.143965+09:00 0 [Warning] CA certificate ca.pem is self signed.
2018-10-14T06:52:16.229120+09:00 0 [Note] Server hostname (bind-address): '*'; port: 3306
2018-10-14T06:52:16.311487+09:00 0 [Note] IPv6 is available.
2018-10-14T06:52:16.311570+09:00 0 [Note]   - '::' resolves to '::';
2018-10-14T06:52:16.311644+09:00 0 [Note] Server socket created on IP: '::'.
2018-10-14T06:52:17.528129+09:00 0 [ERROR] Can't open shared library 'ha_mroonga.so' (errno: 0 /usr/lib64/mysql/plugin/ha_mroonga.so: cannot open shared object file: No such file or directory)
2018-10-14T06:52:17.528199+09:00 0 [ERROR] Can't open shared library 'ha_mroonga.so' (errno: 0 /usr/lib64/mysql/plugin/ha_mroonga.so: cannot open shared object file: No such file or directory)
2018-10-14T06:52:17.528222+09:00 0 [ERROR] Can't open shared library 'ha_mroonga.so' (errno: 0 /usr/lib64/mysql/plugin/ha_mroonga.so: cannot open shared object file: No such file or directory)
2018-10-14T06:52:17.528233+09:00 0 [ERROR] Can't open shared library 'ha_mroonga.so' (errno: 0 /usr/lib64/mysql/plugin/ha_mroonga.so: cannot open shared object file: No such file or directory)
2018-10-14T06:52:17.528244+09:00 0 [ERROR] Can't open shared library 'ha_mroonga.so' (errno: 0 /usr/lib64/mysql/plugin/ha_mroonga.so: cannot open shared object file: No such file or directory)
2018-10-14T06:52:17.528255+09:00 0 [ERROR] Can't open shared library 'ha_mroonga.so' (errno: 0 /usr/lib64/mysql/plugin/ha_mroonga.so: cannot open shared object file: No such file or directory)
2018-10-14T06:52:17.528266+09:00 0 [ERROR] Can't open shared library 'ha_mroonga.so' (errno: 0 /usr/lib64/mysql/plugin/ha_mroonga.so: cannot open shared object file: No such file or directory)
2018-10-14T06:52:17.528278+09:00 0 [ERROR] Can't open shared library 'ha_mroonga.so' (errno: 0 /usr/lib64/mysql/plugin/ha_mroonga.so: cannot open shared object file: No such file or directory)
2018-10-14T06:52:17.528289+09:00 0 [ERROR] Can't open shared library 'ha_mroonga.so' (errno: 0 /usr/lib64/mysql/plugin/ha_mroonga.so: cannot open shared object file: No such file or directory)
2018-10-14T06:52:17.811656+09:00 0 [Note] InnoDB: Buffer pool(s) load completed at 181014  6:52:17
2018-10-14T06:52:18.612662+09:00 0 [Note] Event Scheduler: Loaded 0 events
2018-10-14T06:52:18.615046+09:00 0 [Note] /usr/sbin/mysqld: ready for connections.
Version: '5.7.21'  socket: '/var/lib/mysql/mysql.sock'  port: 3306  MySQL Community Server (GPL)
2018-10-14T22:45:45.248834+09:00 0 [Note] InnoDB: page_cleaner: 1000ms intended loop took 4220ms. The settings might not be optimal. (flushed=0 and evicted=0, during the time.)
2018-10-15T07:30:26.802650+09:00 0 [Note] InnoDB: page_cleaner: 1000ms intended loop took 4741ms. The settings might not be optimal. (flushed=0 and evicted=0, during the time.)
2018-10-15T07:50:23.328205+09:00 0 [Note] InnoDB: page_cleaner: 1000ms intended loop took 4752ms. The settings might not be optimal. (flushed=0 and evicted=0, during the time.)


MySQL再起動


エラーログ見ても良く分からないので、MySQL再起動させてみる
$ sudo service mysqld restart
[sudo] password for ☆☆: 
Redirecting to /bin/systemctl restart mysqld.service


リダイレクトされたので、次回からは下記で良いと思われ
$ systemctl restart mysqld.servic

再起動した結果
・エラー原因は不明だが、取りあえず、Webサイトは正常表示されるようになった


( ! ) Fatal error: Uncaught PDOException: SQLSTATE[22001]: String data, right truncated: 1406 Data too long for column

Fatal error: Uncaught League\OAuth1\Client\Credentials\CredentialsException: Received HTTP status code [401] with message "現在この機能は一時的にご利用いただけません" when getting token credentials.

コメント投稿(ログインが必要)



類似度ページランキング
順位 ページタイトル抜粋
1 Fatal error: Uncaught PDOException: SQLSTATE[HY000] [2002] Connection refused 48
2 ( ! ) Fatal error: Uncaught PDOException: SQLSTATE[HY093]: Invalid parameter number: parameter was not defined 37
3 Fatal error: Uncaught exception 'PDOException' with message 'SQLSTATE[23000]: Integrity constraint violation 35
4 Parse error: syntax error, unexpected T_INCLUDE, expecting T_FUNCTION 34
5 ( ! ) Fatal error: Uncaught PDOException: SQLSTATE[22001]: String data, right truncated: 1406 Data too long for column 34
6 ( ! ) Fatal error: Uncaught PDOException: SQLSTATE[22001]: String data, right truncated: 1406 Data too long for column 34
7 Parse error: syntax error, unexpected T_INCLUDE_ONCE, expecting T_FUNCTION 33
8 Parse error: syntax error, unexpected T_REQUIRE, expecting T_FUNCTION 33
9 Parse error: syntax error, unexpected T_DOUBLE_ARROW in △△ on line □□ 33
10 ( ! ) Fatal error: Uncaught PDOException: SQLSTATE[23000]: Integrity constraint violation: 1048 Column 'カラム名' cannot be null 33
11 A database error has occoured. SQLSTATE[HY000]: General error: 14 unable to open database file 33
12 Fatal error: Uncaught exception 'PDOException' with message 'SQLSTATE[HY000]: General error: 1030 Got error 139 from storage engine' 33
13 ( ! ) Fatal error: Uncaught PDOException: SQLSTATE[HY093]: Invalid parameter number: number of bound variables does not match number of tokens 32
14 Parse error: syntax error, unexpected T_DECLARE, expecting T_STRING in ○○ on lin 32
15 Warning: PDO::query(): LOAD DATA LOCAL INFILE forbidden 32
16 Parse error: syntax error, unexpected T_REQUIRE_ONCE, expecting T_FUNCTION 32
17 Fatal error: Uncaught Error: Class 'Stripe\Checkout\Session' not found 31
18 Parse error: syntax error, unexpected 'public' (T_PUBLIC) 31
19 creating database ERROR!!: exception 'PDOException' with message 'SQLSTATE[HY000]: General error: 1 table tally already exists' 30
20 Fatal error: Uncaught exception 'PDOException' with message 'SQLSTATE[28000] [1045] Access denied for user 'データベースユーザー名'@'localhost' (using password: YES)' 30
2026/7/21 5:07 更新
週間人気ページランキング / 7-14 → 7-20
順位 ページタイトル抜粋 アクセス数
1 PHP用語 10
2 コンストラクタ デストラクタ | クラスとオブジェクト 4
3 ログイン 3
4 型キャスト | 型 2
4 セッション名 | セッション 2
4 エラーレベル一覧(error_reportingの設定) 2
4 カテゴリ一覧 2
4 ゲストコメント一覧ページ 2
4 Fatal error: Uncaught exception 'PDOException' with message 'SQLSTATE[HY000]: General error: 23 Out of resources when opening file '/tmp/#sql_2dd6_0.MYI' (Errcode: 24)' | エラーメッセージ 2
4 実際に遭遇した例 2
4 session.entropy_fileデフォルト設定値 2
4 デリミタ 2
4 PHPで定数を定義する方法は2種類ある / 配列定数の定義 2
4 Parse error: syntax error, unexpected $end in ○○.php on line △△ | Parse error(エラーメッセージ) 2
4 PHPでcurlを使用するためには?/ 2.オプション設定 / curlでPOST送信 2
4 You currently have Essential access which includes access to Twitter API v2 endpoints only. If you need access to this endpoint, you’ll need to apply for Elevated access via the Developer Portal. | Twitter API(エラーメッセージ) 2
4 htmlspecialchars / htmlentities / addslashes / mysql_real_escape_string / mysqli_real_escape_string | セキュリティ 2
4 デフォルト引数 | 関数 2
4 Fatal error: Uncaught Error: Class 'Mecab_Tagger' not found in /var/www/★★.php:☆☆ | Fatal error(エラーメッセージ) 2
4 遭遇例1.存在する間違ったデータベース名を指定 2
2026/7/21 5:05 更新