虚拟机恢复初始化进行联网操作
在终端上输入该命令进行下载
上传压缩包到/root目录

此时
/etc/yum.repos.d 这个路径下会生成两个仓库文件,选mysql-community.repo并进入编辑

在这个文件里,默认启用8.0版本,需要将两个8.0版本的enabled的值改成0,
![[mysq18ø-conrnunity] 
name=MySQL 8.0 Connunity Server 
baseurl=http://repo.mysql.com/yum/mysql-g . O -conununity/el/ //$basearch/ 
enabled-I 
gpgcheck-o 
gpgkey=f i : / / / etc /pki/ rpm- gpg/RPM- GPC-KEY - mysql  [mysq18ø-conrnunity] 
name=MySQL 8.0 Connunity Server 
baseurl=http://repo.mysql.com/yum/mysql-g . O -conununity/el/ //$basearch/ 
enabled-I 
gpgcheck-o 
gpgkey=f i : / / / etc /pki/ rpm- gpg/RPM- GPC-KEY - mysql](https://file.cfanz.cn/uploads/png/2022/05/11/4/4FML6CM292.png)

保存退出后,最好在终端里安装yum
-utils这个包
yum -y
install yum-utils
此处安装以yum安装 联网下载
#   yum -y install
mysql-server  #服务器端
检查

MySQL初始化操作
#service mysqld start #先启动服务
查看状态

#netstat
-tnlp 

查看初始化密码 eyo9q,dWRhT0
![Croot@localhost 
cat /var/log/mysqld. log 
2022-04-29Tø1 : 28 : e2.377545z 
2Ø22-Ø4-29TØ1 : 28 : e2.395e64Z 
2Ø22-Ø4-29TØ1 : 28 :e3.2337esz 
2022-04-29Tø1 : 28:04.251641Z 
e 
1 
1 
6 
[system] [MY-e13169] [Server] 
[System] [MY-e13576] [InnoD3] 
[System] [MY-e13577] [InnoD3] 
[Note] [MY-ØIØ454] [Server] A 
/usr/sbin/mysqld (mysqld 8.e.29) initializing of server in progress as process 12261 
InnoDB initialization has started. 
InnoDB initialization has ended . 
temporary password is generated for root@localhost ey09q , dWRhTe  Croot@localhost 
cat /var/log/mysqld. log 
2022-04-29Tø1 : 28 : e2.377545z 
2Ø22-Ø4-29TØ1 : 28 : e2.395e64Z 
2Ø22-Ø4-29TØ1 : 28 :e3.2337esz 
2022-04-29Tø1 : 28:04.251641Z 
e 
1 
1 
6 
[system] [MY-e13169] [Server] 
[System] [MY-e13576] [InnoD3] 
[System] [MY-e13577] [InnoD3] 
[Note] [MY-ØIØ454] [Server] A 
/usr/sbin/mysqld (mysqld 8.e.29) initializing of server in progress as process 12261 
InnoDB initialization has started. 
InnoDB initialization has ended . 
temporary password is generated for root@localhost ey09q , dWRhTe](https://file.cfanz.cn/uploads/png/2022/05/11/4/8B32V9b622.png)
登录 使用初始化密码
![[root@localhost tmysql -uroot -p ey09q,dWRhTe• 
mysql: [Warning] Using a password on the command line interface can be insecure. 
Welcome to the MySQL monitor. Commands end with ; or 
Your MySQL connection id is le 
Server version: 8.e.29 
Copyright (c) 2øøe, 2022, Oracle and/or its affiliates. 
Oracle is a registered trademark of Oracle Corporation and/or its 
affiliates. Other names may be trademarks of their respective 
owners . 
Type 'help; ' or '\h' for help. Type '\c' to clear the current input statement. 
mysql>  [root@localhost tmysql -uroot -p ey09q,dWRhTe• 
mysql: [Warning] Using a password on the command line interface can be insecure. 
Welcome to the MySQL monitor. Commands end with ; or 
Your MySQL connection id is le 
Server version: 8.e.29 
Copyright (c) 2øøe, 2022, Oracle and/or its affiliates. 
Oracle is a registered trademark of Oracle Corporation and/or its 
affiliates. Other names may be trademarks of their respective 
owners . 
Type 'help; ' or '\h' for help. Type '\c' to clear the current input statement. 
mysql>](https://file.cfanz.cn/uploads/png/2022/05/11/4/Q21P81RPH1.png)
\q
退出

进入配置文件 添加一条命令
#vim
/etc/my.cnf  
skin-grant-tables #用来跳过密码的验证
![[mysqld] 
skin-grant-tables  [mysqld] 
skin-grant-tables](https://file.cfanz.cn/uploads/png/2022/05/11/4/fb2066Y6XJ.png)










