Personal Learning Notes-MySQL Multi-instance configuration
It is necessary to install the MySQL server
Train of thought:
Start multiple mysqld processes
Planning multiple sets of data
Plan multiple port
Plan multiple log paths
Multi-instance configuration:
Create multiple sets of directories:
Mkdir-p / data/330 {7pm 8pm 9}
Prepare multiple sets of profiles:
Vim / data/3307/my.cnf
[mysqld]
Basedir=/app/mysql
Datadir=/data/3307
Port=3307
Server_id=3307
Log-error=/data/3307/mysql.log
Log-bin=/data/3307/mysql-bin
Socket=/data/3307/mysql.sock
Touch / data/3308/my.cnf
Cp 3307/my.cnf 3308/my.cnf
Sed-I's 3307 / 3308 / 3308 / g '3308/my.cnf
Touch / data/3309/my.cnf
Cp 3307/my.cnf 3309/my.cnf
Sed-I's 3307 / 3309 / 3309 / g '3309/my.cnf
Note: the format of each corresponding configuration file is the same
Initialize multiple sets of data:
/ app/mysql/scripts/mysql_install_db\
-basedir=/app/mysql-datadir=/data/3307-user=mysql
The other two instances do the same thing.
Start each instance:
Mysqld_safe-- defaults-file=/data/3307/my.cnf &
Mysqld_safe-- defaults-file=/data/3308/my.cnf &
Mysqld_safe-- defaults-file=/data/3309/my.cnf &
Check to see if it starts: if you see the corresponding port number represents success
Netstat-utpln | grep 330
Ps-ef | grep mysqld
Login method:
Mysql-S / data/3307/mysql.sock
If you can log in to the database, it means success.