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

Example Analysis of Multi-instance installation of mysql 5.7

2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)05/31 Report--

This article mainly introduces the example analysis of multi-instance installation of mysql 5.7. what is introduced in this article is very detailed and has a certain reference value. Interested friends must read it!

Datadir:

Mkdir-p / home/data/3306

Mkdir-p / home/data/3307

Mkdir-p / home/data/3308

Chown-R mysql / home/data/

Cd / opt/mysql

Initialize mysql

. / bin/mysqld-- initialize-- datadir=/home/data/3306-- user=mysql

. / bin/mysqld-- initialize-- datadir=/home/data/3307-- user=mysql

. / bin/mysqld-- initialize-- datadir=/home/data/3308-- user=mysql

Start mysql

Bin/mysqld_safe-defaults-file=/opt/mysql/3306.cnf-user=mysql &

Bin/mysqld_safe-defaults-file=/opt/mysql/3307.cnf-user=mysql &

Bin/mysqld_safe-defaults-file=/opt/mysql/3308.cnf-user=mysql &

Modify the password

Note: when executing bin/mysqld-initialize, the log will output the initialization password

Keyword A temporary password is generated for root@localhost:

Mysql > set password = password ('rootroot')

Mysql > flush privileges

Configure environment variables

Vim / etc/profile add

Export PATH=$PATH:/opt/mysql/bin

Refresh environment variables

Source / etc/profile

Configure alias

Vim / root/.bashrc

`

Alias mysql3306='mysql-uroot-prootroot-P3306-- socket=/home/data/3306/mysql.sock'

Alias start_mysql_3306='/opt/mysql/bin/mysqld_safe-defaults-file=/opt/mysql/3306.cnf-user=mysql &'

Alias stop_mysql_3306='mysqladmin shutdown-uroot-p "rootroot"-socket=/home/data/3306/mysql.sock'

Alias mysql3307='mysql-uroot-prootroot-P3307-- socket=/home/data/3307/mysql.sock'

Alias start_mysql_3307='/opt/mysql/bin/mysqld_safe-defaults-file=/opt/mysql/3307.cnf-user=mysql &'

Alias stop_mysql_3307='mysqladmin shutdown-uroot-p "rootroot"-socket=/home/data/3307/mysql.sock'

Alias mysql3308='mysql-uroot-prootroot-P3308-- socket=/home/data/3308/mysql.sock'

Alias start_mysql_3308='/opt/mysql/bin/mysqld_safe-defaults-file=/opt/mysql/3308.cnf-user=mysql &'

Alias stop_mysql_3308='mysqladmin shutdown-uroot-p "rootroot"-socket=/home/data/3308/mysql.sock'

`

Establish master and slave

Change master to

MASTER_HOST= "192.168.64.52"

MASTER_USER= "root"

MASTER_PASSWORD= "rootroot"

MASTER_PORT=3306

MASTER_CONNECT_RETRY=10

MASTER_AUTO_POSITION = 1

Edit / opt/mysql/3306.cnf

`

[mysql]

Prompt = "\ u@master\ R:\ m:\ s [\ d] >"

[client]

Port = 3306

Socket = / data/mysql/data/mysql.sock

[mysqld]

Datadir=/home/data/3306

Socket=/home/data/3306/mysql.sock

Skip-name-resolve

Symbolic-links=0

Log_bin = binlog

Binlog_format= ROW

Slow_query_log = 1

Slow_query_log_file = slow.log

Log-error = error.log

Innodb_buffer_pool_size = 512MB

Innodb_buffer_pool_instances = 1

[mysqld_safe]

Log-error=/home/data/3306/mysqld-err.log

`

Edit / opt/mysql/3307.cnf

`

[mysql]

Prompt = "\ ubi3307\ R:\ m:\ s [\ d] >"

[client]

Port = 3307

Socket = / data/mysql/data/mysql.sock

[mysqld]

Datadir=/home/data/3307

Socket=/home/data/3307/mysql.sock

Skip-name-resolve

Symbolic-links=0

Log_bin = binlog

Binlog_format= ROW

Slow_query_log = 1

Slow_query_log_file = slow.log

Log-error = error.log

Innodb_buffer_pool_size = 512MB

Innodb_buffer_pool_instances = 1

`

Edit / opt/mysql/3308.cnf

`

[mysql]

Prompt = "\ ubi3308\ R:\ m:\ s [\ d] >"

[client]

Port = 3308

Socket = / data/mysql/data/mysql.sock

[mysqld]

Datadir=/home/data/3308

Socket=/home/data/3308/mysql.sock

Skip-name-resolve

Symbolic-links=0

Log_bin = binlog

Binlog_format= ROW

Slow_query_log = 1

Slow_query_log_file = slow.log

Log-error = error.log

Innodb_buffer_pool_size = 512MB

Innodb_buffer_pool_instances = 1

`

The above is all the contents of the article "sample Analysis of Multi-instance installation mysql 5.7". Thank you for reading! Hope to share the content to help you, more related knowledge, welcome to follow the industry information channel!

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