Support » Localhost Installs » MAMP Error Establishing database connection

  • I’m trying to do a local install of WordPress on a mac using MAMP with mySQL 5.5.33 (which comes with the latest version of MAMP). I’ve created the database and edited my config.php file to use my new DB. and root for the username and pass. I’ve also tried specifying the port for the local host in that part of the config file. I’m not sure what else to try as those seem to fix most other peoples problems.

Viewing 8 replies - 1 through 8 (of 8 total)
  • Cheers.

    Did you edit wp-config-sample.php and the renamed it to ”wp-config.php”? I know it seems silly, but sometimes even the best could do that misstake and forget this.

    If the file name is correct, then there is something wrong with the settings.

    Here is a wp-config.php sample file (on a MAMP install, but applies to all installs):
    http://pastebin.com/mZ1VKE7f

    The important parts is database settings and the database table.

    define( 'DB_NAME', 'mydatabase' );   // Your database name
    define( 'DB_USER', 'root' );     // Never use this on a live site
    define( 'DB_PASSWORD', 'root' );  // Never use this on a live site
    define( 'DB_HOST', 'localhost' ); // MAMP and others 'localhost'

    and:
    $table_prefix = 'wp_myproject'; // WordPress takes care of adding this to the db

    For creating the DB (ok, we are doing this in a reverse order):

    1. Go to: http://localhost:8888/phpMyAdmin/ (Using a standard URL if you have the install at port 8888)

    2. Create database (image link)
    https://dl.dropboxusercontent.com/u/17959832/database1.png

    3. Add user (image link) if this is set, skip to 4.
    https://dl.dropboxusercontent.com/u/17959832/database2.png

    4. Now it should look like this (the row with “root”, the rest of itcan we ignore for this)
    https://dl.dropboxusercontent.com/u/17959832/database3.png

    Now the install should be set up.
    Point the browser to where your site is i.e. http://localhost:8888/myproject

    You may of course know the steps, but others may stumble upon this thread that don’t.
    Let me know how it goes!

    Thanks for the reply Chris.
    I actually tried all of this. I did end up getting it to work by resetting my config file to default and reverting the name to config-sample.php. Seems doing that defaulted it into the install process and then I just had to enter my DB name, User name and pass manually as part of the install process.

    That would be the expected behaviour. WordPress can create a wp-config.php file for you as part of the installation process.

    Thanks esmi,
    That seems to be the case. I didn’t know you could do it that way before. I’m just curious as to why it wouldn’t let me do it the other way.

    Best guess: you’d mistyped the database name or host name into your original wp-config.php file.

    I have the same problem… I do all step I follow in this post but nothing happened…

    some idea?

    ,

    @monkeyvision – per the forum guidelines, please post your own thread unless you’re providing support for this one. Also it’s helpful to supply as much information about your particular localhost server setup as possible.

Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘MAMP Error Establishing database connection’ is closed to new replies.