Search code examples
databaselaravelmigrate

Laravel migrate not working


I have a problem with my new laravel project. Just after I create it, I try to make the migration with "php artisan migrate:install" but nothing happens ! Same with "migrate", "migrate:status" etc...

My terminal shows no error, nothing ! The connexion with the database is ok, when I change it with bad information, I got an error message.

I'm on mac and using MAMP.

here is my .env:

DB_CONNECTION=mysql
DB_HOST=127.0.0.1
DB_PORT=8888
DB_DATABASE=test
DB_USERNAME=root
DB_PASSWORD=root

Also, as I am on MAMP, I use this:

'unix_socket'   => '/Applications/MAMP/tmp/mysql/mysql.sock',

But it is still not working ! and It used to work on my old projects...


Solution

  • If the migrations table does not exist, Laravel cannot reach the database. Must be something in your connection.

    Double checking the config you have shown:

    DB_PORT=8888
    

    In MAMP, that's the port Apache runs on, not MySQL. According to the docs, MAMP runs MySQL on 8889, unless you have changed it.