Get the App
SLTechnology News&Howtos  ›  Development  › 

Example Analysis of rocks mysql Database Multi-instance Database configuration

Shulou Source: shulou.com Published: 2022-06-01 12:38:26 09月11日 Update

This article shares with you the content of a sample analysis of the multi-instance database configuration of a rocks mysql database. The editor thinks it is very practical, so share it with you as a reference and follow the editor to have a look.

Mysql database default path modification

Start the httpd service

Mkdir-p / run/httpd

Systemctl start httpd.service1. What is multiple instances?

Representative in linux system: multiple processes + multiple threads + multiple pre-allocated memory structures

Generally used in the test environment, test master-slave, high availability and so on.

Multi-instance configuration scheme: (multiple database management systems)

Port port separate configuration files separate socket separate logs separate multiple serverid can use mysql user # summary, initialize multiple databases

Create directory modification permissions

Mkdir / share/work/mysqlmkdir / share/work/mysql/3306

Chown mysql:mysql-R / share/work/mysql

Modify the mysql configuration file, execute the "vi / share/work/mysql/3306/my.cnf" command, and determine.

Cp / etc/my.cnf / share/work/mysql

[mysqld] basedir=/opt/rocks/mysqldatadir=/share/work/mysql/3306/dataport=3306socket=/share/work/mysql/3306/mysql.socklog-error=/share/work/mysql/3306/data/mysql.errlog-bin=/share/work/mysql/3306/data/mysql-binserver_id=7

Install the database

Groupadd mysql

Useradd-r-g mysql mysql

-- skip-grant-tables

Set up boot boot:

Initialize the password and authorize remote login

/ share/work/mysql/3306/mysql.sock

# 6. Close multiple instances

[root@db01 scripts] # mysqladmin-S / share/work/mysql/3306/mysql.sock shutdown

# 7. Check Port

[root@db01 scripts] # netstat-lntup | grep 330

Tcp6 0 0: 3306: * LISTEN 25550/mysqld

# 8. Set multi-instance password

[root@db01 scripts] # mysqladmin-uroot-S / share/work/mysql/3306/mysql.sock password '3306'

# 9. Verify the library connection (view server_id)

[root@db01 scripts] # mysql-uroot-p3306-S / share/work/mysql/3306/mysql.sock-e "show variables like 'server_id';" Warning: Using a password on the command line interface can be insecure.

+-+ +

| | Variable_name | Value |

+-+ +

| | server_id | 7 | |

+-+ +

Thank you for reading! On the "rocks mysql database multi-instance database configuration example analysis" this article is shared here, I hope the above content can be of some help to you, so that you can learn more knowledge, if you think the article is good, you can share it out for more people to see it!

Tags: Data database instance configuration multiple example analysis content password file more port article system test good practical master-slave representative memory Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Microsoft Huawei MariaDB Apple Docker