1.下载mysql-8.0.13-1.el7.x86_64.rpm-bundle.tar到本地
2.解压安装包
3.安装MySQL:
yum install mysql-community-{server,client,common,libs}-* --exclude='*minimal*'
4.MySQL启动
service mysqld start
5.启动失败问题
setenforce 0
6.启动问题解决
6.1列出内核安全上下文列表内容
semansge fcontext -l
使用semanage 修改安全上下文的默认值
6.2添加目录到内核安全上下文列表中,类型为mysqld_db_t
semanage fcontext -a -t mysqld_db_t "/mnt/data/mysql(/.*)?"
6.3重新加载安全上下文列表,即刷新
restorecon -Rv /mnt/data/mysql
6.4fixfiles restore
6.5端口的添加例子
semanage port -a -t mysqld_port_t -p tcp <port_open_to_mysqld>
7.启动MySQL
systemctl restart mysqld
8.查看状态
systemctl status mysqld
9.登陆MySQL设置密码
将'root'@'localhost'
创建一个超级用户帐户。设置超级用户的密码并将其存储在错误日志文件中。要显示它,请对RHEL,Oracle Linux,CentOS和Fedora系统使用以下命令:
grep 'temporary password' /var/log/mysqld.log
使用生成的临时密码登录并为超级用户帐户设置自定义密码:
mysql -uroot -p
mysql> ALTER USER 'root'@'localhost' IDENTIFIED BY 'MyNewPass4!';