At this point, Swift and Vapor are already installed and functional for you. If not, go back to Chapter 3. What's left to do is set up your local database environment. Since we are already using Docker, you can easily spin up a MySQL database through Docker. Follow the given steps:
- Go into your terminal and run the following commands:
sudo mkdir /usr/local/opt/mysql
sudo mkdir /usr/local/opt/mysql/8.0
sudo chmod -R ug+w /usr/local/opt/mysql/
By executing the preceding commands, we are installing a local database folder that the Docker instance can access. It keeps us from losing our data when we close Docker.
- Now, grant Docker permission to share information with that folder. Open the preferences for Docker:
- Add the folder we just created to the files under File Sharing and press Apply & Restart:
- Now, we can start our MySQL server...