Zend certified PHP/Magento developer

main.CRITICAL: SQLSTATE[HY000] [2002] Connection refused

I am using magento 2.3.4 version and i am keep getting this error Multiple times

main.CRITICAL: SQLSTATE[HY000] [2002] Connection refused {"report_id":"d953b23017cc156845a623c7225f2e281cf201d080f960026cb40a49fcdaf44b","exception":"[object] (Zend_Db_Adapter_Exception(code: 2002): SQLSTATE[HY000] [2002] Connection refused at /var/www/html/vectorx/vendor/magento/zendframework1/library/Zend/Db/Adapter/Pdo/Abstract.php:144, PDOException(code: 2002): SQLSTATE[HY000] [2002] Connection refused at /var/www/html/vectorx/vendor/magento/zendframework1/library/Zend/Db/Adapter/Pdo/Abstract.php:128)"} []

I tried searching and I found renaming localhost to 127.0.0.1
but this is not working for me how can I solver this error