溫馨提示×

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

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

MySQL 5.7.21基于OEL6.9 平臺(tái)的通用二進(jìn)制安裝方法

發(fā)布時(shí)間:2020-05-09 13:59:20 來(lái)源:億速云 閱讀:267 作者:三月 欄目:MySQL數(shù)據(jù)庫(kù)
  1. 下文主要給大家?guī)?lái)MySQL 5.7.21基于OEL6.9 平臺(tái)的通用二進(jìn)制安裝方法,希望MySQL 5.7.21基于OEL6.9 平臺(tái)的通用二進(jìn)制安裝方法能夠帶給大家實(shí)際用處,這也是我編輯這篇文章的主要目的。好了,廢話不多說(shuō),大家直接看下文吧。

    前提準(zhǔn)備 (關(guān)閉防火墻,selinux,安裝libaio)
    shell> chkconfig --level 2345 iptables off
    shell> service iptables stop
    shell> vi /etc/selinux/config
    SELINUX=disabled

shell> yum install libaio

1. 配置用戶屬組 (MySQL用戶不需要登錄操作系統(tǒng))

shell> groupadd mysql
shell> useradd -r -g mysql -s /bin/false mysql

2. 解壓二進(jìn)制軟件

shell> cd /usr/local
shell> mv ~/mysql-5.7.21-linux-glibc2.12-x86_64.tar.gz ./

shell> tar zxvf mysql-5.7.21-linux-glibc2.12-x86_64.tar.gz
or
shell> gunzip < mysql-5.7.21-linux-glibc2.12-x86_64.tar.gz | tar xvf -

shell> mv mysql-5.7.21-linux-glibc2.12-x86_64 mysql-5.7.21

3. 修改軟件權(quán)限創(chuàng)建鏈接

shell> chmod -R 750 ./mysql-5.7.21
shell> chown -R mysql:mysql ./mysql-5.7.21
shell> ln -s /usr/local/mysql-5.7.21 mysql

4. 創(chuàng)建MySQL數(shù)據(jù)目錄 (提前touch日志文件,否則啟動(dòng)的時(shí)候會(huì)報(bào)錯(cuò))

shell> mkdir -p /mysql/{data,log,binlog}
shell> chown -R mysql:mysql /mysql/
shell> touch /mysql/log/mysqld.log
shell> chown mysql:mysql /mysql/log/mysqld.log

5. 編輯數(shù)據(jù)庫(kù)云服務(wù)器參數(shù) (指定數(shù)據(jù)初始化目錄,也可以通過命令行指定初始化目錄)

shell> vi /etc/my.cnf
[mysqld]
datadir=/mysql/data
socket=/mysql/log/mysql.sock

[mysqld_safe]
log_error=/mysql/log/mysqld.log
pid_file=/mysql/log/mysqld.pid

6. 初始化數(shù)據(jù)庫(kù)

shell> cd mysql
shell> bin/mysqld --initialize --user=mysql    (m3gfb<1gKDZ%)
shell> bin/mysql_ssl_rsa_setup              
shell> bin/mysqld_safe --user=mysql &

7. 修改默認(rèn)root口令

[root@crmdb1 mysql]# mysql -u root -p -S /mysql/log/mysql.sock
mysql> ALTER USER 'root'@'localhost' IDENTIFIED BY 'oracle';
mysql> FLUSH PRIVILEGES;

8. 關(guān)閉數(shù)據(jù)庫(kù)
`[root@crmdb1 mysql]# bin/mysqladmin -u root -p -S /mysql/log/mysql.sock shutdown`

9. 修改環(huán)境變量

shell> vi ~/.bash_profile
export PATH=/usr/local/mysql/bin:$PATH
export MYSQL_PS1="(\u@\h) [\d]> "

[root@crmdb1 mysql]# . ~/.bash_profile

10. 配置MySQL服務(wù)

shell> cp support-files/mysql.server /etc/init.d/mysql
shell> chkconfig --add mysql
shell> chkconfig --level 2345 mysql on

11. 編輯數(shù)據(jù)庫(kù)客戶端參數(shù)

[client]
host=localhost
user=root
password=oracle
socket=/mysql/log/mysql.sock

12. 啟動(dòng)MySQL服務(wù)
`shell> service mysql start`

13. 登錄數(shù)據(jù)庫(kù)驗(yàn)證

shell> mysql
(root@localhost) [(none)]> show databases;

錯(cuò)誤解決:
1. 

2018-03-15T13:38:06.902460Z 0 [ERROR] SSL error: Unable to get private key from 'server-key.pem'
2018-03-15T13:38:06.902470Z 0 [Warning] Failed to set up SSL because of the following SSL library error: Unable to get private key

mysql用戶沒有權(quán)限訪問'server-key.pem'文件,修改權(quán)限后錯(cuò)誤解決:
[root@crmdb1 security]# cd /mysql/data/
[root@crmdb1 data]# ls -la server-key.pem
-rw------- 1 root root 1679 Mar 15 21:24 server-key.pem
[root@crmdb1 data]# chmod 644 server-key.pem
[root@crmdb1 data]# service mysql restart

2018-03-15T14:29:38.605619Z 0 [Note] Found ca.pem, server-cert.pem and server-key.pem in data directory. Trying to enable SSL support using them.
null

2.
2018-03-15T13:38:06.767757Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_time
stamp server option (see documentation for more details).

通過設(shè)置參數(shù)解決該告警:
explicit_defaults_for_timestamp=1

Note
explicit_defaults_for_timestamp is itself deprecated because its only purpose is to permit control over deprecated TIMESTAMP behaviors that are to be removed in a future MySQL release. When removal of those behaviors occurs, explicit_defaults_for_timestamp will have no purpose and will be removed as well.

對(duì)于以上關(guān)于MySQL 5.7.21基于OEL6.9 平臺(tái)的通用二進(jìn)制安裝方法,大家是不是覺得非常有幫助。如果需要了解更多內(nèi)容,請(qǐng)繼續(xù)關(guān)注我們的行業(yè)資訊,相信你會(huì)喜歡上這些內(nèi)容的。

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

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

AI