Bird
0
0

Which of the following is the correct way to set the database connection type in Laravel's .env file?

easy📝 Syntax Q12 of 15
Laravel - Database Basics and Migrations
Which of the following is the correct way to set the database connection type in Laravel's .env file?
ADB_CONNECTION=mysql
BDATABASE=mysql
CDB_TYPE=mysql
DCONNECTION_DB=mysql
Step-by-Step Solution
Solution:
  1. Step 1: Recall Laravel's .env database config keys

    Laravel uses keys starting with DB_, such as DB_CONNECTION for the driver type.
  2. Step 2: Match the correct key for connection type

    The correct key is DB_CONNECTION, set to the database type like mysql, pgsql, sqlite.
  3. Final Answer:

    DB_CONNECTION=mysql -> Option A
  4. Quick Check:

    DB_CONNECTION sets driver = C [OK]
Quick Trick: DB_CONNECTION is the exact key for database type [OK]
Common Mistakes:
  • Using DATABASE or DB_TYPE instead of DB_CONNECTION
  • Mixing key order or spelling
  • Forgetting to set DB_CONNECTION at all

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Laravel Quizzes