DockerHandsonMysqlimage
DockerHandsonMysqlimage
and one of the most popular web server solutions. It stores and structures data
in a meaningful manner, ensuring easy accessibility.
In this tutorial, learn how to deploy a MySQL Docker container and start
working with the containerized database.
Using the Docker software for setting up your database is becoming increasingly
popular for small-scale apps. Instead of having a separate server for database
hosting, you can deploy a MySQL database container.
Multiple containers can run on your computer. The containers share the same
kernel and libraries of the host while packaging the deployed application or
software into single units. This makes the database extraordinarily lightweight
and fast to spin up.
Note: This tutorial assumes you already have Docker on your system. If you
don't have the software, take a look at one of our articles on how to install
Docker on CentOS, installing Docker on Ubuntu, or Docker guides for other
operating systems.
2. Verify the image is now stored locally by listing the downloaded Docker
images:
docker ps
You should see the newly created container listed in the output. It includes
container details, one being the status of this virtual environment. The status
changes from health: starting to healthy, once the setup is complete.
2. Then, open the logs file for the MySQL container to find the generated root
password:
3. Scroll through the output and find the line [Entrypoint] GENERATED ROOT
PASSWORD: , copy and paste the password in a notepad or text editor so you can
use it later.
4. Next, go to the bash shell of the MySQL container by typing:
3. Provide the root password you copied from the logs file, when prompted. With
that, you have connected the MySQL client to the server.
4. Finally, change the server root password to protect your information: