Home > Database > Mysql Tutorial > body text

Sample analysis of multi-instance database configuration of rocks mysql database

PHPz
Release: 2023-05-26 23:22:38
forward
1599 people have browsed it

Mysql database default path modification

Start httpd service

<strong>mkdir -p /run/httpd</strong><strong><br></strong><strong>systemctl start httpd.service</strong>
Copy after login
1. What is multiple instances?

represents: multiple in Linux system One process, multiple threads, multiple pre-allocated memory structures

are generally used in test environments to test master-slave, high availability, etc.

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

    端口port分开
 
    配置文件分开 socket分开
 
    日志分开
 
    多serverid
 
    都可以使用mysql用户 #总结,初始化多次数据库
Copy after login

Create directory modification permissions

<strong>mkdir /share/work/mysql
mkdir /share/work/mysql/3306<br></strong><strong>chown mysql:mysql -R /share/work/mysql</strong>
Copy after login

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

##cp /etc/my.cnf /share/work/mysql

[mysqld]
basedir=/opt/rocks/mysql
datadir=/share/work/mysql/3306/data
port=3306
socket=/share/work/mysql/3306/mysql.sock
log-error=/share/work/mysql/3306/data/mysql.err
log-bin=/share/work/mysql/3306/data/mysql-bin
server_id=7
Copy after login

Install database

groupadd mysql

useradd -r -g mysql mysql

--skip-grant-tables
Copy after login

Set up startup:

Initialize password and authorize remote login

/share/work/mysql/3306/mysql.sock
Copy after login

#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 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 |

--------------- -------

The above is the detailed content of Sample analysis of multi-instance database configuration of rocks mysql database. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:yisu.com
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template