Ticker

6/recent/ticker-posts

Header Ads Widget

Fix the 'Error Establishing a Database Connection' in WordPress in Xampp Server

 

 

If you are facing this kind of error installing Wordpress to your local Xampp server then this is the article you are looking for. Please follow these  instructions step by step to get rid of this kind of error.


I assume you have downloaded the wordpress installation zip file from wordpress.org and extracted it in your Xampp/htdocs folder.You started your Xampp and MySQL server. Then you opened your browser and typed localhost/test_blog (in this case I'm going to install wordpress in the folder named 'blog_site' ).  It looks like this

 

 

You clicked 'Continue' and then you need to setup your database. 


 

Then you have to press "Let's go"

 

Here you need to provide your database details. For this you need to create a database. I created a database with the named test_blog


 

After filling up those database details if you press "Submit" button then the error comes

 

 

To fix this error you need to go to your Xampp/htdocs/test_blog folder and search for wp-config-sample.php file

 

Just copy the file and paste it there. You'll get a wp-config-sample-Copy.php file. Then just rename the copied file to wp-config.php . Like this:

 

 Then open this file with Notepad or any editor. After opening the file with Notepad you will notice your database information there. Actually there is nothing about your database yet. You need to write your database name, database username, password and host name here. It looks like this:


 

Save the file and go to your Web Browser again.There You'll see this:



 

 

Click install now link and if you see the following "Welcome" screen then you are done.


 

 

But if it shows 'Error Establishing a Database Connection' message again, then check the following steps:

Open your Xampp control panel and check the Port number of your MySQL database. If it is other than 3306 then you are facing problems for your port number. In this case You need to define your port number in you wp-config.php file.  

 

In my case it was like this: My port was 3307.



 

Go to your Xampp/htdocs/test_blog directory again and open the  wp-config.php file. Then write your MySQL port number along with your localhost. 



 

Go to your browser and after refreshing it you may see this again.



Hit "Continue" and you will see the following Welcome Page.




If you see this page then I hope that you have successfully solved your Error. This error basically happens if your port number is other than 3306. If you liked this article then please subscribe my Youtube channel  and feel free to comment. Thank you!.




Post a Comment

3 Comments

  1. This comment has been removed by the author.

    ReplyDelete
  2. I was looking for an appropriate clarification on the WordPress maintenance service provider. I much appreciate the administrator for sharing such extraordinary substance on this theme. Presently I have all I require about it. Here’s another enlightening substance for WordPress Maintenance Service Provider , you will get well-informed data about it here.

    ReplyDelete