• Resolved bdsll33g

    (@bdsll33g)


    Hi,
    I’m using MAMP, PHP Version 5.5.14., MySQL Server version: 5.5.38.
    I’ve gone through the steps to install WP maybe a dozen times, deleting and recreating users and databases, each time with the same result: Error establishing a database connection

    I’ve tried manually changing the wp-config.php file.
    I’ve tried setting the host name to localhost, localhost:8889, 127.0.0.1:8080.

    MAMP menu says that servers are running.

    Help?

    thanks!

Viewing 4 replies - 1 through 4 (of 4 total)
  • No need to create a new database user; use the MAMP default 🙂

    Re-name the wp-config.php file (e.g. wp-config_ORG.php) which will allow the installer to run again.

    Assuming your MAMP installation is configured with it’s default settings:

    Create a new, empty database

    1. go to the MAMP Start Page – select Open start page from the MAMP Control Panel if the page is not already open in one of your browser tabs/windows

    2. select phpMyAdmin from the Tools menu drop down or enter http://localhost:8888/phpmyadmin in a new browser tab/window

    3. in phpMyAdmin, select the Databases tab

    4. enter a database name (lower case, no spaces or special charaters – for this example I’ll use macwordpress1 ) in the Create database box then select the Create button

    5. a notification will show that the above database has been created

    6. notice that the new, empty macwordpress1 database is now in the list in the left side bar

    7. close the phpMyAdmin tab/window as that is all there is to do for the database; the WordPress installer will create the necessary tables and populate them accordingly

    Then start the install again:

    – at the first screen, select the Create a Configuration File button
    – at the next screen, select the Let’s go! button
    – at the next screen enter the following:

    — Database Name: macwordpress1
    — User Name: root (this is the default MAMP database user name)
    — Password: root (this is the default MAMP database password)
    — Database Host: localhost
    — Table Prefix: wp_ (leave as-is)

    – select the Submit button
    – All right, sparky! … select the Run the install button

    Thread Starter bdsll33g

    (@bdsll33g)

    Wow, thanks, 2ninerniner2!
    That worked. Question, though:

    Isn’t there a security reason for creating a unique user and password instead of using “root?” Every set of instructions I found said to create a user and give it all privileges over the db, which I had attempted, over and over again, failing each time. Still baffled as to why it never worked.

    So, if I move this site and db to a remote server, will I need to rename the password, and change the wp-config.php? Anything else?

    thanks again, SO MUCH!!!!

    I too have seen other instructions that say to create a new user and assign all privileges … and then I answer the database connection error posts here 🙂

    On a local install I see no reason not to use the default user as long as one is not setting it up to be accessed from elsewhere; then of course one has to correctly do so.

    Regarding the move to live:

    When you set up the new, empty database on your hosting account into which you will be importing the export file from your local install you will be using the unique user of the hosting account. This is why, after the files are moved from the local site, one has to edit the wp-config.php now on the hosting account with the live site database connection credentials.

    Thread Starter bdsll33g

    (@bdsll33g)

    Thank you, 2ninerniner2, you are my hero!

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