I've been scratching my head all day at this and feel like I've tried every conceivable Google search possible. Apologies if I'm being a total idiot!
Error message reads:
Illuminate\Database\QueryException : SQLSTATE[HY000] [1045] Access denied for user 'username'@'localhost' (using password: NO) (SQL: select * from information_schema.tables where table_schema = database_name and table_name = migrations)
I've created a user (I'm using 'username' in this example). This user has been given all the available privileges for the database.
Within Envoyer I've set up the Server Environment to somewhat resemble the .env.example file while changing all the necessary fields.
This is what I've ended up with:
APP_NAME="Test Project"
APP_ENV=production
APP_KEY=[key does show correctly]
APP_DEBUG=true
LOG_CHANNEL=stack
DB_CONNECTION=mysql
DB_HOST=localhost
DB_PORT=3306
DB_DATABASE=database_name
DB_USERNAME=username
DB_PASSWORD=...
BROADCAST_DRIVER=log
CACHE_DRIVER=file
SESSION_DRIVER=file
SESSION_LIFETIME=120
QUEUE_DRIVER=sync
This successfully creates a .env file which is a sibling to the current & releases folders. I've then ssh'd into the server and can see a link to this .env file while in the current folder.
I've also set up a hook to run after 'Purge Old Releases' which looks like:
cd public_html/current
php artisan key:generate
php artisan config:cache
/scripts/restartsrv apache_php_fpm (Restarts the server. The default Envoyer way doesn't work either..)
php artisan migrate --force
This will return the error message above. I don't know where to go next from here.
I've signed into the server through ssh and I am able to login to MySQL through the command line.
I've opened up MySQL Workbench and set up a test connection to the database which works just fine.
I've then run the command 'php artisan tinker' and DB::connection()->getPdo(); will return a similar Access denied message. However, DB::connection()->getDatabaseName(); DOES return the Database's Name that is in the .env file. So I concluded that the .env file is being linked up correctly.
Again, sorry if this is a simple fix but I've tried everything I can find and I'm completely stuck right now.
Thanks for any help in advance! Would be much appreciated :)