首页 > 代码库 > 九.mysql数据库多实例安装
九.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数据库多实例安装
声明:以上内容来自用户投稿及互联网公开渠道收集整理发布,本网站不拥有所有权,未作人工编辑处理,也不承担相关法律责任,若内容有误或涉及侵权可进行投诉: 投诉/举报 工作人员会在5个工作日内联系你,一经查实,本站将立刻删除涉嫌侵权内容。