Support » Installing WordPress » Error establishing a Database Connection

  • I am trying to install WordPress 4.8.2 on my Windows 7 64 pc, using WAMP Server 3.1.0 (64) as the local server. This is the first time I have ever tried doing anything like this. Every time I try to set up WordPress, I get the same error when I attempt to set up the database connection – Error establishing a database connection.

    I have tried Googling this error message, but haven’t found anything that has helped me. This is what I have done so far:
    I have successfully installed Wamp Server, and the tray icon says “All services running”.
    I have created a blank MySQL database in Wamp via phpMyAdmin. I have called it “wordpressdb”. The username has been left at the default “root”, and the password field is left blank.
    I have copied the extracted WordPress folder into the C:\wamp64\www folder. I have renamed the WordPress folder to “mysite”.
    In order to set up WordPress I enter “localserver/mysite/” in my browser.This opens the WordPress language selection page. I select English (Australia)
    I then get asked for the database information. I enter:
    Database Name “wordpressdb”
    Username “root”
    Password: field left blank
    Database host: localhost
    Table prefix wp_
    Then I get the “Error establishing a database connection”.

    Can anyone help me with this?

    The reason I am trying to run WordPress on my personal PC is so that I can get used to it before I take the next step and pay for web hosting services.

Viewing 6 replies - 1 through 6 (of 6 total)
  • Keith


    Try using the default “test” database as your database. This is the default development/testing database built into MySQL. When developing/designing locally, security is not usually much of a concern so I usually just use the default “test” db, root user, blank pw.

    Thanks for the suggestion. I tried using “test” as the database name, “root” as user, password blank, and “localhost” as the database host, but I got the same error message.



    Go to the WordPress config file and check whether you have used same information which you used on the server for “database name” “database username” and password.

    I’m sorry if I am missing something obvious – I am extremely new at this. The problem I am describing happens at the point when WordPress is first attempting to generate a wp-config.php file. Because it is unable to establish a connection to the database, the setup process is aborted and no config file is created. There is no wp-config.php file present in the wordpress folder – only wp-config-sample.php. I tried following online instructions to create a wp-config.php manually, but couldn’t get it to work.

    • This reply was modified 1 month, 3 weeks ago by  pickledpepper.


    HI @pickledpepper,

    The response I supplied to you is due to a few reasons. If using the ‘test’ database (built into MySQL) fails, there is a chance that WAMP is not correctly installed or working correctly. I use a different AMP stack called XAMPP for my development, but have used WAMP and the concepts are the same.

    I would suggest reading this post by a reputable blog called wpBegginer:

    Just keep in mind the issue you are having is almost ALWAYS related to the incorrect use of database name, username, and password 🙂

    Thanks for the suggestions. I have finally found the problem, and it leaves me rather baffled. Prior to posting in this forum I did first read a number of online instructions, including the one in the previous post. None of them worked. After describing my problem in detail on the Wamp forum, I was informed that, in order to get WordPress to work there were three crucial steps: 1) Install Wamp, 2)Create a Virtual Host using Wamp 3)Install WordPress in the site folder specified when creating the Virtual Host. This worked perfectly. I find it really strange that none of the online instructions mention the need for a Virtual Host. They all say – first install Wamp, then install WordPress in the localhost/www/ folder.

Viewing 6 replies - 1 through 6 (of 6 total)
  • You must be logged in to reply to this topic.