首先安装必要的库
yum -y install gcc*
复制代码
###### 安装 MYSQL ######
首先安装camke
一、支持YUM,则
yum install -y cmake
复制代码
二、也可以源码安装
cd /usr/local/src
#下载cmake
wget http://www.cmake.org/files/v2.8/cmake-2.8.7.tar.gz
tar zxvf cmake-2.8.7.tar.gz
cd cmake-2.8.7
#安装cmake
./configure
make
make install
复制代码
安装 MYSQL
官网下载 MYSQL5.5版本 linux下源码包
http://dev.mysql.com/downloads/
安装
wget http://downloads.mysql.com/archives/mysql-5.5/mysql-5.5.25a.tar.gz -P /usr/local/src/
groupadd mysql
useradd -g mysql mysql
tar zxvf mysql-5.2.25.tar.gz
cd mysql-5.2.25
复制代码
#cmake . //默认情况下安装,安装目录为/usr/local/mysql 数据目录为/usr/local/mysql/data
#也可以指定参数安装,如指定UTF8,数据引擎等
#具体参照http://dev.mysql.com/doc/refman/ ... ration-options.html
cmake -DCMAKE_INSTALL_PREFIX=/usr/local/mysql -DMYSQL_DATADIR=/mysql/data -DDEFAULT_CHARSET=utf8 -DDEFAULT_COLLATION=utf8_general_ci -DWITH_EXTRA_CHARSETS:STRING=all -DWITH_DEBUG=0 -DWITH_SSL=yes -DWITH_READLINE=1 -DENABLED_LOCAL_INFILE=1
make && make install
cd /usr/local/mysql
chown -R mysql:mysql /usr/local/mysql
./scripts/mysql_install_db --user=mysql -datadir=/mysql/data
#此处如不指定datadir,到启动时会报错
chown -R root .
chown -R mysql data
cp support-files/my-medium.cnf /etc/my.cnf
bin/mysqld_safe --user=mysql &
# Next command is optional
cp support-files/mysql.server /etc/init.d/mysqld
chmod +x /etc/init.d/mysqld
/etc/init.d/mysqld start
复制代码
到此,安装完成
报错解决文档:http://blog.slogra.com/post-371.html