Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

php artisan migrate error PDOException in Laravel 4

Tags:

php

mysql

laravel

I have a problem to execute this:

$ php artisan migrate

I'm getting an error

[PDOException]                             
SQLSTATE[HY000] [2002] Connection refused 

I'm using MAMP and it's working ok.

I have tried to set the localhost to 127.0.0.1 and I've added 'unix_socket' => '/Applications/MAMP/tmp/mysql/mysql.sock' but nothing helps.

[Edit] also I've added the port and I have checked the user and the password are correct and the server is running properly.. any suggestion??

Thanks

like image 309
gon250 Avatar asked Dec 07 '22 02:12

gon250


1 Answers

Not sure but make sure your mysql server is running and it's running on the right port as expected because, Laravel's default port value is 3306 (it's the default port of mysql server) and most probably mysql is running on a different port. Here is a discussion and also check this answer, it's almost similar.

Also follow this thread which discussed and solved the same error you mentioned in your question:

[SOLVED] SQLSTATE[HY000] [2002] Connection refused
like image 58
The Alpha Avatar answered Dec 23 '22 21:12

The Alpha