MariaDB Database Multi-instance implementation in single machine

---------------------------------------------------------------------
MariaDB Database Multi-instance implementation in single machine
---------------------------------------------------------------------

Step - 1 : Install MaariaDB [ First ] instance by using YUM or Repo installation 
Step - 2 : Setup for other port numbers [ 3307 , 3308 and 3309 ] Instances for MariaDB 
Step - 3 : Start the MariaDB service with new DB instances [ 3307 , 3308 and 3309 ] 
Step - 4 : Stop / Shutdown of MariaDB all Instances [ 3306 , 3307 ,3308 and 3309 ]
Step - 5 : Connection for all MariaDB instances [ 3306 , 3307 ,3308 and 3309 ]
Step - 6 : Setting the password for DB super user for all MariaDB instances [ 3306 , 3307 ,3308 and 3309 ]
Step - 7 : MariaDB services creation for all instances [ 3306 , 3307 ,3308 and 3309 ]
Step - 8 : Stop / Start / Status / Restart for all MariaDB instances by uising mariadb instance service files


-------------------------------------------------------------------------------
Step -1 : Install MaariaDB [ First ] instance by using YUM or Repo installation 
-------------------------------------------------------------------------------

Environment Details :-
---------------------

CentOS = 7.9
MariaDB Version = 10.5.

--> Install MariaDB via package manager (yum)

https://mariadb.org/download/?t=repo-config&d=CentOS+7+%28x86_64%29&v=10.5&r_m=aliyun

By using above link we can configure 10.5.x DB version by using YUM REPOSITORY.

Here is our custom MariaDB YUM repository entry for CentOS. Copy and paste it into a file under /etc/yum.repos.d we suggest naming the file MariaDB.repo or something similar).

[root@multipleinstance ~]# yum repolist

[root@multipleinstance ~]# cd /etc/yum.repos.d/

[root@multipleinstance yum.repos.d]# pwd
/etc/yum.repos.d
[root@multipleinstance yum.repos.d]# ls -ltr
-rw-r--r--. 1 root root  616 Nov 23  2020 CentOS-x86_64-kernel.repo
-rw-r--r--. 1 root root 8515 Nov 23  2020 CentOS-Vault.repo
-rw-r--r--. 1 root root 1331 Nov 23  2020 CentOS-Sources.repo
-rw-r--r--. 1 root root  630 Nov 23  2020 CentOS-Media.repo
-rw-r--r--. 1 root root  314 Nov 23  2020 CentOS-fasttrack.repo
-rw-r--r--. 1 root root  649 Nov 23  2020 CentOS-Debuginfo.repo
-rw-r--r--. 1 root root 1309 Nov 23  2020 CentOS-CR.repo
-rw-r--r--. 1 root root 1664 Nov 23  2020 CentOS-Base.repo

[root@multipleinstance yum.repos.d]# vi MariaDB.repo

[root@multipleinstance yum.repos.d]# cat MariaDB.repo
# MariaDB 10.5 CentOS repository list - created 2022-02-15 16:28 UTC
# https://mariadb.org/download/
[mariadb]
name = MariaDB
baseurl = https://mirrors.aliyun.com/mariadb/yum/10.5/centos7-amd64
gpgkey=https://mirrors.aliyun.com/mariadb/yum/RPM-GPG-KEY-MariaDB
gpgcheck=1
[root@multipleinstance ~]# yum update
[root@multipleinstance ~]# yum repolist

--> After the file is in place, install MariaDB with:

[root@multipleinstance ~]# yum install MariaDB-client.x86_64 MariaDB-server.x86_64

[root@multipleinstance ~]# rpm -qa | grep -i MariaDB
MariaDB-common-10.5.15-1.el7.centos.x86_64
MariaDB-compat-10.5.15-1.el7.centos.x86_64
MariaDB-client-10.5.15-1.el7.centos.x86_64
MariaDB-server-10.5.15-1.el7.centos.x86_64
[root@multipleinstance ~]#

--> Start the MariaDB [3306] DB service..

[root@multipleinstance ~]# service mariadb status
Redirecting to /bin/systemctl status mariadb.service
● mariadb.service - MariaDB 10.5.15 database server
   Loaded: loaded (/usr/lib/systemd/system/mariadb.service; disabled; vendor preset: disabled)
  Drop-In: /etc/systemd/system/mariadb.service.d
           └─migrated-from-my.cnf-settings.conf
   Active: inactive (dead)
     Docs: man:mariadbd(8)
           https://mariadb.com/kb/en/library/systemd/

[root@multipleinstance ~]# service mariadb start
Redirecting to /bin/systemctl start mariadb.service

[root@multipleinstance ~]# service mariadb status
Redirecting to /bin/systemctl status mariadb.service
● mariadb.service - MariaDB 10.5.15 database server
   Loaded: loaded (/usr/lib/systemd/system/mariadb.service; disabled; vendor preset: disabled)
  Drop-In: /etc/systemd/system/mariadb.service.d
           └─migrated-from-my.cnf-settings.conf
   Active: active (running) since Tue 2022-02-15 17:40:28 UTC; 1s ago
     Docs: man:mariadbd(8)
           https://mariadb.com/kb/en/library/systemd/
  Process: 32551 ExecStartPost=/bin/sh -c systemctl unset-environment _WSREP_START_POSITION (code=exited, status=0/SUCCESS)
  Process: 32527 ExecStartPre=/bin/sh -c [ ! -e /usr/bin/galera_recovery ] && VAR= ||   VAR=`cd /usr/bin/..; /usr/bin/galera_recovery`; [ $? -eq 0 ]   && systemctl set-environment _WSREP_START_POSITION=$VAR || exit 1 (code=exited, status=0/SUCCESS)
  Process: 32525 ExecStartPre=/bin/sh -c systemctl unset-environment _WSREP_START_POSITION (code=exited, status=0/SUCCESS)
 Main PID: 32538 (mariadbd)
   Status: "Taking your SQL requests now..."
   CGroup: /system.slice/mariadb.service
           └─32538 /usr/sbin/mariadbd
Feb 15 17:40:28 multipleinstance mariadbd[32538]: 2022-02-15 17:40:28 0 [Note] InnoDB: 10.5.15 started; log sequence number 45106; transaction id 20
Feb 15 17:40:28 multipleinstance mariadbd[32538]: 2022-02-15 17:40:28 0 [Note] Plugin 'FEEDBACK' is disabled.
Feb 15 17:40:28 multipleinstance mariadbd[32538]: 2022-02-15 17:40:28 0 [Note] InnoDB: Loading buffer pool(s) from /var/lib/mysql/ib_buffer_pool
Feb 15 17:40:28 multipleinstance mariadbd[32538]: 2022-02-15 17:40:28 0 [Note] InnoDB: Buffer pool(s) load completed at 220215 17:40:28
Feb 15 17:40:28 multipleinstance mariadbd[32538]: 2022-02-15 17:40:28 0 [Note] Server socket created on IP: '::'.
Feb 15 17:40:28 multipleinstance mariadbd[32538]: 2022-02-15 17:40:28 0 [Note] Reading of all Master_info entries succeeded
Feb 15 17:40:28 multipleinstance mariadbd[32538]: 2022-02-15 17:40:28 0 [Note] Added new Master_info '' to hash table
Feb 15 17:40:28 multipleinstance mariadbd[32538]: 2022-02-15 17:40:28 0 [Note] /usr/sbin/mariadbd: ready for connections.
Feb 15 17:40:28 multipleinstance mariadbd[32538]: Version: '10.5.15-MariaDB'  socket: '/var/lib/mysql/mysql.sock'  port: 3306  MariaDB Server
Feb 15 17:40:28 multipleinstance systemd[1]: Started MariaDB 10.5.15 database server.
[root@multipleinstance ~]#

[root@multipleinstance ~]# ps -ef | grep -i mysql
mysql    32538     1  0 17:40 ?        00:00:00 /usr/sbin/mariadbd
root     32566  2356  0 17:42 pts/1    00:00:00 grep --color=auto -i mysql

[root@multipleinstance lib]# mv mysql mysql3306

[root@multipleinstance ~]# cd /var/lib/mysql3306/

[root@multipleinstance mysql3306]# pwd
/var/lib/mysql3306

[root@multipleinstance mysql]# ls -ltr
drwx------. 2 mysql mysql      4096 Feb 15 17:33 mysql
drwx------. 2 mysql mysql        20 Feb 15 17:33 performance_schema
drwx------. 2 mysql mysql        20 Feb 15 17:33 test
-rw-rw----. 1 mysql mysql       972 Feb 15 17:33 ib_buffer_pool
-rw-rw----. 1 mysql mysql  12582912 Feb 15 17:33 ibdata1
-rw-rw----. 1 mysql mysql        52 Feb 15 17:33 aria_log_control
-rw-rw----. 1 mysql mysql     24576 Feb 15 17:33 aria_log.00000001
-rw-r--r--. 1 mysql mysql        15 Feb 15 17:33 mysql_upgrade_info
-rw-rw----. 1 mysql mysql  12582912 Feb 15 17:40 ibtmp1
-rw-rw----. 1 mysql mysql 100663296 Feb 15 17:40 ib_logfile0
srwxrwxrwx. 1 mysql mysql         0 Feb 15 17:40 mysql.sock
-rw-rw----. 1 mysql mysql         6 Feb 15 17:40 multipleinstance.pid
-rw-rw----. 1 mysql mysql         0 Feb 15 17:40 multi-master.info
[root@multipleinstance mysql3306]#

--> Connectivity for 3306 Port 

[root@multipleinstance ~]# mysql
Welcome to the MariaDB monitor.  Commands end with ; or \g.
Your MariaDB connection id is 3Server version: 10.5.15-MariaDB MariaDB Server Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

MariaDB [(none)]> select version();
+-----------------+
| version()       |
+-----------------+
| 10.5.15-MariaDB |
+-----------------+
1 row in set (0.000 sec)

MariaDB [(none)]> show variables like '%data%';
+---------------------------------------------+------------------------+
| Variable_name                               | Value                  |
+-------------------------------------------------+--------------------+
| binlog_row_metadata                         | NO_LOG                 |
| character_set_database                      | latin1                 |
| collation_database                          | latin1_swedish_ci      |
| datadir                                     | /var/lib/mysql3306/    |
| innodb_background_scrub_data_check_interval | 0                      |
| innodb_background_scrub_data_compressed     | OFF                    |
| innodb_background_scrub_data_interval       | 0                      |
| innodb_background_scrub_data_uncompressed   | OFF                    |
| innodb_data_file_path                       | ibdata1:12M:autoextend |
| innodb_data_home_dir                        |                        |
| innodb_immediate_scrub_data_uncompressed    | OFF                    |
| innodb_stats_on_metadata                    | OFF                    |
| innodb_temp_data_file_path                  | ibtmp1:12M:autoextend  |
| max_length_for_sort_data                    | 1024                   |
| metadata_locks_cache_size                   | 1024                   |
| metadata_locks_hash_instances               | 8                      |
| myisam_data_pointer_size                    | 6                      |
| performance_schema_max_metadata_locks       | -1                     |
| skip_show_database                          | OFF                    |
| updatable_views_with_limit                  | YES                    |
| wsrep_data_home_dir                         | /var/lib/mysql3306/    |
| wsrep_load_data_splitting                   | OFF                    |
+---------------------------------------------+------------------------+

22 rows in set (0.001 sec)
MariaDB [(none)]> show variables like '%socket%';
+-----------------------------------------+-----------------------------------+
| Variable_name                           | Value                        |
+-----------------------------------------+-----------------------------------+
| performance_schema_max_socket_classes   | 10                            |
| performance_schema_max_socket_instances | -1                          |
| socket                                  | /var/lib/mysql3306/mysql3306.sock |
+-----------------------------------------+-----------------------------------+
3 rows in set (0.001 sec)
MariaDB [(none)]> show variables like '%pid%';
+---------------+-------------------------------------+
| Variable_name | Value                               |
+---------------+-------------------------------------+
| pid_file      | /var/lib/mysql/multipleinstance.pid |
+---------------+-------------------------------------+
1 row in set (0.001 sec)
MariaDB [(none)]> show variables like '%port%';
+--------------------------+-------+
| Variable_name            | Value |
+--------------------------+-------+
| extra_port               | 0     |
| large_files_support      | ON    |
| port                     | 3306  |
| progress_report_time     | 5     |
| report_host              |       |
| report_password          |       |
| report_port              | 3306  |
| report_user              |       |
| require_secure_transport | OFF   |
+--------------------------+-------+
9 rows in set (0.001 sec)
MariaDB [(none)]> show variables like '%char%';
+--------------------------+----------------------------+
| Variable_name            | Value                      |
+--------------------------+----------------------------+
| character_set_client     | utf8                       |
| character_set_connection | utf8                       |
| character_set_database   | utf8mb4                    |
| character_set_filesystem | binary                     |
| character_set_results    | utf8                       |
| character_set_server     | utf8mb4                    |
| character_set_system     | utf8                       |
| character_sets_dir       | /usr/share/mysql/charsets/ |
+--------------------------+----------------------------+
8 rows in set (0.001 sec)
MariaDB [(none)]> show variables like '%collat%';
+----------------------+------------------------+
| Variable_name        | Value                  |
+----------------------+------------------------+
| collation_connection | utf8_general_ci        |
| collation_database   | utf8mb4_unicode_520_ci |
| collation_server     | utf8mb4_unicode_520_ci |
+----------------------+------------------------+
3 rows in set (0.001 sec)
MariaDB [(none)]> show databases;
+--------------------+
| Database           |
+--------------------+
| information_schema |
| mysql              |
| performance_schema |
| test               |
+--------------------+
4 rows in set (0.001 sec)
MariaDB [(none)]> select user,host from mysql.user;
+-------------+------------------+
| User        | Host             |
+-------------+------------------+
|             | localhost        |
| mariadb.sys | localhost        |
| mysql       | localhost        |
| root        | localhost        |
|             | multipleinstance |
+-------------+------------------+
5 rows in set (0.001 sec)

MariaDB [(none)]> ALTER USER 'root'@'localhost' IDENTIFIED BY 'root';
Query OK, 0 rows affected (0.005 sec)
MariaDB [(none)]> flush privileges;
Query OK, 0 rows affected (0.000 sec)
MariaDB [(none)]>

--> cnf file configuration for MariaDB instance 3306 ..

[root@multipleinstance ~]# service mariadb stop
Redirecting to /bin/systemctl stop mariadb.service

[root@multipleinstance ~]# service mariadb status
Redirecting to /bin/systemctl status mariadb.service
● mariadb.service - MariaDB 10.5.15 database server
   Loaded: loaded (/usr/lib/systemd/system/mariadb.service; disabled; vendor preset: disabled)
  Drop-In: /etc/systemd/system/mariadb.service.d
           └─migrated-from-my.cnf-settings.conf
   Active: inactive (dead)
     Docs: man:mariadbd(8)
           https://mariadb.com/kb/en/library/systemd/
