[英]Error establishing a database connection in my localhost
I am trying to install Wordpress in my localhost Xampp server我正在尝试在我的 localhost Xampp 服务器中安装 Wordpress
But every time I got an error message with但是每次我收到错误消息时
error establishing 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.
这要么意味着您的 wp-config.php 文件中的用户名和密码信息不正确,要么我们无法联系 localhost 上的数据库服务器。 This could mean your host's database server is down.
这可能意味着您主机的数据库服务器已关闭。
I have already googling but not get the correct answer yet.我已经谷歌搜索但还没有得到正确的答案。
I add define( 'WP_ALLOW_REPAIR', true );
我添加了
define( 'WP_ALLOW_REPAIR', true );
in wp-config.php but not solved.......在 wp-config.php 但没有解决......
This means wordpress can't find your database.这意味着 wordpress 无法找到您的数据库。
Navigate to http://localhost/phpmyadmin .导航到http://localhost/phpmyadmin 。 Where it says create new database, choose a name for your database.
在它说创建新数据库的地方,为您的数据库选择一个名称。
Next, open up wp-config.php in the root of your wordpress folder, and update the four values shown below to reflect your new database.接下来,打开 wordpress 文件夹根目录中的 wp-config.php,并更新下面显示的四个值以反映您的新数据库。
The default credentials for your newly created database are:新创建的数据库的默认凭据是:
/** The name of the database for WordPress */
define('DB_NAME', 'case sensitive chosen db name');
/** MySQL database username */
define('DB_USER', 'root');
/** MySQL database password */
define('DB_PASSWORD', '');
/** MySQL hostname */
define('DB_HOST', 'localhost');
I have solved my error as below procedure.我已经按照以下程序解决了我的错误。
While installing Wordpress in localhost, first set some credentials of the file wp-config-sample.php
as below在 localhost 中安装 Wordpress 时,首先设置文件
wp-config-sample.php
一些凭据,如下所示
/** The name of the database for WordPress */
define( 'DB_NAME', 'learn_wordpress' );
/** MySQL database username */
define( 'DB_USER', 'root' );
/** MySQL database password */
define( 'DB_PASSWORD', '' );
/** MySQL hostname */
define( 'DB_HOST', 'localhost' );
and save the file name as wp-config.php
and run again localhost/wordpress
in the url.并将文件名保存为
wp-config.php
并在 url 中再次运行localhost/wordpress
。
It's done !!完成 !!
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.