mysql8.0(yum部署)

1.做yum仓库,选择对应的平台。MySQL :: Download MySQL Yum Repository

2.我选择的centos7版本。

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

3.可以通过以下命令检查 MySQL Yum 存储库是否已成功添加(对于启用 dnf 的系统,将命令中的yum替换为dnf):

yum repolist enabled | grep "mysql.*-community.*"

4.选择发布系列:

yum repolist all | grep mysql

5.可以通过手动编辑 

/etc/yum.repos.d/mysql-community.repo 

文件来选择发布系列。

6.找到您要配置的子存储库的条目,然后编辑该enabled选项。指定 enabled=0禁用子存储库或 enabled=1启用子存储库。例如,要安装 MySQL 8.0,请确保您具有 enabled=0MySQL 5.7 的上述子存储库条目,并具有 enabled=18.0 系列的条目。注意:在任何时候只为一个发行系列启用子存储库。当启用多个版本系列的子存储库时,Yum 使用最新的系列。

7.通过运行以下命令并检查其输出来验证是否已启用和禁用正确的子存储库(对于启用 dnf 的系统, 将命令中的 yum替换为dnf):

yum repolist enabled | grep mysql

8.通过以下命令安装 MySQL(对于启用 dnf 的系统,将命令中的 yum替换为dnf):

 yum install mysql-community-server

9.使用以下命令启动 MySQL 服务器:

systemctl start mysqld

systemctl enable mysqld

systemctl status mysqld

10.

在服务器初始启动时,假设服务器的数据目录为空,会发生以下情况:

  • 服务器已初始化。

  • SSL 证书和密钥文件在数据目录中生成。

  • validate_password 已安装并启用。

  • 创建了一个超级用户帐户'root'@'localhost。超级用户的密码已设置并存储在错误日志文件中。要显示它,请使用以下命令:

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

11.通过使用生成的临时密码登录并为超级用户帐户设置自定义密码,尽快更改 root 密码:

 mysql -uroot -p

12.

mysql> ALTER USER 'root'@'localhost' IDENTIFIED BY 'MyNewPass4!';

13.重新登录:

mysql -uroot -p'MyNewPass4!'

14.成功登录:

Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 9
Server version: 8.0.30 MySQL Community Server - GPL

Copyright (c) 2000, 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> 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值