Feb 15 17:53:35 multipleinstance mariadbd[32538]: 2022-02-15 17:53:35 0 [Note] /usr/sbin/mariadbd (initiated by: unknown): Normal shutdown
Feb 15 17:53:35 multipleinstance mariadbd[32538]: 2022-02-15 17:53:35 0 [Note] Event Scheduler: Purging the queue. 0 events
Feb 15 17:53:35 multipleinstance mariadbd[32538]: 2022-02-15 17:53:35 0 [Note] InnoDB: FTS optimize thread exiting.
Feb 15 17:53:36 multipleinstance mariadbd[32538]: 2022-02-15 17:53:36 0 [Note] InnoDB: Starting shutdown...
Feb 15 17:53:36 multipleinstance mariadbd[32538]: 2022-02-15 17:53:36 0 [Note] InnoDB: Dumping buffer pool(s) to /var/lib/mysql/ib_buffer_pool
Feb 15 17:53:36 multipleinstance mariadbd[32538]: 2022-02-15 17:53:36 0 [Note] InnoDB: Buffer pool(s) dump completed at 220215 17:53:36
Feb 15 17:53:36 multipleinstance mariadbd[32538]: 2022-02-15 17:53:36 0 [Note] InnoDB: Removed temporary tablespace data file: "ibtmp1"
Feb 15 17:53:36 multipleinstance mariadbd[32538]: 2022-02-15 17:53:36 0 [Note] InnoDB: Shutdown completed; log sequence number 45118; transaction id 21
Feb 15 17:53:36 multipleinstance mariadbd[32538]: 2022-02-15 17:53:36 0 [Note] /usr/sbin/mariadbd: Shutdown complete
Feb 15 17:53:36 multipleinstance systemd[1]: Stopped MariaDB 10.5.15 database server.
[root@multipleinstance ~]#

[root@multipleinstance ~]# cd /etc/
[root@multipleinstance etc]# mv my.cnf /tmp
[root@multipleinstance etc]# vi my3306.cnf
[root@multipleinstance etc]# cat my3306.cnf
[client]
socket = /var/lib/mysql3306/mysql3306.sock
port = 3306
[mysqld]
basedir = /usr
datadir = /var/lib/mysql3306
port = 3306
server_id = 1
socket = /var/lib/mysql3306/mysql3306.sock
character_set_server = utf8mb4
collation_server = utf8mb4_unicode_520_ci

[root@multipleinstance etc]# service mariadb start
Redirecting to /bin/systemctl start mariadb.service

[root@multipleinstance etc]# service mariadb status
Redirecting to /bin/systemctl status mariadb.service
● mariadb.service - MariaDB 10.5.15 database server
   Loaded: loaded (/usr/lib/systemd/system/mariadb.service; disabled; vendor preset: disabled)
  Drop-In: /etc/systemd/system/mariadb.service.d
           └─migrated-from-my.cnf-settings.conf
   Active: active (running) since Tue 2022-02-15 17:58:03 UTC; 3s ago
     Docs: man:mariadbd(8)
           https://mariadb.com/kb/en/library/systemd/
  Process: 332 ExecStartPost=/bin/sh -c systemctl unset-environment _WSREP_START_POSITION (code=exited, status=0/SUCCESS)
  Process: 32751 ExecStartPre=/bin/sh -c [ ! -e /usr/bin/galera_recovery ] && VAR= ||   VAR=`cd /usr/bin/..; /usr/bin/galera_recovery`; [ $? -eq 0 ]   && systemctl set-environment _WSREP_START_POSITION=$VAR || exit 1 (code=exited, status=0/SUCCESS)
  Process: 32749 ExecStartPre=/bin/sh -c systemctl unset-environment _WSREP_START_POSITION (code=exited, status=0/SUCCESS)
 Main PID: 319 (mariadbd)
   Status: "Taking your SQL requests now..."
   CGroup: /system.slice/mariadb.service
           └─319 /usr/sbin/mariadbd
Feb 15 17:58:03 multipleinstance mariadbd[319]: 2022-02-15 17:58:03 0 [Note] InnoDB: 10.5.15 started; log sequence number 45118; transaction id 20
Feb 15 17:58:03 multipleinstance mariadbd[319]: 2022-02-15 17:58:03 0 [Note] Plugin 'FEEDBACK' is disabled.
Feb 15 17:58:03 multipleinstance mariadbd[319]: 2022-02-15 17:58:03 0 [Note] InnoDB: Loading buffer pool(s) from /var/lib/mysql/ib_buffer_pool
Feb 15 17:58:03 multipleinstance mariadbd[319]: 2022-02-15 17:58:03 0 [Note] InnoDB: Buffer pool(s) load completed at 220215 17:58:03
Feb 15 17:58:03 multipleinstance mariadbd[319]: 2022-02-15 17:58:03 0 [Note] Server socket created on IP: '::'.
Feb 15 17:58:03 multipleinstance mariadbd[319]: 2022-02-15 17:58:03 0 [Note] Reading of all Master_info entries succeeded
Feb 15 17:58:03 multipleinstance mariadbd[319]: 2022-02-15 17:58:03 0 [Note] Added new Master_info '' to hash table
Feb 15 17:58:03 multipleinstance mariadbd[319]: 2022-02-15 17:58:03 0 [Note] /usr/sbin/mariadbd: ready for connections.
Feb 15 17:58:03 multipleinstance mariadbd[319]: Version: '10.5.15-MariaDB'  socket: '/var/lib/mysql/mysql.sock'  port: 3306  MariaDB Server
Feb 15 17:58:03 multipleinstance systemd[1]: Started MariaDB 10.5.15 database server.
[root@multipleinstance etc]#

[root@multipleinstance ~]# sudo systemctl enable mariadb.service
Created symlink from /etc/systemd/system/multi-user.target.wants/mariadb.service to /usr/lib/systemd/system/mariadb.service.

[root@multipleinstance ~]# service mariadb restart
Redirecting to /bin/systemctl restart mariadb.service

[root@multipleinstance ~]# sudo chkconfig --level 345 mariadb on
Note: Forwarding request to 'systemctl enable mariadb.service'.

[root@multipleinstance ~]# systemctl enable mariadb.service

[root@multipleinstance ~]# systemctl list-unit-files | grep -i mariadb
mariadb.service                               enabled
mariadb@.service                              disabled
[root@multipleinstance ~]#

First instance is ready with 3306 Port Number ....

[root@multipleinstance ~]# cat /etc/my3306.cnf
[client]
socket = /var/lib/mysql3306/mysql3306.sock
port = 3306
[mysqld]
basedir = /usr
datadir = /var/lib/mysql3306
port = 3306
server_id = 1
socket = /var/lib/mysql3306/mysql3306.sock
character_set_server = utf8mb4
collation_server = utf8mb4_unicode_520_ci
log-error=/var/lib/mysql/mysqld3306.log
[root@multipleinstance ~]#

----------------------------------------------------------------------------------------
Step - 2 : Setup for other port numbers [ 3307 , 3308 and 3309 ] Instances for MariaDB 
 ----------------------------------------------------------------------------------------

--> Create the new data directory for new instances . At this point we need to do is, create the directories to be the database servers BASEDIR 

[root@multipleinstance ~]# cd /var/lib/
[root@multipleinstance lib]# ls -lt *mysql*
-rw-rw----. 1 mysql mysql      1567 Feb 16 00:59 mysqld.log
-rw-rw----. 1 mysql mysql         5 Feb 16 00:59 multipleinstance.pid
srwxrwxrwx. 1 mysql mysql         0 Feb 16 00:59 mysql.sock
-rw-rw----. 1 mysql mysql 100663296 Feb 16 00:59 ib_logfile0
-rw-rw----. 1 mysql mysql  12582912 Feb 16 00:59 ibtmp1
-rw-rw----. 1 mysql mysql     24576 Feb 16 00:59 aria_log.00000001
-rw-rw----. 1 mysql mysql        52 Feb 16 00:59 aria_log_control
-rw-rw----. 1 mysql mysql  12582912 Feb 16 00:59 ibdata1
-rw-rw----. 1 mysql mysql       976 Feb 16 00:59 ib_buffer_pool
-rw-rw----. 1 mysql mysql         0 Feb 15 17:40 multi-master.info
-rw-r--r--. 1 mysql mysql        15 Feb 15 17:33 mysql_upgrade_info
drwx------. 2 mysql mysql        20 Feb 15 17:33 test
drwx------. 2 mysql mysql        20 Feb 15 17:33 performance_schema
drwx------. 2 mysql mysql      4096 Feb 15 17:33 mysql

[root@multipleinstance lib]# pwd
/var/lib

[root@multipleinstance lib]# ls -ltr
drwxr-xr-x. 5 mysql   mysql   4096 Feb 16 00:59 mysql3306
[root@multipleinstance lib]# cd

[root@multipleinstance ~]# mkdir -p /var/lib/mysql3307
[root@multipleinstance ~]# mkdir -p /var/lib/mysql3308
[root@multipleinstance ~]# mkdir -p /var/lib/mysql3309

[root@multipleinstance lib]# pwd
/var/lib
[root@multipleinstance lib]# ls -ltr
drwxr-xr-x. 5 mysql   mysql   4096 Feb 16 00:59 mysql3306
drwxr-xr-x. 2 root    root       6 Feb 16 01:26 mysql3307
drwxr-xr-x. 2 root    root       6 Feb 16 01:26 mysql3308
drwxr-xr-x. 2 root    root       6 Feb 16 01:26 mysql3309
[root@multipleinstance lib]#

--> Configure the ownership and permissions:

[root@multipleinstance ~]# chown -R mysql:mysql /var/lib/mysql3307/
[root@multipleinstance ~]# chown -R mysql:mysql /var/lib/mysql3308/
[root@multipleinstance ~]# chown -R mysql:mysql /var/lib/mysql3309/

[root@multipleinstance lib]# pwd
/var/lib
[root@multipleinstance lib]# ls -ltr
drwxr-xr-x. 5 mysql   mysql   4096 Feb 16 00:59 mysql3306
drwxr-xr-x. 2 mysql   mysql      6 Feb 16 01:26 mysql3307
drwxr-xr-x. 2 mysql   mysql      6 Feb 16 01:26 mysql3308
drwxr-xr-x. 2 mysql   mysql      6 Feb 16 01:26 mysql3309
[root@multipleinstance lib]#

--> Create cnf files for new MariaDB instances [ 3307 , 3308 and 3309 ]
[root@multipleinstance etc]# pwd
/etc

[root@multipleinstance etc]# ls -lt *my*
-rw-r--r--. 1 root root 277 Feb 16 00:58 my3306.cnf

[root@multipleinstance etc]# cp my.cnf my3307.cnf
[root@multipleinstance etc]# cp my.cnf my3308.cnf
[root@multipleinstance etc]# cp my.cnf my3309.cnf

[root@multipleinstance etc]# ls -lt *my*
-rw-r--r--. 1 root root 277 Feb 16 01:32 my3309.cnf
-rw-r--r--. 1 root root 277 Feb 16 01:31 my3308.cnf
-rw-r--r--. 1 root root 277 Feb 16 01:31 my3307.cnf
-rw-r--r--. 1 root root 277 Feb 16 00:58 my3306.cnf
[root@multipleinstance etc]#

--> Change the datadir ,port ,socket ,log , server_id and socket in new Instance cnf files which we created in above step.

[root@multipleinstance etc]# pwd
/etc
[root@multipleinstance etc]# vi my3306.cnf
[root@multipleinstance etc]# vi my3307.cnf
[root@multipleinstance etc]# vi my3308.cnf
[root@multipleinstance etc]# vi my3309.cnf

[root@multipleinstance mysql3306]# cat /etc/my3306.cnf
[client]
socket = /var/lib/mysql3306/mysql3306.sock
port = 3306
[mysqld]
basedir = /usr
datadir = /var/lib/mysql3306
port = 3306
server_id = 1
pid-file = /var/lib/mysql3306/mysql3306.pid
socket = /var/lib/mysql3306/mysql3306.sock
character_set_server = utf8mb4
collation_server = utf8mb4_general_ci
log-error=/var/lib/mysql3306/mysqld3306.log

[root@multipleinstance mysql3306]# cat /etc/my3307.cnf
[client]
socket = /var/lib/mysql3307/mysql3307.sock
port = 3307
[mysqld]
user    = mysql
basedir = /usr
datadir = /var/lib/mysql3307
port = 3307
server_id = 2
socket = /var/lib/mysql3307/mysql3307.sock
pid-file = /var/lib/mysql3307/mysql3307.pid
character_set_server = utf8mb4
collation_server = utf8mb4_general_ci
log-error=/var/lib/mysql3307/mysqld3307.log

[root@multipleinstance mysql3306]# cat /etc/my3308.cnf
[client]
socket = /var/lib/mysql3308/mysql3308.sock
port = 3308
[mysqld]
basedir = /usr
datadir = /var/lib/mysql3308
port = 3308
server_id = 3
socket = /var/lib/mysql3308/mysql3308.sock
pid-file = /var/lib/mysql3308/mysql3308.pid
character_set_server = utf8mb4
collation_server = utf8mb4_general_ci
log-error=/var/lib/mysql3308/mysqld3308.log

[root@multipleinstance mysql3306]# cat /etc/my3309.cnf
[client]
socket = /var/lib/mysql3309/mysql3309.sock
port = 3309
[mysqld]
basedir = /usr
datadir = /var/lib/mysql3309
port = 3309
server_id = 4
socket = /var/lib/mysql3309/mysql3309.sock
pid-file = /var/lib/mysql3309/mysql3309.pid
character_set_server = utf8mb4
collation_server = utf8mb4_general_ci
log-error=/var/lib/mysql3309/mysqld3309.log
[root@multipleinstance mysql3306]#

--> Initialize mysql databases in new MariaDB instances 

[root@multipleinstance lib]# pwd
/var/lib
[root@multipleinstance lib]# ls -ltr
drwxr-xr-x. 5 mysql   mysql   4096 Feb 16 00:59 mysql3306
drwxr-xr-x. 2 mysql   mysql      6 Feb 16 01:26 mysql3307
drwxr-xr-x. 2 mysql   mysql      6 Feb 16 01:26 mysql3308
drwxr-xr-x. 2 mysql   mysql      6 Feb 16 01:26 mysql3309

[root@multipleinstance ~]# mysql_install_db --user=mysql --datadir=/var/lib/mysql3307/
Installing MariaDB/MySQL system tables in '/var/lib/mysql3307/' ...
OK
To start mysqld at boot time you have to copy support-files/mysql.server to the right place for your system
Two all-privilege accounts were created.
One is root@localhost, it has no password, but you need to
be system 'root' user to connect. Use, for example, sudo mysql
The second is mysql@localhost, it has no password either, but
you need to be the system 'mysql' user to connect.
After connecting you can set the password, if you would need to be
able to connect as any of these users with a password and without sudo
See the MariaDB Knowledgebase at https://mariadb.com/kb
You can start the MariaDB daemon with:
cd '/usr' ; /usr/bin/mysqld_safe --datadir='/var/lib/mysql3307/'
You can test the MariaDB daemon with mysql-test-run.pl
cd '/usr/mysql-test' ; perl mysql-test-run.pl
Please report any problems at https://mariadb.org/jira
The latest information about MariaDB is available at https://mariadb.org/.
Consider joining MariaDB's strong and vibrant community:
https://mariadb.org/get-involved/

[root@multipleinstance ~]# mysql_install_db --user=mysql --datadir=/var/lib/mysql3308/
Installing MariaDB/MySQL system tables in '/var/lib/mysql3308/' ...
OK
To start mysqld at boot time you have to copy support-files/mysql.server to the right place for your system
Two all-privilege accounts were created.
One is root@localhost, it has no password, but you need to
be system 'root' user to connect. Use, for example, sudo mysql
The second is mysql@localhost, it has no password either, but
you need to be the system 'mysql' user to connect.
After connecting you can set the password, if you would need to be
able to connect as any of these users with a password and without sudo
See the MariaDB Knowledgebase at https://mariadb.com/kb
You can start the MariaDB daemon with:
cd '/usr' ; /usr/bin/mysqld_safe --datadir='/var/lib/mysql3308/'
You can test the MariaDB daemon with mysql-test-run.pl
cd '/usr/mysql-test' ; perl mysql-test-run.pl
Please report any problems at https://mariadb.org/jira
The latest information about MariaDB is available at https://mariadb.org/.
Consider joining MariaDB's strong and vibrant community:
https://mariadb.org/get-involved/

