首页 > 代码库 > Mysql5.5编译安装

Mysql5.5编译安装

一. 安装环境

    1. RedHat 5.9

    2. 源码包:cmake-2.8.12.2.tar.gz ; mysql-5.5.25.tar.gz

    3. 源码包地址:http://acbynyxjdk.l37.yunpan.cn/lk/Qahqi9YYDpagG#/-0  密码:f6ec

    4. Mysql5.5及之后,预安装选项命令不再使用./configure,而是cmake


二.  安装cmake

    1. 解压并安装

        #tar xf cmake-2.8.12.2.tar.gz -C /usr/src

        #cd cmake-2.8.12.2

        #./configure

        #make && make install


三.  安装mysql

    1. 创建mysql用户和组

        #groupadd -r mysql

        #useradd -r -g mysql -s /sbin/nologin mysql

    2. 解压并安装

        #tar xf mysql-5.5.25.tar.gz -C /usr/src

        #cd mysql-5.5.25

        #cmake . -LH

        #cmake . -DCMAKE_INSTALL_PREFIX=/usr/local/mysql  -DMYSQL_DATADIR=/usr/local/mysql/data

                -DSYSCONFDIR=/etc  -DWITH_INNOBASE_STORAGE_ENGINE=1

                -DWITH_ARCHIVE_STORAGE_ENGINE=1  -DWITH_BLACKHOLE_STORAGE_ENGINE=1 

                -DWITH_READLINE=1  -DWITH_SSL=system

                -DWITH_ZLIB=system  -DWITH_LIBWRAP=0  -DMYSQL_UNIX_ADDR=/tmp/mysql.sock

                -DDEFAULT_CHARSET=utf8  -DDEFAULT_COLLATION=utf8_general_ci

        #make

        #make install


四.  配置mysql

    1. 给予mysql目录权限,并初始化mysql

        #cd /usr/local/mysql

        #chown -R :mysql .

        #chown -R mysql:mysql data

        #scripts/mysql_install_db --user=mysql --datadir=/usr/local/mysql/data

    2. 复制mysql相关配置文件,并添加自系统服务   

        #cp support_files/my-large.cnf /etc/my.cnf

        #cp support_files/mysql.server /etc/init.d/mysqld

        #chkconfig --add mysqld


五.  将mysql客户端命令路径添加到环境变量

        #export PATH=$PATH:/usr/local/mysql/bin >  /etc/profile.d/mysql.sh

        #./etc/profile.d/mysql.sh

        #source /etc/profile


六.  启动mysql

       #service mysqld start


                


Mysql5.5编译安装