• Resolved Lewis

    (@lewisdavis88)


    Hello,

    I created a wordpress site locally on my laptop and then simply moved all the files over to the web server via FTP and am now getting the error:

    Error establishing a database connection

    When I browse to the domain.

    Is there anything I need to do in order to get this to work on the new web server? (I was stupidly under the impression that there wasnt anything I needed to change)

    Thanks in advance

    Lewis

Viewing 5 replies - 1 through 5 (of 5 total)
  • You need to edit wp-config.php file database info to the database on localhost different.

    You will find info here
    http://codex.wordpress.org/Installing_WordPress_Locally_on_Your_Mac_With_MAMP

    Thread Starter Lewis

    (@lewisdavis88)

    Hi govpatel,

    where in this file? :

    <?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', 'wordpress');
    
    /** MySQL database username */
    define('DB_USER', 'wordpress');
    
    /** MySQL database password */
    define('DB_PASSWORD', 'wordpress');
    
    /** 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',         'MFmvL:6Ja{-NIat-liYcqT!&.Ft5V3-4/r]h-|3%|I.0BrFQgx-v;UHD:SRktJwW');
    define('SECURE_AUTH_KEY',  'JQKBl8a1StS,);39r0,KG^%%wx7xl3QOJG(z7c;!~cjJ([,,TrBiSvZ{)5)w?r_1');
    define('LOGGED_IN_KEY',    'PE3D#C,&hSUSO!@vKg$UC4poF7EO=V<code>?0!wDrveQ|h7-2,-z0Wf!1Xa</code>XmD(je{2');
    define('NONCE_KEY',        ',]b-?p-]Z~&+qh6@Ri5_A<>@!|_{w!r!b(e[zC@xUvkMW(g>i8Q

    S5&>z9wq2a<;’);
    define(‘AUTH_SALT’, ‘xf.u0aKMH&_GE[Z*fS0[FEE?H1:(lV4k2UcfQQv v?i DN7^9<6ws0FpTKZ$kb]x’);
    define(‘SECURE_AUTH_SALT’, ‘nnkgiN1{=d,n28j*0$ElCSV{)qE<@TvnSt6.M}4)V}y|<>~$C(:)jhExar%=Xq{/’);
    define(‘LOGGED_IN_SALT’, ‘eweptGk^brS`^}h5RSbW!EnwvZzJ0)R9zYBLHN<4ZSB]r0qZuC!&:%#*svW$L(7$’);
    define(‘NONCE_SALT’, ‘oT]o-DwT|4Ta`>!~tQT4_H&@+i&=1<az(>{d-F6<ToP%mHCuaUKs=ow4sg^GiU;j’);

    /**#@-*/

    /**
    * 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’);
    `

    The install program will create the file wp-config.php

    Thread Starter Lewis

    (@lewisdavis88)

    Ok I managed to fix it by following this tutorial:

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