Error establishing a database connection in my 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 !!

Leave a Comment