I have created an application in Laravel and completed it using a localhost MySQL database. When I was using a localhost XAMPP database, my application worked perfectly but, when I deployed my Laravel application on a newly purchased shared hosting and created a database in cpanel
and created a user against that database with all privileges, it throws the error:
SQLSTATE[HY000] [1045] Access denied for user
‘qualitym_yaseen’@’localhost’ (using password: YES)”
I have tried all possible solution but none worked.
This is my database connection in .env file:
DB_CONNECTION=mysql
DB_HOST=127.0.0.1
DB_PORT=3306
DB_DATABASE=qualitym_medicare
DB_USERNAME=qualitym_yaseen
DB_PASSWORD=password
4
Answers
1) From the Cpanel -> Remote MYSQL -> Copy Access hosts ip >
Add it to Access host -> add host
2) Once the IP is successfully added, paste it to the DB_HOST
Voila, your connection will work
Just need update your params in .env file by something like;
that info provides u in Control Panel>MySQL Databases from menu
https://www.hostinger.com/how-to/what-is-my-mysql-hostname
You can use MySQL Workbench to easily change the permissions.
Under Server -> User and Privileges.
Make host as % for username from which you want to access.
Regarding the question, the password has to be in quotes -> ‘password’ that solutions me in hostinger