In most cases, you execute your code on the same computer your database runs on. In that case localhost is the correct value. If I understand correctly, you execute code locally and wish to communicatie with a remote database. If true, don't connect to 'localhost' but to your remote server (e.g. yourdomain.com). Please check if hostgator allows remote database access. Not all hosters allow you to do so and certainly not by default.
You are correct, I am trying to connect to hostgator a remote database. I changed the 'host' value to http:www.flemzy.com and get this error after trying to run php artisan migrate
[PDOException]
SQLSTATE[HY000] [2003] Can't connect to MySQL server on 'http://www.flemzy.
com' (4)
I found out the issue is I have to have ssh shell access in order to access the CLI utility on Hostgator's server. Hostgator only gives jail shell access which is limited. So this means that database migrations cannot be done with artisan but instead manually importing/exporting sql. If you have a VPS or Dedicated server you get root ssh access. I hope this will help someone in the future. Here is an article for reference if you do have root ssh access: Post
Sign in to participate in this thread!
The Laravel portal for problem solving, knowledge sharing and community building.
The community