1
votes

I've installed and themed Wordpress locally several times in the past so I'm not new to the process. I am using XAMPP.

I reformatted my MacbookPro about a month ago and this is the first new install of WP since.

I'm getting the error: Error establishing a database connection

I've tried the following:

  • Deleting MySQL db and creating new db
  • Deleting DB user and creating new DB user
  • Changing DB user password
  • Changing DB_HOST to 127.0.0.1
  • Changing DB_HOST to 127.0.0.1:3306
  • Changing DB_HOST to Localhost
  • Changing DB_HOST to localhost
  • Downloading a fresh version of WP
  • Shutting down MacBook & restarting everything including XAMPP and MySQL

NOTHING I do makes any difference. For the record a local previously installed (same release 3.2.1) version of WP is working fine. I have already checked MySQL settings against these working settings.

Here is the output of php --ri mysql:

MySQL Support => enabled
Active Persistent Links => 0
Active Links => 0
Client API version => mysqlnd 5.0.8-dev - 20102224 - $Revision: 310735 $

Directive => Local Value => Master Value
mysql.allow_persistent => On => On
mysql.max_persistent => Unlimited => Unlimited
mysql.max_links => Unlimited => Unlimited
mysql.default_host => no value => no value
mysql.default_user => no value => no value
mysql.default_password => no value => no value
mysql.default_port => no value => no value
mysql.default_socket => /var/mysql/mysql.sock => /var/mysql/mysql.sock
mysql.connect_timeout => 60 => 60
mysql.trace_mode => Off => Off
mysql.allow_local_infile => On => On

I've seen the PHP/MySQL Broken After Security Update 2010-05 possible fix, but I don't see why a previous install of WP is working if this is the issue.

I'm quietly going rather batty over this.

I'd really appreciate it if someone could tell me how to fix this :-)

Many many MANY thanks in advance!

2
Have you checked to make sure that all the other info in wp-config.php file is accurate? Mainly the 4 fields that give WP access to the DB?IanB

2 Answers

0
votes

Can you access to the database normally with the access data through phpmyadmin? Maybe it's the service the one with problems, for example is well known that skype makes xampp crash when using the port 80 on its connection settings.

0
votes

The solution (or rather the cause) is embarrassing - I had initially called the WP local folder something like "WP Name" with a space in it. I renamed it "WPName", but the space had already done its damage.

I deleted the install and the holding folder, then created a new folder, new install and it all worked fine.

Embarrassing, but true.