ubuntu下编译安装mysql-5.5.28
#准备工作
# sudo apt-get install -y cmake build-essential libncurses5-dev bison wget vim sysv-rc-conf
# sudo groupadd mysql
# sudo useradd -r -g mysql mysql
# sudo mkdir -p /data/mysql
# sudo mkdir -p /usr/local/mysql
# sudo mkdir -p /usr/software
# cd /usr/software
# sudo wget http://cdn.mysql.com/Downloads/MySQL-5.5/mysql-5.5.28.tar.gz
# sudo tar zxvf mysql-5.5.28.tar.gz
# cd mysql-5.5.28
# sudo cmake -DCMAKE_INSTALL_PREFIX=/usr/local/mysql \
# sudo make
# sudo make install
#设置目录权限
# sudo chown -R mysql /usr/local/mysql
# sudo chgrp -R mysql /usr/local/mysql
# sudo chown -R mysql /data/mysql
# sudo chgrp -R mysql /data/mysql
#初始化
# cd /usr/local/mysql
# sudo scripts/mysql_install_db \
--user=mysql \
--basedir=/usr/local/mysql \
--datadir=/data/mysql/ \
--no-defaults
# sudo cp support-files/my-medium.cnf /etc/my.cnf
# sudo vim /etc/my.cnf
[mysqld]
basedir=/usr/local/mysql
datadir=/data/mysql
user=mysql
:wq
# sudo cp support-files/mysql.server /etc/init.d/mysql
# sudo support-files/mysql.server start
#设置用户
#加入开机启动
# sudo sysv-rc-conf
#找到mysql一栏,勾选3,4,5,按q退出
#至此,mysql-5.5.28编译安装完毕