Answers.Body: <p>I had a similar issue where my '*' was being chosen all of the time, meaning all my environments used the same DB details.</p>
  
  <p>Possibly try splitting it up, and not have a '*' for your DB details, for any environment?</p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-06-24T18:46:04.293Z
Answers.Text: No problem! Threw me off first time as well :) Glad it helped.
Answers.UserDisplayName: Jason Mayo
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-06-24T17:57:36.413Z
Answers.LastActivityDate: 2015-06-24T17:57:36.413Z
Answers.UserDisplayName: Jason Mayo
Answers.Body: <p>Assuming that really was your db.php, you have <code>'9thandthomas.com'</code> <em>inside</em> the <code>*</code> array, not <em>beneath</em> it:</p>
  
  <pre><code>return array(
    '*' =&gt; array(
      ...
      '9thandthomas.com' =&gt; array( ... )
    ),
    // '9thandthomas.com' SHOULD BE HERE
    ...
  )
  </code></pre>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-06-25T19:06:12.383Z
Answers.Text: Yeah Marion, that was the problem. Not sure how it got where it was...
Answers.UserDisplayName: Andrew Means
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-06-25T06:47:29.433Z
Answers.LastActivityDate: 2015-06-25T06:47:29.433Z
Answers.UserDisplayName: Marion Newlevant
Body: <p>I'm moving a craft install from a development to production server and am getting this error:</p>
  
  <pre><code>ERROR ERROR
  Craft can’t connect to the database with the credentials in craft/config/db.php.
  </code></pre>
  
  <p>I've triple checked the db credentials and permissions and everything is correct. Here's my db.php file:</p>
  
  <pre><code>&lt;?php
  
  // uncommenting this gives me a 'connected okay' so I know that the credentials are correct.
  // if ($con=mysqli_connect("localhost","thandtho_db","*********","thandtho_production")) // {
  //  die('connected okay');
  // } else {
  //  die('couldn\'t connect');
  // } 
  
  /**
   * Database Configuration
   *
   * All of your system's database configuration settings go in here.
   * You can see a list of the default settings in craft/app/etc/config/defaults/db.php
   */
  
  // Import your local config settings
  require( 'config.local.php' );
  
  return array(
      '*'=&gt; array(
          // Database Info
          'tablePrefix' =&gt; 'craft',
      // Production Domain
      '9thandthomas.com' =&gt; array(
          'server' =&gt; 'localhost',
          'user' =&gt; 'thandtho_db',
          'password' =&gt; '***********',
          'database' =&gt; 'thandtho_production'
      ),
      ),
      // Dev
      '9thandthomas.transomco.com' =&gt; array(
          'server' =&gt; 'localhost',
          'user' =&gt; 'ninththomas_dev',
          'password' =&gt; '4iJoi58@',
          'database' =&gt; 'ninththomas_dev'
      ),
      // Local
      // Needs to be placed after production since subdomain
      // is similar to production domain name.
      $localConfig['envUrl'] =&gt;  array (
          'server' =&gt; $localDatabase['server'],
          'user' =&gt; $localDatabase['user'],
          'password' =&gt; $localDatabase['password'],
          'database' =&gt; $localDatabase['database'],
      )
  );
  </code></pre>
  
  <p>************************** ANSWER **************************</p>
  
  <p>I moved the database details from beneath the * and it worked.</p>
  
  <p>db.php now looks like this:</p>
  
  <pre><code>&lt;?php
  /**
   * Database Configuration
   *
   * All of your system's database configuration settings go in here.
   * You can see a list of the default settings in craft/app/etc/config/defaults/db.php
   */
  
  // Import your local config settings
  require( 'config.local.php' );
  
  return array(
      '*'=&gt; array(
          // Database Info
          'tablePrefix' =&gt; 'craft',
      ),
      // Production Domain
      '9thandthomas.com' =&gt; array(
          'server' =&gt; 'localhost',
          'user' =&gt; 'thandtho_db',
          'password' =&gt; 'wR39fy2!k',
          'database' =&gt; 'thandtho_production'
      ),
      // Dev
      '9thandthomas.transomco.com' =&gt; array(
          'server' =&gt; 'localhost',
          'user' =&gt; 'ninththomas_dev',
          'password' =&gt; '4iJoi58@',
          'database' =&gt; 'ninththomas_dev'
      ),
      // Local
      // Needs to be placed after production since subdomain
      // is similar to production domain name.
      $localConfig['envUrl'] =&gt;  array (
          'server' =&gt; $localDatabase['server'],
          'user' =&gt; $localDatabase['user'],
          'password' =&gt; $localDatabase['password'],
          'database' =&gt; $localDatabase['database'],
      )
  );
  </code></pre>
  
