0

i am using laravel 7 with a xampp installation. php artisan migrate fails and gives the error: SQLSTATE[HY000] [2006] MySQL server has gone away

my .env file:

APP_URL=http://localhost

LOG_CHANNEL=stack

DB_CONNECTION=mysql
DB_HOST=127.0.0.1
DB_PORT=3306
DB_DATABASE=****_db
DB_USERNAME=root
DB_PASSWORD=*******

i have tried localhost in the env file isntead of 127.0.0.1. Worth mentioning that my xampp application launches at this address: http://192.168.64.2/

i have started and restated the xampp server and i have been php artisan cache:clear each time i make changes to the .env file

Screwtape007
  • 185
  • 1
  • 2
  • 16
  • are there some migration of data in your migrations, this could be mysql doing a timeout – mrhn Jun 06 '20 at 21:57
  • not sure what you mean but i only have migration in migrations/****_create_users_table.php and that is what im running – Screwtape007 Jun 06 '20 at 22:00
  • i used php artisan config:clear and now the error became SQLSTATE[HY000] [2002] No such file or directory – Screwtape007 Jun 06 '20 at 22:18
  • Does this answer your question? [ERROR 2006 (HY000): MySQL server has gone away](https://stackoverflow.com/questions/10474922/error-2006-hy000-mysql-server-has-gone-away) – Dan Jun 06 '20 at 23:50
  • i dont know how i resolved this but its resolved. im just experiencing another error when running php artisan migrate: SQLSTATE[HY000] [2002] No such file or directory – Screwtape007 Jun 06 '20 at 23:59

1 Answers1

0

I ended up ditching connecting to my local xampp installation and connected to an AWS RDS instance and it worked.

Screwtape007
  • 185
  • 1
  • 2
  • 16