

Our command will look like this:ĭocker run -name=tns_mysql -p3306:3306 -v mysql-volume:/var/lib/mysql -e MYSQL_ROOT_PASSWORD=PWORD -d mysql/mysql-server With our volume ready, we’ll now deploy the MySQL container (named tns_mysql) and connect it to the volume. To create a volume named mysql-volume, issue the command: The first thing we’re going to do is create a volume for MySQL, so our data will remain persistent, in case the container fails. You’re now ready to deploy the containers. Log out and log back in, so the changes take effect.
#Docker phpmyadmin access to mysql host install#
Sudo apt-get install docker-ce docker-ce-cli containerd.io -y Next, add the official Docker GPG key with:Ĭurl -fsSL | sudo gpg -dearmor -o /usr/share/keyrings/docker-archive-keyring.gpgĪdd the stable Docker repository with the command:Įcho "deb $(lsb_release -cs) stable" | sudo tee /etc/apt//docker.list > /dev/null Sudo apt-get install ca-certificates curl gnupg lsb-release -y To do this, log into your Linux server and install the necessary dependencies with: I tend to like to start from scratch, so let’s get Docker up and running first. I’ll be demonstrating this on Ubuntu Server 20.04, but the process will be the same on any platform that supports Docker. With this process, you’ll find working with MySQL database container deployments so much easier.

I want to walk you through the process of deploying a MySQL container and then connecting a phpMyAdmin container to that database, for easier management. If you’ve never heard of this tool, it’s a web-based GUI that happens to be the de facto standard UI for MySQL and MariaDB database administration. One way of simplifying the management of your containerized MySQL database deployments is with the help of phpMyadmin. But if your database skills aren’t quite up to that task, how do you make all of this work? If you happen to be a database administrator, you’re probably perfectly at home on the command line.
#Docker phpmyadmin access to mysql host how to#
How to make it easier to manage a containerized database. Now that we’re on the same page, you see the problem. However, what about populating that database with data? Or what about managing the database? You can’t just pull down a docker image, deploy a container with it, and assume it will magically populate with the necessary data for your containerized application. To that end, you might deploy MySQL via a Docker container and then connect another container to the database for data. Without the ability to access data, you might find those containers to be a bit less-than-capable. Databases are a key component of your docker containers.
