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
    
  • 相关阅读:
    C#如何从普通C++动态库导入一个类?
    MFC的子类化技术
    [转贴] 不要以为使用了模式就是好设计
    VC编程经验汇总(三)
    钩子技术介绍及函数使用
    关于VC中的时间函数讨论
    my read_girl
    Linux + SVN / CVS / ClearCase
    OS + Linux Edit emacs /vi vim gvim /SciTE /gedit /kedit /UltraEdit /nedit /sedf
    java Regular Expression / regexp / zhengzebiaodashi
  • 原文地址:https://www.cnblogs.com/lanqie/p/8946379.html
Copyright © 2011-2022 走看看