• MySQL5.6安装


    #本文是兼容mysql多实例安装的,多实例安装只需要本文的3306 全部替换即可。 日志文件名字根据自己需求更改。

    创建目录和设置权限:

    mkdir -p /data/mysql3306/data/
    mkdir -p /data/mysql3306/log/
    mkdir -p /data/mysql3306/tmp/
    chown -R mysql.mysql /data/mysql3306/

     

    初始化数据库:

    /usr/local/mysql/scripts/mysql_install_db --defaults-file=/etc/mysql/my3306.cnf
    --basedir=/usr/local/mysql --datadir=/data1/mysql3306/data --user=mysql

     

    启动数据库:

    /usr/local/mysql/bin/mysqld_safe --defaults-file=/etc/mysql/my3306.cnf
    --ledir=/usr/local/mysql/bin/ >/dev/null &

     

    mysql5.6 参考配置文件:

    cat /etc/mysql/my3306.cnf

    #this is a config file for MySQL 5.6.10
    [client]
    port = 3306
    socket = /tmp/mysql3306.sock
    default-character-set=utf8
    [mysqld]
    federated
    transaction-isolation = READ-COMMITTED
    default_storage_engine = Innodb
    #sql_mode=STRICT_TRANS_TABLES
    explicit_defaults_for_timestamp=true
    # General variables
    user = mysql
    port = 3306
    socket = /tmp/mysql3306.sock
    pid-file = /data/mysql3306/mysqld.pid
    #basedir = /usr/local/mysql
    datadir = /data/mysql3306
    general_log=0
    general_log_file=/data/mysql3306/logs/otherlog/general.log
    log-error = /data/mysql3306/logs/otherlog/error.log
    slow_query_log=1
    long_query_time = 0.5
    slow_query_log_file = /data/mysql3306/logs/otherlog/slow-queries.log
    log-bin = /data/mysql3306/logs/binlog/2241.log
    binlog_format = ROW
    expire_logs_days =10
    max_connections = 5000
    max_user_connections = 3000
    max_connect_errors = 100000
    character_set_server = utf8
    collation_server = utf8_general_ci
    log_bin_trust_function_creators=1
    init-connect = 'set names utf8'
    wait_timeout = 300
    innodb_io_capacity = 1500
    #########replacationsetup ###############################
    #master-master
    #auto_increment_increment=2
    #auto_increment_offset=1
    server-id = 2413306
    #read_only=true
    log-slave-updates=true
    relay_log = /data/mysql3306/logs/relaylog/100132.log
    sync_binlog =0
    binlog_cache_size=2M
    innodb_flush_log_at_trx_commit = 2
    #skip-slave-start
    skip-name-resolve
    #slave-skip-errors = 1032,1062
    ########replicate_do_db ######
    #replicate-do-db = Commodity
    #replicate-do-db = m_gis
    #replicate-do-db = mall
    #replicate-do-db = mqlog
    #replicate-do-db = wms_doc
    #######replicate_ignore_db ###
    #replicate_ignore_db = mysql
    #replicate_ignore_db = Bi
    #replicate_ignore_db = Com
    #replicate_ignore_db = information_schema
    #replicate_ignore_db = m_gis
    #replicate_ignore_db = mall
    #replicate_ignore_db = mqlog
    #replicate_ignore_db = performance_schema
    #replicate_ignore_db = procurement
    #replicate_ignore_db = sbtest
    #replicate_ignore_db = test

    ####session buffer size
    sort_buffer_size = 8m
    read_buffer_size = 8M
    read_rnd_buffer_size = 8m
    thread_stack=512K
    join_buffer_size = 8m
    #
    max_allowed_packet = 512M
    max_heap_table_size = 256M
    tmp_table_size = 128M
    bulk_insert_buffer_size = 64M
    myisam-recover = BACKUP
    key_buffer_size = 1024M
    innodb_buffer_pool_size = 5G
    innodb_additional_mem_pool_size = 64M
    innodb_log_file_size = 1024M
    innodb_log_buffer_size = 8M
    innodb_log_files_in_group = 3
    innodb_file_per_table = 1
    innodb_buffer_pool_instances = 8
    innodb_data_file_path = ibdata1:512M:autoextend
    innodb_rollback_on_timeout
    log_warnings
    lower_case_table_names=0
    ###wsrep begin
    wsrep_on=on
    binlog_format=ROW
    default-storage-engine=innodb
    innodb_autoinc_lock_mode=2
    bind-address=10.2.2.41
    wsrep_provider=/usr/local/mariadb-galera-10.0.22-linux-x86_64/lib/libgalera_smm.so
    wsrep_cluster_name="cluster_stage2"
    wsrep_cluster_address="gcomm://10.2.2.41,10.2.2.42"
    wsrep_slave_threads=64
    wsrep_certify_nonPK=1
    wsrep_max_ws_rows=131072
    wsrep_max_ws_size=1073741824
    wsrep_debug=0
    wsrep_convert_LOCK_to_trx=0
    wsrep_retry_autocommit=1
    wsrep_auto_increment_control=1
    wsrep_drupal_282555_workaround=0
    wsrep_causal_reads=1
    wsrep_notify_cmd=
    wsrep_sst_method=xtrabackup-v2
    wsrep_sst_auth=rsync_user:rsync_password
    wsrep_provider_options="base_port=7654"
    [myisamchk]
    key_buffer_size = 1024M
    sort_buffer_size = 128M
    read_buffer = 2M
    write_buffer = 2M
    [mysqlhotcopy]
    interactive-timeout

     

  • 相关阅读:
    最长上升子序列问题总结
    Problem C
    Problem C
    Problem P
    Problem P
    Problem H
    Problem H
    Problem D
    Problem D
    Linux系统调用--getrlimit()与setrlimit()函数详解
  • 原文地址:https://www.cnblogs.com/fanxuanhui-linux/p/7965536.html
Copyright © 2020-2023  润新知