溫馨提示×

溫馨提示×

您好,登錄后才能下訂單哦!

密碼登錄×
登錄注冊×
其他方式登錄
點擊 登錄注冊 即表示同意《億速云用戶服務(wù)條款》

mysql 5.7數(shù)據(jù)庫安裝部署

發(fā)布時間:2020-08-10 17:54:23 來源:ITPUB博客 閱讀:180 作者:熊貓咪咪 欄目:MySQL數(shù)據(jù)庫

一、安裝依賴環(huán)境:

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

二、下載二進(jìn)制包并部署:
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

三、創(chuàng)建mysql用戶組
groupadd mysql && useradd -g mysql -M -s /sbin/nologin mysql

四、創(chuàng)建數(shù)據(jù)庫文件my.cnf ,統(tǒng)一放到程序目錄里
mv /etc/my.cnf /etc/my.cnf.bak
SSD固態(tài)盤: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

六、設(shè)置環(huán)境變量
echo "export PATH=/usr/local/mysql/bin:$PATH">>/etc/profile && source /etc/profile
which mysql

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

八、啟動mysql5.7服務(wù)
cp /usr/local/mysql/support-files/mysql.server /etc/init.d/mysql
chmod 755 /etc/init.d/mysql
/etc/init.d/mysql start

九、重置密碼(mysql5.7和其他版本不同、初次安裝會生成一個隨機(jī)密碼在/opt/mysql_data/logerr.err日志內(nèi))
密碼在logerr.err 中會默認(rèn)生成一個

set password=password('123456');
如果需要再次修改root密碼
update mysql.user set authentication_string=password('123qwe') where user='root' and Host = 'localhost';

十、設(shè)置訪問權(quán)限

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


向AI問一下細(xì)節(jié)

免責(zé)聲明:本站發(fā)布的內(nèi)容(圖片、視頻和文字)以原創(chuàng)、轉(zhuǎn)載和分享為主,文章觀點不代表本網(wǎng)站立場,如果涉及侵權(quán)請聯(lián)系站長郵箱:is@yisu.com進(jìn)行舉報,并提供相關(guān)證據(jù),一經(jīng)查實,將立刻刪除涉嫌侵權(quán)內(nèi)容。

AI