php - 建立数据库连接时出错

标签 php mysql wordpress

在尝试安装 wordpress 时我收到以下错误

enter image description here

enter image description here

我使用 wampserver 我已经更改了 wp-config.php 文件,现在它看起来像这样:

define('DB_NAME', 'wordpress');

/** MySQL database username */
define('DB_USER', 'root');

/** MySQL database password */
define('DB_PASSWORD', 'root');

/** MySQL hostname */
define('DB_HOST', 'localhost');//i used 127.0.0.1 too but no matter
define('WP_DEBUG', true);

wp-db.php 文件: 1379行:

mysqli_real_connect( $this->dbh, $host, $this->dbuser, $this->dbpassword, null, $port, $socket, $client_flags );

1409行:

$this->dbh = mysqli_connect( $this->dbhost, $this->dbuser, $this->dbpassword, $new_link, $client_flags );

但仍然没有结果我不知道该怎么办有人可以帮助我吗?

最佳答案

如果您使用的是 xampp/wamp 的默认配置,请尝试

define('DB_PASSWORD', '');//对于本地主机

通常是本地主机数据库配置:-

host = localhost
user = root
password = '' (blank)

关于php - 建立数据库连接时出错,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27010062/

相关文章:

php - Smarty PHP 从字符串中删除特定文本

php - 在 php 中将数据导出为 csv 文件时出现空白行

php - 将json数组插入mysql数据库

mysql - SQLite "split"行分成多行

html - wp_editor 始终将 <br> 转换为 <p> </p>

mysql - 从序列化数据中检索特定字段

php - 如何将我的网站、mySQL、php 页面、文件、设置等迁移到 Amazon EC2?

php - Symfony2单元测试获取$_GET参数

php - Codeigniter 数据库类在插入时截断文本

css - 如何在 Wordpress 的 Kalium 主题上将 Logo 居中?