Fix Laravel Valet - MySQL Has Gone Away
There seems to be a bug when using MySQL in combination with the latest macOS release. After some time, MySQL stops working. I discovered the problem mostly when working with WordPress and Laravel Valet.
You may discover the problem when you find something similar to “MySQL server has gone away” in MySQL logs or as output of a command. An example entry from the MySQL log:
SQLSTATE[HY000]  MySQL server has gone away /system/ee/legacy/database/drivers/mysqli/mysqli_connection.php:82
To solve this issue, add these two lines to your MySQL configuration file named my.cnf:
interactive_timeout = 300 wait_timeout = 300
You can locate the my.cnf by using one of these two commands from the terminal:
mdfind -name my.cnf
After restarting MySQL, the problem should be gone.
- Fix Laravel Forge Site Creation Problems
- Laravel - fix "1071 Specified key was too long; max key length is 1000" error
- Install Laravel 5.5 at Codeanywhere with PHP 7.1 and MySQL 5.7
- Manage MySQL Databases and Users from the Command Line
- Tutorial: Ubuntu 18.04 LAMP Setup for WordPress
- Fix WordPress Subfolder 404 Errors When Using Laravel Forge