• Resolved vixenk

    (@vixenk)


    I’m new to WordPress, and actually new to databases and php in general.

    For some reason I can’t seem to get my config file right, because every time I try going to the install file I get a “Error establishing a database connection” error.

    I created a database in mysql and a user account with all permissions enabled. I uploaded WordPress to a “test” directory folder seperate from my site *i.e. https://blah.net/blah/testfolder*. In the config file I followed the read me and in file instructions and entered the database name, username, and password. When it didn’t work I tried changing the host location from localhost to the actual hosts address for my database, and that didn’t work either.

    My config file basically looks like this:

    ‘CODE'<?php
    // ** MySQL settings ** //
    define(‘DB_NAME’, ‘hostname_databasename’); // The name of the database
    define(‘DB_USER’, ‘hostname_username’); // Your MySQL username
    define(‘DB_PASSWORD’, ‘hostname_userpassword’); // …and password
    define(‘DB_HOST’, ‘localhost’); // 99% chance you won’t need to change this value

    // Change the prefix if you want to have multiple blogs in a single database.
    $table_prefix = ‘wp_’; // example: ‘wp_’ or ‘b2’ or ‘mylogin_’

    // Change this to localize WordPress. A corresponding MO file for the
    // chosen language must be installed to wp-includes/languages.
    // For example, install de.mo to wp-includes/languages and set WPLANG to ‘de’
    // to enable German language support.
    define (‘WPLANG’, ”);

    /* Stop editing */

    define(‘ABSPATH’, dirname(__FILE__).’/’);
    require_once(ABSPATH.’wp-settings.php’);
    ?>’/CODE’

Viewing 8 replies - 1 through 8 (of 8 total)
  • Thread Starter vixenk

    (@vixenk)

    LOL, sorry, minus the ‘CODE’ tags, I was worried that the code I was entering wouldn’t show up as text.

    Without knowing where you’re hosted etc. about the only thing I can see offhand is that “hostname_password” wouldn’t necessarily be a password with “hostname” prepended to it with the underscore. Your password should be entered in that field “bare” – exactly as you set it up when you created the db.

    Thread Starter vixenk

    (@vixenk)

    *nods* I thought of that as well, and tried everything exactly the way it was done in phpmyadmin, with the pw being stripped of the whole hostname and underscore thing, then I tried stripping all of it of the hostname and underscore thing… none of it worked either. ??

    Thread Starter vixenk

    (@vixenk)

    So I tried again, this time this is what it looked like, and this is the actual file word for word *except for the password*…

    <?php
    // ** MySQL settings ** //
    define(‘DB_NAME’, ‘shortst_wordpress’); // The name of the database
    define(‘DB_USER’, ‘shortst_vixen’); // Your MySQL username
    define(‘DB_PASSWORD’, ‘******’); // …and password
    define(‘DB_HOST’, ‘localhost’); // 99% chance you won’t need to change this value

    // Change the prefix if you want to have multiple blogs in a single database.
    $table_prefix = ‘wp_’; // example: ‘wp_’ or ‘b2’ or ‘mylogin_’

    // Change this to localize WordPress. A corresponding MO file for the
    // chosen language must be installed to wp-includes/languages.
    // For example, install de.mo to wp-includes/languages and set WPLANG to ‘de’
    // to enable German language support.
    define (‘WPLANG’, ”);

    /* Stop editing */

    define(‘ABSPATH’, dirname(__FILE__).’/’);
    require_once(ABSPATH.’wp-settings.php’);
    ?>

    Many hosts have quite specific requirements for the DB_HOST line… Did you check with your host about these 4 pieces of info?

    Thread Starter vixenk

    (@vixenk)

    I tried entering the host location in here, but other than that, no, I will try that now. ??

    What four pieces of info do I need?

    Thread Starter vixenk

    (@vixenk)

    Nevermind, I finally got it to work. ??

    Please tell us what you did, so that someone searching may also find the solution!

    Thanks!

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