Migration error php artisan PDOException in Laravel 4

I have a problem to accomplish this:

$ php artisan migrate

I get an error

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

I use MAMP and it works fine.

I tried setting localhost to 127.0.0.1, and I added 'unix_socket' => '/Applications/MAMP/tmp/mysql/mysql.sock', but nothing helps.

[Change] I also added a port and I checked the user and the password is correct and the server is working correctly .. any suggestion

thank

+4
source share
4 answers

, , mysql server , , Laravel 3306 ( mysql) , , mysql . , , .

, , :

[SOLVED] SQLSTATE[HY000] [2002] Connection refused
+6

, , Google, , , - .

MAMP MySQL " MySQL", Laravel ( ). MySQL Unix.

+5

.env laravel: MAMP mysql

'mysql' => [
        'driver'    => 'mysql',
        'host'      => env('DB_HOST', 'localhost'),
        'database'  => env('DB_DATABASE', 'forge'),
        'username'  => env('DB_USERNAME', 'forge'),
        'password'  => env('DB_PASSWORD', ''),
        'charset'   => 'utf8',
        'collation' => 'utf8_unicode_ci',
        'prefix'    => '',
        'port'      => '8889',
        'strict'    => false,
    ],

+4

, , MAMP config/database 'port' = > '8889' (, yu , 80, , Skype!)

0

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


All Articles