VM: docker: mysql installation
In this quick guide we go over installation of a docker mysql.
- 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