WordPress.org

Forums

[resolved] “Error Establishing a Database Connection” on WordPress XAMPP Localhost for GAE (6 posts)

  1. Catalyx
    Member
    Posted 1 year ago #

    I've been trying to launch WP after installing it locally on an XAMPP stack to prepare for a Google App Engine (GAE) server.

    Under WP_debug mode, I get the following reported when I visit "localhost:8080":

    Warning: mysql_connect(): Access denied for user '**wp_user**'@'localhost' (using password: YES) in C:\Documents and Settings\User\My Documents\Catallactic\Catallactic-GoogleAppEngine\catallactic\wordpress\wp-includes\wp-db.php on line 1142

    Error establishing a database connection

    The GAE instructions are pretty clear advising creating the WP database, user and privileges with this SQL script:

    CREATE DATABASE IF NOT EXISTS wordpress_db;
    CREATE USER 'wp_user'@'localhost' IDENTIFIED BY 'wp_password';
    GRANT ALL PRIVILEGES ON wordpress_db.* TO 'wp_user'@'localhost';

    and the applicable wp_config parameters:

    /** The name of the database for WordPress */
    define('DB_NAME', '**wordpress_db**');

    /** MySQL database username */
    define('DB_USER', '**wp_user**');

    /** MySQL database password */
    define('DB_PASSWORD', '**wp_password**');

    Following these instructions, I still get the "Error establishing a database connection", which is perplexing because this is not the first WP local development I've set up (which could be the problem?).

    I've deleted and created the user and database a few times without success.

    Any suggestions would be appreciated.

    Thanks.

  2. Tara
    Volunteer Moderator
    Posted 1 year ago #

    Error connecting to your database is common, but it isn't necessarily a problem with wordpress itself.
    - double check your wp-config.php file settings for the database name, database username and database password. This is where most errors occur.
    - Then check that you don't need to change the database host from "localhost" to something else. You can get that info from your hosting provider.
    - Check you have actually created a database with the same database name as is in your wp-config.php file.
    - Last, but not least, if all that information is correct your database probably has a problem with it, and you may need to contact your hosting provider if the database server is online / if they have any other problem at their end, or they made any changes to your account, or if there are any limitations/restrictions, if the hosting package is set to Windows and not Linux, etc.
    - There are also many threads on this topic on these forums: http://wordpress.org/search/Error+establishing+a+database+connection?forums=1

  3. Catalyx
    Member
    Posted 1 year ago #

    @Tara, many thanks for the reply and suggestions.

    I'm new to WP and Google App Engine (GAE). It seems the snag in GAE's instructions are the wildcards, "**", used as references in wp_config:

    * The database ("**wordpress_db**")
    * The user ("**wp_user**") and
    * The user's password ("**wp_password**").

    The only reference to wildcards in the database is listing "wp_user" as having access to "wordpress_db" with a type of "wildcard: wordpress_db"

    I'm unfamiliar with the syntax used in WP or MySQL. Can you tell me whether this syntax used made sense? Does WP Codex have much on wildcard use in the WP database?

  4. Tara
    Volunteer Moderator
    Posted 1 year ago #

  5. catacaustic
    very awesome
    Posted 1 year ago #

    I don't understand why you'd want a wildcard in your DB connection values??? Aren't you trying to connect to one DB only? You should be! so, there's no need for a wildcard anywhere and that's probably what's breaking your connection.

    From what I can see in what you've posted, something like **wp_user** is not a "wildcard". It's meant for you to substitute that for the actual value that you need to add. As an example it should be something like this:

    Database name: db_name
    Username: my_username
    Password: the_password

    define('DB_NAME', 'db_name');
    define('DB_USER', 'my_username');
    define('DB_PASSWORD', 'the_password');

    Of course, you'll change those values to match what you have - and without any ** anywhere.

  6. Catalyx
    Member
    Posted 1 year ago #

    @catacaustic

    Thank you for clarifying MySQL's syntax applied to WP. It appears that the App Engine manual has one or two inconsistencies that led to confusion.

    I'll mark this resolved. Thanks.

Topic Closed

This topic has been closed to new replies.

About this Topic