0
votes

I am working on my Mac and i am trying to connect to database as shown in the env file i have mention the db name but i still getting this error on my laravel project. i have tried it on core php project it work but i get this error while connecting laravel project to database.

SQLSTATE[HY000] [2002] Connection refused (SQL: select * from information_schema.tables where table_schema = cart and table_name = migrations and table_type = 'BASE TABLE') at vendor/laravel/framework/src/Illuminate/Database/Connection.php:671

667|         // If an exception occurs when attempting to run a query, we'll format the error
668|         // message to include the bindings with SQL, which will make this exception a
669|         // lot more helpful to the developer instead of just the database's errors.
670|         catch (Exception $e) {
671|             throw new QueryException(
672|                 $query, $this->prepareBindings($bindings), $e
673|             );
674|         }
675| 

Error Message

1

1 Answers

1
votes

try this

php artisan config:clear

and then

php artisan migrate

that if you are sure the database already exists