Laravel 5.6 MySQL Server has gone away

This worked for me. I used the following command to update my password with new authentication plugin. You can use MySQL 8 now. Have fun.

ALTER USER `username`@`localhost` IDENTIFIED WITH caching_sha2_password BY 'password';

If above doesn't work use this instead.

ALTER USER 'username'@'localhost' IDENTIFIED WITH mysql_native_password BY 'password';

Got this sorted out! Woohoo! Thank you again to everyone for all of the advice, I really appreciated the assistance.

How I Resolved:

Digging deeper into this, I noticed that I had 2 versions of MySQL installed - 5.7 & 8.0.

  • I uninstalled [email protected] via homebrew
  • Linked the correct version
  • I updated my $PATH
    • sudo nano ~/.bash_profile
    • And added the following line in place of the 5.7:
    • export PATH="/usr/local/opt/[email protected]/bin:$PATH"
  • I followed @poohbear 's answer here about altering the mysql user
  • Then, I truncated the user table on the Laravel database from the mysql prompt
    • mysql -u root -p
    • mysql> USE digitalchef;
    • mysql> TRUNCATE TABLE users;

I don't know if it accomplished anything after the fact, but I made sure to run a php artisan config:cache afterwards, just for good measure.

Hopefully this helps someone out who is struggling with this! Thank you all again for the support, and @poohbear deserves mad credit for his answer.

Tags:

Mysql

Php

Laravel