CentOS7.5下yum安装MySQL8图文教程

 

卸载MariaDB

1.列出所有安装的MariaDB rpm 包

rpm -qa | grep mariadb

2.强制卸载

rpm -e --nodeps mariadb-libs-5.5.60-1.el7_5.x86_64

安装MySQL

1. 环境

CentOS7.5

2. 获取MySQL最新版 rpm包

yum仓库下载MySQL

yum localinstall https://repo.mysql.com//mysql80-community-release-el7-1.noarch.rpm

CentOS7.5下yum安装MySQL8图文教程_第1张图片

3. yum安装MySQL

yum install mysql-community-server

CentOS7.5下yum安装MySQL8图文教程_第2张图片

4. 启动MySQL服务

service mysqld start

5. MySQL服务状态

service mysqld status

CentOS7.5下yum安装MySQL8图文教程_第3张图片

6. 查看初始密码

grep 'temporary password' /var/log/mysqld.log

7. 本地MySQL客户端登录

mysql -u root -p

CentOS7.5下yum安装MySQL8图文教程_第4张图片

8. 修改root登录密码

ALTER USER 'root'@'localhost' IDENTIFIED BY 'Aspirin@369';

9 .刷新

flush privileges;

CentOS7.5下yum安装MySQL8图文教程_第5张图片

10. 设置开机启动

systemctl enable mysqld.service

11. 远程连接授权

use mysql;
select user,host from user; 
update user set host = '%' where user = 'root';   #任意ip都可以连
update user set host='your ip' where user='root'; //指定ip
flush privileges;

CentOS7.5下yum安装MySQL8图文教程_第6张图片

12. 重启MySQL

systemctl restart mysqld;

13. 开放3306端口

firewall-cmd --permanent --zone=public --add-port=3306/tcp
firewall-cmd --reload

 


CentOS7.5下yum安装MySQL8图文教程_第7张图片

 

你可能感兴趣的:(#,MySQL)