So, when I was creating my first laravel 6 app and trying to connect it to the database, I got these two errors:

  1. PDOException : SQLSTATE[HY000] [2006] MySQL server has gone away
  2. Illuminate\Database\QueryException  : SQLSTATE[HY000] [2002] Connection refused (SQL: select * from information_schema.tables where table_schema = chat_db and table_name = migrations and table_type = 'BASE TABLE')
    

As I Googled around for a bit, I found 2 very simple solutions!

  1. For the first problem, you have to edit your MySQL configuration file which should be in /usr/local/etc/my.cnf in your Mac.
    Open the file and add the following line to it:
default-authentication-plugin=mysql_native_password
  1. And for the second error, go to your laravel app and open the .env file and then, change your DB_HOST=127.0.0.1 to DB_HOST=localhost.

You're good to go now!