title: message: "SQLSTATE[HY000] [2002] php_network_getaddresses: getaddrinfo failed: Temporary failure in name resolution (SQL: select * from `users`...)"
body: <p>I developed a Web Portal on Windows Operating System using Angular-7 as the frontend and Laravel-5.8 as the backend. Before deployment, I tested everything on the local machine and it was okay.</p>
  
  <p>The Linux Ubuntu server IP is: 20.10.10.122
  The Laravel file path is: </p>
  
  <p><a href="http://120.10.10.122/client-app/backend" rel="noreferrer">http://120.10.10.122/client-app/backend</a></p>
  
  <p>.env</p>
  
  <pre><code>APP_NAME=Client
  APP_ENV=local
  APP_KEY=base64:QT/LLNA/aduSekOXF4/CsY1iYEcRwwwwssssssHxuFs=
  APP_DEBUG=true
  APP_URL=http://localhost
  
  LOG_CHANNEL=stack
  
  DB_CONNECTION=mysql
  DB_HOST=http://localhost/
  DB_PORT=3306
  DB_DATABASE=client
  DB_USERNAME=jdggsss
  DB_PASSWORD=kjhgfdddd
  </code></pre>
  
  <p>However, when I deployed to Linux Ubuntu-18 Server, I ran the application. When the user tried to login, I got this error:</p>
  
  <blockquote>
    <p>message: "SQLSTATE[HY000] [2002] php_network_getaddresses: getaddrinfo failed: Temporary failure in name resolution (SQL: select * from <code>users</code> where <code>email</code> = noblemfd@yahoo.com and <code>active</code> = 1 and <code>deleted_at</code> is null and <code>users</code>.<code>deleted_at</code> is null limit 1)"</p>
  </blockquote>
  
  <p>Why am I getting the error and how do I resolve it?</p>