• Hi all,

    I’ve just followed a video and these installation instructions: https://codex.wordpress.org/Installing_WordPress_Locally_on_Your_Mac_With_MAMP

    i have installed MAMP, created a database MySQL and filled the values in wp_config.php (password, user, database name …) but still doesn’t work.

    this is the error message:

    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.

    this is the content of my wp-config.php file http://pastebin.com/BQzw8Ftc

    and these some error messages i found in php-error.log:

    '');' (T_CONSTANT_ENCAPSED_STRING) in /Applications/MAMP/htdocs/wp-config.php on line 22
    [14-Mar-2014 13:26:36 Europe/Berlin] PHP Parse error:  syntax error, unexpected '@' in /Applications/MAMP/htdocs/wp-config.php on line 22
    [14-Mar-2014 13:26:43 Europe/Berlin] PHP Parse error:  syntax error, unexpected '@' in /Applications/MAMP/htdocs/wp-config.php on line 22
    [14-Mar-2014 13:27:11 Europe/Berlin] PHP Parse error:  syntax error, unexpected '');' (T_CONSTANT_ENCAPSED_STRING) in /Applications/MAMP/htdocs/wp-config.php on line 25
    [14-Mar-2014 13:27:29 Europe/Berlin] PHP Parse error:  syntax error, unexpected '');' (T_CONSTANT_ENCAPSED_STRING) in /Applications/MAMP/htdocs/wp-config.php on line 25

    Tank you!

Viewing 10 replies - 1 through 10 (of 10 total)
  • Thread Starter itsnotonlyrocknroll

    (@itsnotonlyrocknroll)

    sorry for some reason the content of the wp-conf.php file is not showing above:
    her it is

    <?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 */
    
    [ deleted for safety sake ]
    
    /** 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');

    thanks again

    First: never post your full WP-CONFIG.PHP file here. You never want to share your database details including the username and password, even when it’s just on your local machine.

    Second: don’t use “root” as a user for your WordPress database. Create a new user and password specifically for this (something like “wpuser” or something).

    Then, the problem itself. It’s possible things go wrong because your database name and username in WP-CONFIG.PHP are encapsulated by single quote signs, instead of apostrophes.

    BAD:

    define('DB_NAME', ‘wordpressdb’);

    GOOD:

    define('DB_NAME', 'wordpressdb');

    Try using “regular” single quote signs (the one next to the ENTER key) and see if that makes a difference.

    Thread Starter itsnotonlyrocknroll

    (@itsnotonlyrocknroll)

    thank you, I will try that…is there any way to delete my config details now? thanks

    Thread Starter itsnotonlyrocknroll

    (@itsnotonlyrocknroll)

    Hi, i didn’t succeed…now there is simply a blank page on the browser…i notice that I keep receiving this error messages on erro.log:

    [14-Mar-2014 16:28:18 Europe/Berlin] PHP Parse error: syntax error, unexpected ”);’ (T_CONSTANT_ENCAPSED_STRING) in /Applications/MAMP/htdocs/wp-config.php on line 25

    could it be this line below? (copied from config.php)
    /** The Database Collate type. Don’t change this if in doubt. */
    define(‘DB_COLLATE’, ”);

    do I need to put anything between the single quote sign for DB_COLLATE?

    another question: not sure i am using the single quote sign, i type the one close to the enter key but it looks more like an apostrophe, i don’t see any other sign like that on my keyboard (mac keyboard)

    thank you again

    The DB_COLLATE line is fine.

    According to what you posted on Pastebin, line 25 is not that line, but the one where you enter the password.

    Thread Starter itsnotonlyrocknroll

    (@itsnotonlyrocknroll)

    ok, still can’t find how to fix the error, I tried all suggested but still doesn’t work, any other suggestion? thank you

    Thread Starter itsnotonlyrocknroll

    (@itsnotonlyrocknroll)

    please do ask me if you need any more details in order to help solving this.
    cheers

    Thread Starter itsnotonlyrocknroll

    (@itsnotonlyrocknroll)

    is there anybody out there that could follow me with a step by step help?

    You really just need to check any typos, missing brackets, wrong apostrophes, etc. That’s likely the cause of the problem.

    Thread Starter itsnotonlyrocknroll

    (@itsnotonlyrocknroll)

    ok, i will try again, thanks

Viewing 10 replies - 1 through 10 (of 10 total)
  • The topic ‘new wp user – error establishing database connection’ is closed to new replies.