1.MySQL multiple instancesMySQL multi-instance means running multiple MySQL databases on one or more machines, which greatly saves overhead and facilitates the management of data content. 2. Environmental equipment
3. Create a data directoryThe steps of adding environment variables and owners to the installation package are omitted, and all kinds of gods will [root@clq ~]# mkdir /opt/data/{3306,3307,3308} -p [root@clq ~]# chown mysql.mysql /opt/data/* 4. Initialize the databases separately[root@192 ~]# mysqld --initialize --datadir=/opt/data/3306 --user=mysql [root@192 ~]# mysqld --initialize --datadir=/opt/data/3307 --user=mysql [root@192 ~]# mysqld --initialize --datadir=/opt/data/3308 --user=mysql #Save 3 mysql passwords respectively [root@192 ~]# echo 'wxa+r_N6ooYu' > 3306 [root@192 ~]# echo 'faiuehfaowh' > 3307 [root@192 ~]# echo 'fuahfu' > 3308 5. Install perlPerl provides all the functionality of scripting languages such as sed and awk [root@clq ~]# yum -y install perl 6. Install the packages required by mysql[root@clq ~]# dnf whatprovides libncurses.so.5 ncurses-compat-libs-6.1-7.20180224.el8.i686 : Ncurses compatibility libraries #See which package provides the repository: @System matches source: Provided by: libncurses.so.5 [root@clq ~]# dnf -y install ncurses-compat-libs (compatibility library) 7. Configure /etc/my.cnf file[root@192 ~]# cat /etc/my.cnf [mysqld_multi] mysqld = /usr/local/mysql/bin/mysqld_safe #Safe directory mysqladmin = /usr/local/mysql/bin/mysqladmin #Administrator login directory [mysqld3306] datadir = /opt/data/3306 port = 3306 socket = /tmp/mysql3306.sock pid-file = /opt/data/3306/mysql3306.pid log-error = /var/log/3306.log [mysqld3307] #Must be mysqld3307, not mysql3307 datadir = /opt/data/3307 port = 3307 socket = /tmp/mysql3307.sock pid-file = /opt/data/3307/mysql3307.pid log-error = /var/log/3307.log [mysqld3308] datadir = /opt/data/3308 port = 3308 socket = /tmp/mysql3308.sock pid-file = /opt/data/3308/mysql3308.pid log-error = /var/log/3308.log 8. Run the database*Prerequisite: You must specify a socket or local ip127.0.0.1 to connect
//Enter mysql separately and change the passwords one by one 9. One-key start and automatic start#Copy the mysqld_multi service script to /etc/init.d/[root@mysql ~]# cp /usr/local/mysql/support-files/mysqld_multi.server /etc/init.d/mysqld_multi #Modify the script. When the system script is started, it will be reloaded in the new terminal. Adding this line will find mysqld_multi under bindir basedir=/usr/local/mysql bindir=/usr/local/mysql/bin export PATH=$bindir:$PATH systemctl daemon-reload system reloading service is enabled: [root@mysql ~]# service mysqld_multi start 3306 [root@mysql ~]# service mysqld_multi start 3307 [root@mysql ~]# service mysqld_multi start 3308 Self-start: [root@mysql ~]# chkconfig mysqld_multi on [root@mysql ~]#reboot [root@mysql ~]# ss -antl State Recv-Q Send-Q Local Address:Port Peer Address:Port Process LISTEN 0 80 *:3306 *:* LISTEN 0 80 *:3307 *:* LISTEN 0 80 *:3308 *:* #Close a single mysql and kill the process using the kill method The above is the details of the MySQL multi-instance installation and startup service configuration process. For more information about the MySQL multi-instance installation and startup service configuration, please pay attention to other related articles on 123WORDPRESS.COM! You may also be interested in:
|
<<: js handles account logout when closing the browser
>>: Detailed process of modifying hostname after Docker creates a container
Preface As we all know, the nginx configuration f...
Table of contents 1. Demand Background 2. Optimiz...
1. Overview The image in Docker is designed in la...
Achieve results Implementation Code <h1>123...
1 What is MVCC The full name of MVCC is: Multiver...
In many cases, large and medium-sized websites wi...
When nginx configures proxy_pass, the difference ...
Install Ubuntu 20.04 Install NVIDIA drivers Confi...
1. Download and install VirtualBox software First...
Today, I found out while working on PHP that if w...
1: Throughput (Requests per second) A quantitativ...
0x0 Test Environment The headquarters production ...
Table of contents What is a mind map? How to draw...
Introduction to void keyword First of all, the vo...
According to the coefficient of pi and the radius...