[root@multipleinstance ~]# mysql_install_db --user=mysql --datadir=/var/lib/mysql3309/
Installing MariaDB/MySQL system tables in '/var/lib/mysql3309/' ...
OK
To start mysqld at boot time you have to copy support-files/mysql.server to the right place for your system
Two all-privilege accounts were created.
One is root@localhost, it has no password, but you need to
be system 'root' user to connect. Use, for example, sudo mysql
The second is mysql@localhost, it has no password either, but
you need to be the system 'mysql' user to connect.
After connecting you can set the password, if you would need to be
able to connect as any of these users with a password and without sudo
See the MariaDB Knowledgebase at https://mariadb.com/kb
You can start the MariaDB daemon with:
cd '/usr' ; /usr/bin/mysqld_safe --datadir='/var/lib/mysql3309/'
You can test the MariaDB daemon with mysql-test-run.pl
cd '/usr/mysql-test' ; perl mysql-test-run.pl
Please report any problems at https://mariadb.org/jira
The latest information about MariaDB is available at https://mariadb.org/.
Consider joining MariaDB's strong and vibrant community:
https://mariadb.org/get-involved/

[root@multipleinstance lib]# pwd
/var/lib
[root@multipleinstance lib]# ls -ltr
drwxr-xr-x. 5 mysql   mysql   4096 Feb 18 13:26 mysql3307
drwxr-xr-x. 5 mysql   mysql   4096 Feb 18 15:07 mysql3308
drwxr-xr-x. 5 mysql   mysql   4096 Feb 18 15:08 mysql3309
drwxr-xr-x. 5 mysql   mysql   4096 Feb 18 15:10 mysql3306
[root@multipleinstance lib]#

[root@multipleinstance mysql3307]# pwd
/var/lib/mysql3307

[root@multipleinstance mysql3307]# ls -ltr
drwx------. 2 mysql mysql      4096 Feb 18 13:20 mysql
drwx------. 2 mysql mysql        20 Feb 18 13:20 performance_schema
drwx------. 2 mysql mysql        20 Feb 18 13:20 test
-rw-r--r--. 1 root  root         15 Feb 18 13:20 mysql_upgrade_info
-rw-rw----. 1 mysql mysql       976 Feb 18 13:24 ib_buffer_pool
-rw-rw----. 1 mysql mysql  12582912 Feb 18 13:24 ibdata1
-rw-rw----. 1 mysql mysql        52 Feb 18 13:24 aria_log_control
-rw-rw----. 1 mysql mysql     24576 Feb 18 13:24 aria_log.00000001
-rw-rw----. 1 mysql mysql      6599 Feb 18 13:24 multipleinstance.err
-rw-rw----. 1 mysql mysql  12582912 Feb 18 13:26 ibtmp1
-rw-rw----. 1 mysql mysql         0 Feb 18 13:26 multi-master.info
-rw-rw----. 1 mysql mysql      1774 Feb 18 13:26 mysqld3307.log
[root@multipleinstance lib]# cd mysql3308/

[root@multipleinstance mysql3308]# pwd
/var/lib/mysql3308

[root@multipleinstance mysql3308]# ls -ltr
drwx------. 2 mysql mysql      4096 Feb 18 13:27 mysql
drwx------. 2 mysql mysql        20 Feb 18 13:27 performance_schema
drwx------. 2 mysql mysql        20 Feb 18 13:27 test
-rw-r--r--. 1 root  root         15 Feb 18 13:27 mysql_upgrade_info
-rw-rw----. 1 mysql mysql         0 Feb 18 13:27 multi-master.info
-rw-rw----. 1 mysql mysql       976 Feb 18 15:05 ib_buffer_pool
-rw-rw----. 1 mysql mysql  12582912 Feb 18 15:06 ibdata1
-rw-rw----. 1 mysql mysql        52 Feb 18 15:06 aria_log_control
-rw-rw----. 1 mysql mysql     24576 Feb 18 15:06 aria_log.00000001
-rw-rw----. 1 mysql mysql  12582912 Feb 18 15:07 ibtmp1
-rw-rw----. 1 mysql mysql 100663296 Feb 18 15:07 ib_logfile0
-rw-rw----. 1 mysql mysql      7000 Feb 18 15:07 mysqld3308.log
[root@multipleinstance mysql3308]# cd ..

[root@multipleinstance lib]# cd mysql3309/
[root@multipleinstance mysql3309]# pwd
/var/lib/mysql3309
[root@multipleinstance mysql3309]# ls -ltr
drwx------. 2 mysql mysql      4096 Feb 18 13:28 mysql
drwx------. 2 mysql mysql        20 Feb 18 13:28 performance_schema
drwx------. 2 mysql mysql        20 Feb 18 13:28 test
-rw-r--r--. 1 root  root         15 Feb 18 13:28 mysql_upgrade_info
-rw-rw----. 1 mysql mysql         0 Feb 18 13:28 multi-master.info
-rw-rw----. 1 mysql mysql       976 Feb 18 15:07 ib_buffer_pool
-rw-rw----. 1 mysql mysql  12582912 Feb 18 15:07 ibdata1
-rw-rw----. 1 mysql mysql        52 Feb 18 15:07 aria_log_control
-rw-rw----. 1 mysql mysql     24576 Feb 18 15:07 aria_log.00000001
-rw-rw----. 1 mysql mysql  12582912 Feb 18 15:08 ibtmp1
-rw-rw----. 1 mysql mysql 100663296 Feb 18 15:08 ib_logfile0
-rw-rw----. 1 mysql mysql      4387 Feb 18 15:08 mysqld3309.log
[root@multipleinstance mysql3309]#

----------------------------------------------------------------------------------------
Step - 3 : Start the MariaDB service with all DB instances [ 3306 ,3307 , 3308 and 3309 ] 
----------------------------------------------------------------------------------------

--> Start the Individual MariaDB instance :- 
[root@multipleinstance ~]# ps -ef | grep -i mysql
root     16355 13888  0 15:19 pts/3    00:00:00 grep --color=auto -i mysql
[root@multipleinstance ~]#

[root@multipleinstance ~]# /usr/bin/mysqld_safe  --defaults-file=/etc/my3306.cnf &
[1] 16379
[root@multipleinstance ~]# 220218 15:22:54 mysqld_safe Logging to '/var/lib/mysql3306/mysqld3306.log'.
220218 15:22:54 mysqld_safe Starting mariadbd daemon with databases from /var/lib/mysql3306

[root@multipleinstance ~]# /usr/bin/mysqld_safe  --defaults-file=/etc/my3307.cnf &
[2] 16493
[root@multipleinstance ~]# 220218 15:23:02 mysqld_safe Logging to '/var/lib/mysql3307/mysqld3307.log'.
220218 15:23:02 mysqld_safe Starting mariadbd daemon with databases from /var/lib/mysql3307

[root@multipleinstance ~]# /usr/bin/mysqld_safe  --defaults-file=/etc/my3308.cnf &
[3] 16610
[root@multipleinstance ~]# 220218 15:23:08 mysqld_safe Logging to '/var/lib/mysql3308/mysqld3308.log'.
220218 15:23:08 mysqld_safe Starting mariadbd daemon with databases from /var/lib/mysql3308

[root@multipleinstance ~]# /usr/bin/mysqld_safe  --defaults-file=/etc/my3309.cnf &
[4] 16724
[root@multipleinstance ~]# 220218 15:23:12 mysqld_safe Logging to '/var/lib/mysql3309/mysqld3309.log'.
220218 15:23:12 mysqld_safe Starting mariadbd daemon with databases from /var/lib/mysql3309

[root@multipleinstance ~]# ps -ef | grep -i mysql
root     16379 13888  0 15:22 pts/3    00:00:00 /bin/sh /usr/bin/mysqld_safe --defaults-file=/etc/my3306.cnf
mysql    16480 16379  0 15:22 pts/3    00:00:00 /usr/sbin/mariadbd --defaults-file=/etc/my3306.cnf --basedir=/usr --datadir=/var/lib/mysql3306 --plugin-dir=/usr/lib64/mysql/plugin --user=mysql --log-error=/var/lib/mysql3306/mysqld3306.log --pid-file=/var/lib/mysql3306/mysql3306.pid --socket=/var/lib/mysql3306/mysql3306.sock --port=3306
root     16493 13888  0 15:23 pts/3    00:00:00 /bin/sh /usr/bin/mysqld_safe --defaults-file=/etc/my3307.cnf
mysql    16597 16493  0 15:23 pts/3    00:00:00 /usr/sbin/mariadbd --defaults-file=/etc/my3307.cnf --basedir=/usr --datadir=/var/lib/mysql3307 --plugin-dir=/usr/lib64/mysql/plugin --user=mysql --log-error=/var/lib/mysql3307/mysqld3307.log --pid-file=/var/lib/mysql3307/mysql3307.pid --socket=/var/lib/mysql3307/mysql3307.sock --port=3307
root     16610 13888  0 15:23 pts/3    00:00:00 /bin/sh /usr/bin/mysqld_safe --defaults-file=/etc/my3308.cnf
mysql    16711 16610  0 15:23 pts/3    00:00:00 /usr/sbin/mariadbd --defaults-file=/etc/my3308.cnf --basedir=/usr --datadir=/var/lib/mysql3308 --plugin-dir=/usr/lib64/mysql/plugin --user=mysql --log-error=/var/lib/mysql3308/mysqld3308.log --pid-file=/var/lib/mysql3308/mysql3308.pid --socket=/var/lib/mysql3308/mysql3308.sock --port=3308
root     16724 13888  0 15:23 pts/3    00:00:00 /bin/sh /usr/bin/mysqld_safe --defaults-file=/etc/my3309.cnf
mysql    16825 16724  0 15:23 pts/3    00:00:00 /usr/sbin/mariadbd --defaults-file=/etc/my3309.cnf --basedir=/usr --datadir=/var/lib/mysql3309 --plugin-dir=/usr/lib64/mysql/plugin --user=mysql --log-error=/var/lib/mysql3309/mysqld3309.log --pid-file=/var/lib/mysql3309/mysql3309.pid --socket=/var/lib/mysql3309/mysql3309.sock --port=3309
root     16839 13888  0 15:23 pts/3    00:00:00 grep --color=auto -i mysql
[root@multipleinstance ~]#

[root@multipleinstance ~]# cd /var/lib/mysql3306/

[root@multipleinstance mysql3306]# pwd
/var/lib/mysql3306
[root@multipleinstance mysql3306]# ls -ltr
drwx------. 2 mysql mysql      4096 Feb 18 13:17 mysql
drwx------. 2 mysql mysql        20 Feb 18 13:17 performance_schema
drwx------. 2 mysql mysql        20 Feb 18 13:17 test
-rw-r--r--. 1 root  root         15 Feb 18 13:17 mysql_upgrade_info
-rw-rw----. 1 mysql mysql         0 Feb 18 13:19 multi-master.info
-rw-rw----. 1 mysql mysql      2492 Feb 18 15:10 multipleinstance.err
-rw-rw----. 1 mysql mysql       976 Feb 18 15:18 ib_buffer_pool
-rw-rw----. 1 mysql mysql  12582912 Feb 18 15:18 ibdata1
-rw-rw----. 1 mysql mysql        52 Feb 18 15:18 aria_log_control
-rw-rw----. 1 mysql mysql     24576 Feb 18 15:18 aria_log.00000001
-rw-rw----. 1 mysql mysql  12582912 Feb 18 15:22 ibtmp1
-rw-rw----. 1 mysql mysql 100663296 Feb 18 15:22 ib_logfile0
srwxrwxrwx. 1 mysql mysql         0 Feb 18 15:22 mysql3306.sock
-rw-rw----. 1 mysql mysql         6 Feb 18 15:22 mysql3306.pid
-rw-rw----. 1 mysql mysql      4543 Feb 18 15:22 mysqld3306.log

[root@multipleinstance lib]# cd mysql3307/
[root@multipleinstance mysql3307]# pwd
/var/lib/mysql3307
[root@multipleinstance mysql3307]# ls -ltr
drwx------. 2 mysql mysql      4096 Feb 18 13:20 mysql
drwx------. 2 mysql mysql        20 Feb 18 13:20 performance_schema
drwx------. 2 mysql mysql        20 Feb 18 13:20 test
-rw-r--r--. 1 root  root         15 Feb 18 13:20 mysql_upgrade_info
-rw-rw----. 1 mysql mysql      6599 Feb 18 13:24 multipleinstance.err
-rw-rw----. 1 mysql mysql         0 Feb 18 13:26 multi-master.info
-rw-rw----. 1 mysql mysql       976 Feb 18 15:18 ib_buffer_pool
-rw-rw----. 1 mysql mysql  12582912 Feb 18 15:18 ibdata1
-rw-rw----. 1 mysql mysql        52 Feb 18 15:18 aria_log_control
-rw-rw----. 1 mysql mysql     24576 Feb 18 15:18 aria_log.00000001
-rw-rw----. 1 mysql mysql  12582912 Feb 18 15:23 ibtmp1
-rw-rw----. 1 mysql mysql 100663296 Feb 18 15:23 ib_logfile0
srwxrwxrwx. 1 mysql mysql         0 Feb 18 15:23 mysql3307.sock
-rw-rw----. 1 mysql mysql         6 Feb 18 15:23 mysql3307.pid
-rw-rw----. 1 mysql mysql      4380 Feb 18 15:23 mysqld3307.log
[root@multipleinstance lib]# cd mysql3308

[root@multipleinstance mysql3308]# pwd
/var/lib/mysql3308
[root@multipleinstance mysql3308]# ls -ltr
drwx------. 2 mysql mysql      4096 Feb 18 13:27 mysql
drwx------. 2 mysql mysql        20 Feb 18 13:27 performance_schema
drwx------. 2 mysql mysql        20 Feb 18 13:27 test
-rw-r--r--. 1 root  root         15 Feb 18 13:27 mysql_upgrade_info
-rw-rw----. 1 mysql mysql         0 Feb 18 13:27 multi-master.info
-rw-rw----. 1 mysql mysql       976 Feb 18 15:18 ib_buffer_pool
-rw-rw----. 1 mysql mysql  12582912 Feb 18 15:18 ibdata1
-rw-rw----. 1 mysql mysql        52 Feb 18 15:18 aria_log_control
-rw-rw----. 1 mysql mysql     24576 Feb 18 15:18 aria_log.00000001
-rw-rw----. 1 mysql mysql  12582912 Feb 18 15:23 ibtmp1
-rw-rw----. 1 mysql mysql 100663296 Feb 18 15:23 ib_logfile0
srwxrwxrwx. 1 mysql mysql         0 Feb 18 15:23 mysql3308.sock
-rw-rw----. 1 mysql mysql         6 Feb 18 15:23 mysql3308.pid
-rw-rw----. 1 mysql mysql      9606 Feb 18 15:23 mysqld3308.log

[root@multipleinstance lib]# cd mysql3309/
[root@multipleinstance mysql3309]# pwd
/var/lib/mysql3309
[root@multipleinstance mysql3309]# ls -ltr
drwx------. 2 mysql mysql      4096 Feb 18 13:28 mysql
drwx------. 2 mysql mysql        20 Feb 18 13:28 performance_schema
drwx------. 2 mysql mysql        20 Feb 18 13:28 test
-rw-r--r--. 1 root  root         15 Feb 18 13:28 mysql_upgrade_info
-rw-rw----. 1 mysql mysql         0 Feb 18 13:28 multi-master.info
-rw-rw----. 1 mysql mysql       976 Feb 18 15:18 ib_buffer_pool
-rw-rw----. 1 mysql mysql  12582912 Feb 18 15:18 ibdata1
-rw-rw----. 1 mysql mysql        52 Feb 18 15:18 aria_log_control
-rw-rw----. 1 mysql mysql     24576 Feb 18 15:18 aria_log.00000001
-rw-rw----. 1 mysql mysql  12582912 Feb 18 15:23 ibtmp1
-rw-rw----. 1 mysql mysql 100663296 Feb 18 15:23 ib_logfile0
srwxrwxrwx. 1 mysql mysql         0 Feb 18 15:23 mysql3309.sock
-rw-rw----. 1 mysql mysql         6 Feb 18 15:23 mysql3309.pid
-rw-rw----. 1 mysql mysql      6993 Feb 18 15:23 mysqld3309.log
[root@multipleinstance mysql3309]#

