Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Personal Learning Notes-MySQL Multi-instance configuration

2025-01-19 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)06/01 Report--

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.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Database

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report