yum安装依赖的包
yum install cmake gcc gcc-c++ make ncurses-devel bison wget
编译安装
useradd -s /sbin/nologin -M mysql
cd mysql5.6.4
cmake . -DCMAKE_INSTALL_PREFIX=/usr/local/mysql -DINSTALL_DATADIR=/data/mysql -DMYSQL_UNIX_ADDR=/tmp/mysql.sock -DDEFAULT_CHARSET=utf8 -DDEFAULT_COLLATION=utf8_general_ci -DWITH_EXTRA_CHARSETS=complex -DMYSQL_USER=mysql
make && make install
初始化
cd /usr/local/mysql/
chown -R mysql:mysql .
mkdir /data
scripts/mysql_install_db --user=mysql --basedir=/usr/local/mysql/ --datadir=/data/mysql
chown -R root .
rm -rf /etc/my.cnf
cp support-files/my-medium.cnf /etc/my.cnf
[mysqld]
bind-address = 127.0.0.1
port = 3306
socket = /tmp/mysql.sock
basedir = /usr/local/mysql
datadir = /data/mysql
user = mysql
character_set_server = utf8
......
vim /etc/init.d/mysqld
basedir=/usr/local/mysql
datadir=/data/mysql
启动mysql
service mysqld start