0

I have EC2 instance with MySQL installed and I am trying to connect MySql to Laravel, but I keep getting an error SQLSTATE[HY000] [2002] Connection refused.

What am I doing wrong?

.envfile

DB_CONNECTION=mysql
DB_HOST=127.0.0.1
DB_PORT=3306
DB_DATABASE=LOGI
DB_USERNAME=root
DB_PASSWORD=MY_PASSWORD
smchae
  • 1,035
  • 3
  • 17
  • 39
  • 1
    have you ran `php artisan config:cache`? can you enter your mysql with that username and password using phpmyadmin or terminal? what have you tried other than changing the .env? – Sérgio Reis Mar 15 '18 at 13:51
  • @SérgioReis Oh god. you saved my day. thank you so much. you should have answer the post, so I could accept it. – smchae Mar 15 '18 at 13:52
  • This is already a well known question though, check for example https://stackoverflow.com/questions/34420761/laravel-5-2-not-reading-env-file , anyways, glad to have helped – Sérgio Reis Mar 15 '18 at 13:54
  • 1
    Possible duplicate of [Laravel 5.2 not reading env file](https://stackoverflow.com/questions/34420761/laravel-5-2-not-reading-env-file) – Option Mar 15 '18 at 14:18

0 Answers0