--------------------------------------------------------------------------------------
Step - 4 : Stop / Shutdown of MariaDB all Instances [ 3306 , 3307 ,3308 and 3309 ]
--------------------------------------------------------------------------------------

[root@multipleinstance ~]# ps -ef | grep -i mysql
root     16379 13888  0 15:22 pts/3    00:00:00 /bin/sh /usr/bin/mysqld_safe --defaults-file=/etc/my3306.cnf
mysql    16480 16379  0 15:22 pts/3    00:00:00 /usr/sbin/mariadbd --defaults-file=/etc/my3306.cnf --basedir=/usr --datadir=/var/lib/mysql3306 --plugin-dir=/usr/lib64/mysql/plugin --user=mysql --log-error=/var/lib/mysql3306/mysqld3306.log --pid-file=/var/lib/mysql3306/mysql3306.pid --socket=/var/lib/mysql3306/mysql3306.sock --port=3306
root     16493 13888  0 15:23 pts/3    00:00:00 /bin/sh /usr/bin/mysqld_safe --defaults-file=/etc/my3307.cnf
mysql    16597 16493  0 15:23 pts/3    00:00:00 /usr/sbin/mariadbd --defaults-file=/etc/my3307.cnf --basedir=/usr --datadir=/var/lib/mysql3307 --plugin-dir=/usr/lib64/mysql/plugin --user=mysql --log-error=/var/lib/mysql3307/mysqld3307.log --pid-file=/var/lib/mysql3307/mysql3307.pid --socket=/var/lib/mysql3307/mysql3307.sock --port=3307
root     16610 13888  0 15:23 pts/3    00:00:00 /bin/sh /usr/bin/mysqld_safe --defaults-file=/etc/my3308.cnf
mysql    16711 16610  0 15:23 pts/3    00:00:00 /usr/sbin/mariadbd --defaults-file=/etc/my3308.cnf --basedir=/usr --datadir=/var/lib/mysql3308 --plugin-dir=/usr/lib64/mysql/plugin --user=mysql --log-error=/var/lib/mysql3308/mysqld3308.log --pid-file=/var/lib/mysql3308/mysql3308.pid --socket=/var/lib/mysql3308/mysql3308.sock --port=3308
root     16724 13888  0 15:23 pts/3    00:00:00 /bin/sh /usr/bin/mysqld_safe --defaults-file=/etc/my3309.cnf
mysql    16825 16724  0 15:23 pts/3    00:00:00 /usr/sbin/mariadbd --defaults-file=/etc/my3309.cnf --basedir=/usr --datadir=/var/lib/mysql3309 --plugin-dir=/usr/lib64/mysql/plugin --user=mysql --log-error=/var/lib/mysql3309/mysqld3309.log --pid-file=/var/lib/mysql3309/mysql3309.pid --socket=/var/lib/mysql3309/mysql3309.sock --port=3309
root     16896 13888  0 15:32 pts/3    00:00:00 grep --color=auto -i mysql

[root@multipleinstance ~]# mysqladmin shutdown --socket=/var/lib/mysql3306/mysql3306.sock
[1]   Done                    /usr/bin/mysqld_safe --defaults-file=/etc/my3306.cnf

[root@multipleinstance ~]# mysqladmin shutdown --socket=/var/lib/mysql3307/mysql3307.sock
[2]   Done                    /usr/bin/mysqld_safe --defaults-file=/etc/my3307.cnf

[root@multipleinstance ~]# mysqladmin shutdown --socket=/var/lib/mysql3308/mysql3308.sock
[3]-  Done                    /usr/bin/mysqld_safe --defaults-file=/etc/my3308.cnf

[root@multipleinstance ~]# mysqladmin shutdown --socket=/var/lib/mysql3309/mysql3309.sock
[4]+  Done                    /usr/bin/mysqld_safe --defaults-file=/etc/my3309.cnf
[root@multipleinstance ~]# ps -ef | grep -i mysql
root     16948 13888  0 15:35 pts/3    00:00:00 grep --color=auto -i mysql
[root@multipleinstance ~]#

Again if you want to start all MariaDB instances by using below commands should start .

[root@multipleinstance ~]# ps -ef | grep -i mysql
root     16950 13888  0 15:36 pts/3    00:00:00 grep --color=auto -i mysql

[root@multipleinstance ~]# /usr/bin/mysqld_safe  --defaults-file=/etc/my3306.cnf &
[1] 16951
[root@multipleinstance ~]# 220218 15:36:37 mysqld_safe Logging to '/var/lib/mysql3306/mysqld3306.log'.
220218 15:36:37 mysqld_safe Starting mariadbd daemon with databases from /var/lib/mysql3306

[root@multipleinstance ~]# /usr/bin/mysqld_safe  --defaults-file=/etc/my3307.cnf &
[2] 17065
[root@multipleinstance ~]# 220218 15:36:43 mysqld_safe Logging to '/var/lib/mysql3307/mysqld3307.log'.
220218 15:36:43 mysqld_safe Starting mariadbd daemon with databases from /var/lib/mysql3307

[root@multipleinstance ~]# /usr/bin/mysqld_safe  --defaults-file=/etc/my3308.cnf &
[3] 17182
[root@multipleinstance ~]# 220218 15:36:48 mysqld_safe Logging to '/var/lib/mysql3308/mysqld3308.log'.
220218 15:36:48 mysqld_safe Starting mariadbd daemon with databases from /var/lib/mysql3308

[root@multipleinstance ~]# /usr/bin/mysqld_safe  --defaults-file=/etc/my3309.cnf &
[4] 17296
[root@multipleinstance ~]# 220218 15:36:52 mysqld_safe Logging to '/var/lib/mysql3309/mysqld3309.log'.
220218 15:36:52 mysqld_safe Starting mariadbd daemon with databases from /var/lib/mysql3309

[root@multipleinstance ~]# ps -ef | grep -i mysql
root     16951 13888  0 15:36 pts/3    00:00:00 /bin/sh /usr/bin/mysqld_safe --defaults-file=/etc/my3306.cnf
mysql    17052 16951  0 15:36 pts/3    00:00:00 /usr/sbin/mariadbd --defaults-file=/etc/my3306.cnf --basedir=/usr --datadir=/var/lib/mysql3306 --plugin-dir=/usr/lib64/mysql/plugin --user=mysql --log-error=/var/lib/mysql3306/mysqld3306.log --pid-file=/var/lib/mysql3306/mysql3306.pid --socket=/var/lib/mysql3306/mysql3306.sock --port=3306
root     17065 13888  0 15:36 pts/3    00:00:00 /bin/sh /usr/bin/mysqld_safe --defaults-file=/etc/my3307.cnf
mysql    17169 17065  0 15:36 pts/3    00:00:00 /usr/sbin/mariadbd --defaults-file=/etc/my3307.cnf --basedir=/usr --datadir=/var/lib/mysql3307 --plugin-dir=/usr/lib64/mysql/plugin --user=mysql --log-error=/var/lib/mysql3307/mysqld3307.log --pid-file=/var/lib/mysql3307/mysql3307.pid --socket=/var/lib/mysql3307/mysql3307.sock --port=3307
root     17182 13888  0 15:36 pts/3    00:00:00 /bin/sh /usr/bin/mysqld_safe --defaults-file=/etc/my3308.cnf
mysql    17283 17182  0 15:36 pts/3    00:00:00 /usr/sbin/mariadbd --defaults-file=/etc/my3308.cnf --basedir=/usr --datadir=/var/lib/mysql3308 --plugin-dir=/usr/lib64/mysql/plugin --user=mysql --log-error=/var/lib/mysql3308/mysqld3308.log --pid-file=/var/lib/mysql3308/mysql3308.pid --socket=/var/lib/mysql3308/mysql3308.sock --port=3308
root     17296 13888  0 15:36 pts/3    00:00:00 /bin/sh /usr/bin/mysqld_safe --defaults-file=/etc/my3309.cnf
mysql    17397 17296  1 15:36 pts/3    00:00:00 /usr/sbin/mariadbd --defaults-file=/etc/my3309.cnf --basedir=/usr --datadir=/var/lib/mysql3309 --plugin-dir=/usr/lib64/mysql/plugin --user=mysql --log-error=/var/lib/mysql3309/mysqld3309.log --pid-file=/var/lib/mysql3309/mysql3309.pid --socket=/var/lib/mysql3309/mysql3309.sock --port=3309
root     17411 13888  0 15:36 pts/3    00:00:00 grep --color=auto -i mysql
[root@multipleinstance ~]#

--------------------------------------------------------------------------------
Step - 5 : Connection for all MariaDB instances [ 3306 , 3307 ,3308 and 3309 ]
--------------------------------------------------------------------------------

The below connection is happend with out password while connecting to the DB for all instances. 

[root@multipleinstance ~]# mysql -S /var/lib/mysql3306/mysql3306.sock
Welcome to the MariaDB monitor.  Commands end with ; or \g.Your MariaDB connection id is 3.Server version: 10.5.15-MariaDB MariaDB ServerCopyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
MariaDB [(none)]> show variables like '%port%';
+--------------------------+-------+
| Variable_name            | Value |
+--------------------------+-------+
| extra_port               | 0     |
| large_files_support      | ON    |
| port                     | 3306  |
| progress_report_time     | 5     |
| report_host              |       |
| report_password          |       |
| report_port              | 3306  |
| report_user              |       |
| require_secure_transport | OFF   |
+--------------------------+-------+
9 rows in set (0.001 sec)
MariaDB [(none)]> exit
Bye
[root@multipleinstance ~]#

[root@multipleinstance ~]# mysql -S /var/lib/mysql3307/mysql3307.sock
Welcome to the MariaDB monitor.  Commands end with ; or \g.Your MariaDB connection id is 3.Server version: 10.5.15-MariaDB MariaDB ServerCopyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
MariaDB [(none)]> show variables like '%port%';
+--------------------------+-------+
| Variable_name            | Value |
+--------------------------+-------+
| extra_port               | 0     |
| large_files_support      | ON    |
| port                     | 3307  |
| progress_report_time     | 5     |
| report_host              |       |
| report_password          |       |
| report_port              | 3307  |
| report_user              |       |
| require_secure_transport | OFF   |
+--------------------------+-------+
9 rows in set (0.001 sec)
MariaDB [(none)]> exit
Bye
[root@multipleinstance ~]#

[root@multipleinstance ~]# mysql -S /var/lib/mysql3308/mysql3308.sock
Welcome to the MariaDB monitor.  Commands end with ; or \g.Your MariaDB connection id is 3Server version: 10.5.15-MariaDB MariaDB Server Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
MariaDB [(none)]> show variables like '%port%';
+--------------------------+-------+
| Variable_name            | Value |
+--------------------------+-------+
| extra_port               | 0     |
| large_files_support      | ON    |
| port                     | 3308  |
| progress_report_time     | 5     |
| report_host              |       |
| report_password          |       |
| report_port              | 3308  |
| report_user              |       |
| require_secure_transport | OFF   |
+--------------------------+-------+
9 rows in set (0.001 sec)
MariaDB [(none)]> exit
Bye
[root@multipleinstance ~]#

[root@multipleinstance ~]# mysql -S /var/lib/mysql3309/mysql3309.sock
Welcome to the MariaDB monitor.  Commands end with ; or \g.Your MariaDB connection id is 3.Server version: 10.5.15-MariaDB MariaDB ServerCopyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
MariaDB [(none)]> show variables like '%port%';
+--------------------------+-------+
| Variable_name            | Value |
+--------------------------+-------+
| extra_port               | 0     |
| large_files_support      | ON    |
| port                     | 3309  |
| progress_report_time     | 5     |
| report_host              |       |
| report_password          |       |
| report_port              | 3309  |
| report_user              |       |
| require_secure_transport | OFF   |
+--------------------------+-------+
9 rows in set (0.001 sec)
MariaDB [(none)]> exit
Bye
[root@multipleinstance ~]#

-----------------------------------------------------------------------------------------
Step - 6 : Setting the password for DB super user for all MariaDB instances [ 3306 , 3307 ,3308 and 3309 ]
-----------------------------------------------------------------------------------------

We are going to use mysql_secure_installation utility to set password for all MariaDB instances.

[root@multipleinstance ~]# mysql_secure_installation --socket=/var/lib/mysql3306/mysql3306.sock
NOTE: RUNNING ALL PARTS OF THIS SCRIPT IS RECOMMENDED FOR ALL MariaDB
      SERVERS IN PRODUCTION USE!  PLEASE READ EACH STEP CAREFULLY!
In order to log into MariaDB to secure it, we'll need the current password for the root user. If you've just installed MariaDB, and
haven't set the root password yet, you should just press enter here.
Enter current password for root (enter for none):
OK, successfully used password, moving on...
Setting the root password or using the unix_socket ensures that nobody can log into the MariaDB root user without the proper authorisation.
You already have your root account protected, so you can safely answer 'n'.
Switch to unix_socket authentication [Y/n] n
 ... skipping.
You already have your root account protected, so you can safely answer 'n'.
Change the root password? [Y/n] y
New password:
Re-enter new password:
Password updated successfully!
Reloading privilege tables..
 ... Success!

By default, a MariaDB installation has an anonymous user, allowing anyone to log into MariaDB without having to have a user account created for
them.  This is intended only for testing, and to make the installation go a bit smoother.  You should remove them before moving into a
production environment.
Remove anonymous users? [Y/n] y
 ... Success!
Normally, root should only be allowed to connect from 'localhost'.  This ensures that someone cannot guess at the root password from the network.
Disallow root login remotely? [Y/n] n
 ... skipping.
By default, MariaDB comes with a database named 'test' that anyone can access.  This is also intended only for testing, and should be removed
before moving into a production environment.
Remove test database and access to it? [Y/n] y
 - Dropping test database...
 ... Success!
 - Removing privileges on test database...
 ... Success!
Reloading the privilege tables will ensure that all changes made so far
will take effect immediately.
Reload privilege tables now? [Y/n] y
 ... Success!
Cleaning up...
All done!  If you've completed all of the above steps, your MariaDB
installation should now be secure.
Thanks for using MariaDB!
[root@multipleinstance ~]#

[root@multipleinstance ~]# mysql_secure_installation --socket=/var/lib/mysql3307/mysql3307.sock
NOTE: RUNNING ALL PARTS OF THIS SCRIPT IS RECOMMENDED FOR ALL MariaDB
      SERVERS IN PRODUCTION USE!  PLEASE READ EACH STEP CAREFULLY!
In order to log into MariaDB to secure it, we'll need the current password for the root user. If you've just installed MariaDB, and
haven't set the root password yet, you should just press enter here.
Enter current password for root (enter for none):
OK, successfully used password, moving on...
Setting the root password or using the unix_socket ensures that nobody can log into the MariaDB root user without the proper authorisation.
You already have your root account protected, so you can safely answer 'n'.
Switch to unix_socket authentication [Y/n] n
 ... skipping.
You already have your root account protected, so you can safely answer 'n'.
Change the root password? [Y/n] y
New password:
Re-enter new password:
Password updated successfully!
Reloading privilege tables..
 ... Success!

By default, a MariaDB installation has an anonymous user, allowing anyone to log into MariaDB without having to have a user account created for
them.  This is intended only for testing, and to make the installation go a bit smoother.  You should remove them before moving into a
production environment.
Remove anonymous users? [Y/n] y
 ... Success!
Normally, root should only be allowed to connect from 'localhost'.  This ensures that someone cannot guess at the root password from the network.
Disallow root login remotely? [Y/n] n
 ... skipping.
