zoukankan      html  css  js  c++  java
  • centos 编译安装 mysql

    一、下载

    到官方网站下载mysql源码:http://dev.mysql.com/downloads/mysql/#downloads

    查找到source code,下载安装包:msyql-5.6.10.tar.gz

    或者wget http://cdn.mysql.com/Downloads/MySQL-5.6/mysql-5.6.10.tar.gz

    解压

    tar -xvf mysql-5.6.10.tar.gz

    二、安装

    cmake -DCMAKE_INSTALL_PREFIX=/usr/local/mysql -DMYSQL_UNIX_ADDR=/tmp/mysql.sock -DDEFAULT_CHARSET=utf8 -DDEFAULT_COLLATION=utf8_general_ci -DWITH_EXTRA_CHARSETS=all -DWITH_MYISAM_STORAGE_ENGINE=1 -DWITH_INNOBASE_STORAGE_ENGINE=1 -DWITH_MEMORY_STORAGE_ENGINE=1 -DWITH_READLINE=1 -DENABLED_LOCAL_INFILE=1 -DMYSQL_DATADIR=/var/mysql/data -DMYSQL_USER=mysql -DWITH_SSL=yes
    make && make install

    三、配置用户

    groupadd mysql
    useradd -g mysql mysql

    四、配置mysql

    chmod +w /usr/local/mysql/
    chown -R mysql:mysql /usr/local/mysql/
    ln -s /usr/local/mysql/lib/libmysqlclient.so.18 /usr/lib/libmysqlclient.so.18
    mkdir -p /var/mysql/
    mkdir -p /var/mysql/data/
    mkdir -p /var/mysql/log/
    chown -R mysql:mysql /var/mysql/
    cd /usr/local/mysql/support-files    
    cp mysql.server /etc/rc.d/init.d/mysqld
    cp my-default.cnf /var/mysql/my.cnf
    /usr/local/mysql/scripts/mysql_install_db \
    --defaults-file=/var/mysql/my.cnf \
    --basedir=/usr/local/mysql \
    --datadir=/var/mysql/data \
    --user=mysql
    chmod +x /etc/init.d/mysqld 
    vi /etc/init.d/mysqld 
    basedir=/usr/local/msyql
    datadir=/var/mysql/data
    /usr/local/mysql/bin/mysqld_safe --defaults-file=/var/mysql/my.cnf
    /usr/local/mysql/bin/mysqladmin password '123456' 

    五、加入启动项

    chkconfig --add mysqld
    chkconfig --level 345 mysqld on

    六、启动服务

    service mysqld start

    七、链接

    ln -s /usr/local/mysql/bin/mysql /usr/bin/mysql
    ln -s /usr/local/mysql/bin/mysqldump /usr/bin/mysqldump
  • 相关阅读:
    [紫书] 八数码问题(BFS)
    [紫书] 移动盒子(Boxes in a Line)
    [洛谷] P1803 凌乱的yyy / 线段覆盖 (贪心)
    [紫书] 破损的键盘(Broken Keyboard)
    bzoj3891
    poj3233
    bzoj1941
    Vijos2034
    poj2985
    Vijos1100
  • 原文地址:https://www.cnblogs.com/zhuangzebo/p/3115737.html
Copyright © 2011-2022 走看看