zoukankan      html  css  js  c++  java
  • MySQL5.7安装

     安装MySQL5.7:

     

    安装准备阶段:

    yum -y groupinstall "Development tools"
    yum -y install ncurses ncurses-devel openssl-devel bison gcc gcc-c++ make

    useradd mysql -s /sbin/nologin

    mkdir -pv /data/mysql3306/log
    chown mysql:mysql /data/mysql

    tar xvf mysql-5.7.12-linux-glibc2.5-x86_64.tar.gz
    mv mysql-5.7.12-linux-glibc2.5-x86_64 /usr/local/mysql
    chown -R mysql: /usr/local/mysql

    初始化:

    cd /usr/local/mysql/
    ./bin/mysqld --initialize --user=mysql --basedir=/usr/local/mysql --datadir=/data/mysql
    #root@localhost: =,B-glo2tV&                       #屏幕输出密码
    #如果/etc/my.cnf 设置了放在文件那么屏幕就不会输出密码了,可能会输出到错误日志里面

     

    初始化后续:

    cp support-files/mysql.server /etc/init.d/mysql5.7

    vim /etc/init.d/mysql5.7
    #basedir=/usr/local/mysql
    #datadir=/data/mysql

    vim /etc/profile
    export PATH=$PATH:/usr/local/mysql/bin/

    /etc/init.d/mysql5.7 start

    mysql -uroot -p"=,B-glo2tV&T"
    alter user 'root'@'localhost' identified by '123456';

     

     

     

    my.cnf 参考配置文件:(配置文件仅供参考)

     

    #mysql5.7.9

    [client]
    port = 3306
    socket = /tmp/mysql3306.sock
    default_character_set = utf8mb4

    [mysqld]
    lower_case_table_names = 1
    port = 3306
    basedir = /usr/local/mysql
    datadir = /data/mysql3306/mysql3306
    socket = /tmp/mysql3306.sock
    pid_file = /data/mysql3306/mysql3306.pid
    tmpdir = /tmp/

    skip_name_resolve = 1
    character_set_server = utf8
    collation_server = utf8_unicode_ci

    max_connections = 512
    max_connect_errors = 100000
    interactive_timeout = 600
    wait_timeout = 600

    table_open_cache = 2048
    query_cache_type = 0
    #query_cache_size = 64M
    #query_cache_limit = 2M
    thread_cache_size = 51
    max_allowed_packet = 16M

    tmp_table_size = 256M
    max_tmp_tables = 128
    max_heap_table_size = 96M
    sort_buffer_size = 4M
    read_buffer_size = 4M #顺序IO
    join_buffer_size = 4M
    read_rnd_buffer_size = 8M #随机IO
    bulk_insert_buffer_size = 64M #

    default_storage_engine = InnoDB
    log_bin = /data/mysql3306/mysql3306/mysql-bin
    expire_logs_days = 7
    binlog_format = row
    log_slave_updates =1
    log_error = /data/mysql3306/logs/mysql-error.log
    slow_query_log = 1
    slow_query_log_file = /data/mysql3306/logs/mysql-slow.log
    long_query_time = 1
    log_output = FILE
    log_queries_not_using_indexes = 1
    relay_log = /data/mysql3306/mysql3306/mysql-relay

    max_binlog_cache_size = 8M
    max_binlog_size = 1024M
    binlog_cache_size = 4M
    sync_binlog = 1
    server_id = 15133306


    #innodb
    innodb_data_home_dir = /data/mysql3306/mysql3306/
    innodb_data_file_path = ibdata1:512M:autoextend
    innodb_log_group_home_dir = /data/mysql3306/mysql3306
    innodb_buffer_pool_instances = 1
    innodb_buffer_pool_size = 1024M
    innodb_buffer_pool_dump_pct = 40
    innodb_page_cleaners = 4
    innodb_log_file_size = 256M
    innodb_log_files_in_group = 2
    innodb_log_buffer_size = 32M #default 16M
    innodb_flush_log_at_trx_commit = 1
    innodb_lock_wait_timeout = 30

    innodb_undo_directory = /data/mysql3306/mysql3306/
    innodb_undo_logs = 128 #must >=35.default 128
    innodb_undo_tablespaces = 3 #must >=2
    innodb_undo_log_truncate = 1
    innodb_max_undo_log_size = 1000M
    innodb_purge_rseg_truncate_frequency = 128

    innodb_print_all_deadlocks = 1
    innodb_buffer_pool_load_at_startup = 1
    innodb_buffer_pool_dump_at_shutdown = 1
    innodb_open_files = 65536
    innodb_file_per_table = 1
    innodb_lock_wait_timeout = 30
    innodb_read_io_threads = 8
    innodb_write_io_threads = 8
    innodb_io_capacity = 200
    innodb_flush_log_at_trx_commit = 1
    innodb_flush_method = O_DIRECT
    innodb_purge_threads = 4
    innodb_support_xa = 1
    innodb_max_dirty_pages_pct = 75
    transaction_isolation = REPEATABLE-READ

    #rep
    slave-parallel-type=LOGICAL_CLOCK
    slave-parallel-workers=16
    master_info_repository=TABLE
    relay_log_info_repository=TABLE
    relay_log_recovery=ON
    binlog_checksum=NONE
    slave_preserve_commit_order=1
    #group_replication_flow_control_mode=DISABLED

    gtid_mode=on
    log_slave_updates=1
    enforce_gtid_consistency=1


    #GR
    transaction_write_set_extraction =XXHASH64 # off
    loose-group_replication_group_name ="a876d35e-9110-11e6-a365-842b2b5909d6" #
    loose-group_replication_start_on_boot =off # off
    loose-group_replication_local_address ="192.168.31.200:24900" #
    loose-group_replication_group_seeds ="192.168.31.200:24900,192.168.31.201:24900,192.168.31.202:24900"

    loose-group_replication_bootstrap_group =off # off

    [mysqldump]
    max_allowed_packet = 16M

    [mysql]
    default_character_set = utf8

     

  • 相关阅读:
    WINFrom Excal 数据导入数据库
    Asp.net MVC 中Ajax的使用 [分享]
    C#高级二
    C#高级一
    C#入门基础三四
    C#入门基础三
    C#入门基础二
    《Think in Java》(六)访问权限控制
    TCP/IP 详解笔记
    Win7使用之查端口,杀进程
  • 原文地址:https://www.cnblogs.com/fanxuanhui-linux/p/7965686.html
Copyright © 2011-2022 走看看