我正在尝试建立一个本地的开发环境。我无法让wordpress连接到mysql。我可以使用以下命令复制错误:
wp core install --url=http://uganda.localhost/ --title="Uganda Aid" --admin_user="Jack" --admin_password="thepassword" --admin_email="JackWinterstein@msf.org"
结果:
Error: Error establishing a database connection. This 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.我试过的事情:
homebrew.mxcl.mysql.plist包括--绑定-地址=*mysql_config --socket producef /tmp/mysql.sockbind-address = *环境
达尔文osx10.14,mysql Ver 8.0.17,nginx版本: nginx/1.17.3,Wordpress 5.2.2,PHP 7.3.9
发布于 2019-09-01 01:41:55
我想通了。问题是客户端不知道caching_sha2_password身份验证方法。为了解决这个问题,我跑了:
ALTER USER jack@localhost IDENTIFIED WITH mysql_native_password BY 'thepassword';我通过:创建一个基本的测试脚本发现了这一点:
<?php
$link = mysqli_connect('localhost', 'jack', 'thepassword');
if (!$link) {
die('Could not connect: ' . mysqli_error());
}
echo 'Connected successfully';
mysqli_close($link);
?>由此产生的错误提到了caching_sha2_password身份验证方法。
https://stackoverflow.com/questions/57741737
复制相似问题