By default, MariaDB comes with a database named 'test' that anyone can access.  This is also intended only for testing, and should be removed
before moving into a production environment.
Remove test database and access to it? [Y/n] y
 - Dropping test database...
 ... Success!
 - Removing privileges on test database...
 ... Success!
Reloading the privilege tables will ensure that all changes made so far will take effect immediately.
Reload privilege tables now? [Y/n] y
 ... Success!
Cleaning up...
All done!  If you've completed all of the above steps, your MariaDB
installation should now be secure.
Thanks for using MariaDB!
[root@multipleinstance ~]#

[root@multipleinstance ~]# mysql_secure_installation --socket=/var/lib/mysql3308/mysql3308.sock
NOTE: RUNNING ALL PARTS OF THIS SCRIPT IS RECOMMENDED FOR ALL MariaDB
      SERVERS IN PRODUCTION USE!  PLEASE READ EACH STEP CAREFULLY!
In order to log into MariaDB to secure it, we'll need the current password for the root user. If you've just installed MariaDB, and
haven't set the root password yet, you should just press enter here.
Enter current password for root (enter for none):
OK, successfully used password, moving on...
Setting the root password or using the unix_socket ensures that nobody can log into the MariaDB root user without the proper authorisation.
You already have your root account protected, so you can safely answer 'n'.
Switch to unix_socket authentication [Y/n] n
 ... skipping.
You already have your root account protected, so you can safely answer 'n'.
Change the root password? [Y/n] y
New password:
Re-enter new password:
Password updated successfully!
Reloading privilege tables..
 ... Success!

By default, a MariaDB installation has an anonymous user, allowing anyone to log into MariaDB without having to have a user account created forthem.  This is intended only for testing, and to make the installation go a bit smoother.  You should remove them before moving into a production environment.
Remove anonymous users? [Y/n] y
 ... Success!
Normally, root should only be allowed to connect from 'localhost'.  This ensures that someone cannot guess at the root password from the network.
Disallow root login remotely? [Y/n] n
 ... skipping.
By default, MariaDB comes with a database named 'test' that anyone can access.  This is also intended only for testing, and should be removed
before moving into a production environment.
Remove test database and access to it? [Y/n] y
 - Dropping test database...
 ... Success!
 - Removing privileges on test database...
 ... Success!
Reloading the privilege tables will ensure that all changes made so far
will take effect immediately.
Reload privilege tables now? [Y/n] y
 ... Success!
Cleaning up...
All done!  If you've completed all of the above steps, your MariaDB
installation should now be secure.
Thanks for using MariaDB!
[root@multipleinstance ~]#

[root@multipleinstance ~]# mysql_secure_installation --socket=/var/lib/mysql3309/mysql3309.sock
NOTE: RUNNING ALL PARTS OF THIS SCRIPT IS RECOMMENDED FOR ALL MariaDB
      SERVERS IN PRODUCTION USE!  PLEASE READ EACH STEP CAREFULLY!
In order to log into MariaDB to secure it, we'll need the current password for the root user. If you've just installed MariaDB, and
haven't set the root password yet, you should just press enter here.
Enter current password for root (enter for none):
OK, successfully used password, moving on...
Setting the root password or using the unix_socket ensures that nobody can log into the MariaDB root user without the proper authorisation.
You already have your root account protected, so you can safely answer 'n'.
Switch to unix_socket authentication [Y/n] n
 ... skipping.
You already have your root account protected, so you can safely answer 'n'.
Change the root password? [Y/n] y
New password:
Re-enter new password:
Password updated successfully!
Reloading privilege tables..
 ... Success!

By default, a MariaDB installation has an anonymous user, allowing anyone to log into MariaDB without having to have a user account created for
them.  This is intended only for testing, and to make the installation go a bit smoother.  You should remove them before moving into a
production environment.
Remove anonymous users? [Y/n] y
 ... Success!
Normally, root should only be allowed to connect from 'localhost'.  This ensures that someone cannot guess at the root password from the network.
Disallow root login remotely? [Y/n] n
 ... skipping.
By default, MariaDB comes with a database named 'test' that anyone can access.  This is also intended only for testing, and should be removed
before moving into a production environment.
Remove test database and access to it? [Y/n] y
 - Dropping test database...
 ... Success!
 - Removing privileges on test database...
 ... Success!
Reloading the privilege tables will ensure that all changes made so far
will take effect immediately.
Reload privilege tables now? [Y/n] y
 ... Success!
Cleaning up...
All done!  If you've completed all of the above steps, your MariaDB
installation should now be secure.
Thanks for using MariaDB!
[root@multipleinstance ~]#

Now connection establishment with password :-
----------------------------------------------------

[root@multipleinstance ~]# mysql -u root -p -S /var/lib/mysql3306/mysql3306.sock
Enter password: root 
Welcome to the MariaDB monitor.  Commands end with ; or \g.Your MariaDB connection id is 15 Server version: 10.5.15-MariaDB MariaDB ServerCopyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
MariaDB [(none)]> \s
--------------
mysql  Ver 15.1 Distrib 10.5.15-MariaDB, for Linux (x86_64) using readline 5.1
Connection id:          15
Current database:
Current user:           root@localhost
SSL:                    Not in use
Current pager:          stdout
Using outfile:          ''
Using delimiter:        ;
Server:                 MariaDB
Server version:         10.5.15-MariaDB MariaDB Server
Protocol version:       10
Connection:             Localhost via UNIX socket
Server characterset:    utf8mb4
Db     characterset:    utf8mb4
Client characterset:    utf8
Conn.  characterset:    utf8
UNIX socket:            /var/lib/mysql3306/mysql3306.sock
Uptime:                 1 hour 35 min 41 sec
Threads: 1  Questions: 57  Slow queries: 0  Opens: 21  Open tables: 14  Queries per second avg: 0.009
--------------
MariaDB [(none)]> show variables like 'datadir'; show variables like 'port'; show variables like 'socket'; 
show variables like 'pid%';show databases;
+---------------+---------------------+
| Variable_name | Value               |
+---------------+---------------------+
| datadir       | /var/lib/mysql3306/ |
+---------------+---------------------+
1 row in set (0.001 sec)
+---------------+-------+
| Variable_name | Value |
+---------------+-------+
| port          | 3306  |
+---------------+-------+
1 row in set (0.001 sec)
+---------------+-----------------------------------+
| Variable_name | Value                             |
+---------------+-----------------------------------+
| socket        | /var/lib/mysql3306/mysql3306.sock |
+---------------+-----------------------------------+
1 row in set (0.001 sec)
+---------------+----------------------------------+
| Variable_name | Value                            |
+---------------+----------------------------------+
| pid_file      | /var/lib/mysql3306/mysql3306.pid |
+---------------+----------------------------------+
1 row in set (0.001 sec)
+--------------------+
| Database           |
+--------------------+
| information_schema |
| mysql              |
| performance_schema |
+--------------------+
3 rows in set (0.000 sec)
MariaDB [(none)]> exit
Bye

[root@multipleinstance ~]# mysql -u root -p -S /var/lib/mysql3307/mysql3307.sock
Enter password: root 
Welcome to the MariaDB monitor.  Commands end with ; or \g.Your MariaDB connection id is 11 Server version: 10.5.15-MariaDB MariaDB ServerCopyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
MariaDB [(none)]> \s
--------------
mysql  Ver 15.1 Distrib 10.5.15-MariaDB, for Linux (x86_64) using readline 5.1
Connection id:          11
Current database:
Current user:           root@localhost
SSL:                    Not in use
Current pager:          stdout
Using outfile:          ''
Using delimiter:        ;
Server:                 MariaDB
Server version:         10.5.15-MariaDB MariaDB Server
Protocol version:       10
Connection:             Localhost via UNIX socket
Server characterset:    utf8mb4
Db     characterset:    utf8mb4
Client characterset:    utf8
Conn.  characterset:    utf8
UNIX socket:            /var/lib/mysql3307/mysql3307.sock
Uptime:                 1 hour 36 min 56 sec
Threads: 1  Questions: 21  Slow queries: 0  Opens: 21  Open tables: 14  Queries per second avg: 0.003
--------------
MariaDB [(none)]> show variables like 'datadir'; show variables like 'port'; show variables like 'socket'; 
show variables like 'pid%';show databases;
+---------------+---------------------+
| Variable_name | Value               |
+---------------+---------------------+
| datadir       | /var/lib/mysql3307/ |
+---------------+---------------------+
1 row in set (0.001 sec)
+---------------+-------+
| Variable_name | Value |
+---------------+-------+
| port          | 3307  |
+---------------+-------+
1 row in set (0.001 sec)
+---------------+-----------------------------------+
| Variable_name | Value                             |
+---------------+-----------------------------------+
| socket        | /var/lib/mysql3307/mysql3307.sock |
+---------------+-----------------------------------+
1 row in set (0.001 sec)
+---------------+----------------------------------+
| Variable_name | Value                            |
+---------------+----------------------------------+
| pid_file      | /var/lib/mysql3307/mysql3307.pid |
+---------------+----------------------------------+
1 row in set (0.001 sec)
+--------------------+
| Database           |
+--------------------+
| information_schema |
| mysql              |
| performance_schema |
+--------------------+
3 rows in set (0.000 sec)
MariaDB [(none)]> exit
Bye

[root@multipleinstance ~]# mysql -u root -p -S /var/lib/mysql3308/mysql3308.sock
Enter password: root 
Welcome to the MariaDB monitor.  Commands end with ; or \g.Your MariaDB connection id is 11 Server version: 10.5.15-MariaDB MariaDB Server Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
MariaDB [(none)]> \s
--------------
mysql  Ver 15.1 Distrib 10.5.15-MariaDB, for Linux (x86_64) using readline 5.1
Connection id:          11
Current database:
Current user:           root@localhost
SSL:                    Not in use
Current pager:          stdout
Using outfile:          ''
Using delimiter:        ;
Server:                 MariaDB
Server version:         10.5.15-MariaDB MariaDB Server
Protocol version:       10
Connection:             Localhost via UNIX socket
Server characterset:    utf8mb4
Db     characterset:    utf8mb4
Client characterset:    utf8
Conn.  characterset:    utf8
UNIX socket:            /var/lib/mysql3308/mysql3308.sock
Uptime:                 1 hour 37 min 10 sec
Threads: 1  Questions: 21  Slow queries: 0  Opens: 21  Open tables: 14  Queries per second avg: 0.003
--------------
MariaDB [(none)]> show variables like 'datadir'; show variables like 'port'; show variables like 'socket'; 
show variables like 'pid%';show databases;
+---------------+---------------------+
| Variable_name | Value               |
+---------------+---------------------+
| datadir       | /var/lib/mysql3308/ |
+---------------+---------------------+
1 row in set (0.001 sec)
+---------------+-------+
| Variable_name | Value |
+---------------+-------+
| port          | 3308  |
+---------------+-------+
1 row in set (0.001 sec)
+---------------+-----------------------------------+
| Variable_name | Value                             |
+---------------+-----------------------------------+
| socket        | /var/lib/mysql3308/mysql3308.sock |
+---------------+-----------------------------------+
1 row in set (0.001 sec)
+---------------+----------------------------------+
| Variable_name | Value                            |
+---------------+----------------------------------+
| pid_file      | /var/lib/mysql3308/mysql3308.pid |
+---------------+----------------------------------+
1 row in set (0.001 sec)
+--------------------+
| Database           |
+--------------------+
| information_schema |
| mysql              |
| performance_schema |
+--------------------+
3 rows in set (0.001 sec)
MariaDB [(none)]> exit
Bye

[root@multipleinstance ~]# mysql -u root -p -S /var/lib/mysql3309/mysql3309.sock
Enter password: root 
Welcome to the MariaDB monitor.  Commands end with ; or \g.Your MariaDB connection id is 11 Server version: 10.5.15-MariaDB MariaDB Server Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
MariaDB [(none)]> \s
--------------
mysql  Ver 15.1 Distrib 10.5.15-MariaDB, for Linux (x86_64) using readline 5.1
Connection id:          11
Current database:
Current user:           root@localhost
SSL:                    Not in use
Current pager:          stdout
Using outfile:          ''
Using delimiter:        ;
Server:                 MariaDB
Server version:         10.5.15-MariaDB MariaDB Server
Protocol version:       10
Connection:             Localhost via UNIX socket
Server characterset:    utf8mb4
Db     characterset:    utf8mb4
Client characterset:    utf8
Conn.  characterset:    utf8
UNIX socket:            /var/lib/mysql3309/mysql3309.sock
Uptime:                 1 hour 37 min 18 sec
Threads: 1  Questions: 21  Slow queries: 0  Opens: 21  Open tables: 14  Queries per second avg: 0.003
--------------
MariaDB [(none)]> show variables like 'datadir'; show variables like 'port'; show variables like 'socket'; 
show variables like 'pid%';show databases;
+---------------+---------------------+
| Variable_name | Value               |
+---------------+---------------------+
| datadir       | /var/lib/mysql3309/ |
+---------------+---------------------+
1 row in set (0.001 sec)
+---------------+-------+
| Variable_name | Value |
+---------------+-------+
| port          | 3309  |
+---------------+-------+
1 row in set (0.001 sec)
+---------------+-----------------------------------+
| Variable_name | Value                             |
+---------------+-----------------------------------+
| socket        | /var/lib/mysql3309/mysql3309.sock |
+---------------+-----------------------------------+
1 row in set (0.001 sec)
+---------------+----------------------------------+
| Variable_name | Value                            |
+---------------+----------------------------------+
| pid_file      | /var/lib/mysql3309/mysql3309.pid |
+---------------+----------------------------------+
1 row in set (0.001 sec)
+--------------------+
| Database           |
+--------------------+
| information_schema |
| mysql              |
| performance_schema |
+--------------------+
3 rows in set (0.000 sec)
MariaDB [(none)]> exit
Bye
[root@multipleinstance ~]#

-------------------------------------------------------------------------------------
Step - 7 : MariaDB serviceS creation for all instances [ 3306 , 3307 ,3308 and 3309 ]
-------------------------------------------------------------------------------------

Now it’s time to rock it inside new system units to make it possible to have a clear separation of the both MariaDB Servers running on 
the same box. I will call the MariaDB running on 3306, mariadb3306.service and the one running on port 3307, mariadb3307.service and then, 

I will reload the system units and start the services.

--> Create service files under the below location 

[root@multipleinstance ~]# vi /etc/systemd/system/mariadb3306.service

[root@multipleinstance ~]# cd /etc/systemd/system/

[root@multipleinstance system]# pwd
/etc/systemd/system
[root@multipleinstance system]# ls -ltr
drwxr-xr-x. 2 root root   44 Apr 30  2020 system-update.target.wants
drwxr-xr-x. 2 root root   32 Apr 30  2020 getty.target.wants
drwxr-xr-x. 2 root root   87 Apr 30  2020 default.target.wants
drwxr-xr-x. 2 root root   28 Apr 30  2020 sockets.target.wants
drwxr-xr-x. 2 root root  171 Apr 30  2020 sysinit.target.wants
drwxr-xr-x. 2 root root   35 Apr 30  2020 local-fs.target.wants
drwxr-xr-x. 2 root root   32 Apr 30  2020 basic.target.wants
drwxr-xr-x. 2 root root   48 Apr 30  2020 network-online.target.wants
lrwxrwxrwx. 1 root root   57 Apr 30  2020 dbus-org.freedesktop.nm-dispatcher.service -> /usr/lib/systemd/system/NetworkManager-dispatcher.service
drwxr-xr-x. 2 root root   31 Apr 30  2020 remote-fs.target.wants
drwxr-xr-x. 2 root root   38 Apr 30  2020 dev-virtio\x2dports-org.qemu.guest_agent.0.device.wants
lrwxrwxrwx. 1 root root   37 Apr 30  2020 default.target -> /lib/systemd/system/multi-user.target
drwxr-xr-x. 2 root root   29 Feb 15 16:55 vmtoolsd.service.requires
drwxr-xr-x. 2 root root   48 Feb 15 17:33 mariadb.service.d
drwxr-xr-x. 2 root root 4096 Feb 16 05:53 multi-user.target.wants
-rw-r--r--. 1 root root  256 Feb 19 00:39 mariadb3306.service

