title: How can I change database connection "localhost" to "127.0.0.1" in Symfony 4?
body: <p>According to the resolution of this question...</p>
  
  <p><a href="https://stackoverflow.com/questions/16111324/what-is-the-symfony-firewall-doing-that-takes-so-long">What is the Symfony firewall doing that takes so long?</a></p>
  
  <p>...I try to change in the <code>.env</code> file</p>
  
  <pre><code>DATABASE_URL=mysql://root:root@localhost/project
  </code></pre>
  
  <p>to</p>
  
  <pre><code>DATABASE_URL=mysql://root:root@127.0.0.1/project
  </code></pre>
  
  <p>to achieve better performance. </p>
  
  <p>But then I get an error:</p>
  
  <blockquote>
    <p>An exception occurred in driver:
    SQLSTATE[HY000] [2002] Connection refused</p>
    
    <p>Uncaught PHP Exception Doctrine\DBAL\Exception\ConnectionException:
    "An exception occurred in driver: SQLSTATE[HY000] [2002] Connection
    refused" at
    /Users/work/project/vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/AbstractMySQLDriver.php
    line 112</p>
  </blockquote>