I am trying to install Wordpress in my localhost Xampp server
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. 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 );
in wp-config.php but not solved.......
This means wordpress can't find your database.
Navigate to 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.
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
/** 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.
It's done !!
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.