Fix PHP 7.4 + MySQL 8 errors with server has gone away
PHP 7.4 is now released, and it comes with support for MySQL 8's new password authentication plugin: caching_sha2_password.
1. Connect to the database as root
Depending on your root username, you will be prompted to enter the password, a hostname, etc. By default, typing mysql in your server terminal should work. If you have trouble logging in, try mysql -p -u root, and entering the root password when asked.
2. Check existing authentication plugin:
Replace USERNAME and YOUR_PASSWORD with your application database username and the password.