SQLSTATE[HY000] [2002] Connection refused (SQL: select `active_template` from `general_settings` limit 1)

  laravel, mamp, php, sql

I have been trying to install a system to my local MAC via MAMP, I just recently updated the Database connection not configured error but not upon making the changes to the right configuration I got another error SQLSTATE[HY000] [2002] Connection refused.

Error goes as follows :

SQLSTATE[HY000] [2002] Connection refused (SQL: select active_template from general_settings limit 1)

IlluminateDatabaseQueryException:
SQLSTATE[HY000] [2002] Connection refused (SQL: select `active_template` from `general_settings` limit 1)

  at /Applications/MAMP/htdocs/VSMLM/core/vendor/laravel/framework/src/Illuminate/Database/Connection.php:678
  at IlluminateDatabaseConnection->runQueryCallback('select `active_template` from `general_settings` limit 1', array(), object(Closure))
     (/Applications/MAMP/htdocs/VSMLM/core/vendor/laravel/framework/src/Illuminate/Database/Connection.php:752)
  at IlluminateDatabaseConnection->tryAgainIfCausedByLostConnection(object(QueryException), 'select `active_template` from `general_settings` limit 1', array(), object(Closure))
     (/Applications/MAMP/htdocs/VSMLM/core/vendor/laravel/framework/src/Illuminate/Database/Connection.php:732)
  at IlluminateDatabaseConnection->handleQueryException(object(QueryException), 'select `active_template` from `general_settings` limit 1', array(), object(Closure))
     (/Applications/MAMP/htdocs/VSMLM/core/vendor/laravel/framework/src/Illuminate/Database/Connection.php:641)
  at IlluminateDatabaseConnection->run('select `active_template` from `general_settings` limit 1', array(), object(Closure))
     (/Applications/MAMP/htdocs/VSMLM/core/vendor/laravel/framework/src/Illuminate/Database/Connection.php:346)
  at IlluminateDatabaseConnection->select('select `active_template` from `general_settings` limit 1', array(), true)
     (/Applications/MAMP/htdocs/VSMLM/core/vendor/laravel/framework/src/Illuminate/Database/Query/Builder.php:2315)
  at IlluminateDatabaseQueryBuilder->runSelect()
     (/Applications/MAMP/htdocs/VSMLM/core/vendor/laravel/framework/src/Illuminate/Database/Query/Builder.php:2303)
  at IlluminateDatabaseQueryBuilder->IlluminateDatabaseQuery{closure}()
     (/Applications/MAMP/htdocs/VSMLM/core/vendor/laravel/framework/src/Illuminate/Database/Query/Builder.php:2867)
  at IlluminateDatabaseQueryBuilder->onceWithColumns(array('active_template'), object(Closure))
     (/Applications/MAMP/htdocs/VSMLM/core/vendor/laravel/framework/src/Illuminate/Database/Query/Builder.php:2304)
  at IlluminateDatabaseQueryBuilder->get(array('active_template'))
     (/Applications/MAMP/htdocs/VSMLM/core/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Builder.php:598)
  at IlluminateDatabaseEloquentBuilder->getModels(array('active_template'))
     (/Applications/MAMP/htdocs/VSMLM/core/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Builder.php:582)
  at IlluminateDatabaseEloquentBuilder->get(array('active_template'))
     (/Applications/MAMP/htdocs/VSMLM/core/vendor/laravel/framework/src/Illuminate/Database/Concerns/BuildsQueries.php:254)
  at IlluminateDatabaseEloquentBuilder->first(array('active_template'))
     (/Applications/MAMP/htdocs/VSMLM/core/vendor/laravel/framework/src/Illuminate/Support/Traits/ForwardsCalls.php:23)
  at IlluminateDatabaseEloquentModel->forwardCallTo(object(Builder), 'first', array(array('active_template')))
     (/Applications/MAMP/htdocs/VSMLM/core/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Model.php:1917)
  at IlluminateDatabaseEloquentModel->__call('first', array(array('active_template')))
     (/Applications/MAMP/htdocs/VSMLM/core/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Model.php:1929)
  at IlluminateDatabaseEloquentModel::__callStatic('first', array(array('active_template')))
     (/Applications/MAMP/htdocs/VSMLM/core/app/Http/Helpers/helpers.php:155)
  at activeTemplate()
     (/Applications/MAMP/htdocs/VSMLM/core/app/Providers/AppServiceProvider.php:40)
  at AppProvidersAppServiceProvider->boot()
     (/Applications/MAMP/htdocs/VSMLM/core/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php:36)
  at IlluminateContainerBoundMethod::IlluminateContainer{closure}()
     (/Applications/MAMP/htdocs/VSMLM/core/vendor/laravel/framework/src/Illuminate/Container/Util.php:40)
  at IlluminateContainerUtil::unwrapIfClosure(object(Closure))
     (/Applications/MAMP/htdocs/VSMLM/core/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php:93)
  at IlluminateContainerBoundMethod::callBoundMethod(object(Application), array(object(AppServiceProvider), 'boot'), object(Closure))
     (/Applications/MAMP/htdocs/VSMLM/core/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php:37)
  at IlluminateContainerBoundMethod::call(object(Application), array(object(AppServiceProvider), 'boot'), array(), null)
     (/Applications/MAMP/htdocs/VSMLM/core/vendor/laravel/framework/src/Illuminate/Container/Container.php:614)
  at IlluminateContainerContainer->call(array(object(AppServiceProvider), 'boot'))
     (/Applications/MAMP/htdocs/VSMLM/core/vendor/laravel/framework/src/Illuminate/Foundation/Application.php:914)
  at IlluminateFoundationApplication->bootProvider(object(AppServiceProvider))
     (/Applications/MAMP/htdocs/VSMLM/core/vendor/laravel/framework/src/Illuminate/Foundation/Application.php:895)
  at IlluminateFoundationApplication->IlluminateFoundation{closure}(object(AppServiceProvider), 20)
  at array_walk(array(object(EventServiceProvider), object(LogServiceProvider), object(RoutingServiceProvider), object(AuthServiceProvider), object(CookieServiceProvider), object(DatabaseServiceProvider), object(EncryptionServiceProvider), object(FilesystemServiceProvider), object(FormRequestServiceProvider), object(ParallelTestingServiceProvider), object(FoundationServiceProvider), object(NotificationServiceProvider), object(PaginationServiceProvider), object(SessionServiceProvider), object(ViewServiceProvider), object(TrustedProxyServiceProvider), object(CorsServiceProvider), object(ImageServiceProvider), object(UiServiceProvider), object(ServiceProvider), object(AppServiceProvider), object(AuthServiceProvider), object(EventServiceProvider), object(RouteServiceProvider), object(HashServiceProvider)), object(Closure))
     (/Applications/MAMP/htdocs/VSMLM/core/vendor/laravel/framework/src/Illuminate/Foundation/Application.php:896)
  at IlluminateFoundationApplication->boot()
     (/Applications/MAMP/htdocs/VSMLM/core/vendor/laravel/framework/src/Illuminate/Foundation/Bootstrap/BootProviders.php:17)
  at IlluminateFoundationBootstrapBootProviders->bootstrap(object(Application))
     (/Applications/MAMP/htdocs/VSMLM/core/vendor/laravel/framework/src/Illuminate/Foundation/Application.php:237)
  at IlluminateFoundationApplication->bootstrapWith(array('IlluminateFoundationBootstrapLoadEnvironmentVariables', 'IlluminateFoundationBootstrapLoadConfiguration', 'IlluminateFoundationBootstrapHandleExceptions', 'IlluminateFoundationBootstrapRegisterFacades', 'IlluminateFoundationBootstrapRegisterProviders', 'IlluminateFoundationBootstrapBootProviders'))
     (/Applications/MAMP/htdocs/VSMLM/core/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php:152)
  at IlluminateFoundationHttpKernel->bootstrap()
     (/Applications/MAMP/htdocs/VSMLM/core/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php:136)
  at IlluminateFoundationHttpKernel->sendRequestThroughRouter(object(Request))
     (/Applications/MAMP/htdocs/VSMLM/core/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php:110)
  at IlluminateFoundationHttpKernel->handle(object(Request))
     (/Applications/MAMP/htdocs/VSMLM/index.php:52)            

Source: Laravel

Leave a Reply