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
This article shares the specific code of js to im...
I logged into the backend to check the solution t...
Written in front Weibo components are component p...
This article shares with you the installation and...
In js, set the user to read a certain agreement b...
Table of contents 1. Event Flow 1. Concept 2. DOM...
Here are 30 best practices for HTML beginners. 1....
1. Introduction After MySQL is started, BufferPoo...
Table of contents Preface $attrs example: $listen...
Table of contents 1. Dep 2. Understand obverser 3...
Sometimes you need to use links, but you don't...
Table of contents Preface Core - CancelToken Prac...
We can set a background image for the cell, and w...
Interviewer: Have you read the source code of Vue...
This article example shares the specific code of ...