Summary
I'm getting the following error when attempting to install a new Craft site locally:
CDbCommand failed to execute the SQL statement: SQLSTATE[3D000]: Invalid catalog name: 1046 No database selected. The SQL statement executed was: SHOW TABLES LIKE 'craft_%'
Having just downloaded the ZIP, I assume the version of Craft in question is the latest at time of writing (2.1.2563).
Point of failure
After some digging, the error appears to be caused by line 59 in craft/app/etc/behaviors/AppBehavior.php
, specifically the call to craft()->db->tableExists()
:
$this->_isInstalled = (craft()->isConsole() || craft()->db->tableExists('info', false));
If that is indeed the case, it means that the preceding craft()->getComponent('db')
and craft()->getIsDbConnectionValid()
checks are passing, which leaves me completely baffled as to what is causing the error.
Environment info
The site is (not) running on a local Vagrant VM, which is happily hosting another Craft site with no problems. It's perhaps worth noting that I didn't install the other site from scratch on this server.
The basic server specs are as follows:
- Ubuntu 12.04 LTS (64-bit)
- Apache 2.2.22
- PHP 5.4.30
The database definitely exists, and I can connect to it using Sequel Pro.
Has anybody else run into this?