Fix Laravel - SQLSTATE 2006 MySQL server has gone away


This is a common error in Laravel, for example, when you are performing migrations or execute the migration command:

Illuminate\Database\QueryException

SQLSTATE[HY000] [2006] MySQL server has gone away (SQL: select * from information_schema.tables where table_schema = laravel_backend_api and table_name = migrations and table_type = 'BASE TABLE')

FIX:

Open your my.ini file and change the following settings:

FROM:

max_allowed_packet=1M

TO:

max_allowed_packet=16M