My Laravel Project Files Hosted in example.in/projects/projectName
And the Database is on example.com
What I did
On example.com
Added Access Host IP of example.in
on Remote MySql Option.
On my Configuration( .env
) File which is hosted on example.in
DB_CONNECTION=mysql
DB_HOST=IPofExample.com
DB_PORT=3306
DB_DATABASE=sampleDatabase
DB_USERNAME=sampleUsername
DB_PASSWORD=samplePassword
Now When I try to fetch record from database. It shows me the following error.
Illuminate\Database\QueryException thrown with message "SQLSTATE[28000] [1045] Access denied for user 'ashutoshvibgyor'@'sg2plcpnl0032.prod.sin2.secureserver.net' (using password: YES) (SQL: select * from `case_studies`)"
Although I give all privileges to user when I Created One. I crawled through stackoverflow and google but didn't get any helpful answer.
I'm using shared hosting
To allow a mysql user to connect from a non-localhost ip in phpmyadmin:
(assuming mysql is already port forwarded/etc
)
Go to User accounts
> click edit privileges
on your user > switch the oval tab at the top to login information
> edit the host field to either your your ipv4 of your office/home/etc, or %
, then press go in the bottom right corner.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.