mysql 5.7數據庫安裝部署

一、安裝依賴環境:

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 netstat

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 
ldconfig

二、下載二進制包並部署: 
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

三、創建mysql用戶組 
groupadd mysql && useradd -g mysql -M -s /sbin/nologin mysql

四、創建數據庫文件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.cnf

五、初始化,記得加上配置文件 
/usr/local/mysql/bin/mysqld --defaults-file=/etc/my.cnf --initialize

六、設置環境變量 
echo "export PATH=/usr/local/mysql/bin:$PATH">>/etc/profile && source /etc/profile 
which mysql

七、修改屬主屬組 
chown -R mysql.mysql /opt/mysql_data

八、啓動mysql5.7服務 
cp /usr/local/mysql/support-files/mysql.server /etc/init.d/mysql 
chmod 755 /etc/init.d/mysql       鄭州婦科醫院×××:http://yyk.familydoctor.com.cn/sysdfkyy/

/etc/init.d/mysql start

九、重置密碼(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';

十、設置訪問權限

grant all on   to root@"%" identified by "mysql*()";


發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章