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

Day1 (multi-instance configuration)

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

Share

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

The installation path of the database: / usr/local/mysql

Data directory: / data/mysql/data

(here the decompression of mysql is no longer listed.)

An instance of port3306 has already been installed in the original environment

Two new instances need to be added here (port 3307 _ 3308)

[root@master2 mysql] # pwd

/ data/mysql

# mkdir data3307

# mkdir data3308

Chown-R mysql:mysql.

# cd scripts/

# ls

Mysql_install_db

. / mysql_install_db-- user=mysql datadir=/data/mysql/data3307

. / scripts/mysql_install_db-user=mysql-datadir=/data/mysql/data3307/

. / scripts/mysql_install_db-user=mysql-datadir=/data/mysql/data3308/

Configuration file (/ etc/my.cnf)

[mysqld_multi]

Mysqld=/usr/local/mysql/bin/mysqld

Mysqladmin=/usr/local/mysql/bin/mysqladmin

User=admin

Password=123456

[mysqld3306]

Port=3306

Pid-file=/data/mysql/data/master2.pid

Datadir=/data/mysql/data

Basedir=/usr/local/mysql

Socket=/tmp/mysql.sock

User = mysql

Server-id = 3306

[mysqld3307]

Socket=/tmp/mysql3307.sock

Port=3307

Datadir=/data/mysql/data3307

Pid-file=/data/mysql/data/mysql3307.pid

Basedir=/usr/local/mysql

User = mysql

Server-id = 3307

Sql_mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES

[mysqld3308]

Socket=/tmp/mysql3308.sock

Port=3308

Datadir=/data/mysql/data3308

Pid-file=/data/mysql/data/mysql3308.pid

Basedir=/usr/local/mysql

User = mysql

Server-id = 3308

Start three mysql services

Mysqld_multi start 3306

Mysqld_multi start 3307

Mysqld_multi start 3308

# mysql-uroot-p123456-S. / mysql.sock (password has been set for port 3306)

Mysql-uroot-p-S. / mysql3307.sock # Log in to mysql

Mysql-uroot-p-S. / mysql3308.sock

Netstat-ntlp | grep mysql # View mysql port snooping

[root@master2 lib] # netstat-ntlp | grep mysql

Tcp 0 0: 3307: * LISTEN 15878/mysqld

Tcp 0 0: 3308: * LISTEN 15968/mysqld

Tcp 0 0: 3306: * LISTEN 15819/mysqld

Set a new password

Mysqladmin-uroot-S / tmp/mysql_3307.sock password 123456

Mysqladmin-uroot-S / tmp/mysql_3308.sock password 123456

Set permissions (3307, 3308, 3308, 3306).

Grant all on *. * to admin@'%' identified by 'root' with grant option

View the log

Cd / usr/local/mysql/share

# tail-f mysqld_multi.log

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