您好,登錄后才能下訂單哦!
下文主要給大家帶來MySQL 5.7.21基于OEL6.9 平臺的通用二進制安裝方法,希望MySQL 5.7.21基于OEL6.9 平臺的通用二進制安裝方法能夠帶給大家實際用處,這也是我編輯這篇文章的主要目的。好了,廢話不多說,大家直接看下文吧。
前提準備 (關閉防火墻,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用戶不需要登錄操作系統)
shell> groupadd mysql
shell> useradd -r -g mysql -s /bin/false mysql
2. 解壓二進制軟件
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. 修改軟件權限創建鏈接
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. 創建MySQL數據目錄 (提前touch日志文件,否則啟動的時候會報錯)
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. 編輯數據庫云服務器參數 (指定數據初始化目錄,也可以通過命令行指定初始化目錄)
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. 初始化數據庫
shell> cd mysql
shell> bin/mysqld --initialize --user=mysql (m3gfb<1gKDZ%)
shell> bin/mysql_ssl_rsa_setup
shell> bin/mysqld_safe --user=mysql &
7. 修改默認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. 關閉數據庫 `[root@crmdb1 mysql]# bin/mysqladmin -u root -p -S /mysql/log/mysql.sock shutdown` 9. 修改環境變量
shell> vi ~/.bash_profile
export PATH=/usr/local/mysql/bin:$PATH
export MYSQL_PS1="(\u@\h) [\d]> "
[root@crmdb1 mysql]# . ~/.bash_profile
10. 配置MySQL服務
shell> cp support-files/mysql.server /etc/init.d/mysql
shell> chkconfig --add mysql
shell> chkconfig --level 2345 mysql on
11. 編輯數據庫客戶端參數
[client]
host=localhost
user=root
password=oracle
socket=/mysql/log/mysql.sock
12. 啟動MySQL服務 `shell> service mysql start` 13. 登錄數據庫驗證
shell> mysql
(root@localhost) [(none)]> show databases;
錯誤解決: 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用戶沒有權限訪問'server-key.pem'文件,修改權限后錯誤解決:
[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).
通過設置參數解決該告警:
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.
對于以上關于MySQL 5.7.21基于OEL6.9 平臺的通用二進制安裝方法,大家是不是覺得非常有幫助。如果需要了解更多內容,請繼續關注我們的行業資訊,相信你會喜歡上這些內容的。
免責聲明:本站發布的內容(圖片、視頻和文字)以原創、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。