怎么在mysql中使用mysqld_multi部署一个单机
发表于:2024-10-03 作者:千家信息网编辑
千家信息网最后更新 2024年10月03日,这期内容当中小编将会给大家带来有关怎么在mysql中使用mysqld_multi部署一个单机,文章内容丰富且以专业的角度为大家分析和叙述,阅读完这篇文章希望大家可以有所收获。一、mysql编译安装:c
千家信息网最后更新 2024年10月03日怎么在mysql中使用mysqld_multi部署一个单机
这期内容当中小编将会给大家带来有关怎么在mysql中使用mysqld_multi部署一个单机,文章内容丰富且以专业的角度为大家分析和叙述,阅读完这篇文章希望大家可以有所收获。
一、mysql编译安装:
cd /usr/local/srcwget http://mirrors.sohu.com/mysql/MySQL-5.6/mysql-5.6.35-linux-glibc2.5-x86_64.tar.gz tar zxvf mysql-5.6.35-linux-glibc2.5-x86_64.tar.gzmv mysql-5.6.35-linux-glibc2.5-x86_64 /usr/local/mysqlcd /usr/local/mysqluseradd mysqlmkdir -p /data/mysqlchown -R mysql:mysql /data/mysql./scripts/mysql_install_db --user=mysql --datadir=/data/mysqlcp support-files/my-default.cnf /etc/my.cnfcp support-files/mysql.server /etc/init.d/mysqld
二、准备第一个多实例3307
2.1 创建目录:
mkdir /usr/local/mysql3307chown -R mysql.mysql /usr/local/mysql3307/mkdir -p /data/mysql3307chown -R mysql.mysql /data/mysql3307mkdir -p /home/data/mysql3307/binlogchown -R mysql.mysql /home/data/mysql3307
2.2 配置文件
[root@zhdya01 ~]# vim /etc/my.cnf# For advice on how to change settings please see# http://dev.mysql.com/doc/refman/5.6/en/server-configuration-defaults.html# *** DO NOT EDIT THIS FILE. It's a template which will be copied to the# *** default location during install, and will be replaced if you# *** upgrade to a newer version of MySQL.[mysqld_multi]mysqld = /usr/local/mysql/bin/mysqld_safemysqladmin =/usr/local/mysql/bin/mysqladminlog =/var/log/mysqld_multi.log[mysqld1]socket = /usr/local/mysql3307/mysql.sockport = 3307pid-file = /usr/local/mysql3307/mysql.piddatadir = /data/mysql3307log_bin=/home/data/mysql3307/binlogserver-id = 1innodb_buffer_pool_size = 128Minnodb_flush_log_at_trx_commit = 0
2.3 初始化数据库
/usr/local/mysql/scripts/mysql_install_db --user=mysql --basedir=/usr/local/mysql --datadir=/data/mysql3307
三、准备第二个多实例3308
3.1 创建目录:
mkdir /usr/local/mysql3308chown -R mysql.mysql /usr/local/mysql3308/mkdir -p /data/mysql3308chown -R mysql.mysql /data/mysql3308mkdir -p /home/data/mysql3308/binlogchown -R mysql.mysql /home/data/mysql3308
3.2 配置文件
[root@zhdya01 ~]# vim /etc/my.cnf# For advice on how to change settings please see# http://dev.mysql.com/doc/refman/5.6/en/server-configuration-defaults.html# *** DO NOT EDIT THIS FILE. It's a template which will be copied to the# *** default location during install, and will be replaced if you# *** upgrade to a newer version of MySQL.[mysqld_multi]mysqld = /usr/local/mysql/bin/mysqld_safemysqladmin =/usr/local/mysql/bin/mysqladminlog =/var/log/mysqld_multi.log[mysqld1]socket = /usr/local/mysql3307/mysql.sockport = 3307pid-file = /usr/local/mysql3307/mysql.piddatadir = /data/mysql3307log_bin=/home/data/mysql3307/binlogserver-id = 1innodb_buffer_pool_size = 128Minnodb_flush_log_at_trx_commit = 0[mysqld2]socket = /usr/local/mysql3308/mysql.sockport = 3308pid-file = /usr/local/mysql3308/mysql.piddatadir = /data/mysql3308log_bin=/home/data/mysql3308/binlogserver-id = 2innodb_buffer_pool_size = 128Minnodb_flush_log_at_trx_commit = 0
3.3 初始化数据库
/usr/local/mysql/scripts/mysql_install_db --user=mysql --basedir=/usr/local/mysql --datadir=/data/mysql3308
四、启动多实例
/etc/init.d/mysqld startmysqld_multi --defaults-extra-file=/etc/my.cnf start 1,2[root@zhdya01 bin]# !netnetstat -lntp -lntpActive Internet connections (only servers)Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN 1241/sshd tcp 0 0 127.0.0.1:25 0.0.0.0:* LISTEN 2087/master tcp6 0 0 :::3306 :::* LISTEN 4406/mysqld tcp6 0 0 :::3307 :::* LISTEN 4197/mysqld tcp6 0 0 :::3308 :::* LISTEN 3359/mysqld tcp6 0 0 :::8080 :::* LISTEN 2222/java tcp6 0 0 :::22 :::* LISTEN 1241/sshd tcp6 0 0 ::1:25 :::* LISTEN 2087/master
五、查看启动状态
[root@zhdya01 bin]# mysqld_multi --defaults-extra-file=/etc/my.cnf reportReporting MySQL serversMySQL server from group: mysqld1 is runningMySQL server from group: mysqld2 is running
六、停止多实例
[root@zhdya01 bin]# mysqld_multi --defaults-extra-file=/etc/my.cnf stop 1,2[root@zhdya01 bin]# mysqld_multi --defaults-extra-file=/etc/my.cnf reportReporting MySQL serversMySQL server from group: mysqld1 is not runningMySQL server from group: mysqld2 is not running
七、各自登录mysql实例
[root@zhdya01 bin]# mysql --socket=/usr/local/mysql3307/mysql.sockWelcome to the MySQL monitor. Commands end with ; or \g.Your MySQL connection id is 1Server version: 5.6.35-log MySQL Community Server (GPL)Copyright (c) 2000, 2016, Oracle and/or its affiliates. All rights reserved.Oracle is a registered trademark of Oracle Corporation and/or itsaffiliates. Other names may be trademarks of their respectiveowners.Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.mysql>
上述就是小编为大家分享的怎么在mysql中使用mysqld_multi部署一个单机了,如果刚好有类似的疑惑,不妨参照上述分析进行理解。如果想知道更多相关知识,欢迎关注行业资讯频道。
实例
单机
内容
数据
数据库
文件
目录
准备
分析
配置
专业
中小
内容丰富
就是
文章
更多
状态
知识
篇文章
行业
数据库的安全要保护哪些东西
数据库安全各自的含义是什么
生产安全数据库录入
数据库的安全性及管理
数据库安全策略包含哪些
海淀数据库安全审计系统
建立农村房屋安全信息数据库
易用的数据库客户端支持安全管理
连接数据库失败ssl安全错误
数据库的锁怎样保障安全
杭州东业网络技术
福通互联网科技有限公司招聘
法狗狗裁判文书数据库
在对层次数据库进行操作时
我的世界基岩建筑服务器
华为ibm服务器管理控制台
数据库费用排行
如何评价网络安全
属于数据库技术的有哪些
简述软件开发的基本流程图
决定网络服务器租用价格的参数
类似极光服务器
免费搭建服务器软件
城关网络安全检查
联通网络安全拍照
湛江教育软件开发方案
lol选择服务器测试失败
数据库表单中怎么添加数据
我国网络安全等级保护制度
嘉定区机械网络技术品牌
网络技术三级贴吧
网络技术与开发有限公司
服务器没网络
可搜网络技术有限公司
数据库和编程有关联吗
大话2服务器有哪些
星瀚网络技术有限公司怎么样
网络安全工作以
数据库分库 懒加载
广州服务器购买