248 文字
1 分
Unexpected server respose while doing caching_sha2 authの直し方

概要#

  • PHP7.2の環境でWordpressが動かなくなった。
  • MySQL 8.0にあがったのが理由

解決方法#

[23-Aug-2018 15:59:59 UTC] PHP Warning: mysqli_real_connect(): Unexpected server respose while doing caching_sha2 auth: 109 in /xxxxxxxxx/wp-includes/wp-db.php on line 1531
[23-Aug-2018 16:00:09 UTC] PHP Warning: mysqli_real_connect(): MySQL server has gone away in /xxxxxxxxx/wp-includes/wp-db.php on line 1531
[23-Aug-2018 16:00:09 UTC] PHP Warning: mysqli_real_connect(): (HY000/2006): MySQL server has gone away in /xxxxxxxxx/wp-includes/wp-db.php on line 1531

解決するには、MySQLでパスワードのハッシュ方式を変更してあげる必要がある。

ALTER USER `username`@`localhost` IDENTIFIED WITH caching_sha2_password BY 'same password';

変更後は以下を忘れずに。

FLUSH PRIVILEGES;

これだけで完了。

しばらくしたらPHP側でcaching_sha2がサポートされるらしいので、この記事の対処は不要になるとのことですが、本家PHPのbug reportにはコメントが一切書かれていません。。。

Unexpected server respose while doing caching_sha2 authの直し方
https://blog.teraren.com/posts/unexpected-server-respose-while-doing-caching-sha2-auth/
作者
Yuki Matsukura
公開日
2018-08-24
ライセンス
CC BY-NC-SA 4.0

コメント