[root@multipleinstance system]# cat mariadb3306.service
#: add the below to the mariadb3306’s unit
[Unit]
Description=mariadb mysql3306
After=network.target
[Service]
Type=simple
User=mysql
ExecStart=/bin/mysqld_safe --defaults-file=/etc/my3306.cnf
Restart=on-abort

[Install]
WantedBy=multi-user.target
[root@multipleinstance system]#

--> Do the same for the second one, which is the mariadb3307 and enable them:

[root@multipleinstance ~]# vi /etc/systemd/system/mariadb3307.service
[root@multipleinstance ~]# cat
/etc/systemd/system/mariadb3307.service
#: add the below to the mariadb3307’s unit
[Unit]
Description=mariadb mysql3307
After=network.target
[Service]
Type=simple
User=mysql
ExecStart=/bin/mysqld_safe --defaults-file=/etc/my3307.cnf
Restart=on-abort
[Install]
WantedBy=multi-user.target

[root@multipleinstance ~]# vi /etc/systemd/system/mariadb3308.service
[root@multipleinstance ~]# cat
/etc/systemd/system/mariadb3308.service
#: add the below to the mariadb3308’s unit
[Unit]
Description=mariadb mysql3308
After=network.target
[Service]
Type=simple
User=mysql
ExecStart=/bin/mysqld_safe --defaults-file=/etc/my3308.cnf
Restart=on-abort
[Install]
WantedBy=multi-user.target

[root@multipleinstance ~]# vi /etc/systemd/system/mariadb3309.service
[root@multipleinstance ~]# cat /etc/systemd/system/mariadb3309.service
#: add the below to the mariadb3309’s unit
[Unit]
Description=mariadb mysql3309
After=network.target
[Service]
Type=simple
User=mysql
ExecStart=/bin/mysqld_safe --defaults-file=/etc/my3309.cnf
Restart=on-abort
[Install]
WantedBy=multi-user.target
[root@multipleinstance ~]#

--> Enable services by using systemctl command 

[root@multipleinstance ~]# systemctl enable mariadb3306.service
Created symlink from /etc/systemd/system/multi-user.target.wants/mariadb3306.service to /etc/systemd/system/mariadb3306.service.
[root@multipleinstance ~]#

[root@multipleinstance ~]# systemctl enable mariadb3307.service
[root@multipleinstance ~]# systemctl enable mariadb3308.service
Failed to execute operation: File exists
[root@multipleinstance ~]# systemctl enable mariadb3309.service
Failed to execute operation: File exists
Solution for above failed info , remove mentioned services under /etc/systemd/system/multi-user.target.wants folder and rerun above commands
[root@multipleinstance ~]# systemctl enable mariadb3308.service
Created symlink from /etc/systemd/system/multi-user.target.wants/mariadb3308.service to /etc/systemd/system/mariadb3308.service.
[root@multipleinstance ~]# systemctl enable mariadb3309.service
Created symlink from /etc/systemd/system/multi-user.target.wants/mariadb3309.service to /etc/systemd/system/mariadb3309.service.
[root@multipleinstance ~]#

--> Location of services files for all MariaDB instances 

[root@multipleinstance ~]# ls -ltr /etc/systemd/system/multi-user.target.wants
total 0
lrwxrwxrwx. 1 root root 40 Apr 30  2020 remote-fs.target -> /usr/lib/systemd/system/remote-fs.target
lrwxrwxrwx. 1 root root 39 Apr 30  2020 rpcbind.service -> /usr/lib/systemd/system/rpcbind.service
lrwxrwxrwx. 1 root root 46 Apr 30  2020 rhel-configure.service -> /usr/lib/systemd/system/rhel-configure.service
lrwxrwxrwx. 1 root root 37 Apr 30  2020 crond.service -> /usr/lib/systemd/system/crond.service
lrwxrwxrwx. 1 root root 46 Apr 30  2020 NetworkManager.service -> /usr/lib/systemd/system/NetworkManager.service
lrwxrwxrwx. 1 root root 37 Apr 30  2020 tuned.service -> /usr/lib/systemd/system/tuned.service
lrwxrwxrwx. 1 root root 41 Apr 30  2020 nfs-client.target -> /usr/lib/systemd/system/nfs-client.target
lrwxrwxrwx. 1 root root 40 Apr 30  2020 vmtoolsd.service -> /usr/lib/systemd/system/vmtoolsd.service
lrwxrwxrwx. 1 root root 36 Apr 30  2020 sshd.service -> /usr/lib/systemd/system/sshd.service
lrwxrwxrwx. 1 root root 39 Apr 30  2020 postfix.service -> /usr/lib/systemd/system/postfix.service
lrwxrwxrwx. 1 root root 38 Apr 30  2020 auditd.service -> /usr/lib/systemd/system/auditd.service
lrwxrwxrwx. 1 root root 39 Apr 30  2020 chronyd.service -> /usr/lib/systemd/system/chronyd.service
lrwxrwxrwx. 1 root root 39 Apr 30  2020 rsyslog.service -> /usr/lib/systemd/system/rsyslog.service
lrwxrwxrwx. 1 root root 42 Apr 30  2020 irqbalance.service -> /usr/lib/systemd/system/irqbalance.service
lrwxrwxrwx. 1 root root 39 Feb 15 17:59 mariadb.service -> /usr/lib/systemd/system/mariadb.service
lrwxrwxrwx. 1 root root 39 Feb 16 05:53 mariadb3307.service -> /etc/systemd/system/mariadb3307.service
lrwxrwxrwx. 1 root root 39 Feb 19 00:41 mariadb3306.service -> /etc/systemd/system/mariadb3306.service
lrwxrwxrwx. 1 root root 39 Feb 19 01:03 mariadb3308.service -> /etc/systemd/system/mariadb3308.service
lrwxrwxrwx. 1 root root 39 Feb 19 01:03 mariadb3309.service -> /etc/systemd/system/mariadb3309.service
[root@multipleinstance ~]#

--> Are them really enabled?

[root@multipleinstance ~]# systemctl is-enabled mariadb3306.service
enabled
[root@multipleinstance ~]# systemctl is-enabled mariadb3307.service
enabled
[root@multipleinstance ~]# systemctl is-enabled mariadb3308.service
enabled
[root@multipleinstance ~]# systemctl is-enabled mariadb3309.service
enabled
[root@multipleinstance ~]#
--> Reload them:
[root@multipleinstance ~]# systemctl daemon-reload
[root@multipleinstance ~]#

--> All instances are running ..Now stop all MariaDB instances ....

[root@multipleinstance ~]# ps aux | grep mysqld
root      1763  0.0  0.1 113420  1648 pts/1    S    00:20   0:00 /bin/sh /usr/bin/mysqld_safe --defaults-file=/etc/my3306.cnf
mysql     1864  0.0  9.1 1144792 87128 pts/1   Sl   00:20   0:00 /usr/sbin/mariadbd --defaults-file=/etc/my3306.cnf --basedir=/usr --datadir=/var/lib/mysql3  306 --plugin-dir=/usr/lib64/mysql/plugin --user=mysql --log-error=/var/lib/mysql3306/mysqld3306.log --pid-file=/var/lib/mysql3306/mysql3306.pid --socket=/va  r/lib/mysql3306/mysql3306.sock --port=3306
root      1877  0.0  0.1 113420  1656 pts/1    S    00:20   0:00 /bin/sh /usr/bin/mysqld_safe --defaults-file=/etc/my3307.cnf
mysql     1981  0.0  9.3 1152844 89128 pts/1   Sl   00:20   0:00 /usr/sbin/mariadbd --defaults-file=/etc/my3307.cnf --basedir=/usr --datadir=/var/lib/mysql3  307 --plugin-dir=/usr/lib64/mysql/plugin --user=mysql --log-error=/var/lib/mysql3307/mysqld3307.log --pid-file=/var/lib/mysql3307/mysql3307.pid --socket=/va  r/lib/mysql3307/mysql3307.sock --port=3307
root      1995  0.0  0.1 113420  1648 pts/1    S    00:20   0:00 /bin/sh /usr/bin/mysqld_safe --defaults-file=/etc/my3308.cnf
mysql     2096  0.0  8.9 1152844 84828 pts/1   Sl   00:20   0:00 /usr/sbin/mariadbd --defaults-file=/etc/my3308.cnf --basedir=/usr --datadir=/var/lib/mysql3  308 --plugin-dir=/usr/lib64/mysql/plugin --user=mysql --log-error=/var/lib/mysql3308/mysqld3308.log --pid-file=/var/lib/mysql3308/mysql3308.pid --socket=/va  r/lib/mysql3308/mysql3308.sock --port=3308
root      2110  0.0  0.1 113420  1652 pts/1    S    00:20   0:00 /bin/sh /usr/bin/mysqld_safe --defaults-file=/etc/my3309.cnf
mysql     2211  0.0  9.1 1152848 87060 pts/1   Sl   00:20   0:00 /usr/sbin/mariadbd --defaults-file=/etc/my3309.cnf --basedir=/usr --datadir=/var/lib/mysql3  309 --plugin-dir=/usr/lib64/mysql/plugin --user=mysql --log-error=/var/lib/mysql3309/mysqld3309.log --pid-file=/var/lib/mysql3309/mysql3309.pid --socket=/va  r/lib/mysql3309/mysql3309.sock --port=3309
root      2525  0.0  0.1 112812   980 pts/1    R+   00:44   0:00 grep --color=auto mysqld
[root@multipleinstance ~]#

[root@multipleinstance ~]# mysqladmin shutdown --socket=/var/lib/mysql3306/mysql3306.sock
[1]   Done                    /usr/bin/mysqld_safe --defaults-file=/etc/my3306.cnf  (wd: /var/lib/mysql3306)
(wd now: ~)

[root@multipleinstance ~]# mysqladmin shutdown --socket=/var/lib/mysql3307/mysql3307.sock
[2]   Done                    /usr/bin/mysqld_safe --defaults-file=/etc/my3307.cnf  (wd: /var/lib/mysql3306)
(wd now: ~)

[root@multipleinstance ~]# mysqladmin shutdown --socket=/var/lib/mysql3308/mysql3308.sock
[3]-  Done                    /usr/bin/mysqld_safe --defaults-file=/etc/my3308.cnf  (wd: /var/lib/mysql3306)
(wd now: ~)

[root@multipleinstance ~]# mysqladmin shutdown --socket=/var/lib/mysql3309/mysql3309.sock
[4]+  Done                    /usr/bin/mysqld_safe --defaults-file=/etc/my3309.cnf  (wd: /var/lib/mysql3306)
(wd now: ~)
[root@multipleinstance ~]# ps aux | grep mysqld
root      2551  0.0  0.1 112812   976 pts/1    R+   00:45   0:00 grep --color=auto mysqld
[root@multipleinstance ~]#

--> start the first instance on 3306 and check status

[root@multipleinstance ~]# systemctl start mariadb3306.service
[root@multipleinstance ~]# systemctl status mariadb3306.service
● mariadb3306.service - mariadb mysql3306
   Loaded: loaded (/etc/systemd/system/mariadb3306.service; enabled; vendor preset: disabled)
   Active: active (running) since Sat 2022-02-19 00:48:03 UTC; 6s ago
 Main PID: 2581 (mysqld_safe)
   CGroup: /system.slice/mariadb3306.service
           ├─2581 /bin/sh /bin/mysqld_safe --defaults-file=/etc/my3306.cnf
           └─2682 //sbin/mariadbd --defaults-file=/etc/my3306.cnf --basedir=/usr --datadir=/var/lib/mysql3306 --plugin-dir=/usr/lib64/mysql/plugin --log-...
Feb 19 00:48:03 multipleinstance systemd[1]: Started mariadb mysql3306.
Feb 19 00:48:03 multipleinstance mysqld_safe[2581]: 220219 00:48:03 mysqld_safe Logging to '/var/lib/mysql3306/mysqld3306.log'.
Feb 19 00:48:03 multipleinstance mysqld_safe[2581]: 220219 00:48:03 mysqld_safe Starting mariadbd daemon with databases from /var/lib/mysql3306
[root@multipleinstance ~]#

[root@multipleinstance ~]# ps aux | grep mysqld
mysql     2581  0.0  0.1 113420  1652 ?        Ss   00:48   0:00 /bin/sh /bin/mysqld_safe --defaults-file=/etc/my3306.cnf
mysql     2682  0.1  7.9 1150364 74984 ?       Sl   00:48   0:00 //sbin/mariadbd --defaults-file=/etc/my3306.cnf --basedir=/usr --datadir=/var/lib/mysql3306 --plugin-dir=/usr/lib64/mysql/plugin --log-error=/var/lib/mysql3306/mysqld3306.log --pid-file=/var/lib/mysql3306/mysql3306.pid --socket=/var/lib/mysql3306/mysql3306.sock --port=3306
root      2697  0.0  0.1 112812   980 pts/1    R+   00:48   0:00 grep --color=auto mysqld
[root@multipleinstance ~]#

--> start other instance on 3307,3308,3309 and check status

[root@multipleinstance ~]# ps -ef | grep -i mysql
mysql     2581     1  0 00:48 ?        00:00:00 /bin/sh /bin/mysqld_safe --defaults-file=/etc/my3306.cnf
mysql     2682  2581  0 00:48 ?        00:00:00 //sbin/mariadbd --defaults-file=/etc/my3306.cnf --basedir=/usr --datadir=/var/lib/mysql3306 --plugin-dir=/usr/lib64/mysql/plugin --log-error=/var/lib/mysql3306/mysqld3306.log --pid-file=/var/lib/mysql3306/mysql3306.pid --socket=/var/lib/mysql3306/mysql3306.sock --port=3306
root      2943  1714  0 01:07 pts/1    00:00:00 grep --color=auto -i mysql
[root@multipleinstance ~]# systemctl start mariadb3307.service
[root@multipleinstance ~]# systemctl status mariadb3307.service
● mariadb3307.service - mariadb mysql3307
   Loaded: loaded (/etc/systemd/system/mariadb3307.service; enabled; vendor preset: disabled)
   Active: active (running) since Sat 2022-02-19 01:07:57 UTC; 11s ago
 Main PID: 2950 (mysqld_safe)
   CGroup: /system.slice/mariadb3307.service
           ├─2950 /bin/sh /bin/mysqld_safe --defaults-file=/etc/my3307.cnf
           └─3054 //sbin/mariadbd --defaults-file=/etc/my3307.cnf --basedir=/usr --datadir=/var/lib/mysql3307 --plugin-dir=/usr/lib64/mysql/plugin --log-er...
Feb 19 01:07:57 multipleinstance systemd[1]: Started mariadb mysql3307.
Feb 19 01:07:57 multipleinstance mysqld_safe[2950]: 220219 01:07:57 mysqld_safe Logging to '/var/lib/mysql3307/mysqld3307.log'.
Feb 19 01:07:57 multipleinstance mysqld_safe[2950]: 220219 01:07:57 mysqld_safe Starting mariadbd daemon with databases from /var/lib/mysql3307

[root@multipleinstance ~]# systemctl start mariadb3308.service
[root@multipleinstance ~]# systemctl status mariadb3308.service
● mariadb3308.service - mariadb mysql3308
   Loaded: loaded (/etc/systemd/system/mariadb3308.service; enabled; vendor preset: disabled)
   Active: active (running) since Sat 2022-02-19 01:08:17 UTC; 4s ago
 Main PID: 3074 (mysqld_safe)
   CGroup: /system.slice/mariadb3308.service
           ├─3074 /bin/sh /bin/mysqld_safe --defaults-file=/etc/my3308.cnf
           └─3175 //sbin/mariadbd --defaults-file=/etc/my3308.cnf --basedir=/usr --datadir=/var/lib/mysql3308 --plugin-dir=/usr/lib64/mysql/plugin --log-er...
