Title: wp-config.php problems.
Last modified: August 21, 2016

---

# wp-config.php problems.

 *  Resolved [tesa113](https://wordpress.org/support/users/tesa113/)
 * (@tesa113)
 * [11 years, 10 months ago](https://wordpress.org/support/topic/wp-configphp-problems/)
 * Hello,
    I would like to run WordPress on my Mac and for that reason I downloaded
   MAMP. I opened MAMP, went to Database and created a new db called WPtestdb. I
   also downloaded WordPress 3.9.1 and I moved the unzipped files to htdocs in MAMP.
   Next I went to wp-config-sample.php and changed it to wp-config.php.
 * Next I opened wp-config.php and edited accordingly like the one displayed bellow:
 *     ```
       <?php
       /**
        * The base configurations of the WordPress.
        *
        * This file has the following configurations: MySQL settings, Table Prefix,
        * Secret Keys, WordPress Language, and ABSPATH. You can find more information
        * by visiting {@link http://codex.wordpress.org/Editing_wp-config.php Editing
        * wp-config.php} Codex page. You can get the MySQL settings from your web host.
        *
        * This file is used by the wp-config.php creation script during the
        * installation. You don't have to use the web site, you can just copy this file
        * to "wp-config.php" and fill in the values.
        *
        * @package WordPress
        */
   
       // ** MySQL settings - You can get this info from your web host ** //
       /** The name of the database for WordPress */
       define('DB_NAME', ‘XXXXXXXXX’);
   
       /** MySQL database username */
       define('DB_USER', ‘yyyyyyy’);
   
       /** MySQL database password */
       define('DB_PASSWORD', ‘zzzzzzz’);
   
       /** MySQL hostname */
       define('DB_HOST', 'localhost');
   
       /** Database Charset to use in creating database tables. */
       define('DB_CHARSET', 'utf8');
   
       /** The Database Collate type. Don't change this if in doubt. */
       define('DB_COLLATE', '');
   
       /**#@+
        * Authentication Unique Keys and Salts.
        *
        * Change these to different unique phrases!
        * You can generate these using the {@link https://api.wordpress.org/secret-key/1.1/salt/ WordPress.org secret-key service}
        * You can change these at any point in time to invalidate all existing cookies. This will force all users to have to log in again.
        *
        * @since 2.6.0
        */
       define('AUTH_KEY',         'put your unique phrase here');
       define('SECURE_AUTH_KEY',  'put your unique phrase here');
       define('LOGGED_IN_KEY',    'put your unique phrase here');
       define('NONCE_KEY',        'put your unique phrase here');
       define('AUTH_SALT',        'put your unique phrase here');
       define('SECURE_AUTH_SALT', 'put your unique phrase here');
       define('LOGGED_IN_SALT',   'put your unique phrase here');
       define('NONCE_SALT',       'put your unique phrase here');
   
       /**#@-*/
   
       /**
        * WordPress Database Table prefix.
        *
        * You can have multiple installations in one database if you give each a unique
        * prefix. Only numbers, letters, and underscores please!
        */
       $table_prefix  = 'wp_';
   
       /**
        * WordPress Localized Language, defaults to English.
        *
        * Change this to localize WordPress. A corresponding MO file for the chosen
        * language must be installed to wp-content/languages. For example, install
        * de_DE.mo to wp-content/languages and set WPLANG to 'de_DE' to enable German
        * language support.
        */
       define('WPLANG', '');
   
       /**
        * For developers: WordPress debugging mode.
        *
        * Change this to true to enable the display of notices during development.
        * It is strongly recommended that plugin and theme developers use WP_DEBUG
        * in their development environments.
        */
       define('WP_DEBUG', false);
   
       /* That's all, stop editing! Happy blogging. */
   
       /** Absolute path to the WordPress directory. */
       if ( !defined('ABSPATH') )
       	define('ABSPATH', dirname(__FILE__) . '/');
   
       /** Sets up WordPress vars and included files. */
       require_once(ABSPATH . 'wp-settings.php');
       ```
   
 * Next I put in the bar [http://localhost:8888/wp-admin/install.php](http://localhost:8888/wp-admin/install.php)
   and pressed Enter
 * This is the message I get
 * 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?
   If you’re unsure what these terms mean you should probably contact your host.
   If you still need help you can always visit the WordPress Support Forums.
 * My host database server is running which means it’s not down.
 * What else can be wrong in here?
    PLEASE HELP. THANK YOU.

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

 *  [catacaustic](https://wordpress.org/support/users/catacaustic/)
 * (@catacaustic)
 * [11 years, 10 months ago](https://wordpress.org/support/topic/wp-configphp-problems/#post-5156170)
 * Did you also grant permissions on that database to the user that you created 
   as well? That’s a step that a lot of people don’t realise, and has caught out
   a lot of people in the past (including me a few times).
 * If that has been done then double-check the usernmae, password and database names
   as _something_ in there would be wrong.
 *  Thread Starter [tesa113](https://wordpress.org/support/users/tesa113/)
 * (@tesa113)
 * [11 years, 10 months ago](https://wordpress.org/support/topic/wp-configphp-problems/#post-5156185)
 * Yes, the database created by me has all the privileges. It takes it automatically
   when it’s created. I checked the username, password, and database name in wp-
   config.php and it’s the same as entered in MAMP.
    No luck so far.
 *  [catacaustic](https://wordpress.org/support/users/catacaustic/)
 * (@catacaustic)
 * [11 years, 10 months ago](https://wordpress.org/support/topic/wp-configphp-problems/#post-5156186)
 * That should normally be all that you need to do. I know it sounds silly, but 
   it may be worth going back and double-checking your settings again, just in case.
   I’ve found a few cases of my own where a spelling mistake that I didn’t see cost
   me half an hour of swearing at the comptuer…
 * If it’s all correct then I’d suggest starting off on some pretty involved de-
   bugging. If it was me I’d place markers around the code where the database connection
   is created to see what step the error happens at and see if you can get the acual
   error back rather then the generic one from WordPress.
 *  Thread Starter [tesa113](https://wordpress.org/support/users/tesa113/)
 * (@tesa113)
 * [11 years, 10 months ago](https://wordpress.org/support/topic/wp-configphp-problems/#post-5156188)
 * I went back and I checked at least 10 times every single letter and punctuation,
   I swear.
    It’s crazy.
 *  [2ninerniner2](https://wordpress.org/support/users/2ninerniner2/)
 * (@2ninerniner2)
 * [11 years, 10 months ago](https://wordpress.org/support/topic/wp-configphp-problems/#post-5156190)
 * Perhaps give this a try:
 * – go to phpMyAdmin and create a new database
    – that’s all; just enter a name(
   e.g. WPTestdb2) and click the Create button – rename the current wp-config.php
   to something else, e.g. wp-config_ORG.php – this will let the installer run again–
   start the install with `http://localhost:8888` (as you have the files in the 
   root (htdocs) – at the first screen, click the Create a Configuration File button–
   at the next screen, click the Let’s go! button – at the next screen, enter the
   following:
 * — Database Name: WPtestdb2 (or whatever you entered)
    — 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)
 * – click the Submit button
    … is your name now “Sparky” ? 🙂 … if so, click the
   Run the install button 🙂
 * An aside, it would be nice to see the wording changed on the first screen to 
   indicate that one try the manual method only IF clicking the Create a Configuration
   File does not work. In the literally 100s of installs I have done on many different
   hosts, I have never, ever had it not work 🙂
 *  Thread Starter [tesa113](https://wordpress.org/support/users/tesa113/)
 * (@tesa113)
 * [11 years, 10 months ago](https://wordpress.org/support/topic/wp-configphp-problems/#post-5156227)
 * You’re the man. I woke up and first thing I did was to check on my email. I followed
   step by step your plan and it worked from the first run.
    I still wonder what
   was the problem with first technique I tried so hard to make it work. Thank you
   so much for your help.
 *  [Valentine](https://wordpress.org/support/users/varantain/)
 * (@varantain)
 * [11 years, 10 months ago](https://wordpress.org/support/topic/wp-configphp-problems/#post-5156232)
 * I noticed that your database, username and password fields are enclosed by curly
   quotes (‘xxx’) instead of straight quotes (‘xxx’). That could be something to
   watch out for in the future.
 *  Thread Starter [tesa113](https://wordpress.org/support/users/tesa113/)
 * (@tesa113)
 * [11 years, 10 months ago](https://wordpress.org/support/topic/wp-configphp-problems/#post-5156234)
 * Ohh, but with all due respect where is the straight one on my MacPro keyboard?
   I did find it in special characters – punctuation…but that can’t be right.
 *  [Valentine](https://wordpress.org/support/users/varantain/)
 * (@varantain)
 * [11 years, 10 months ago](https://wordpress.org/support/topic/wp-configphp-problems/#post-5156236)
 * The key in between colon/semicolon and enter on the US Mac keyboard gives you
   straight quotes. If you copy/pasted your wp-config or edited it in a word processor,
   it was probably converted to curly quotes automagically somewhere along the way.
 *  Thread Starter [tesa113](https://wordpress.org/support/users/tesa113/)
 * (@tesa113)
 * [11 years, 10 months ago](https://wordpress.org/support/topic/wp-configphp-problems/#post-5156237)
 * On my keyboard colon an semicolon is on one key, but I believe now that was the
   problem. When I replaced database, username and password I did erased the straight
   quotes and obviously replaced it with the one I have on my keyboard. Straight
   quote I can only find it in special characters, but if one erase it by accident
   the easiest way is to copy one from the same file and paste it whatever is need
   it. You made a keen observation.
    Thank you.
 *  [catacaustic](https://wordpress.org/support/users/catacaustic/)
 * (@catacaustic)
 * [11 years, 10 months ago](https://wordpress.org/support/topic/wp-configphp-problems/#post-5156265)
 * Just as a note, the straight-vs-“curly” quotes isn’t normally anything to do 
   with the keyboard. It’s normally something that’s done by the program that you’re
   using to edit the file. If you’re on a Mac I’m guessing that you’re uisng TextEdit,
   which does this by default. If you’re going to do much more of this you should
   look at downloading a good text editor or IDE that won’t change the quote marks
   for you. There’s a few options that are good and free, so it’s worth having a
   look around at a few options there.
 *  Thread Starter [tesa113](https://wordpress.org/support/users/tesa113/)
 * (@tesa113)
 * [11 years, 10 months ago](https://wordpress.org/support/topic/wp-configphp-problems/#post-5156273)
 * Yes, it makes sense. Thank you.

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

The topic ‘wp-config.php problems.’ is closed to new replies.

## Tags

 * [MAMP](https://wordpress.org/support/topic-tag/mamp/)
 * [wp-config.php](https://wordpress.org/support/topic-tag/wp-config-php/)

 * In: [Installing WordPress](https://wordpress.org/support/forum/installation/)
 * 12 replies
 * 4 participants
 * Last reply from: [tesa113](https://wordpress.org/support/users/tesa113/)
 * Last activity: [11 years, 10 months ago](https://wordpress.org/support/topic/wp-configphp-problems/#post-5156273)
 * Status: resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
