'SQLSTATE[HY000] [1045] Access denied for user 'qualitym_yaseen'@'localhost' (using password: YES)
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
Solution 1:[1]
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
Solution 2:[2]
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.
Solution 3:[3]
Just need update your params in .env file by something like;
DB_HOST= mysql.hostinger.com
DB_DATABASE=u7979345345_user
DB_PASSWORD=password
that info provides u in Control Panel>MySQL Databases from menu
Solution 4:[4]
Regarding the question, the password has to be in quotes -> 'password' that solutions me in hostinger
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | |
| Solution 2 | Community |
| Solution 3 | |
| Solution 4 | Eric Aya |
