Reputation: 301
I am having the following error:
After following this guide: http://tutsnare.com/access-denied-for-user-homesteadlocalhost-laravel-5/
I changed my .env file in accordance with the guide but I'm still getting that error. Does anyone else know how to solve this? Also I am using a mac with MAMP on localhost. Thanks.
Upvotes: 3
Views: 731
Reputation: 106
If you 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 in your database.php
config add unix_socket
and port
..
'mysql' => [
'unix_socket' => env('DB_UNIX_SOCKET', ''),
'port' => env('DB_PORT', '3306'),
],
Upvotes: 1
Reputation: 7899
In your .env
file you need to set the database config values to match your database configuration. With your current settings you are trying to login to the database as the root user without a password.
You say that you're using MAMP and the default MySQL password under MAMP is root
, so your .env
should have these database values.
DB_HOST=localhost
DB_DATABASE=laravel
DB_USERNAME=root
DB_PASSWORD=root
Obviously, you'll also need to make sure there is a database named laravel
.
NOTE: Don't run this configuration in a production environment or any environment where security is important. It's ok for development, but for a production server I would recommend giving Laravel its own database user, and only granting that user permissions for your
laravel
database.
Upvotes: 2