Thursday, July 29, 2021

How to Run Multiple versions of MySQL on the Same Server?


Introduction

In this tutorial we are going to install Multiple

versions of MySQL on the Same server with the help of Docker service.

MySQL is an open-source relational database management system. Its name is a combination of "My", the name of co-founder Michael Widenius's daughter, and "SQL", the abbreviation for Structured Query Language, and its port no 3306

Docker is a set of platform as a service products that use OS-level virtualization to deliver software in packages called containers. Containers are isolated from one another and bundle their own software, libraries and configuration files; they can communicate with each other through well-defined channels.

Note :- If your system having a current version of MySQL 5.7 and you need MySQL 8.0 version so follow below steps.

Note :- You can also install different version of MySQL by just changing the value of version number.

 

Step 1) Open terminal or Connect Server via ssh

Step 2) Install Docker by execute the following command on your shell. 

$ curl -sSL https://get.docker.com/ | sh

Step 3) Download MySQL 8.0 container

MySQL run on default MySQL port number 3306. so This mysql 8.0 will run as the docker container and will change the port no 3307.

$ sudo docker run --name mysql-80-container -p 127.0.0.1:3307:3306 -e MYSQL_ROOT_PASSWORD=mypassword -d mysql:8.0

 NOTE-- Change the MySQL root Password according to your choice.

 

Step 4) Connect MySQL 8.0 version 

$ mysql -u root -p --host=127.0.0.1 --port=3307

Step 5) Verify Mysql 5.7 version also connecting.

$ mysql -u root -p --host=127.0.0.1 --port=3306

 

 

= Below MySQL Dump Import or Export Commands. =

Database Export

$  mysql -u root -p --host=127.0.0.1 --port=3306  database_name > database.sql

Database Import

$  mysql -u root -p --host=127.0.0.1 --port=3306  database_name < database.sql

No comments:

Post a Comment

testing