0x0032 - Docker / Mysql Installation

Installing Docker / Mysql in Linux

0x0032 - Docker / Mysql Installation
  • Because you just can never have enough installation guides...

First install mysql-client

sudo apt install mysql-client

Pulls about 78 MB installation..

sudo apt install docker.io -y
sudo docker pull mysql/mysql-server:latest
sudo docker images -a

Shows we now have the mysql image:

sudo docker run --name mysql -d --restart unless-stopped mysql/mysql-server

Get the generated root password:

sudo docker logs mysql

Will show up as:

This only opened up the local port to the 172 address when we nmap the local 192 it is not there:

Checking for the assigned IP address for the running container:

The full installation:

sudo docker run --name mysql -d --restart unless-stopped -p 3306:3306 -e MYSQL_ROOT_PASSWORD=<mypassword> mysql

Even though we did not do a bind to 0.0.0.0 adding the -p 3306:3306 has made it external and bound it to the 192.168.2.X address:

  • We have been able to set the default password as well in the ENV option: MYSQL_ROOT_PASSWORD=<mypassword>

Testing the remote connection works!

mysql -u root -h 192.168.2.X -p
Linux Rocks Every Day