3

I'm a fresher in Cpanel laravel hosting. I'm facing a specific problem SQLSTATE[HY000] [1045] Access denied for user 'mbaam_trodian'@'localhost' (using password: YES) (SQL: select * from users where email = phar@gmail.com limit 1) and can't found any solution for 3 days.

Localhost: localhost setting

database user:

database user settings

.env file:

DB_CONNECTION=mysql
DB_HOST=127.0.0.1
DB_PORT=3306
DB_DATABASE=mbaam_smart_hospital
DB_USERNAME=mbaam_trodian
DB_PASSWORD=*************
Danish Kazmi
  • 101
  • 2
  • 6

3 Answers3

3

Try and removed all special characters from database password and replace with only alphabet or alphanumeric. for instance, DB_PASSWORD= mbamTrod0105

Rachael
  • 31
  • 2
1
  1. make database user in your cpanel
  2. add newly created user into your .env file
  3. clear cache php artisan cache:clear and then php artisan config:cache or you can delete the files into bootstrap/cache folder then your laravel project work fine
  • `DB_USERNAME=mbaam_trodian` where 'mbaam_trodian' is created by Cpanel | I also deleted all files as you said... but all in vain! – Danish Kazmi Nov 16 '20 at 12:35
  • make another user for your database and then try with it – tameemahmad shahzad Nov 16 '20 at 12:40
  • Sorry, brother... Nothing happens! One thing I want to confirm, which password should I use in creating a database user? my created password or generate a password??? -> [Suggestion Plz](https://snipboard.io/uLjHVx.jpg) – Danish Kazmi Nov 16 '20 at 19:15
  • tameemahmad shahzad thanks after struggling a lot your suggestion helps and save my day after deleting the bootstrap/cache – Shamsi786 Jul 16 '22 at 20:20
0

mine worked after I created new user and assigned to the db.