时间:2021-07-01 10:21:17 帮助过:26人阅读
1. 安装依赖组件# yum install gcc gcc-c++ ncurses-devel perl -y2. 安装cmake# wget http://www.cmake.org/files/v2.8/cmake-2.8.12.tar.gz# tar zxvf cmake-2.8.12.tar.gz# cd cmake-2.8.12# ./bootstrap # make && make install3. 安装bison# wget http://ftp.gnu.org/gnu/bison/bison-3.0.2.tar.gz# tar zxvf bison-3.0.2.tar.gz# cd bison-3.0.2# ./configure# make && make install4. 创建用户的相应目录# groupadd mysql# useradd -g mysql mysql# mkdir -p /data/mysql/# mkdir -p /data/mysql/data/# mkdir -p /data/mysql/log/5. 获取mysql安装包并安装# wget http://downloads.mysql.com/archives/mysql-5.5/mysql-5.5.24.tar.gz# tar zxvf mysql-5.5.24.tar.gz# cd mysql-5.5.24# cmake /-DCMAKE_INSTALL_PREFIX=/data/mysql /-DMYSQL_UNIX_ADDR=/data/mysql/mysql.sock /-DDEFAULT_CHARSET=utf8 /-DDEFAULT_COLLATION=utf8_general_ci /-DWITH_INNOBASE_STORAGE_ENGINE=1 /-DWITH_ARCHIVE_STORAGE_ENGINE=1 /-DWITH_BLACKHOLE_STORAGE_ENGINE=1 /-DMYSQL_DATADIR=/data/mysql/data /-DMYSQL_TCP_PORT=3306 /-DENABLE_DOWNLOADS=1# make && make install6. 修改目录权限# chmod +w /data/mysql/# chown -R mysql:mysql /data/mysql/# ln -s /data/mysql/lib/libmysqlclient.so.18 /usr/lib/libmysqlclient.so.18# ln -s /data/mysql/mysql.sock /tmp/mysql.sock7. 初始化数据库# cp -rp /data/mysql/support-files/my-medium.cnf /etc/my.cnf# cp -rp /data/mysql/support-files/mysql.server /etc/rc.d/init.d/mysqld# /data/mysql/scripts/mysql_install_db --user=mysql --defaults-file=/etc/my.cnf --basedir=/data/mysql --datadir=/data/mysql/data8. 启动mysql服务# chmod +x /etc/init.d/mysqld# vi /etc/init.d/mysqld -->basedir=/data/mysqldatadir=/data/mysql/data# chkconfig --add mysqld# service mysqld start9. 完成配置# /data/mysql/bin/mysqladmin -uroot -p password 'PASSWD'# echo "export PATH=/data/mysql/bin:$PATH" >> ~/.bash_profile # source ~/.bash_profile