源码安装mysql5.5.37

添加用户和组
groupadd mysql
useradd -g mysql mysql
#设置datadir的目录
mkdir -p /data/mysql/data
mkdir -p /data/mysql/log
chown -R mysql:mysql /data/mysql/
#安装如下软件包
rpm -ivh mpfr-2.4.1-6.el6.x86_64.rpm
rpm -ivh ppl-0.10.2-11.el6.x86_64.rpm 
rpm -ivh cloog-ppl-0.15.7-1.2.el6.x86_64.rpm 
rpm -ivh glibc-devel-2.12-1.149.el6.x86_64.rpm
rpm -ivh libstdc++-devel-4.4.7-11.el6.x86_64.rpm 
rpm -ivh cpp-4.4.7-11.el6.x86_64.rpm 
rpm -ivh gcc-4.4.7-11.el6.x86_64.rpm 
rpm -ivh gcc-c++-4.4.7-11.el6.x86_64.rpm 
rpm -ivh cmake-2.8.12.2-4.el6.x86_64.rpm 
rpm -ivh bison-2.4.1-5.el6.x86_64.rpm 
rpm -ivh ncurses-devel-5.7-3.20090208.el6.x86_64.rpm 
#编译mysql
cd /root/mysql-5.5.37
cmake .
make
make install
#初始化mysql
/usr/local/mysql/scripts/mysql_install_db --user=mysql --datadir=/data/mysql/data --basedir=/usr/local/mysql
#将mysql设置成服务
cp /usr/local/mysql/support-files/mysql.server /etc/init.d/mysqld
#修改配置文件
vi /etc/my.cnf
[mysqld]
datadir=/data/mysql/data
basedir=/usr/local/mysql
#启动和关闭mysql
service mysqld start
service mysqld stop


你可能感兴趣的:(源码mysql)