• Resolved sandrabowers

    (@sandrabowers)


    I have just downloaded and installed MAMP and WordPress4.3 and am having problems getting it working.
    I am getting an error
    Error establishing a 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.

    Are you sure you have the correct username and password?
    Are you sure that you have typed the correct hostname?
    Are you sure that the database server is running?

    I have stopped, restarted both MAMP and my PC (Windows 8)
    Hopefully someone can tell me that I have missed something simple
    By the way I am not really very technical – was not sure about fiddling with the wp-config.php file as saw somewhere that I should not (cannot find that thread now)
    Thanks
    Sandra

Viewing 10 replies - 1 through 10 (of 10 total)
  • Hello,

    Have you seen this guide on how to install WordPress locally using MAMP?

    Regards

    KC

    Thread Starter sandrabowers

    (@sandrabowers)

    Hi KC, no I had not seen that one, but it is the same as I have followed from elsewhere, it all works OK until I click ‘submit’ after entering database connection details – I then get the error
    Sandra

    Hi Sandra,

    Just to confirm:

    – you have installed MAMP with the default settings; that is, you have not changed the document root or the server ports

    – you have MAMP running and both Apache and MySQL servers are also running (check boxes filled on MAMP Control panel)

    – you have created a new, empty database using phpMyAdmin by accessing it from the MAMP Start Page > Tools

    At the Database connection screen, this is what you need to enter:

    Database Name: whatever you named it when you created it (no spaces in the name)

    User Name: root <this is the default MAMP database user – this value is shown on the MAMP Start Page>

    Password: root <this is the default MAMP database user pwd – this value is shown on the MAMP Start Page>

    Database Host: localhost

    Table Prefix: wp_ <leave as-is>

    Give that a go ??

    BTW, the link in the other post is for installing MAMP on a Mac; it’s slightly different for Windows in that by default the Apache port is 80.

    Cheers!
    Lyle

    I am having the same (or a very similar) problem installing WordPress on a 2nd site in MAMP. I’m using MAMP PRO 3.4 on a mac… so let me know if I should start a new thread instead.

    I have 3 site folders inside MAMP’s htdocs: a non-WordPress site, a working WordPress 4.2 site, and site #3. I’m trying to install WordPress 4.3 on the third site, but I can’t complete wp_config.php setup with either auto-install or manual edits. Everything I’ve tried results in “Error establishing database connection”.

    Here are the values I’ve tried (both manually and auto-install) for wp_config.php:

    • Database Name: “wpress”, “wordpress”, site’s name (all 3 exist)
    • username/pw: root (MAMP default)
    • Database host: localhost, 127.0.0.1, site’s MAMP PRO hostname, localhost:/Applications/MAMP/tmp/mysql/mysql.sock
    • Table Prefix: wp_, qp_

    Initially, I used the same procedure for site #3 that I’d used for the other currently working WP install (Installing WP locally on your Mac with MAMP).
    I tried turning MAMP off and on again. I’ve deleted and re-created the databases. I’ve used both default (8888/8889) and non-default (80/3306) port settings for Apache and MySQL. I created a sym link
    (sudo ln -s /tmp/mysql.sock /Applications/MAMP/tmp/mysql/mysql.sock, and also tried the reverse) and verified that my php.ini template file includes
    mysql.default_socket = /Applications/MAMP/tmp/mysql/mysql.sock. Nothing has worked — everything results in the “Error establishing database connection” screen.

    How can we get around this error and install WordPress?

    Thanks ??
    – ghyll

    Thread Starter sandrabowers

    (@sandrabowers)

    Hi Lyle – yes but when I installed MAMP I went into the setup and clicked on ‘default’ settings to get the ports 8888 and 8889.

    I have tried using root and creating a new user but both give the same problem.

    Thanks
    Sandra

    Thread Starter sandrabowers

    (@sandrabowers)

    If this helps, this is the URL when getting the database error https://localhost:8888/wordpress43/wp-admin/setup-config.php?step=2
    Sandra

    Thread Starter sandrabowers

    (@sandrabowers)

    oops, sorry did not mean to post that as a link

    @ghyll – yes, please start your own thread ??

    Sandra,

    What do you get when you enter https://localhost:8888 ?

    BTW, use the backtick character to enclose links so that they are just text ??

    Normally, with MAMP for Windows, one does not change the ports. Go in an set them back to the defaults and try that ??

    Thread Starter sandrabowers

    (@sandrabowers)

    I get the index page showing wordpress43 directory

    When I installed MAMP it did not install with the defaults set, as it was not working, I went in to check the preferences and the ports were not as expected so i clicked ‘set mamp ports to default’

    Thread Starter sandrabowers

    (@sandrabowers)

    I have it working – I re-read ghyll’s message at the end it says ‘BTW, the link in the other post is for installing MAMP on a Mac; it’s slightly different for Windows in that by default the Apache port is 80.’
    So I went into MAMP and changed the ports and it is working.
    Thanks for all your help, sorry to be such a divvy
    Sandra

Viewing 10 replies - 1 through 10 (of 10 total)
  • The topic ‘MAMP localhost – Error establishing a database connection’ is closed to new replies.