标签:
1.准备工作:
yum install gcc gcc-c++ ncurses-devel perl
mysql5.5过后,源码安装需要cmake
wget http://www.cmake.org/files/v2.8/cmake-2.8.10.2.tar.gz
tar -xzvf cmake-2.8.10.2.tar.gz
cd cmake-2.8.10.2
./bootstrap ; make ; make install
cd ~
建立所需要的目录:
groupadd mysql useradd -r -g mysql mysql
mkdir -p /usr/local/mysql mkdir -p /data/mysqldb
2.获取mysql源代码:
wget http://dev.mysql.com/get/Downloads/MySQL-5.6/mysql-5.6.22.tar.gz
3.编译安装mysql:
cmake \
-DCMAKE_INSTALL_PREFIX=/usr/local/mysql \
-DMYSQL_UNIX_ADDR=/usr/local/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/mysqldb \
-DMYSQL_TCP_PORT=3306 \
-DENABLE_DOWNLOADS=1
make ---make install
4.修改mysql目录所有者和组
cd /usr/local/mysql
chown -R mysql:mysql
cd /data/mysqldb
chown -R mysql:mysql
5.初始化mysql数据库:
cd /usr/local/mysql
scripts/mysql_install_db --user=mysql --datadir=/data/mysqldb
6. 复制mysql的配置文件
cp /usr/local/mysql/support-files/my-default.cnf /etc/my.cnf
7.复制服务器启动脚本
cp support-files/mysql.server /etc/init.d/mysqld
标签:
原文地址:http://www.cnblogs.com/netRob/p/5106383.html