![](/img/trans.png)
[英]installation failed: could not create directory in wordpress nginx on ubuntu
[英]wordpress installation failed with nginx
我在 CentOS7 上使用 nginx/1.20.1、PHP 7.2.34、mysqld 8.0.27。 我可以打开 wordpress 索引页面,但安装总是失败。 我确定我的用户名、密码和主机名是正确的(即使我添加更多用户或重置密码),但它显示:
建立数据库连接时出错:这意味着您的 wp-config.php 文件中的用户名和密码信息不正确,或者我们无法联系本地主机上的数据库服务器。 这可能意味着您主机的数据库服务器已关闭。
I tried to create my own wp-config.php file and set the configuration, then it would be a HTTP ERROR 500. The log says: PHP Warning: require_once(/var/www/html/wp-config.php): failed在第 50 行打开 stream: Permission denied in /var/www/html/wp-load.php 我不知道为什么我的是第 50 行而其他人是 37。但是,我已经更改了 html 的所有权(甚至是 www ) 文件夹 fo 到 nginx,并将其中的所有文件更改为 777,但它仍然无法正常工作。
我认为 MySQL 未连接到 wordpress 但 3306 端口已打开:tcp6 0 0:::3306:::* LISTEN 31913/mysqld
当我这样做时它仍然不起作用:define('DB_HOST', '127.0.0.1:3306'); 在 wp-config.php
我厌倦了WP-DEBUG,但由于HTTP ERROR 500,它没有显示。我现在还能做什么
我从其他地方阅读并了解到这一点:运行测试 PHP 程序以连接 MySQL
<PHP
<?PHP
$connect =mysqli_connect("localhost","username","password","dbname");
if (!$connect) {
die('error'. mysqli_error());
}
echo 'success';
mysqli_close($link);
?>
它返回:
PHP Warning: mysqli_connect(): The server requested authentication method unknown to the client [caching_sha2_password] in /home/test.php on line 4
PHP Warning: mysqli_connect(): (HY000/2054): The server requested authentication method unknown to the client in /home/test.php on line 4
PHP Warning: mysqli_error() expects exactly 1 parameter, 0 given in /home/test.php on line 7
我当前的 PHP 不支持所需的验证方法(caching_sha2_password),PHP 的默认值是 mysql_native_password。 我改变了它
ALTER USER 'username'@'localhost' IDENTIFIED WITH mysql_native_password BY 'password';
它奏效了。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.