I am not able to connect to database using Laravel.
PHP version: 7.1.10 MAC OSX
Error:
Whoops, looks like something went wrong.
(2/2) QueryException
SQLSTATE[HY000] [2002] Connection refused (SQL: SELECT * FROM project_categories WHERE status='A')
in Connection.php (line 647)
at Connection->runQueryCallback(object(Expression), array(), object(Closure))
in Connection.php (line 607)
at Connection->run(object(Expression), array(), object(Closure))
in Connection.php (line 326)
at Connection->select(object(Expression))
in DatabaseManager.php (line 324)`
ENV SETTINGS
APP_NAME=Somesite
APP_ENV=local
APP_KEY=base64:hFfau6WVxgBJ7GCmvnOK+GZd9/MuIy03zAqNCO8VTO8=
APP_DEBUG=true
APP_LOG_LEVEL=debug
APP_URL=http://localhost
DB_CONNECTION=mysql
DB_HOST=127.0.0.1
DB_PORT=3306
DB_DATABASE=somesite
DB_USERNAME=root
DB_PASSWORD=
Database.php configurations:
mysql' => [
'driver' => 'mysql',
'host' => env('DB_HOST', '127.0.0.1'),
'port' => env('DB_PORT', '3306'),
'database' => env('DB_DATABASE', 'mahijaa'),
'username' => env('DB_USERNAME', 'root'),
'password' => env('DB_PASSWORD', ''),
'unix_socket' => env('DB_SOCKET', ''),
'charset' => 'utf8mb4',
'collation' => 'utf8mb4_unicode_ci',
'prefix' => '',
'strict' => true,
'engine' => null,
],
Followed this thread: https://github.com/laravel/framework/issues/19522 to find solution but no use. What am i doing wrong, is it the problem with my code or environment. The same code works absolutely fine in windows machine. Recently migrated to mac OS and all went on toss