Home >Database >Mysql Tutorial >Sample analysis of multi-instance database configuration of rocks mysql database
Mysql database default path modification
Start httpd service
<strong>mkdir -p /run/httpd</strong><strong><br></strong><strong>systemctl start httpd.service</strong>
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用户 #总结,初始化多次数据库
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>
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
Install database
groupadd mysql
useradd -r -g mysql mysql
--skip-grant-tables
Set up startup:
Initialize 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 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!