title: SQLSTATE[HY000] [2002] Connection refused on Mac OS Catalina with XAMPP, tried most of the solutions on StackOverflow
body: <p>Recently I bought a Macbook and I want to run a laravel app using XAMPP. I downloaded the last available XAMPP for Mac OS, installed composer and successfully ran the project. Composer is working as expected, the local host is also working fine (when I try to access PhpMyAdmin it works). After that, I wanted to migrate using php artisan migrate <strong>after</strong> I created the database into PhpMyAdmin under the name web3project. I cloned my git repository containing the laravel application and edited the .env file:</p>
  <pre><code>APP_NAME=Laravel
  APP_ENV=local
  APP_KEY=base64:B8MsHk7bk84kwOl5HQebNY7c2UGLlDtpb/YbGl8HkYE=
  APP_DEBUG=true
  APP_URL=http://localhost
  
  LOG_CHANNEL=stack
  
  DB_CONNECTION=mysql
  DB_HOST=127.0.0.1
  DB_PORT=3306
  DB_DATABASE=web3project
  DB_USERNAME=root
  DB_PASSWORD=
  </code></pre>
  <p>I tried editing</p>
  <pre><code>DB_HOST=127.0.0.1
  </code></pre>
  <p>to</p>
  <pre><code>DB_HOST=localhost
  </code></pre>
  <p>The error I receive is:</p>
  <pre><code>Illuminate\Database\QueryException  : SQLSTATE[HY000] [2002] Connection refused (SQL: select * from information_schema.tables where table_schema = web3project and table_name = migrations and table_type = 'BASE TABLE')
  </code></pre>
  <p>As I mentioned I am new to Mac OS and I may be doing something wrong with the XAMPP but the localhost is indeed working.</p>