CentOS 7 安装 MySql 8

官方文档地址:

https://dev.mysql.com/doc/refman/8.0/en/linux-installation-yum-repo.html

1、下载rpm包

https://dev.mysql.com/get/mysql80-community-release-el7-3.noarch.rpm

2、安装MySQL Yum库

上传包到Linux系统,

安装命令:

yum install mysql80-community-release-el7-3.noarch.rpm

3、安装mysql

yum install mysql-community-server

5、启动MySQL服务

systemctl start mysqld

6、登录mysql

查找临时密码:

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

image

登录进去:

mysql -uroot -p

7、修改超管密码

ALTER USER 'root'@'localhost' IDENTIFIED BY 'Admin@123';
flush privileges;

8、创建用户

create user 'jsh'@'%' identified with mysql_native_password by 'Admin@123';
grant all on *.* to 'jsh'@'%';
flush privileges;

9、navicat 连接数据库

image

如果连接不上,可能是防火墙没关:

systemctl stop firewalld
posted @ 2021-09-09 23:03  金盛年华  阅读(43)  评论(0)    收藏  举报