1. XenForo 1.5.14 中文版——支持中文搜索!现已发布!查看详情
  2. Xenforo 爱好者讨论群:215909318 XenForo专区

CentOS 6.3 编译 MySQL 5.6.15

本帖由 admin2013-04-12 发布。版面名称:应用交流

  1. admin

    admin 管理员 管理成员

    注册:
    2011-11-01
    帖子:
    3,671
    赞:
    2,425
    准备源码
    代码:
    wget http://dev.mysql.com/get/Downloads/MySQL-5.6/mysql-5.6.15.tar.gz/from/http://cdn.mysql.com/
    tar -zxv -f mysql-5.6.15.tar.gz
    cd mysql-5.6.15
    
    编译
    代码:
    cmake \
    -DCMAKE_INSTALL_PREFIX=/usr/local/mysql \
    -DMYSQL_UNIX_ADDR=/usr/local/mysql/mysql.sock \
    -DDEFAULT_CHARSET=utf8 \
    -DDEFAULT_COLLATION=utf8_general_ci \
    -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 \
    -DWITH_READLINE=1 \
    -DENABLED_LOCAL_INFILE=1 \
    -DMYSQL_DATADIR=/usr/local/mysql/data \
    -DMYSQL_USER=mysql \
    -DMYSQL_TCP_PORT=3306
    安装
    代码:
    make
    make install
    ##########添加专门的mysql用户和组,控制权限#######
    groupadd mysql
    useradd -s /sbin/nologin -M -g mysql mysql
    cp /usr/local/mysql/support-files/my-default.cnf /etc/my.cnf
    sed -i 's/skip-locking/skip-external-locking/g' /etc/my.cnf
    cd /usr/local/mysql
    scripts/mysql_install_db --user=mysql --datadir=/usr/local/mysql/data
    datadir=/usr/local/mysql/data
    chown -R mysql:mysql /usr/local/mysql
    chown -R mysql:mysql /usr/local/mysql/data
    chown -R mysql:mysql /usr/local/mysql/.
    chown -R mysql:mysql /usr/local/mysql/data/.
    ##########设置开机启动项##########
    cp /usr/local/mysql/support-files/mysql.server /etc/init.d/mysql
    chmod 755 /etc/init.d/mysql
    cat > /etc/ld.so.conf.d/mysql.conf<<EOF
    /usr/local/mysql/lib/mysql
    /usr/local/lib
    EOF
    ldconfig
    ln -s /usr/local/mysql/lib/mysql /usr/lib/mysql
    ln -s /usr/local/mysql/include/mysql /usr/include/mysql
    /etc/init.d/mysql start
    ln -s /usr/local/mysql/bin/mysql /usr/bin/mysql
    ln -s /usr/local/mysql/bin/mysqldump /usr/bin/mysqldump
    ln -s /usr/local/mysql/bin/myisamchk /usr/bin/myisamchk
    #############设置mysql root用户的密码
    /usr/local/mysql/bin/mysqladmin -u root password 你的密码
    /etc/init.d/mysql restart
    /etc/init.d/mysql stop
    #################添加mysql为系统服务###########
    chkconfig --level 345 mysql on
    service mysql start
    
     
    最后编辑: 2013-12-03
正在加载...