0

I have installed a fresh Laravel project (5.7.5) on my Mac (10.13.6).

I have installed mysql (8.0.12) with brew install mysql and the laravel project with the laravel create laraveltest command.

Laravel is running in the Valet environment (2.1.1).

I can connect to the Mysql server with the Sequel Pro client (127.0.0.0, root with no password) and also by the command line mysql -uroot.

I can create a database create database laraveltest and use the database use laraveltest but when I try migrating the database php artisan migrate i get an error:

'PDOException : SQLSTATE[HY000] [2006] MySQL server has gone away')

So it seems that Laravel can't connect to my mysql server.

My .env file:

DB_CONNECTION=mysql
DB_HOST=127.0.0.1
DB_PORT=3306
DB_DATABASE=laraveltest
DB_USERNAME=root
DB_PASSWORD=

I tried uninstalling/installing mysql. restarting the computer. deleting/creating the laravel project. same error.

Any ideas what I can try to resolve this?

thisiskelvin
  • 4,136
  • 1
  • 10
  • 17
Fredrik
  • 33
  • 1
  • 5
  • *MySQL server has gone away* means that the connection was made but then something wrong happened with a query that made the server drop the connection. – apokryfos Sep 21 '18 at 10:33
  • 4
    Possible duplicate of [How to solve General error: 2006 MySQL server has gone away](https://stackoverflow.com/questions/33250453/how-to-solve-general-error-2006-mysql-server-has-gone-away) – Sand Of Vega Sep 21 '18 at 10:36

1 Answers1

-1

input your root password of your php admin i think you do have a password to root php admin right ? DB_PASSWORD="yourpassword"

ABO Baloyi
  • 17
  • 4