Bird
0
0

You updated your .env file to change the database password but Laravel still uses the old password. What is the most likely cause?

medium📝 Debug Q6 of 15
Laravel - Database Basics and Migrations
You updated your .env file to change the database password but Laravel still uses the old password. What is the most likely cause?
AThe database server is down
BYou forgot to clear the config cache
CThe password is hardcoded in a controller
DYou need to restart the database service
Step-by-Step Solution
Solution:
  1. Step 1: Understand Laravel config caching

    Laravel caches config values for performance; changes in .env require cache clearing.
  2. Step 2: Identify the fix

    Running php artisan config:clear clears the cache and applies new .env values.
  3. Final Answer:

    Not clearing config cache causes old password to persist -> Option B
  4. Quick Check:

    Clear config cache after .env changes [OK]
Quick Trick: Run php artisan config:clear after .env changes [OK]
Common Mistakes:
  • Restarting database unnecessarily
  • Assuming password is hardcoded
  • Ignoring config cache

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Laravel Quizzes