Tags: <database>
Title: Need help troubleshooting DB connection
ThreadText: # Need help troubleshooting DB connection
  
  (Asked by: username_0 on 2015-06-24)
  
  I'm moving a craft install from a development to production server and am getting this error:
  
  ```
  ERROR ERROR
  Craft can’t connect to the database with the credentials in craft/config/db.php.
  
  ```
  
  I've triple checked the db credentials and permissions and everything is correct. Here's my db.php file:
  
  ```
  <?php
  
  // uncommenting this gives me a 'connected okay' so I know that the credentials are correct.
  // if ($con=mysqli_connect("localhost","thandtho_db","*********","thandtho_production")) // {
  //  die('connected okay');
  // } else {
  //  die('couldn\'t connect');
  // } 
  
  /**
   * Database Configuration
   *
   * All of your system's database configuration settings go in here.
   * You can see a list of the default settings in craft/app/etc/config/defaults/db.php
   */
  
  // Import your local config settings
  require( 'config.local.php' );
  
  return array(
      '*'=> array(
          // Database Info
          'tablePrefix' => 'craft',
      // Production Domain
      '9thandthomas.com' => array(
          'server' => 'localhost',
          'user' => 'thandtho_db',
          'password' => '***********',
          'database' => 'thandtho_production'
      ),
      ),
      // Dev
      '9thandthomas.transomco.com' => array(
          'server' => 'localhost',
          'user' => 'ninththomas_dev',
          'password' => '4iJoi58@',
          'database' => 'ninththomas_dev'
      ),
      // Local
      // Needs to be placed after production since subdomain
      // is similar to production domain name.
      $localConfig['envUrl'] =>  array (
          'server' => $localDatabase['server'],
          'user' => $localDatabase['user'],
          'password' => $localDatabase['password'],
          'database' => $localDatabase['database'],
      )
  );
  
  ```
  
  \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\* ANSWER \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*
  
  I moved the database details from beneath the \* and it worked.
  
  db.php now looks like this:
  
  ```
  <?php
  /**
   * Database Configuration
   *
   * All of your system's database configuration settings go in here.
   * You can see a list of the default settings in craft/app/etc/config/defaults/db.php
   */
  
  // Import your local config settings
  require( 'config.local.php' );
  
  return array(
      '*'=> array(
          // Database Info
          'tablePrefix' => 'craft',
      ),
      // Production Domain
      '9thandthomas.com' => array(
          'server' => 'localhost',
          'user' => 'thandtho_db',
          'password' => 'wR39fy2!k',
          'database' => 'thandtho_production'
      ),
      // Dev
      '9thandthomas.transomco.com' => array(
          'server' => 'localhost',
          'user' => 'ninththomas_dev',
          'password' => '4iJoi58@',
          'database' => 'ninththomas_dev'
      ),
      // Local
      // Needs to be placed after production since subdomain
      // is similar to production domain name.
      $localConfig['envUrl'] =>  array (
          'server' => $localDatabase['server'],
          'user' => $localDatabase['user'],
          'password' => $localDatabase['password'],
          'database' => $localDatabase['database'],
      )
  );
  
  ```
  
  **Tags:** database
  
  
  ---
  
  ## 2 answers
  
  ### Answer by username_1 on 2015-06-24. Score: 3 | Accepted answer
  
  I had a similar issue where my '\*' was being chosen all of the time, meaning all my environments used the same DB details.
  
  Possibly try splitting it up, and not have a '\*' for your DB details, for any environment?
  
  > **Comments:**
  > **username_1**: No problem! Threw me off first time as well :) Glad it helped.  
  
  ---
  
  ### Answer by username_2 on 2015-06-25. Score: 3
  
  Assuming that really was your db.php, you have `'9thandthomas.com'` *inside* the `*` array, not *beneath* it:
  
  ```
  return array(
    '*' => array(
      ...
      '9thandthomas.com' => array( ... )
    ),
    // '9thandthomas.com' SHOULD BE HERE
    ...
  )
  
  ```
  
  > **Comments:**
  > **username_0**: Yeah username_2, that was the problem. Not sure how it got where it was...  
  
  ---
  
  