yum grouplist | grep Development
yum -y groupinstall "Development tools" "Server Platform Development"
yum list all | grep cmake
yum -y install https://mirrors.aliyun.com/epel/6Server/x86_64/Packages/e/epel-release-6-8.noarch.rpm
yum -y install cmake28
yum -y install readline-devel zlib-devel openssl-devel
wget https://cdn.mysql.com//Downloads/MySQL-5.5/mysql-5.5.62.tar.gz --no-check-certificate
tar xf mysql-5.5.62.tar.gz
cd mysql-5.5.62
cmake28 . -DCMAKE_INSTALL_PREFIX=/usr/local/mysql -DMYSQL_DATADIR=/mydata/data -DSYSCONFDIR=/etc -DWITH_INNOBASE_STORAGE_ENGINE=1 -DWITH_ARCHIVE_STORAGE_ENGINE=1 -DWITH_BLACKHOLE_STORAGE_ENGINE=1 -DWITH_READLINE=1 -DWITH_SSL=system -DWITH_ZLIB=system -DWITH_LIBWRAP=0 -DMYSQL_UNIX_ADDR=/tmp/mysql.sock -DDEFAULT_CHARSET=utf8 -DDEFAULT_COLLATION=utf8_general_ci
make
make install
useradd -r -s /sbin/nologin mysql
mkdir -p /mydata/data
mkdir -p /mydata/binlog
chown mysql:mysql /mydata/data
chown mysql:mysql /mydata/binlog
chown :mysql /usr/local/mysql -R
cd /usr/local/mysql
scripts/mysql_install_db --user=mysql --datadir=/mydata/data/
ls /mydata/data/
cp support-files/mysql.server /etc/rc.d/init.d/mysqld
chmod +x /etc/rc.d/init.d/mysqld
chkconfig --add mysqld
cp /etc/my.cnf /etc/my.cnf.back
cp support-files/my-large.cnf /etc/my.cnf
在my.cnf的配置文件中加入datadir选项
[mysqld]
datadir = /mydata/data
log-bin=/mydata/binlog/log-bin
service mysqld start
ss -tnl
保持客户端可以使用
vim /etc/profile.d/mysql.sh
export PATH=/usr/local/mysql/bin:$PATH
source /etc/profile.d/mysql.sh