1
. 安装依赖组件
# yum install gcc gcc-c++ ncurses-devel perl -y
2
. 安装cmake
# wget http:
# tar zxvf cmake-
2.8
.
12
.tar.gz
# cd cmake-
2.8
.
12
# ./bootstrap
# make && make install
3
. 安装bison
# wget http:
# tar zxvf bison-
3.0
.
2
.tar.gz
# cd bison-
3.0
.
2
# ./configure
# make && make install
4
. 创建用户的相应目录
# groupadd mysql
# useradd -g mysql mysql
# mkdir -p /data/mysql/
# mkdir -p /data/mysql/data/
# mkdir -p /data/mysql/log/
5
. 获取mysql安装包并安装
# wget http:
# 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 install
6
. 修改目录权限
# 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.sock
7
. 初始化数据库
# 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/data
8
. 启动mysql服务
# chmod +x /etc/init.d/mysqld
# vi /etc/init.d/mysqld -->
basedir=/data/mysql
datadir=/data/mysql/data
# chkconfig --add mysqld
# service mysqld start
9
. 完成配置
# /data/mysql/bin/mysqladmin -uroot -p password
'PASSWD'
# echo
"export PATH=/data/mysql/bin:$PATH"
>> ~/.bash_profile
# source ~/.bash_profile