亚洲在线久爱草,狠狠天天香蕉网,天天搞日日干久草,伊人亚洲日本欧美

為了賬號安全,請及時綁定郵箱和手機立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

無法安裝 WordPress 錯誤:“無法連接到數據庫”

無法安裝 WordPress 錯誤:“無法連接到數據庫”

PHP
料青山看我應如是 2022-10-28 09:30:11
Ubuntu 上的 Apache2,沒有 SELinux。我正在嘗試安裝 WordPress 的新服務器,但出現錯誤cannot connect to database我可以使用命令行登錄mysql -u user -p database很好,端口 3306 是活的。root@localhost:/home/www/services.com# netstat -anActive Internet connections (servers and established)Proto Recv-Q Send-Q Local Address           Foreign Address         State      tcp        0      0 127.0.0.1:3306          0.0.0.0:*               LISTEN     tcp        0      0 127.0.0.53:53           0.0.0.0:*               LISTEN     tcp        0      0 0.0.0.0:22              0.0.0.0:*               LISTEN          tcp6       0      0 :::80                   :::*                    LISTENroot@localhost:/home/www/services.com# cat wp-config.phproot@localhost:/home/www/services.com# ufw 狀態Status: inactive完整錯誤:Warning: mysqli_real_connect(): The server requested authentication method unknown to the client [caching_sha2_password] in /home/www/services.com/wp-includes/wp-db.php on line 1633Warning: mysqli_real_connect(): (HY000/2054): The server requested authentication method unknown to the client in /home/www/services.com/wp-includes/wp-db.php on line 1633The server requested authentication method unknown to the clientError establishing a database connectionThis either means that the username and password information in your wp-config.php file is incorrect or we can’t contact the database server at localhost. This could mean your host’s database server is down.    Are you sure you have the correct username and password?    Are you sure you have typed the correct hostname?    Are you sure the database server is running?If you’re unsure what these terms mean you should probably contact your host. If you still need help you can always visit the WordPress Support Forums.我還檢查了用戶名中的空格或錯誤,并閱讀了許多其他類似的帖子。如何讓 WordPress 連接到 MySQL?
查看完整描述

1 回答

?
慕尼黑5688855

TA貢獻1848條經驗 獲得超2個贊

您使用的 MySQL 8 服務器已將caching_sha2_password插件設置為默認密碼插件。

(參見:https ://dev.mysql.com/doc/refman/8.0/en/caching-sha2-pluggable-authentication.html和https://dev.mysql.com/doc/refman/8.0/en/upgrading -from-previous-series.html#upgrade-caching-sha2-password

7.1.16 或 7.2.4 之前的 PHP 版本不支持caching_sha2_password.

(見:https ://www.php.net/manual/en/mysqli.requirements.php )

mysql_native_password您可以通過直接在 mysql 控制臺中使用查詢來臨時解決此問題:

ALTER USER 'services.com'@'localhost' IDENTIFIED WITH mysql_native_password BY '1111';

或者更好的是找到并編輯 my.cnf (Linux Distros) 或 my.ini 并將default_authentication_plugin值更改為:

default_authentication_plugin=mysql_native_password

并重新啟動 MySQL 服務器。


查看完整回答
反對 回復 2022-10-28
  • 1 回答
  • 0 關注
  • 155 瀏覽

添加回答

舉報

0/150
提交
取消
微信客服

購課補貼
聯系客服咨詢優惠詳情

幫助反饋 APP下載

慕課網APP
您的移動學習伙伴

公眾號

掃描二維碼
關注慕課網微信公眾號