In this article
Single Command Database Setup
When you are working on a backend application, you are likely to need a database. You can either install it on your machine or use a Docker container. I prefer to use Docker containers because it is easier to setup and doesn't pollute my machine with unnecessary dependencies.
This short guide will show you how to spin up a MySQL, PostgreSQL, or MongoDB instance on your local machine using docker. Feel free to submit a PR adding more databases.
PostgreSQL
You can run the following command to run PostgreSQL in a Docker container:
Now you can connect and run commands against the instance using the following:
MySQL
You can run the following command to run MySQL in a Docker container:
Now, you can use the following to run commands against the MySQL instance:
MongoDB
You can run the following command to run MongoDB in a Docker container:
Now, you can use the following to run commands against the MongoDB instance:
Feel free to submit a pull request by adding additional databases to this guide.