database connection error with valid settings
-
Hello,
I’m running both a wordpress site as well as a mediawiki off of the same web servers. The mediawiki site works great! The wordpress site, meh. Not so much. I keep getting the common database connection error:
Error establishing a database connectionAnd as far as I can tell the settings between the mediawiki site and the wordpress site are nearly identical.
Here’s the media wiki config first since that one’s working:
## Database settings $wgLBFactoryConf['class'] = 'LBFactorySimple'; $wgDBtype = "mysql"; $wgDBservers = ''; $wgDBserver = "db.example.com"; $wgDBssl = true; $wgDBname = "jfwiki"; $wgDBuser = "admin_ssl"; $wgDBpassword = "secret";And here’s what the wordpress database connection settings look like since they are not:
/** MySQL database username */ define('DB_NAME', 'jokefire'); define('DB_USER', 'admin_ssl'); /** MySQL database password */ define('DB_PASSWORD', 'secret'); /** MySQL hostname */ define('DB_HOST', 'db.example.com'); /** 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', ''); /** Contact the database over a secure connection */ define('DB_SSL', true);I realize that they’re not exactly the same. But I think you can make an easy correlation between the mediawiki settings and the settings for wordpress. And they look similar enough to think that wordpress should be working. Right?
The only real other difference is the name of the database each site is using, which I guess makes sense.
But the fact that medawiki works fine tells me that the user and password set for both sites has access to the database.
Just for laughs I use the account settings from the wordpress config to demonstrate that I can connect to the DB on the command line. Again, it’s the same account info that I have in the wik site:
#mysql -uadmin_ssl -p -h db.example.com -D jokefire -e "show tables" | head -5 Enter password: Tables_in_jokefire wp_bp_activity wp_bp_activity_meta wp_bp_chat_channel_users wp_bp_chat_channelsNow there are a couple of things that I should probably explain about my environment. Although I have no idea if these details play into the error that I’m getting. The two different sites are both on the same web servers as mentioned. There are 3 web servers sharing a document root that sits on an NFS share.
The sites are load balanced behind varnish 4. And the two varnish nodes are load balanced by two HA/Proxy hosts. The site names points to a VIP that is load balanced on HA/Proxy.
There are two MySQL databases configured in a master/master setup. The database address is also a VIP that is load balanced on the same two HA/Proxy nodes. The two database servers are using MariaDB version 10.0.20-1.
Again, I’m not really sure how important it is to know all of that. But I wanted to get those details out into the open just in case they were important.
Thanks for your help!
The topic ‘database connection error with valid settings’ is closed to new replies.