Feb 19 01:08:17 multipleinstance systemd[1]: Started mariadb mysql3308.
Feb 19 01:08:17 multipleinstance mysqld_safe[3074]: 220219 01:08:17 mysqld_safe Logging to '/var/lib/mysql3308/mysqld3308.log'.
Feb 19 01:08:17 multipleinstance mysqld_safe[3074]: 220219 01:08:17 mysqld_safe Starting mariadbd daemon with databases from /var/lib/mysql3308

[root@multipleinstance ~]# systemctl start mariadb3309.service
[root@multipleinstance ~]# systemctl status mariadb3309.service
● mariadb3309.service - mariadb mysql3309
   Loaded: loaded (/etc/systemd/system/mariadb3309.service; enabled; vendor preset: disabled)
   Active: active (running) since Sat 2022-02-19 01:08:28 UTC; 6s ago
 Main PID: 3195 (mysqld_safe)
   CGroup: /system.slice/mariadb3309.service
           ├─3195 /bin/sh /bin/mysqld_safe --defaults-file=/etc/my3309.cnf
           └─3296 //sbin/mariadbd --defaults-file=/etc/my3309.cnf --basedir=/usr --datadir=/var/lib/mysql3309 --plugin-dir=/usr/lib64/mysql/plugin --log-er...
Feb 19 01:08:28 multipleinstance systemd[1]: Started mariadb mysql3309.
Feb 19 01:08:28 multipleinstance mysqld_safe[3195]: 220219 01:08:28 mysqld_safe Logging to '/var/lib/mysql3309/mysqld3309.log'.
Feb 19 01:08:28 multipleinstance mysqld_safe[3195]: 220219 01:08:28 mysqld_safe Starting mariadbd daemon with databases from /var/lib/mysql3309
[root@multipleinstance ~]#

[root@multipleinstance ~]# ps -ef | grep -i mysql
mysql     2581     1  0 00:48 ?        00:00:00 /bin/sh /bin/mysqld_safe --defaults-file=/etc/my3306.cnf
mysql     2682  2581  0 00:48 ?        00:00:00 //sbin/mariadbd --defaults-file=/etc/my3306.cnf --basedir=/usr --datadir=/var/lib/mysql3306 --plugin-dir=/usr/lib64/mysql/plugin --log-error=/var/lib/mysql3306/mysqld3306.log --pid-file=/var/lib/mysql3306/mysql3306.pid --socket=/var/lib/mysql3306/mysql3306.sock --port=3306
mysql     2950     1  0 01:07 ?        00:00:00 /bin/sh /bin/mysqld_safe --defaults-file=/etc/my3307.cnf
mysql     3054  2950  0 01:07 ?        00:00:00 //sbin/mariadbd --defaults-file=/etc/my3307.cnf --basedir=/usr --datadir=/var/lib/mysql3307 --plugin-dir=/usr/lib64/mysql/plugin --log-error=/var/lib/mysql3307/mysqld3307.log --pid-file=/var/lib/mysql3307/mysql3307.pid --socket=/var/lib/mysql3307/mysql3307.sock --port=3307
mysql     3074     1  0 01:08 ?        00:00:00 /bin/sh /bin/mysqld_safe --defaults-file=/etc/my3308.cnf
mysql     3175  3074  0 01:08 ?        00:00:00 //sbin/mariadbd --defaults-file=/etc/my3308.cnf --basedir=/usr --datadir=/var/lib/mysql3308 --plugin-dir=/usr/lib64/mysql/plugin --log-error=/var/lib/mysql3308/mysqld3308.log --pid-file=/var/lib/mysql3308/mysql3308.pid --socket=/var/lib/mysql3308/mysql3308.sock --port=3308
mysql     3195     1  0 01:08 ?        00:00:00 /bin/sh /bin/mysqld_safe --defaults-file=/etc/my3309.cnf
mysql     3296  3195  0 01:08 ?        00:00:00 //sbin/mariadbd --defaults-file=/etc/my3309.cnf --basedir=/usr --datadir=/var/lib/mysql3309 --plugin-dir=/usr/lib64/mysql/plugin --log-error=/var/lib/mysql3309/mysqld3309.log --pid-file=/var/lib/mysql3309/mysql3309.pid --socket=/var/lib/mysql3309/mysql3309.sock --port=3309
root      3312  1714  0 01:09 pts/1    00:00:00 grep --color=auto -i mysql
[root@multipleinstance ~]#

--> And now, just to finish it, let’s access the instances:

[root@multipleinstance ~]# mysql -u root -p -S /var/lib/mysql3306/mysql3306.sock
Enter password: root
Welcome to the MariaDB monitor.  Commands end with ; or \g.Your MariaDB connection id is 3 Server version: 10.5.15-MariaDB MariaDB Server Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
MariaDB [(none)]> show variables like '%port%';
+--------------------------+-------+
| Variable_name            | Value |
+--------------------------+-------+
| extra_port               | 0     |
| large_files_support      | ON    |
| port                     | 3306  |
| progress_report_time     | 5     |
| report_host              |       |
| report_password          |       |
| report_port              | 3306  |
| report_user              |       |
| require_secure_transport | OFF   |
+--------------------------+-------+
9 rows in set (0.001 sec)
MariaDB [(none)]>exit
Bye

[root@multipleinstance ~]# mysql -u root -p -S /var/lib/mysql3307/mysql3307.sock
Enter password: root 
Welcome to the MariaDB monitor.  Commands end with ; or \g. Your MariaDB connection id is 3 Server version: 10.5.15-MariaDB MariaDB Server Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others. Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
MariaDB [(none)]> show variables like '%port%';
+--------------------------+-------+
| Variable_name            | Value |
+--------------------------+-------+
| extra_port               | 0     |
| large_files_support      | ON    |
| port                     | 3307  |
| progress_report_time     | 5     |
| report_host              |       |
| report_password          |       |
| report_port              | 3307  |
| report_user              |       |
| require_secure_transport | OFF   |
+--------------------------+-------+
9 rows in set (0.001 sec)
MariaDB [(none)]> exit
Bye

[root@multipleinstance ~]# mysql -u root -p -S /var/lib/mysql3308/mysql3308.sock
Enter password: root
Welcome to the MariaDB monitor.  Commands end with ; or \g.Your MariaDB connection id is 3 Server version: 10.5.15-MariaDB MariaDB Server Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
MariaDB [(none)]> show variables like '%port%';
+--------------------------+-------+
| Variable_name            | Value |
+--------------------------+-------+
| extra_port               | 0     |
| large_files_support      | ON    |
| port                     | 3308  |
| progress_report_time     | 5     |
| report_host              |       |
| report_password          |       |
| report_port              | 3308  |
| report_user              |       |
| require_secure_transport | OFF   |
+--------------------------+-------+
9 rows in set (0.001 sec)
MariaDB [(none)]> exit
Bye

[root@multipleinstance ~]# mysql -u root -p -S /var/lib/mysql3309/mysql3309.sock
Enter password: root 
Welcome to the MariaDB monitor.  Commands end with ; or \g.Your MariaDB connection id is 3 Server version: 10.5.15-MariaDB MariaDB Server Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others. Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
MariaDB [(none)]> show variables like '%port%';
+--------------------------+-------+
| Variable_name            | Value |
+--------------------------+-------+
| extra_port               | 0     |
| large_files_support      | ON    |
| port                     | 3309  |
| progress_report_time     | 5     |
| report_host              |       |
| report_password          |       |
| report_port              | 3309  |
| report_user              |       |
| require_secure_transport | OFF   |
+--------------------------+-------+
9 rows in set (0.001 sec)
MariaDB [(none)]> exit
Bye
[root@multipleinstance ~]#

-------------------------------------------------------------------------------------
Step - 8 : Stop / Start / Status / Restart for all MariaDB instances by uising mariadb instance service files
-------------------------------------------------------------------------------------

--> All instance status command 

[root@multipleinstance ~]# ps -ef | grep -i mysql
mysql     2581     1  0 00:48 ?        00:00:00 /bin/sh /bin/mysqld_safe --defaults-file=/etc/my3306.cnf
mysql     2682  2581  0 00:48 ?        00:00:00 //sbin/mariadbd --defaults-file=/etc/my3306.cnf --basedir=/usr --datadir=/var/lib/mysql3306 --plugin-dir=/usr/lib64/mysql/plugin --log-error=/var/lib/mysql3306/mysqld3306.log --pid-file=/var/lib/mysql3306/mysql3306.pid --socket=/var/lib/mysql3306/mysql3306.sock --port=3306
mysql     2950     1  0 01:07 ?        00:00:00 /bin/sh /bin/mysqld_safe --defaults-file=/etc/my3307.cnf
mysql     3054  2950  0 01:07 ?        00:00:00 //sbin/mariadbd --defaults-file=/etc/my3307.cnf --basedir=/usr --datadir=/var/lib/mysql3307 --plugin-dir=/usr/lib64/mysql/plugin --log-error=/var/lib/mysql3307/mysqld3307.log --pid-file=/var/lib/mysql3307/mysql3307.pid --socket=/var/lib/mysql3307/mysql3307.sock --port=3307
mysql     3074     1  0 01:08 ?        00:00:00 /bin/sh /bin/mysqld_safe --defaults-file=/etc/my3308.cnf
mysql     3175  3074  0 01:08 ?        00:00:00 //sbin/mariadbd --defaults-file=/etc/my3308.cnf --basedir=/usr --datadir=/var/lib/mysql3308 --plugin-dir=/usr/lib64/mysql/plugin --log-error=/var/lib/mysql3308/mysqld3308.log --pid-file=/var/lib/mysql3308/mysql3308.pid --socket=/var/lib/mysql3308/mysql3308.sock --port=3308
mysql     3195     1  0 01:08 ?        00:00:00 /bin/sh /bin/mysqld_safe --defaults-file=/etc/my3309.cnf
mysql     3296  3195  0 01:08 ?        00:00:00 //sbin/mariadbd --defaults-file=/etc/my3309.cnf --basedir=/usr --datadir=/var/lib/mysql3309 --plugin-dir=/usr/lib64/mysql/plugin --log-error=/var/lib/mysql3309/mysqld3309.log --pid-file=/var/lib/mysql3309/mysql3309.pid --socket=/var/lib/mysql3309/mysql3309.sock --port=3309
root      3367  1714  0 01:15 pts/1    00:00:00 grep --color=auto -i mysql


[root@multipleinstance ~]# systemctl status mariadb3306.service
● mariadb3306.service - mariadb mysql3306
   Loaded: loaded (/etc/systemd/system/mariadb3306.service; enabled; vendor preset: disabled)
   Active: active (running) since Sat 2022-02-19 00:48:03 UTC; 28min ago
 Main PID: 2581 (mysqld_safe)
   CGroup: /system.slice/mariadb3306.service
           ├─2581 /bin/sh /bin/mysqld_safe --defaults-file=/etc/my3306.cnf
           └─2682 //sbin/mariadbd --defaults-file=/etc/my3306.cnf --basedir=/usr --datadir=/var/lib/mysql3306 --plugin-dir=/usr/lib64/mysql/plugin --log-er...
Feb 19 00:48:03 multipleinstance systemd[1]: Started mariadb mysql3306.
Feb 19 00:48:03 multipleinstance mysqld_safe[2581]: 220219 00:48:03 mysqld_safe Logging to '/var/lib/mysql3306/mysqld3306.log'.
Feb 19 00:48:03 multipleinstance mysqld_safe[2581]: 220219 00:48:03 mysqld_safe Starting mariadbd daemon with databases from /var/lib/mysql3306

[root@multipleinstance ~]# systemctl status mariadb3307.service
● mariadb3307.service - mariadb mysql3307
   Loaded: loaded (/etc/systemd/system/mariadb3307.service; enabled; vendor preset: disabled)
   Active: active (running) since Sat 2022-02-19 01:07:57 UTC; 8min ago
 Main PID: 2950 (mysqld_safe)
   CGroup: /system.slice/mariadb3307.service
           ├─2950 /bin/sh /bin/mysqld_safe --defaults-file=/etc/my3307.cnf
           └─3054 //sbin/mariadbd --defaults-file=/etc/my3307.cnf --basedir=/usr --datadir=/var/lib/mysql3307 --plugin-dir=/usr/lib64/mysql/plugin --log-er...
Feb 19 01:07:57 multipleinstance systemd[1]: Started mariadb mysql3307.
Feb 19 01:07:57 multipleinstance mysqld_safe[2950]: 220219 01:07:57 mysqld_safe Logging to '/var/lib/mysql3307/mysqld3307.log'.
Feb 19 01:07:57 multipleinstance mysqld_safe[2950]: 220219 01:07:57 mysqld_safe Starting mariadbd daemon with databases from /var/lib/mysql3307

[root@multipleinstance ~]# systemctl status mariadb3308.service
● mariadb3308.service - mariadb mysql3308
   Loaded: loaded (/etc/systemd/system/mariadb3308.service; enabled; vendor preset: disabled)
   Active: active (running) since Sat 2022-02-19 01:08:17 UTC; 7min ago
 Main PID: 3074 (mysqld_safe)
   CGroup: /system.slice/mariadb3308.service
           ├─3074 /bin/sh /bin/mysqld_safe --defaults-file=/etc/my3308.cnf
           └─3175 //sbin/mariadbd --defaults-file=/etc/my3308.cnf --basedir=/usr --datadir=/var/lib/mysql3308 --plugin-dir=/usr/lib64/mysql/plugin --log-er...
Feb 19 01:08:17 multipleinstance systemd[1]: Started mariadb mysql3308.
Feb 19 01:08:17 multipleinstance mysqld_safe[3074]: 220219 01:08:17 mysqld_safe Logging to '/var/lib/mysql3308/mysqld3308.log'.
Feb 19 01:08:17 multipleinstance mysqld_safe[3074]: 220219 01:08:17 mysqld_safe Starting mariadbd daemon with databases from /var/lib/mysql3308

[root@multipleinstance ~]# systemctl status mariadb3309.service
● mariadb3309.service - mariadb mysql3309
   Loaded: loaded (/etc/systemd/system/mariadb3309.service; enabled; vendor preset: disabled)
   Active: active (running) since Sat 2022-02-19 01:08:28 UTC; 7min ago
 Main PID: 3195 (mysqld_safe)
   CGroup: /system.slice/mariadb3309.service
           ├─3195 /bin/sh /bin/mysqld_safe --defaults-file=/etc/my3309.cnf
           └─3296 //sbin/mariadbd --defaults-file=/etc/my3309.cnf --basedir=/usr --datadir=/var/lib/mysql3309 --plugin-dir=/usr/lib64/mysql/plugin --log-er...
Feb 19 01:08:28 multipleinstance systemd[1]: Started mariadb mysql3309.
Feb 19 01:08:28 multipleinstance mysqld_safe[3195]: 220219 01:08:28 mysqld_safe Logging to '/var/lib/mysql3309/mysqld3309.log'.
Feb 19 01:08:28 multipleinstance mysqld_safe[3195]: 220219 01:08:28 mysqld_safe Starting mariadbd daemon with databases from /var/lib/mysql3309
[root@multipleinstance ~]#

--> All instance for Stop Command 

