PHP 7.4 is now released, and it comes with support for MySQL 8's new password authentication plugin: caching_sha2_password.
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.
Replace USERNAME and YOUR_PASSWORD with your application database username and the password.
mysql> SELECT user,plugin from mysql.user;
Sample output
+------------------+-----------------------+
| user | plugin |
+------------------+-----------------------+
| Ayesh | caching_sha2_password |
| debian-sys-maint | mysql_native_password |
| mysql.infoschema | caching_sha2_password |
| mysql.session | mysql_native_password |
| mysql.sys | caching_sha2_password |
| root | auth_socket |
| testuser | mysql_native_password |
+------------------+-----------------------+
If you see mysql_native_password next to the database user's name, you can now change it to caching_sha2_password.
mysql> ALTER USER 'USERNAME'@'localhost' IDENTIFIED WITH caching_sha2_password BY 'YOUR_PASSWORD';
mysql> FLUSH PRIVILEGES;
https://php.watch/articles/PHP-7.4-MySQL-8-server-gone-away-fix https://laravel-news.com/laravel-and-mysql-8-fixing-mysql-server-has-gone-away-error