centos7 安装 mysql8 ,yum方式

1、添加yum库

sudo yum install -y https://repo.mysql.com/mysql80-community-release-el7-3.noarch.rpm

 

2、导入 mysql GPG公钥   失效的:sudo rpm --import https://repo.mysql.com/RPM-GPG-KEY-mysql

rpm --import https://repo.mysql.com/RPM-GPG-KEY-mysql-2022

 

3、安装mysql8 ,   sudo yum install -y mysql-community-server --nogpgcheck方式可以跳过第二步

sudo yum install -y mysql-community-server

 

4、启动 MySQL 服务

sudo systemctl start mysqld

 

5、设置开机自启动

sudo systemctl enable mysqld

 

6、查看root初始密码

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

 

7、查看msyql状态

sudo systemctl status mysqld

 

8、修改密码

#密码查看第6步
mysql -u root -p

#设置密码
ALTER USER 'root'@'localhost' IDENTIFIED BY '新密码';
#刷新权限
FLUSH PRIVILEGES;

 

posted @ 2023-12-28 22:10  Binz  阅读(263)  评论(0编辑  收藏  举报