zoukankan      html  css  js  c++  java
  • Mysql多实例安装笔记

    参考:
    系统:KaliLinux (x86_64)

    软件下载

    1、下载地址:
    2、选择5.6版本

    安装

    1、准备文件和目录

    tar -zxvf mysql-5.6.40-linux-glibc2.12-x86_64.tar.gz -C /usr/local/
    cd /usr/local/
    ln -sv mysql-5.6.40-linux-glibc2.12-x86_64 mysql
    
    mkdir -pv /data/mysql_3306
    mkdir -pv /data/mysql_3307
    mkdir -pv /data/mysql_3306/{data,log}
    mkdir -pv /data/mysql_3307/{data,log}
    

    2、修改权限

    chown -R mysql.mysql /usr/local/mysql
    chown -R mysql.mysql /data
    
    

    3、初始化数据

    /usr/local/mysql/scripts/mysql_install_db --datadir=/data/mysql_3306/data --user=mysql --basedir=/usr/local/mysql --no-defaults
    /usr/local/mysql/scripts/mysql_install_db --datadir=/data/mysql_3307/data --user=mysql --basedir=/usr/local/mysql --no-defaults
    

    4、配置文件

    • /etc/my3306.cnf
    [client]
    user=root
    port=3306  
    socket=/tmp/mysql.sock  
     
    [mysqld] 
    user=mysql  
    basedir = /usr/local/mysql  
    datadir=/data/mysql_3306/data
    pid-file=/data/mysql_3306/data/mysql_3306.pid
    port=3306  
    server_id=3306  
    socket=/tmp/mysql_3306.sock  
    character_set_server = utf8
    skip_name_resolve = 1
    max_connections = 800
    max_connect_errors = 1000
    max_allowed_packet = 16777216  
    log-error = /data/mysql_3306/log/error.log  
    binlog_format = mixed  
    expire_logs_days = 30
    log-bin = /data/mysql_3306/log/mysql-bin.log  
    log-bin-index = /data/mysql_3306/log/mysql-bin.index
    
    • /etc/my3307.cnf
    [client]
    root=root
    port=3307
    socket=/tmp/mysql.sock  
     
    [mysqld] 
    user=mysql  
    basedir = /usr/local/mysql  
    datadir=/data/mysql_3307/data
    pid-file=/data/mysql_3307/data/mysql_3307.pid
    port=3307  
    server_id=3307  
    socket=/tmp/mysql_3307.sock  
    character_set_server = utf8
    skip_name_resolve = 1
    max_connections = 800
    max_connect_errors = 1000
    max_allowed_packet = 16777216
    log-error = /data/mysql_3307/log/error.log  
    binlog_format = mixed  
    expire_logs_days = 30
    log-bin = /data/mysql_3307/log/mysql-bin.log  
    log-bin-index = /data/mysql_3307/log/mysql-bin.index
    

    5、启动服务

    /usr/local/mysql/bin/mysqld_safe --defaults-file=/etc/my3306.cnf &
    /usr/local/mysql/bin/mysqld_safe --defaults-file=/etc/my3306.cnf &
    

    6、连接服务

    mysql -S /tmp/mysql_3306.sock
    mysql -S /tmp/mysql_3307.sock
    或
    /usr/local/mysql/bin/mysql -h 127.0.0.1 -P3306
    /usr/local/mysql/bin/mysql -h 127.0.0.1 -P3307
    
  • 相关阅读:
    谈谈对《镇魔曲》经济的一些看法
    谈谈对《神武2》经济的一些看法
    关于数值策划在使用Excel表时的一点想法
    游戏系统数值建模过程设计
    制作Excel工作薄目录
    制作当前表所在文件夹中所有文件的动态链接
    Excel各种tips汇总
    关于randbetween连乘的问题
    VBA实现两种方法生成任意概率分布的随机数
    Excel数值、文本相互转换
  • 原文地址:https://www.cnblogs.com/lanqie/p/8946379.html
Copyright © 2011-2022 走看看