Answers.Body: <p>I don't think that <code>host</code> is a valid configuration key for the Connection component.</p>
  <p><code>127.0.0.1</code> won't work for the <code>server</code> key (within Nitro), so I'd recommend moving the value of the <code>DB_HOST</code> variable over to <code>DB_SERVER</code>, and removing the <code>host</code> key from the config object entirely!</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2022-01-19T20:09:01.163Z
Answers.Text: Thank you for your help! @August Miller
Answers.UserDisplayName: peco60052
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2022-01-18T23:31:37.353Z
Answers.LastActivityDate: 2022-01-18T23:31:37.353Z
Answers.UserDisplayName: August Miller
Body: <p>I am experimenting with Nitro and getting the 503 db error when trying to connect db. I am able to connect to my GUI (Sequel Ace) but not get the browser connecting.</p>
  <p>My db.php is as follows:</p>
  <pre><code>return [
      'driver' =&gt; getenv('DB_DRIVER'),
      'server' =&gt; getenv('DB_SERVER'),
      'user' =&gt; getenv('DB_USER'),
      'password' =&gt; getenv('DB_PASSWORD'),
      'database' =&gt; getenv('DB_DATABASE'),
      'schema' =&gt; getenv('DB_SCHEMA'),
      'tablePrefix' =&gt; getenv('DB_TABLE_PREFIX'),
      'port' =&gt; getenv('DB_PORT')
  ];
  </code></pre>
  <p>With the relevant <code>.env</code> file snippet:</p>
  <pre><code>DB_DRIVER=mysql
  DB_HOST=&quot;mysql-5.7-3306.database.nitro&quot; # I got this from running nitro context
  DB_SERVER=127.0.0.1
  DB_USER=&quot;nitro&quot;
  DB_PASSWORD=&quot;nitro&quot;
  DB_DATABASE=nitro_play
  DB_SCHEMA=
  DB_TABLE_PREFIX=
  DB_PORT=3306
  </code></pre>
  
Tags: <mysql><nitro>
Title: Getting 503 error when setting up a site with CraftCMS nitro
ThreadText: # Getting 503 error when setting up a site with CraftCMS nitro
  
  (Asked by: username_0 on 2022-01-18)
  
  I am experimenting with Nitro and getting the 503 db error when trying to connect db. I am able to connect to my GUI (Sequel Ace) but not get the browser connecting.
  
  My db.php is as follows:
  
  ```
  return [
      'driver' => getenv('DB_DRIVER'),
      'server' => getenv('DB_SERVER'),
      'user' => getenv('DB_USER'),
      'password' => getenv('DB_PASSWORD'),
      'database' => getenv('DB_DATABASE'),
      'schema' => getenv('DB_SCHEMA'),
      'tablePrefix' => getenv('DB_TABLE_PREFIX'),
      'port' => getenv('DB_PORT')
  ];
  
  ```
  
  With the relevant `.env` file snippet:
  
  ```
  DB_DRIVER=mysql
  DB_HOST="mysql-5.7-3306.database.nitro" # I got this from running nitro context
  DB_SERVER=127.0.0.1
  DB_USER="nitro"
  DB_PASSWORD="nitro"
  DB_DATABASE=nitro_play
  DB_SCHEMA=
  DB_TABLE_PREFIX=
  DB_PORT=3306
  
  ```
  
  **Tags:** mysql, nitro
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2022-01-18. Score: 1 | Accepted answer
  
  I don't think that `host` is a valid configuration key for the Connection component.
  
  `127.0.0.1` won't work for the `server` key (within Nitro), so I'd recommend moving the value of the `DB_HOST` variable over to `DB_SERVER`, and removing the `host` key from the config object entirely!
  
  > **Comments:**
  > **username_0**: Thank you for your help! @username_1  
  
  ---
  
  