How to connect Laravel application to MySQL using MAMP?

SOLVED: I followed what this site said http://forums.laravel.io/viewtopic.php?id=980 I just added 'unix_socket' to the mysql array and it will work!

I follow the Laravel quick start guide at http://laravel.com/docs/quick

Everything is set up for me and I use MAMP. When I try to view the /public/users page, it amazes me:

PDOException

SQLSTATE [28000] [1045] Access denied for user "root" @ "localhost" (using password: YES) ".

My database.php file looks like this:

 'mysql' => array( 'driver' => 'mysql', 'host' => 'localhost', 'database' => 'todolist', 'username' => 'root', 'password' => 'root', 'charset' => 'utf8', 'collation' => 'utf8_unicode_ci', 'prefix' => '', ), 

My MAMP displays:

 host localhost port 8889 user root password root 

My question is, is MySQL on MAMP separate from the MySQL tables that I created locally? I suppose yes, because I cannot see the tables in PHPMyAdmin. If so, is it possible to connect my Laravel application to MAMP MySQL?

+6
source share
1 answer

MAMPs MySQL runs on port 8889, so add 'port' => '8889' to your configuration array

+12
source

Source: https://habr.com/ru/post/951756/


All Articles