Question

Access Denied for Database although credentials are correct

As I was following this tutorial,

https://www.digitalocean.com/community/tutorials/automatically-deploy-laravel-applications-deployer-ubuntu

Everything is perfectly done except the database connection. During deploy, at migrate stage, it seems the env credentials provided is not able to establish a connection with the server itself.

  • Laravel 8
  • MySQL 8
  • PHP 7.4
  • Ubuntu 20 These are the specs
Subscribe
Share

Submit an answer
You can type!ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Hi @risingsoul1991,

Can you try using the following command to see if you would be able to connect to the database :

mysql -u laravel_db_user -p laravel_db -h localhost

You’ll need to change laravel_db_user and laravel_db with the actual information of course.

If it doesn’t work, most probably your password is not correct. To change it, you can use the following

mysql
ALTER USER 'laravel_db_user '@'localhost' IDENTIFIED BY 'New-Password-Here';

Regards, KFSys