Hey guys, 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 connection And 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_channels Also, I created a basic php script to see if it could connect to the database <?php $link = mysql_connect('db.example.com', 'admin_ssl', 'secret'); if (!$link) { die('Could not connect: ' . mysql_error()); } echo 'Connected successfully'; mysql_close($link); ?> And to my surprise it can't connect! php testconnect.php Could not connect: Access denied for user 'admin_ssl'@'ec2-54-86-143-49.compute-1.amazonaws.com' (using password: YES) Why am I surprised that it can't? Because again 1) the wiki can connect to the database no problem. And 2) I can connect to the db on the command line using the same credentials. My API Client version is: Client API version mysqlnd 5.0.10 - 20111026 - $Id: c85105d7c6f7d70d609bb4c000257868a40840ab $ There are two MySQL databases configured in a master/master setup. The database address is 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. There's 3 web servers sitting behind a VIP as well. But to troubleshoot this I just the IP address of the 1st web server into my hosts file and I'm using that as the site name. I'm not really sure how important it is to know all of that about the load balanced aspects of the site. But I wanted to get those details out into the open just in case they were important. Thanks in advance! Tim -- GPG me!! gpg --keyserver pool.sks-keyservers.net --recv-keys F186197B
> Date: Saturday, August 15, 2015 13:53:28 -0400 > From: Tim Dunphy <bluethundr at gmail.com> > > Hey guys, > > 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 connection > > And as far as I can tell the settings between the mediawiki site > and the wordpress site are nearly identical.< ... snip ... > [this isn't really a centos issue, even if you're using centos, which isn't obvious. that said ...] I would start by looking at the access control entries for the wp and mw dbs, (in the mysql.db table). Based on what you are trying here, there should be matching entries in that table for the "Db"s "jokefire" and "jfwiki" (e.g., for the Host as well as the various _priv fields). select * from db where Db='jokefire' or Db='jfwiki' order by Host\g There may be something else going on, but without knowing that the access control is as it should be there's not much value in speculating.
> > [this isn't really a centos issue, even if you're using centos, > which isn't obvious. that said ...]Yeah that's true. But this list tends to be rather helpful for general problems that are less specific to centos. Sometimes. :) Really seems to depend... Incidentally I am using centos on all hosts: #cat /etc/redhat-release CentOS Linux release 7.0.1406 (Core) OK now that that's out of the way, for some reason I don't seem to have an entry in my db database for either jokefire or jfwiki: MariaDB [mysql]> select * from db where Db like 'jfwiki' or Db like 'jokefire'; Empty set (0.00 sec) Not sure why that would be the case. They're definitely there on this database server: MariaDB [mysql]> show databases; +--------------------+ | Database | +--------------------+ | bacula | | information_schema | | jfwiki | | jokefire | | mysql | | performance_schema | +--------------------+ 6 rows in set (0.00 sec) Any other ideas? Thanks, Tim On Sat, Aug 15, 2015 at 3:07 PM, Richard <lists-centos at listmail.innovate.net> wrote:> > > > Date: Saturday, August 15, 2015 13:53:28 -0400 > > From: Tim Dunphy <bluethundr at gmail.com> > > > > Hey guys, > > > > 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 connection > > > > And as far as I can tell the settings between the mediawiki site > > and the wordpress site are nearly identical. > > < ... snip ... > > > [this isn't really a centos issue, even if you're using centos, > which isn't obvious. that said ...] > > I would start by looking at the access control entries for the wp > and mw dbs, (in the mysql.db table). Based on what you are trying > here, there should be matching entries in that table for the "Db"s > "jokefire" and "jfwiki" (e.g., for the Host as well as the various > _priv fields). > > select * from db where Db='jokefire' or Db='jfwiki' order by Host\g > > There may be something else going on, but without knowing that the > access control is as it should be there's not much value in > speculating. > > _______________________________________________ > CentOS mailing list > CentOS at centos.org > http://lists.centos.org/mailman/listinfo/centos >-- GPG me!! gpg --keyserver pool.sks-keyservers.net --recv-keys F186197B