Answers.Body: <p>After cheating via discussion in the comments, I’m certain that your <code>DB_SERVER</code> is incorrectly set to <code>127.0.0.1</code> when it should in fact be <code>mysql-5.6-3306.database.nitro</code>.</p>
  <p>In a perfect world this would have been set for you when Nitro edited <code>.env</code>, but in a pandemic-ravaged dystopia your next best option is to use whatever <code>nitro context</code> indicates.</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2021-03-16T22:00:59.513Z
Answers.Text: FWIW the Craft starter project was tragically overwriting the `.env` Nitro likely set up for you with `nitro create`, [which we’ve fixed](https://github.com/craftcms/craft/releases/tag/1.1.3). Should be smoother sailing going forward!
Answers.UserDisplayName: Matt Stein
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2021-03-17T11:10:06.840Z
Answers.Text: Thanks for your help Matt :)
Answers.UserDisplayName: Jonathan Schofield
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2021-03-16T20:10:57.200Z
Answers.LastActivityDate: 2021-03-16T20:10:57.200Z
Answers.UserDisplayName: Matt Stein
Body: <p>I installed Docker and Nitro and successfully used <code>nitro create &lt;folder-name&gt;</code>, and ended up with the 'Welcome to Craft CMS!' message.</p>
  <p>I <code>cd</code>ed into the new folder and invoked <code>./craft setup</code>, which along the way has reported 'success!' at testing database credentials.</p>
  <p>After saying yes to installing on the command line and creating an admin user account, I've received:</p>
  <pre><code>*** installed Craft successfully (time: 12.240s)
  
  Generating project config files from the loaded project config ... done
  </code></pre>
  <p>I can see my new local dev instance running in Docker.app, but when I go to the site in a browser I get <code>503 – Service Unavailable</code>.</p>
  <p>If I go to <code>{hostname}/admin</code> I get the browser prompt to Install Craft. If I try and fill that out I get <code>PDO exception: SQLSTATE[HY000] [2002] Connection refused</code>.</p>
  <p>The potential ease of use of Nitro looks really promising so it's frustrating to be so close!</p>
  <p>What could I be missing?</p>
  <hr />
  <h3>Update 1</h3>
  <p>I have the following in my <code>.env</code>:</p>
  <pre><code>DB_DRIVER=mysql
  DB_SERVER=127.0.0.1
  DB_PORT=3306
  DB_DATABASE=&lt;dbname&gt;
  DB_USER=nitro
  DB_PASSWORD=nitro
  DB_SCHEMA=
  DB_TABLE_PREFIX=
  </code></pre>
  <p>where <code>&lt;dbname&gt;</code> is the DB name I was asked to define (during <code>nitro create</code> I think) and which it said it could connect to.</p>
  <p>Under 'Databases' <code>nitro context</code> reports:</p>
  <pre><code>Databases:
    engine:        mysql 5.6      hostname: mysql-5.6-3306.database.nitro
    username:      nitro  password: nitro
    port:  3306
  </code></pre>
  <hr />
  <h3>Update 2</h3>
  <p>To start from scratch, I junked my nitro instance in Docker and uninstalled nitro, and then reinstalled it, and went through <code>nitro create</code> again, and…</p>
  <p>ended up in basically the same place.</p>
  <p>I've tried my custom database name as the value of <code>DB_DATABASE</code> and the default <code>nitro</code> database name, and it makes no difference.</p>
  
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2021-03-16T14:45:25.253Z
Comments.Text: Did you edit your `.env` file or have Nitro do it for you? Your `DB_*` values need to reference the details you get for the relevant database engine running `nitro context`.
Comments.UserDisplayName: Matt Stein
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2021-03-16T14:57:53.953Z
Comments.Text: Thanks Matt. Re the `.env` I did a combination of both I think. I have updated my question above with the current state.
Comments.UserDisplayName: Jonathan Schofield
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2021-03-16T17:16:16.700Z
Comments.Text: Nitro should have updated `.env` so that `DB_SERVER=mysql-5.6-3306.database.nitro` in this case, not `127.0.0.1`.
Comments.UserDisplayName: Matt Stein
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2021-03-16T17:24:44.757Z
Comments.Text: Ah, of course! So obvious now you point it out. That has worked thanks. Do you want to post it as an answer so I can vote for it?
Comments.UserDisplayName: Jonathan Schofield
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2021-03-16T20:11:37.200Z
Comments.Text: Answered—thank you! :)
Comments.UserDisplayName: Matt Stein
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2022-06-03T10:47:35.483Z
Comments.Text: Heyy! I have the same Problem but i do have the right Database in the .env file. Any Suggestions?
Comments.UserDisplayName: Samuel Reichör
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2022-06-03T13:06:19.080Z
Comments.Text: Are you using Nitro?
Comments.UserDisplayName: James White
Tags: <nitro>
Title: First steps with Craft Nitro: hostname not working after successful install
ThreadText: # First steps with Craft Nitro: hostname not working after successful install
  
  (Asked by: username_0 on 2021-03-16)
  
  I installed Docker and Nitro and successfully used `nitro create <folder-name>`, and ended up with the 'Welcome to Craft CMS!' message.
  
  I `cd`ed into the new folder and invoked `./craft setup`, which along the way has reported 'success!' at testing database credentials.
  
  After saying yes to installing on the command line and creating an admin user account, I've received:
  
  ```
  *** installed Craft successfully (time: 12.240s)
  
  Generating project config files from the loaded project config ... done
  
  ```
  
  I can see my new local dev instance running in Docker.app, but when I go to the site in a browser I get `503 – Service Unavailable`.
  
  If I go to `{hostname}/admin` I get the browser prompt to Install Craft. If I try and fill that out I get `PDO exception: SQLSTATE[HY000] [2002] Connection refused`.
  
  The potential ease of use of Nitro looks really promising so it's frustrating to be so close!
  
  What could I be missing?
  
  ---
  
  ### Update 1
  
  I have the following in my `.env`:
  
  ```
  DB_DRIVER=mysql
  DB_SERVER=127.0.0.1
  DB_PORT=3306
  DB_DATABASE=<dbname>
  DB_USER=nitro
  DB_PASSWORD=nitro
  DB_SCHEMA=
  DB_TABLE_PREFIX=
  
  ```
  
  where `<dbname>` is the DB name I was asked to define (during `nitro create` I think) and which it said it could connect to.
  
  Under 'Databases' `nitro context` reports:
  
  ```
  Databases:
    engine:        mysql 5.6      hostname: mysql-5.6-3306.database.nitro
    username:      nitro  password: nitro
    port:  3306
  
  ```
  
  ---
  
  ### Update 2
  
  To start from scratch, I junked my nitro instance in Docker and uninstalled nitro, and then reinstalled it, and went through `nitro create` again, and…
  
  ended up in basically the same place.
  
  I've tried my custom database name as the value of `DB_DATABASE` and the default `nitro` database name, and it makes no difference.
  
  **Tags:** nitro
  
  > **Comments:**
  > **username_1**: Did you edit your `.env` file or have Nitro do it for you? Your `DB_*` values need to reference the details you get for the relevant database engine running `nitro context`.  
  > **username_0**: Thanks username_1. Re the `.env` I did a combination of both I think. I have updated my question above with the current state.  
  > **username_1**: Nitro should have updated `.env` so that `DB_SERVER=mysql-5.6-3306.database.nitro` in this case, not `127.0.0.1`.  
  > **username_0**: Ah, of course! So obvious now you point it out. That has worked thanks. Do you want to post it as an answer so I can vote for it?  
  > **username_1**: Answered—thank you! :)  
  > **username_2**: Heyy! I have the same Problem but i do have the right Database in the .env file. Any Suggestions?  
  > **username_3**: Are you using Nitro?  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2021-03-16. Score: 3
  
  After cheating via discussion in the comments, I’m certain that your `DB_SERVER` is incorrectly set to `127.0.0.1` when it should in fact be `mysql-5.6-3306.database.nitro`.
  
  In a perfect world this would have been set for you when Nitro edited `.env`, but in a pandemic-ravaged dystopia your next best option is to use whatever `nitro context` indicates.
  
  > **Comments:**
  > **username_1**: FWIW the Craft starter project was tragically overwriting the `.env` Nitro likely set up for you with `nitro create`, [which we’ve fixed](https://github.com/craftcms/craft/releases/tag/1.1.3). Should be smoother sailing going forward!  
  > **username_0**: Thanks for your help username_1 :)  
  
  ---
  
  