Catalyx
Catalyx

Reputation: 455

How to Resolve "Error Establishing a Database Connection" on WordPress XAMPP Localhost for Google App Engine

Following Google App Engine's instructions for creating a local WordPress development platform, I created the database and initial user using the instruction's MySQL direction:

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';

After running it without errors reported, MySQL subsequently reported back:

CREATE DATABASE IF NOT EXISTS wordpress_db;# 1 row affected.

CREATE USER 'wp_user'@'localhost' IDENTIFIED BY 'wp_password';# MySQL returned an empty result set (i.e. zero rows).

GRANT ALL PRIVILEGES ON wordpress_db.* TO 'wp_user'@'localhost';# MySQL returned an empty result set (i.e. zero rows).

While the command line runs dev_appserver.py, I try reaching the WordPress app and get instead:

Error establishing a database connection

I've removed and recreated the database (wordpress_db) and user (wp_user) without reaching the WP app.

Any suggestion how to resolve this is appreciated.

Thanks, this is my App Engine log:

2013-11-26 17:40:25 Running command: "['C:\Program Files\Python27\python.exe', u'C:\Program Files\Google\google_appengine\dev_appserver.py', '--skip_sdk_update_check=yes', '--port=8080', '--admin_port=8000', u'C:\Documents and Settings\User\My Documents\Catalyx\Catalyx-GoogleAppEngine\Catalyx']" 2013-11-26 17:40:26 (Process exited with code -1073741515)

Upvotes: 4

Views: 33369

Answers (3)

Abanoub Hanna
Abanoub Hanna

Reputation: 39

To fix this problem try those fixes :

  1. Open wp-config.php, check line DB_USER, DB_PASSWORD, DB_HOST, DB_NAME. Make sure the values is same with mysql access.

  2. If you use Dedicated server or VPS hosting, try to restart your mysql server by typing : -service mysql restart or -service mysql start but if you use shared hosting, ignore this step!

  3. if all the previous fixes can not fix it, so it's a server-side problem! it is not your error! so let the hosting company fix this error for you because it is their error! contact them or give them a day or so and they will solve this error and the problem will disappear automatically. you can also check this video for the error establishing database connection fixes

Upvotes: 0

ken
ken

Reputation: 14575

This happens to me and I have a very 'good' evening with it. So hopefully someone can found this problem earlier...

I am trying to replicate the server wordpress on localhost. After replacing the actual URL with localhost, thing works perfectly. Except one thing, the newly created page is always in "Error Establishing a Database Connection”.

Let me put in sequence why this problem happened.

  1. on local pc I already have an old wordpress directory wp/
  2. on server my wordpress was placed under wp/
  3. when i copy the package to my local pc, i placed it to wp2/ (remember wp/ already taken?)

So who's the culprit? it's the .htaccess

RewriteBase /wp/

So it pointing to another database used by wp, which is of course resulting in error! The fix is easy, just change it to wp2!

RewriteBase /wp2/

Voila! Cheers and the evening suddenly become beautiful again! :)

Upvotes: 0

danmux
danmux

Reputation: 2982

As you have mentioned you are following googles own instructions...

then in the section titled ... Step 4. Create your wp-config.php configuration file

where the instructions state that you should replace the existing lines with the following:

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

You should enter those lines without the ** either side of the words like so...

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

When you hit the default root url for your local app - normally localhost:8080 you may get some odd redirects, so instead go direct to the local Wordpress install url...

http://localhost:8082/wp-admin/install.php

You should then get the nice Wordpress install page that you were expecting

Upvotes: 2

Related Questions