Title: Error in Installing WordPress in Localhost
Last modified: February 5, 2025

---

# Error in Installing WordPress in Localhost

 *  Resolved [Gourab Neogi](https://wordpress.org/support/users/gourab7775/)
 * (@gourab7775)
 * [1 year, 4 months ago](https://wordpress.org/support/topic/error-in-installing-wordpress-in-localhost/)
 * Hello,
 *  This is the first time I’m trying to install a WordPress site in my **Windows
   11** laptop using **localhost**. But unfortunately at the very end I’m repeatedly
   facing an error. Please help me out.
 * _**Steps I followed**:_
    1.  Downloaded** XAMPP** from the official website.
    2.  Installed it by following on screen instructions
    3.  Opened the XAMPP Control Panel and started the **Apache** and** MySQL** services.
    4.   - First I tried starting Apache in XAMPP using **port number 80**. But the
           Apache services were not starting. Hence, I changed the port number from
           80 to 85 in** httpd.conf.**
         - In the same file I changed **listen 80** to listen **listen 85** and changed
           the **servername** from **localhost:80** to **localhost:85**.
         - I also changed the port number in **httpd-ssl.conf** from 443 to 4433 and
           the port number for listen from 443 to 4433.
         - For MySQL I changed the port number from 3306 to 3307 in **my.ini**.
    5.  Downloaded the latest version of WordPress.
    6.  Extracted the **wordpress.zip** file into the XAMPP’s _**htdocs**_ folder.
    7.  Created a database for WordPress on [http://localhost/phpmyadmin](http://localhost/phpmyadmin)
        and named it **wordpress**
    8.  Gave all the db permissions to the user _**root**_ .
    9.  Opened [http://localhost:85/wordpress/](http://localhost:85/wordpress/) in 
        my Chrome browser and selected my preferred language English
    10. After that I entered the following database details:
    11.  - _Database Name:_ wordpress
         - _Username_: root
         - _Password_: **\*\*\***
         - _Database Host_: localhost
         - _Table Prefix_: wp_
    12. Then I clicked the _Submit button_ and faced the following error again and 
        again:_**`error establishing a database connection`**_
 * Please let me know what I should do to resolve the error.
 * Thank you,
 * Gourab
    -  This topic was modified 1 year, 4 months ago by [Gourab Neogi](https://wordpress.org/support/users/gourab7775/).

Viewing 7 replies - 1 through 7 (of 7 total)

 *  Moderator [threadi](https://wordpress.org/support/users/threadi/)
 * (@threadi)
 * [1 year, 4 months ago](https://wordpress.org/support/topic/error-in-installing-wordpress-in-localhost/#post-18287598)
 * You must also specify the changed port for MySQL on the host. So probably `localhost:
   3307`
 *  Thread Starter [Gourab Neogi](https://wordpress.org/support/users/gourab7775/)
 * (@gourab7775)
 * [1 year, 4 months ago](https://wordpress.org/support/topic/error-in-installing-wordpress-in-localhost/#post-18288934)
 * [@threadi](https://wordpress.org/support/users/threadi/) I changed the port number
   from 3306 to 3307 in **my.ini**.
 * Thank You
 *  Moderator [threadi](https://wordpress.org/support/users/threadi/)
 * (@threadi)
 * [1 year, 4 months ago](https://wordpress.org/support/topic/error-in-installing-wordpress-in-localhost/#post-18289302)
 * Yes, that’s why you also need to specify this changed port when installing WordPress.
   WordPress otherwise assumes 3306.
 *  Thread Starter [Gourab Neogi](https://wordpress.org/support/users/gourab7775/)
 * (@gourab7775)
 * [1 year, 4 months ago](https://wordpress.org/support/topic/error-in-installing-wordpress-in-localhost/#post-18289962)
 * [@threadi](https://wordpress.org/support/users/threadi/) I have already tried****`
   _Database Host_: localhost:3307` but still didn’t work.
 * Not sure what I am doing worng.
 * Thank You
    -  This reply was modified 1 year, 4 months ago by [Gourab Neogi](https://wordpress.org/support/users/gourab7775/).
 *  Moderator [threadi](https://wordpress.org/support/users/threadi/)
 * (@threadi)
 * [1 year, 4 months ago](https://wordpress.org/support/topic/error-in-installing-wordpress-in-localhost/#post-18290351)
 * Another possibility would be a firewall (perhaps the Windows firewall) that blocks
   this particular port. I also don’t know why you changed the port in the first
   place. Port 3306 is not a problem at all, especially with a local installation.
 *  Thread Starter [Gourab Neogi](https://wordpress.org/support/users/gourab7775/)
 * (@gourab7775)
 * [1 year, 4 months ago](https://wordpress.org/support/topic/error-in-installing-wordpress-in-localhost/#post-18291041)
 * [@threadi](https://wordpress.org/support/users/threadi/) Thank you for sharing
   your knowledge to me. I resolved my problem.
    -  This reply was modified 1 year, 4 months ago by [Gourab Neogi](https://wordpress.org/support/users/gourab7775/).
 *  [Jorge Luiz](https://wordpress.org/support/users/jluizsouzadev/)
 * (@jluizsouzadev)
 * [1 year, 3 months ago](https://wordpress.org/support/topic/error-in-installing-wordpress-in-localhost/#post-18307334)
 * [@gourab7775](https://wordpress.org/support/users/gourab7775/) please, could 
   you share us how you’ve solved the issue. That piece of information could be 
   _helpful _and _useful _for the WordPress community.

Viewing 7 replies - 1 through 7 (of 7 total)

The topic ‘Error in Installing WordPress in Localhost’ is closed to new replies.

## Tags

 * [connection](https://wordpress.org/support/topic-tag/connection/)
 * [database](https://wordpress.org/support/topic-tag/database/)

 * In: [Installing WordPress](https://wordpress.org/support/forum/installation/)
 * 7 replies
 * 4 participants
 * Last reply from: [Jorge Luiz](https://wordpress.org/support/users/jluizsouzadev/)
 * Last activity: [1 year, 3 months ago](https://wordpress.org/support/topic/error-in-installing-wordpress-in-localhost/#post-18307334)
 * Status: resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
