Setting Up the Chinook database for the Project
This lesson is part of a series on creating a REST API for the Chinook database.
Related Links:
- Setting up a connection pool with the mysql2 package
- Here's a good reference on running queries with mysql2
- mysql2 documentation
The .env files
In this video we'll add environment variables to the .env files. To save you time, I've put them here. Make sure you paste the following samples into the proper .env file
.env.dev
Add these variables to the .env.dev file:
DB_CONNECTION_LIMIT=10
DB_HOST=localhost
DB_USER=root
DB_PASSWORD=""
DB_NAME=chinook
DB_PORT=3306
DB_ALLOW_MULTIPLE_STATEMENTS=false
DB_WAIT_FOR_CONNECTION=false
.env.test
Add these variables to the .env.test file:
DB_CONNECTION_LIMIT=10
DB_HOST=localhost
DB_USER=root
DB_PASSWORD=""
DB_NAME=chinook_test
DB_PORT=3306
DB_ALLOW_MULTIPLE_STATEMENTS=true
DB_WAIT_FOR_CONNECTION=false
.env
Add these variables to the .env file:
DB_CONNECTION_LIMIT=10
DB_HOST=xxx
DB_USER=xxx
DB_PASSWORD=xxx
DB_NAME=xxx
DB_PORT=xxx
DB_ALLOW_MULTIPLE_STATEMENTS=false
DB_WAIT_FOR_CONNECTION=true