Solution:
If your system is having a current version of MySQL installed i.e 5.6 and you also need 5.5 version then follow the below steps.
You can also play with different versions also.
Installing Docker
To install Docker on your machine, execute the following command on your shell.
curl -sSL https://get.docker.com/ | sh
Get MySQL 5.5 container
Execute the following command; this will download the MySQL 5.5 image and will spin off the container. This will run as the docker container on port 3306. But on the host machine, we can choose the port 3310, so it will forward it to 3306 port.
sudo docker run --name mysql-55-container -p 127.0.0.1:3310:3306 -e MYSQL_ROOT_PASSWORD=mypassword -d mysql:5.5
NOTE: Password for the root user is “mypassword” (you can set of your choice)
Connect to MySQL 5.5
mysql -u root -p --host=127.0.0.1 --port=3310
Connect to MySQL 5.6
mysql -u root -p
And now you will have both My SQL 5.5 and 5.6 now. But for external remote access to the database of the container, you have to allow the port 3310 in the firewall.