enter image description here

SQLSTATE[HY000] [2002] Connection refused for the database server host name

  • Replace to localhost Jan 9, 2017 at 7:33
  • It has not worked parekh.
    – vignesh
    Jan 9, 2017 at 8:49

2 Answers 2


I think there is something error with your database credential

as per your image that is what I understand May be you have written wrong db credential

check list for you

Create Db user at your server

Set password for that user

Create Blank database

and put those right credential at here

  • Thank you Murtuza,but I can do all those things locally with xampp server.but i have no idea how to do that in heroku.when i deployed magento2 to heroku ,it just showed me that client interface
    – vignesh
    Jan 9, 2017 at 7:38
  • @vignesh as per your image I think you are trying this at live site Jan 9, 2017 at 8:00
  • yes murtuza,I am in cloud environment
    – vignesh
    Jan 9, 2017 at 8:05
  • @vignesh how can you connect your local database with cloud ?? create database at your cloud environment Jan 9, 2017 at 8:06
  • yes murtuza,i thought that heroku would provide mysql default for the deployed application.but it wont provide mysql it seems.can you suggest me a way to implement database for magento in heroku
    – vignesh
    Jan 9, 2017 at 8:08

I believe Heroku uses database urls to convey the DB connection information that it has configured. you can use heroku config --app APPNAME to get the connection url which you can then enter in the web install wizard.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.