Local install does not start, PDO Exception 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' =&gt; [
        // The database server name or IP address. Usually this is 'localhost' or '127.0.0.1'.
        'server' =&gt; '127.0.0.1',

        // The database username to connect with.
        'user' =&gt; 'root',

        // The database password to connect with.
        'password' =&gt; '',

        // The name of the database to select.
        'database' =&gt; 'craft_cms',

        // The prefix to use when naming tables. This can be no more than 5 characters.
        'tablePrefix' =&gt; '',
    ],
];


craft/config/general.php:

return [
    '.local' =&gt; [
        'devMode' =&gt; true,
    ],
    '*' =&gt; [
        'omitScriptNameInUrls' =&gt; 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.
You are using multi-environment configs improperly.

You must have an environment with the * key. This is how Craft knows that you are using a multi-environment config. Even if the value is simply an empty array, it must exist.


  The '*' array is required to enable Craft’s multi-environment config support, even if you don’t need it. Craft specifically checks for it when deciding whether to enable multi-environment config support or not.


And this is a bit of speculation... but I'd highly recommend having your * environment as the first item in the array. I'm not sure if it makes a difference to Craft, but it's at least a bit of a standard.