I wanted to install a single instance of craft on my local machine. However upon starting the installation via calling /admin/
or /admin/install
, the only message I get, is
SQLSTATE[3D000]: Invalid catalog name: 1046 No database selected The SQL being executed was: SHOW TABLES LIKE 'craft_%'
Which in itself is weird, since I have modified the configuration already to not use craft_ as a table prefix.
These are my settings:
- OS: Mac OS X 10.11.3 (El Capitan)
- PHP 5.6.25
- MySQL 5.7.14
- Apache 2.4.16
- Latest Craft 2 build from today / Latest Craft 3 build from today
I have made the following changes to the configuration:
craft/config/db.php:
return [
'.local' => [
// The database server name or IP address. Usually this is 'localhost' or '127.0.0.1'.
'server' => '127.0.0.1',
// The database username to connect with.
'user' => 'root',
// The database password to connect with.
'password' => '',
// The name of the database to select.
'database' => 'craft_cms',
// The prefix to use when naming tables. This can be no more than 5 characters.
'tablePrefix' => '',
],
];
craft/config/general.php:
return [
'.local' => [
'devMode' => true,
],
'*' => [
'omitScriptNameInUrls' => true,
],
];
I even went the extra mile and updated the my.cnf for mysql in order to work properly in 5.7:
[mysqld]
sql_mode=STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION
Any suggestions?
Edit Since the mods removed the craft3 tag due to my typo, I thought it was necessary to say that this error occurs on both the latest version of craft3 and craft2.
'.local' => [
– Brad Bell Sep 21 '16 at 22:01