下文主要给大家带来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进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。