There are various ways to run multiple mysql instances (on different ports) on the same computer. Here I used the same binary and used a separate configuration file (with a separate port, pid, socket and data directory). We need to create new directories for our data folder and log (if used). We also need to assign the appropriate permissions for these folders:
# mkdir /var/lib/mysql2
Next, we need a separate configuration file, the same as the default mysql configuration file. Therefore, start by copying an existing one and changing the necessary values.
(or change the path corresponding to your configuration file is in a different place).
Then we need to edit our new configuration file with a different mysql port (3306 by default), pid and socket than the default, and also point the data and log folders to the ones created earlier.
# cd /etc
Finally, we need to initialize dbs by default:
Finally, we can start our new mysql instance using
We can connect to our new instance using:
or
# mysql -h 127.0.0.1 -P 3307
and if we don’t need it anymore, stop it:
Ref Site: https://linuxinpakistan.com/start-multiple-instances-mysql-machine
Mari criss
source share