Laravel 5 migration error 1045

I am getting the following error: enter image description here

Following this guide: http://tutsnare.com/access-denied-for-user-homesteadlocalhost-laravel-5/

I changed the .env file according to the guide, but I still get this error. Does anyone else know how to solve this? Also I am using mac with MAMP on localhost. Thank you.

+3


source to share


2 answers


In your file, .env

you need to set the database configuration values ​​according to your database configuration. With your current settings, you are trying to log into the database as root without a password.

You say you are using MAMP, and the default MySQL password in MAMP is root

, so yours .env

should have these database values.

DB_HOST=localhost
DB_DATABASE=laravel
DB_USERNAME=root
DB_PASSWORD=root

      



Obviously, you also need to make sure there is a named database laravel

.

NOTE. Do not run this configuration in a production environment or in any environment where security is important. This is fine for development, but for a production server, I would recommend giving Laravel its own database user, and only granting these permissions to your database laravel

.

+2


source


If you are using MAMP you need to add some things.

In your .env

add this.

DB_UNIX_SOCKET=/Applications/MAMP/tmp/mysql/mysql.sock
DB_PORT=8889

      



If you changed your MAMP MySQL port, change it here too.

Then database.php

add unix_socket

and port

..

'mysql' => [
    'unix_socket'   => env('DB_UNIX_SOCKET', ''),
    'port'          => env('DB_PORT', '3306'),
],

      

+1


source







All Articles