zoukankan      html  css  js  c++  java
  • 27) centos 源码编译mysql5.7

    1- 源码安装mysql5.7 [自动安装脚本:https://files-cdn.cnblogs.com/files/lemanlai/make_mysql.sh]

    groupadd mysql
    useradd mysql -g mysql  -s /bin/nologin
    yum install ncurses-devel
    
    1.1安装boost库1.59
    wget http://nchc.dl.sourceforge.net/project/boost/boost/1.59.0/boost_1_59_0.tar.gz
    tar zxvf  boost_1_59_0.tar.gz 
    mv boost_1_59_0 /usr/local/boost
    
    1.2- 下载安装mysql5.7.13
    wget http://dev.mysql.com/get/Downloads/MySQL-5.7/mysql-5.7.13.tar.gz
    tar -zxvf mysql-5.7.13.tar.gz
    cd mysql-5.7.13
    cmake -DCMAKE_INSTALL_PREFIX=/usr/local/mysql -DMYSQL_DATADIR=/usr/local/mysql/data 
         -DDEFAULT_CHARSET=utf8 -DDEFAULT_COLLATION=utf8_general_ci  -DMYSQL_TCP_PORT=3306  
        -DMYSQL_USER=mysql -DWITH_MYISAM_STORAGE_ENGINE=1 -DWITH_INNOBASE_STORAGE_ENGINE=1 
        -DWITH_ARCHIVE_STORAGE_ENGINE=1 -DWITH_BLACKHOLE_STORAGE_ENGINE=1 -DWITH_MEMORY_STORAGE_ENGINE=1  
        -DDOWNLOAD_BOOST=1 -DWITH_BOOST=/usr/local/boost
    
    make && make install //需要三个小时
    
    1.3- 初始化数据库
    #初始化数据库
    /usr/local/mysql/bin/mysqld –initialize
    

    1.4- 添加配置文件
    cp /usr/local/support-files/my-default.cnf /etc/my.cnf
    vim /etc/my.cnf
    [client]
    port=3306
    socket=/usr/local/mysql/mysql.sock
    [mysqld]
    character-set-server=utf8
    collation-server=utf8_general_ci
    
    skip-external-locking
    skip-name-resolve
    
    user=mysql
    port=3306
    basedir=/usr/local/mysql
    datadir=/var/mysql_data
    tmpdir=/usr/local/mysql/temp
    # server_id = .....
    socket=/usr/local/mysql/mysql.sock
    log-error=/usr/local/mysql/logs/mysql_error.log
    pid-file=/usr/local/mysql/mysql.pid
    open_files_limit=10240
    back_log=600
    max_connections=500
    max_connect_errors=6000
    wait_timeout=605800
    #open_tables=600
    #table_cache = 650
    #opened_tables = 630
    
    max_allowed_packet=32M
    sort_buffer_size=4M
    join_buffer_size=4M
    thread_cache_size=300
    query_cache_type=1
    query_cache_size=256M
    query_cache_limit=2M
    query_cache_min_res_unit=16k
    
    tmp_table_size=256M
    max_heap_table_size=256M
    
    key_buffer_size=256M
    read_buffer_size=1M
    read_rnd_buffer_size=16M
    bulk_insert_buffer_size=64M
    
    lower_case_table_names=1
    
    default-storage-engine=INNODB
    
    innodb_buffer_pool_size=2G
    innodb_log_buffer_size=32M
    innodb_log_file_size=128M
    innodb_flush_method=O_DIRECT
    #####################
    thread_concurrency=32
    long_query_time=2
    slow-query-log=on
    slow-query-log-file=/usr/local/mysql/logs/mysql-slow.log
    
    [mysqldump]
    quick
    max_allowed_packet=32M
    
    [mysqld_safe]
    log-error=/var/log/mysqld.log
    pid-file=/var/run/mysqld/mysqld.pid
    
    1.5- 配置mysql服务
    cp support-files/mysql.server /etc/init.d/mysqld
    chkconfig --add mysqld     # 添加到系统服务
    chkconfig mysqld on        # 开机启动
    
    1.6- 启动服务
    service mysqld start       
    

    故障处理:

    /usr/local/mysql 里面没有mysql.pid文件

    解决办法:

    vim  /etc/selinux/config,把SELINUX=enforcing改为SELINUX=disabled后存盘退出重启机器试试。
    service mysqld stop        # 停止mysql服务
    service mysqld restart     # 重新启动mysql服务
  • 相关阅读:
    facedetect
    gmm
    拉格朗日对偶
    基于 MeanShift 算法的目标跟踪问题研究
    视频目标跟踪算法综述
    AtCoder Beginner Contest 088 C Takahashi's Information
    L3-016. 二叉搜索树的结构
    垒骰子
    1130. Infix Expression (25)
    1129. Recommendation System (25)
  • 原文地址:https://www.cnblogs.com/lemanlai/p/12362821.html
Copyright © 2011-2022 走看看