gpt4 book ai didi

php - Wordpress:建立数据库连接时出错。是的,我已经尝试过了。然后

转载 作者:行者123 更新时间:2023-11-29 09:17:22 25 4
gpt4 key购买 nike

这让我发疯!我的 MacBook Pro 上安装了一个 Wordpress 测试实例,但它突然停止工作。如果我前往http://localhost:9003/wp-admin/我得到:

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.

Are you sure you have the correct username and password?

Are you sure that you have typed the correct hostname?

Are you sure that 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.

哼!我已经很久没有碰过配置了。以下是相关行现在的样子:

define('DB_NAME', 'wordpress');
define('DB_USER', 'wordpress');
define('DB_PASSWORD', 'wordpress');
define('DB_HOST', 'localhost');
$table_prefix = 'wp_';

这些值都很好:

$ mysql -h localhost -u wordpress --password=wordpress \
> wordpress -e 'select user_login from wp_users'
+------------+
| user_login |
+------------+
| simon |
+------------+

MySQL 错误日志中没有任何内容,Apache 的错误日志中也没有任何内容。我尝试过使用不同的 MySQL 用户和不同的数据库,但出现相同的错误。我很沮丧 - 有 WordPress 专家知道我错过了什么吗?

<小时/>

php --ri mysql 的输出:

$ php --ri mysql

mysql

MySQL Support => enabled
Active Persistent Links => 0
Active Links => 0
Client API version => mysqlnd 5.0.7-dev - 091210 - $Revision: 294543 $

Directive => Local Value => Master Value
mysql.allow_persistent => On => On
mysql.max_persistent => Unlimited => Unlimited
mysql.max_links => Unlimited => Unlimited
mysql.default_host => no value => no value
mysql.default_user => no value => no value
mysql.default_password => no value => no value
mysql.default_port => no value => no value
mysql.default_socket => /var/mysql/mysql.sock => /var/mysql/mysql.sock
mysql.connect_timeout => 60 => 60
mysql.trace_mode => Off => Off
mysql.allow_local_infile => On => On

最佳答案

关于php - Wordpress:建立数据库连接时出错。是的,我已经尝试过了。然后,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3662860/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com