码迷,mamicode.com
首页 > 数据库 > 详细

九.mysql数据库多实例安装

时间:2017-01-17 00:55:56      阅读:301      评论:0      收藏:0      [点我收藏+]

标签:ror   style   sql_mod   mysql数据库   l数据库   art   mysql   结构   目录   

经常应为系统硬件短缺,导致需要在同一台硬件服务器上面安装多个mysql实例

1.在mysql用户目录下新建mysql3306,mysql3307,mysql3308三个文件夹,并分别在这三个文件夹下建立data,log,tmp文件夹,总体目录结构如下

     /home/mysql

            ├── mysql3306
                        ├──data
                        ├──log
                        ├──tmp
            ├── mysql3307
                        ├──data
                        ├──log
                        ├──tmp
            ├── mysql3308
                        ├──data
                        ├──log
                        ├──tmp

2.配置my.cnf文件
[client]
port=3306
socket=/tmp/mysql.sock
 

[mysqld_multi]
mysqld=/usr/local/mysql/bin/mysqld_safe
mysqladmin=/usr/local/mysql/bin/mysqladmin
log=/home/mysql/mysqld_multi.log


[mysqld]
user=mysql
basedir=/usr/local/mysql
sql_mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES


[mysqld3306]  
mysqld=mysqld  
mysqladmin=mysqladmin  
datadir=/home/mysql/mysql3306/data  
port=3306  
server_id=3306  
socket=/tmp/mysql3306.sock  
log-output=file  
slow_query_log = 1  
long_query_time = 1  
slow_query_log_file = /home/mysql/mysql3306/log/slow.log  
log-error = /home/mysql/mysql3306/log/error.log  
binlog_format = mixed  
log-bin = /home/mysql/mysql3306/log/mysql3306_bin



[mysqld3307]
mysqld=mysqld
mysqladmin=mysqladmin
datadir=/home/mysql/mysql3307/data
port=3307
server_id=3307
socket=/tmp/mysql3307.sock
log-output=file
slow_query_log = 1
long_query_time = 1
slow_query_log_file = /home/mysql/mysql3307/log/slow.log
log-error = /home/mysql/mysql3307/log/error.log
binlog_format = mixed
log-bin = /home/mysql/mysql3307/log/mysql3307_bin




[mysqld3308]
mysqld=mysqld
mysqladmin=mysqladmin
datadir=/home/mysql/mysql3308/data
port=3308
server_id=3308
socket=/tmp/mysql3308.sock
log-output=file
slow_query_log = 1
long_query_time = 1
slow_query_log_file = /home/mysql/mysql3308/log/slow.log
log-error = /home/mysql/mysql3308/log/error.log
binlog_format = mixed
log-bin = /home/mysql/mysql3308/log/mysql3308_bin

 

3.运行mysqld_multi

# 启动
/usr/local/mysql/bin/mysqld_multi start
# 停止
/usr/local/mysql/bin/mysqld_multi stop
# 查询状态
/usr/local/mysql/bin/mysqld_multi report

 

九.mysql数据库多实例安装

标签:ror   style   sql_mod   mysql数据库   l数据库   art   mysql   结构   目录   

原文地址:http://www.cnblogs.com/qizhelongdeyang/p/6291392.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!