【问题标题】:WordPress 'Error establishing a database connection'WordPress“建立数据库连接时出错”
【发布时间】:2021-05-28 11:45:21
【问题描述】:

我正在尝试在WordPress 开始我的第一个项目并输入这些数据

  1. Database Namewp-project-1
  2. DB_USERroot
  3. DB_PASSWORD:``
  4. DB_HOST : localhost
  5. Table Prefix : wp_

在我的wp-config-sample.php:

define( 'DB_NAME', 'wp-project-1' );

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

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

/** MySQL hostname */
define( 'DB_HOST', 'localhost' );

/** Database Charset to use in creating database tables. */
define( 'DB_CHARSET', 'utf8' );

/** The Database Collate type. Don't change this if in doubt. */
define( 'DB_COLLATE', '' );

但是当我提交它们时它会说这样的错误:

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 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.

这里我使用的是xampp服务器,我的xampp端口号是3307(我改了,因为3306每次都很忙。)

我该如何解决?

【问题讨论】:

    标签: wordpress xampp


    【解决方案1】:

    请将您的 wp-config-sample.php 文件更改为 wp-config.php

    【讨论】:

      【解决方案2】:

      在 xampp 上,您可以打开控制面板,其中显示 apache hit the config select php ini 并找到以下内容

      mysqli.default_port=
      

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 2015-08-11
        • 2012-12-29
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2017-07-05
        • 2017-07-13
        相关资源
        最近更新 更多