微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

MySQL 5.7.21基于OEL6.9 平台的通用二进制安装方法

  1. 下文主要给大家带来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 平台的通用二进制安装方法,大家是不是觉得非常有帮助。如果需要了解更多内容,请继续关注我们的行业资讯,相信你会喜欢上这些内容的。

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。

相关推荐