[root@multipleinstance ~]# ps -ef | grep -i mysql
mysql     2581     1  0 00:48 ?        00:00:00 /bin/sh /bin/mysqld_safe --defaults-file=/etc/my3306.cnf
mysql     2682  2581  0 00:48 ?        00:00:00 //sbin/mariadbd --defaults-file=/etc/my3306.cnf --basedir=/usr --datadir=/var/lib/mysql3306 --plugin-dir=/usr/lib64/mysql/plugin --log-error=/var/lib/mysql3306/mysqld3306.log --pid-file=/var/lib/mysql3306/mysql3306.pid --socket=/var/lib/mysql3306/mysql3306.sock --port=3306
mysql     2950     1  0 01:07 ?        00:00:00 /bin/sh /bin/mysqld_safe --defaults-file=/etc/my3307.cnf
mysql     3054  2950  0 01:07 ?        00:00:00 //sbin/mariadbd --defaults-file=/etc/my3307.cnf --basedir=/usr --datadir=/var/lib/mysql3307 --plugin-dir=/usr/lib64/mysql/plugin --log-error=/var/lib/mysql3307/mysqld3307.log --pid-file=/var/lib/mysql3307/mysql3307.pid --socket=/var/lib/mysql3307/mysql3307.sock --port=3307
mysql     3074     1  0 01:08 ?        00:00:00 /bin/sh /bin/mysqld_safe --defaults-file=/etc/my3308.cnf
mysql     3175  3074  0 01:08 ?        00:00:00 //sbin/mariadbd --defaults-file=/etc/my3308.cnf --basedir=/usr --datadir=/var/lib/mysql3308 --plugin-dir=/usr/lib64/mysql/plugin --log-error=/var/lib/mysql3308/mysqld3308.log --pid-file=/var/lib/mysql3308/mysql3308.pid --socket=/var/lib/mysql3308/mysql3308.sock --port=3308
mysql     3195     1  0 01:08 ?        00:00:00 /bin/sh /bin/mysqld_safe --defaults-file=/etc/my3309.cnf
mysql     3296  3195  0 01:08 ?        00:00:00 //sbin/mariadbd --defaults-file=/etc/my3309.cnf --basedir=/usr --datadir=/var/lib/mysql3309 --plugin-dir=/usr/lib64/mysql/plugin --log-error=/var/lib/mysql3309/mysqld3309.log --pid-file=/var/lib/mysql3309/mysql3309.pid --socket=/var/lib/mysql3309/mysql3309.sock --port=3309
root      3373  1714  0 01:17 pts/1    00:00:00 grep --color=auto -i mysql

[root@multipleinstance ~]# systemctl stop mariadb3306.service
[root@multipleinstance ~]# systemctl stop mariadb3307.service
[root@multipleinstance ~]# systemctl stop mariadb3308.service
[root@multipleinstance ~]# systemctl stop mariadb3309.service

[root@multipleinstance ~]# ps -ef | grep -i mysql
root      3424  1714  0 01:17 pts/1    00:00:00 grep --color=auto -i mysql
[root@multipleinstance ~]#

Working fine ...

--> All instance for Stop Command 

[root@multipleinstance ~]# ps -ef | grep -i mysql
root      3424  1714  0 01:17 pts/1    00:00:00 grep --color=auto -i mysql
[root@multipleinstance ~]# systemctl status mariadb3306.service
● mariadb3306.service - mariadb mysql3306
   Loaded: loaded (/etc/systemd/system/mariadb3306.service; enabled; vendor preset: disabled)
   Active: inactive (dead) since Sat 2022-02-19 01:17:24 UTC; 49s ago
  Process: 2581 ExecStart=/bin/mysqld_safe --defaults-file=/etc/my3306.cnf (code=exited, status=0/SUCCESS)
 Main PID: 2581 (code=exited, status=0/SUCCESS)
Feb 19 00:48:03 multipleinstance systemd[1]: Started mariadb mysql3306.
Feb 19 00:48:03 multipleinstance mysqld_safe[2581]: 220219 00:48:03 mysqld_safe Logging to '/var/lib/mysql3306/mysqld3306.log'.
Feb 19 00:48:03 multipleinstance mysqld_safe[2581]: 220219 00:48:03 mysqld_safe Starting mariadbd daemon with databases from /var/lib/mysql3306
Feb 19 01:17:24 multipleinstance systemd[1]: Stopping mariadb mysql3306...
Feb 19 01:17:24 multipleinstance systemd[1]: Stopped mariadb mysql3306.

[root@multipleinstance ~]# systemctl status mariadb3307.service
● mariadb3307.service - mariadb mysql3307
   Loaded: loaded (/etc/systemd/system/mariadb3307.service; enabled; vendor preset: disabled)
   Active: inactive (dead) since Sat 2022-02-19 01:17:29 UTC; 48s ago
  Process: 2950 ExecStart=/bin/mysqld_safe --defaults-file=/etc/my3307.cnf (code=exited, status=0/SUCCESS)
 Main PID: 2950 (code=exited, status=0/SUCCESS)
Feb 19 01:07:57 multipleinstance systemd[1]: Started mariadb mysql3307.
Feb 19 01:07:57 multipleinstance mysqld_safe[2950]: 220219 01:07:57 mysqld_safe Logging to '/var/lib/mysql3307/mysqld3307.log'.
Feb 19 01:07:57 multipleinstance mysqld_safe[2950]: 220219 01:07:57 mysqld_safe Starting mariadbd daemon with databases from /var/lib/mysql3307
Feb 19 01:17:29 multipleinstance systemd[1]: Stopping mariadb mysql3307...
Feb 19 01:17:29 multipleinstance systemd[1]: Stopped mariadb mysql3307.

[root@multipleinstance ~]# systemctl status mariadb3308.service
● mariadb3308.service - mariadb mysql3308
   Loaded: loaded (/etc/systemd/system/mariadb3308.service; enabled; vendor preset: disabled)
   Active: inactive (dead) since Sat 2022-02-19 01:17:33 UTC; 47s ago
  Process: 3074 ExecStart=/bin/mysqld_safe --defaults-file=/etc/my3308.cnf (code=exited, status=0/SUCCESS)
 Main PID: 3074 (code=exited, status=0/SUCCESS)
Feb 19 01:08:17 multipleinstance systemd[1]: Started mariadb mysql3308.
Feb 19 01:08:17 multipleinstance mysqld_safe[3074]: 220219 01:08:17 mysqld_safe Logging to '/var/lib/mysql3308/mysqld3308.log'.
Feb 19 01:08:17 multipleinstance mysqld_safe[3074]: 220219 01:08:17 mysqld_safe Starting mariadbd daemon with databases from /var/lib/mysql3308
Feb 19 01:17:32 multipleinstance systemd[1]: Stopping mariadb mysql3308...
Feb 19 01:17:33 multipleinstance systemd[1]: Stopped mariadb mysql3308.

[root@multipleinstance ~]# systemctl status mariadb3309.service
● mariadb3309.service - mariadb mysql3309
   Loaded: loaded (/etc/systemd/system/mariadb3309.service; enabled; vendor preset: disabled)
   Active: inactive (dead) since Sat 2022-02-19 01:17:36 UTC; 49s ago
  Process: 3195 ExecStart=/bin/mysqld_safe --defaults-file=/etc/my3309.cnf (code=exited, status=0/SUCCESS)
 Main PID: 3195 (code=exited, status=0/SUCCESS)
Feb 19 01:08:28 multipleinstance systemd[1]: Started mariadb mysql3309.
Feb 19 01:08:28 multipleinstance mysqld_safe[3195]: 220219 01:08:28 mysqld_safe Logging to '/var/lib/mysql3309/mysqld3309.log'.
Feb 19 01:08:28 multipleinstance mysqld_safe[3195]: 220219 01:08:28 mysqld_safe Starting mariadbd daemon with databases from /var/lib/mysql3309
Feb 19 01:17:36 multipleinstance systemd[1]: Stopping mariadb mysql3309...
Feb 19 01:17:36 multipleinstance systemd[1]: Stopped mariadb mysql3309.
[root@multipleinstance ~]#

--> All instance for restart Command 

[root@multipleinstance ~]# ps -ef | grep -i mysql
root      3453  1714  0 01:20 pts/1    00:00:00 grep --color=auto -i mysql

[root@multipleinstance ~]# systemctl restart mariadb3306.service
[root@multipleinstance ~]# systemctl restart mariadb3307.service
[root@multipleinstance ~]# systemctl restart mariadb3308.service
[root@multipleinstance ~]# systemctl restart mariadb3309.service

[root@multipleinstance ~]# ps -ef | grep -i mysql
mysql     3460     1  0 01:20 ?        00:00:00 /bin/sh /bin/mysqld_safe --defaults-file=/etc/my3306.cnf
mysql     3561  3460  0 01:20 ?        00:00:00 //sbin/mariadbd --defaults-file=/etc/my3306.cnf --basedir=/usr --datadir=/var/lib/mysql3306 --plugin-dir=/usr/lib64/mysql/plugin --log-error=/var/lib/mysql3306/mysqld3306.log --pid-file=/var/lib/mysql3306/mysql3306.pid --socket=/var/lib/mysql3306/mysql3306.sock --port=3306
mysql     3580     1  0 01:20 ?        00:00:00 /bin/sh /bin/mysqld_safe --defaults-file=/etc/my3307.cnf
mysql     3684  3580  0 01:20 ?        00:00:00 //sbin/mariadbd --defaults-file=/etc/my3307.cnf --basedir=/usr --datadir=/var/lib/mysql3307 --plugin-dir=/usr/lib64/mysql/plugin --log-error=/var/lib/mysql3307/mysqld3307.log --pid-file=/var/lib/mysql3307/mysql3307.pid --socket=/var/lib/mysql3307/mysql3307.sock --port=3307
mysql     3703     1  0 01:20 ?        00:00:00 /bin/sh /bin/mysqld_safe --defaults-file=/etc/my3308.cnf
mysql     3804  3703  0 01:20 ?        00:00:00 //sbin/mariadbd --defaults-file=/etc/my3308.cnf --basedir=/usr --datadir=/var/lib/mysql3308 --plugin-dir=/usr/lib64/mysql/plugin --log-error=/var/lib/mysql3308/mysqld3308.log --pid-file=/var/lib/mysql3308/mysql3308.pid --socket=/var/lib/mysql3308/mysql3308.sock --port=3308
mysql     3823     1  0 01:20 ?        00:00:00 /bin/sh /bin/mysqld_safe --defaults-file=/etc/my3309.cnf
mysql     3924  3823  3 01:20 ?        00:00:00 //sbin/mariadbd --defaults-file=/etc/my3309.cnf --basedir=/usr --datadir=/var/lib/mysql3309 --plugin-dir=/usr/lib64/mysql/plugin --log-error=/var/lib/mysql3309/mysqld3309.log --pid-file=/var/lib/mysql3309/mysql3309.pid --socket=/var/lib/mysql3309/mysql3309.sock --port=3309
root      3938  1714  0 01:21 pts/1    00:00:00 grep --color=auto -i mysql
[root@multipleinstance ~]#

[root@multipleinstance ~]# systemctl status mariadb3306.service
● mariadb3306.service - mariadb mysql3306
   Loaded: loaded (/etc/systemd/system/mariadb3306.service; enabled; vendor preset: disabled)
   Active: active (running) since Sat 2022-02-19 01:20:49 UTC; 1min 41s ago
 Main PID: 3460 (mysqld_safe)
   CGroup: /system.slice/mariadb3306.service
           ├─3460 /bin/sh /bin/mysqld_safe --defaults-file=/etc/my3306.cnf
           └─3561 //sbin/mariadbd --defaults-file=/etc/my3306.cnf --basedir=/usr --datadir=/var/lib/mysql3306 --plugin-dir=/usr/lib64/mysql/plugin --log-er...
Feb 19 01:20:49 multipleinstance systemd[1]: Started mariadb mysql3306.
Feb 19 01:20:49 multipleinstance mysqld_safe[3460]: 220219 01:20:49 mysqld_safe Logging to '/var/lib/mysql3306/mysqld3306.log'.
Feb 19 01:20:49 multipleinstance mysqld_safe[3460]: 220219 01:20:49 mysqld_safe Starting mariadbd daemon with databases from /var/lib/mysql3306

[root@multipleinstance ~]# systemctl status mariadb3307.service
● mariadb3307.service - mariadb mysql3307
   Loaded: loaded (/etc/systemd/system/mariadb3307.service; enabled; vendor preset: disabled)
   Active: active (running) since Sat 2022-02-19 01:20:53 UTC; 1min 40s ago
 Main PID: 3580 (mysqld_safe)
   CGroup: /system.slice/mariadb3307.service
           ├─3580 /bin/sh /bin/mysqld_safe --defaults-file=/etc/my3307.cnf
           └─3684 //sbin/mariadbd --defaults-file=/etc/my3307.cnf --basedir=/usr --datadir=/var/lib/mysql3307 --plugin-dir=/usr/lib64/mysql/plugin --log-er...
Feb 19 01:20:53 multipleinstance systemd[1]: Started mariadb mysql3307.
Feb 19 01:20:53 multipleinstance mysqld_safe[3580]: 220219 01:20:53 mysqld_safe Logging to '/var/lib/mysql3307/mysqld3307.log'.
Feb 19 01:20:53 multipleinstance mysqld_safe[3580]: 220219 01:20:53 mysqld_safe Starting mariadbd daemon with databases from /var/lib/mysql3307

[root@multipleinstance ~]# systemctl status mariadb3308.service
● mariadb3308.service - mariadb mysql3308
   Loaded: loaded (/etc/systemd/system/mariadb3308.service; enabled; vendor preset: disabled)
   Active: active (running) since Sat 2022-02-19 01:20:56 UTC; 1min 39s ago
 Main PID: 3703 (mysqld_safe)
   CGroup: /system.slice/mariadb3308.service
           ├─3703 /bin/sh /bin/mysqld_safe --defaults-file=/etc/my3308.cnf
           └─3804 //sbin/mariadbd --defaults-file=/etc/my3308.cnf --basedir=/usr --datadir=/var/lib/mysql3308 --plugin-dir=/usr/lib64/mysql/plugin --log-er...
Feb 19 01:20:56 multipleinstance systemd[1]: Started mariadb mysql3308.
Feb 19 01:20:56 multipleinstance mysqld_safe[3703]: 220219 01:20:56 mysqld_safe Logging to '/var/lib/mysql3308/mysqld3308.log'.
Feb 19 01:20:56 multipleinstance mysqld_safe[3703]: 220219 01:20:56 mysqld_safe Starting mariadbd daemon with databases from /var/lib/mysql3308

[root@multipleinstance ~]# systemctl status mariadb3309.service
● mariadb3309.service - mariadb mysql3309
   Loaded: loaded (/etc/systemd/system/mariadb3309.service; enabled; vendor preset: disabled)
   Active: active (running) since Sat 2022-02-19 01:20:59 UTC; 2min 46s ago
 Main PID: 3823 (mysqld_safe)
   CGroup: /system.slice/mariadb3309.service
           ├─3823 /bin/sh /bin/mysqld_safe --defaults-file=/etc/my3309.cnf
           └─3924 //sbin/mariadbd --defaults-file=/etc/my3309.cnf --basedir=/usr --datadir=/var/lib/mysql3309 --plugin-dir=/usr/lib64/mysql/plugin --log-er...
Feb 19 01:20:59 multipleinstance systemd[1]: Started mariadb mysql3309.
Feb 19 01:20:59 multipleinstance mysqld_safe[3823]: 220219 01:20:59 mysqld_safe Logging to '/var/lib/mysql3309/mysqld3309.log'.
Feb 19 01:20:59 multipleinstance mysqld_safe[3823]: 220219 01:20:59 mysqld_safe Starting mariadbd daemon with databases from /var/lib/mysql3309
[root@multipleinstance ~]#

Working fine ...


Thank you for vising my blog ....

Comments

Popular posts from this blog

PostgreSQL Database Version 13.4 To MySQL Database Version 8.0.20 Migration by using SQLines Tool

RDS MySQL / MariaDB SSL Connection by using Workbench and command line

Install Mydumper and Myloader Software for Backup of MySQL / MariaDB Databases and Usage of commands