-
Notifications
You must be signed in to change notification settings - Fork 0
06. Databases
MySQL will be deploy on localhost:3306, and inside the virtual machine it will have the db hostname.
The application is ready to connect to this address as set in the .env file:
DB_CONNECTION=mysql
DB_HOST=db
DB_PORT=3306
DB_DATABASE=laravel
DB_USERNAME=root
DB_PASSWORD=secret
These variables are being used to configure the MySQL as default database for Laravel in /config/database.php.
They are also being used in in docker-compose.yml to build the MySQL container.
So if you want a different hostname or password for you MySQL, just edit them on .env file.
See Laravel Docs for more info about Database configuration.
Redis will be deploy on localhost:6379, and inside the virtual machine it will have the redis hostname.
The application is ready to connect to this address as set in the .env file:
REDIS_HOST=redis
REDIS_PASSWORD=redis
These variables are being used to configure Redis database for Laravel in /config/database.php.
They are also being used in in docker-compose.yml to build the Redis container.
So if you want a different hostname or password for you Redis, just edit them on .env file.
The application also comes with PhpRedis installed, so you can use Redis right away:
use Illuminate\Support\Facades\Redis;
Redis::set('name', 'Taylor');