1、安裝依賴環境:mysql
yum -y install libaio libaio-devel libtool make automake autoconf numactl numactl-devel bzip2 gcc gcc-c++ perl perl-DBI perl-ExtUtils-MakeMaker perl-devel perl-Time-HiRes perl-DBD-MySQL pcre-devel time jemalloc gperf cmake zlib-devel openssl-devel readline-devel readline glib2-devel mysql-devel qpress which netstatc++
wget http://repositories.voole.com/jemalloc-4.0.4.tar.bz2
tar xjf jemalloc-4.0.4.tar.bz2
cd jemalloc-4.0.4
./autogen.sh
make && make install
echo '/usr/local/lib' >> /etc/ld.so.conf.d/local.conf
ldconfigsql
2、下載二進制包並部署:
cd /opt/soft
wget http://repositories.voole.com/Percona-Server-5.7.21-20-Linux.x86_64.ssl101.tar.gz
tar zxvf Percona-Server-5.7.21-20-Linux.x86_64.ssl101.tar.gz
mv Percona-Server-5.7.21-20-Linux.x86_64.ssl101 /usr/local/mysql數據庫
3、建立mysql用戶組
groupadd mysql && useradd -g mysql -M -s /sbin/nologin mysqlide
4、建立數據庫文件my.cnf ,統一放到程序目錄裏
mv /etc/my.cnf /etc/my.cnf.bak
SSD固態盤:wget http://repositories.voole.com/my57_19.cnf -O /etc/my.cnf
SATA磁盤:wget http://repositories.voole.com/my57_19_sata.cnf -O /etc/my.cnf
從庫:wget http://repositories.voole.com/my_slave.cnf -O /etc/my.cnf
主庫:wget http://repositories.voole.com/my_master.cnf -O /etc/my.cnfspa
5、初始化,記得加上配置文件
/usr/local/mysql/bin/mysqld --defaults-file=/etc/my.cnf --initialize日誌
6、設置環境變量
echo "export PATH=/usr/local/mysql/bin:$PATH">>/etc/profile && source /etc/profile
which mysqlorm
7、修改屬主屬組
chown -R mysql.mysql /opt/mysql_dataserver
8、啓動mysql5.7服務
cp /usr/local/mysql/support-files/mysql.server /etc/init.d/mysql
chmod 755 /etc/init.d/mysql
/etc/init.d/mysql startip
9、重置密碼(mysql5.7和其餘版本不一樣、初次安裝會生成一個隨機密碼在/opt/mysql_data/logerr.err日誌內)
密碼在logerr.err 中會默認生成一個
>set password=password('123456');
若是須要再次修改root密碼
update mysql.user set authentication_string=password('123qwe') where user='root' and Host = 'localhost';
10、設置訪問權限
grant all on *.* to root@"%" identified by "mysql*()";