Reputation: 153
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
Upvotes: 3
Views: 8549
Reputation: 480
Try to use username and password as follows with quotation. i have no idea how it worked, but it really worked for me after searching a lot.
DB_CONNECTION=mysql
DB_HOST=127.0.0.1
DB_PORT=3306
DB_DATABASE=admin_clrank
DB_USERNAME='admin_clranke'
DB_PASSWORD='admin@123'
Upvotes: 1
Reputation: 19
Regarding the question, the password has to be in quotes -> 'password' that solutions me in hostinger
Upvotes: 0
Reputation: 913
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
Upvotes: 1
Reputation: 67
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
https://www.hostinger.com/how-to/what-is-my-mysql-hostname
Upvotes: 0
Reputation: 75
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.
Upvotes: -1