I tried deploying my project to an AWS EC2 server but when I tried to run php artisan migrate
I am getting the following error.
PDOException::(“SQLSTATE[HY000] [1045] Access denied for user ‘root’@’localhost’ (using password: NO)”)
PDO::__construct(“mysql:host=127.0.0.1;port=3306;dbname=myDb”, “root”, “”, [])
The following is my .env file:
PP_NAME="MyProject" APP_ENV=local APP_KEY=base64:UTBgGqkc11OYbnGGJVe32xFluhFeNw288oH0UcmMYqU= APP_DEBUG=true APP_URL=http://localhost LOG_CHANNEL=stack DB_CONNECTION=mysql DB_HOST=127.0.0.1 DB_PORT=3306 DB_DATABASE=myDb DB_USERNAME=root DB_PASSWORD=
Advertisement
Answer
Okay, so I got it fixed. All I did was run php artisan config:clear
. The problem was I had a previous migration already done with wrong credentials and everything. So after running php artisan config:clear
I went ahead and ran php artisan migrate
and everything was fine.
Thanks all for your time.