Recall & Review
beginner
What file in a Laravel project holds the main database configuration settings?
The
.env file holds the main database configuration settings like database name, username, password, and host.Click to reveal answer
beginner
How do you specify the database connection type in Laravel?
You specify the database connection type in the
DB_CONNECTION variable inside the .env file, for example, DB_CONNECTION=mysql.Click to reveal answer
intermediate
Where does Laravel store the default database connection settings besides the
.env file?Laravel stores default database connection settings in the
config/database.php file, which reads values from the .env file.Click to reveal answer
beginner
What is the purpose of the
DB_HOST variable in Laravel's database configuration?The
DB_HOST variable defines the address of the database server Laravel should connect to, like 127.0.0.1 or a remote IP.Click to reveal answer
intermediate
How can you configure multiple database connections in Laravel?
You can add multiple connections inside the
connections array in config/database.php and switch between them by setting DB_CONNECTION in .env.Click to reveal answer
Which file do you edit to set your database username in Laravel?
✗ Incorrect
The
.env file is where you set environment variables like database username.What does the
DB_CONNECTION variable specify?✗ Incorrect
DB_CONNECTION tells Laravel which database type to use, like mysql or sqlite.Where are the default database connection settings stored in Laravel?
✗ Incorrect
The
config/database.php file holds the default connection settings.If you want to connect to a remote database server, which variable do you change?
✗ Incorrect
DB_HOST sets the address of the database server.How do you switch between multiple database connections in Laravel?
✗ Incorrect
You switch connections by setting
DB_CONNECTION in the .env file.Explain how Laravel uses the
.env file and config/database.php together for database configuration.Think about where you put your database details and how Laravel reads them.
You got /4 concepts.
Describe the steps to configure Laravel to connect to a MySQL database on a remote server.
Focus on the variables in the .env file related to MySQL.
You got /5 concepts.