Linux 下安装MySQL8

一、下载对应系统的MySQL版本,并上传到要安装的服务器上

MySQL :: Download MySQL Yum Repository

二、开始安装

  1. 添加到yum库
    1. 命令:
      #下载    https://repo.mysql.com//mysql80-community-release-el8-1.noarch.rpm
      
      yum install mysql80-community-release-el7-3.noarch.rpm
    2. 查看是否添加成功命令:
      yum repolist enabled | grep "mysql.*-community.*"
  2. 安装命令:
     yum install mysql-community-server
    
    # 如果出现 Unable to find a match: mysql-community-server 请先禁用本地组件再安装
    
    yum module disable mysql
    
    yum install mysql-community-server
    
    
    
  3. 查看是安装目录和版本
  4.  启动MySQL
    systemctl start mysqld

 启动成功后需要先生成临时密码登录并修改设置新密码

# 生成 root@localhost 的临时密码
grep 'temporary password' /var/log/mysqld.log

 使用临时密码登录后修改密码

 退出 使用新密码就可以登录了

猜你喜欢

转载自blog.csdn.net/weirdo_world/article/details/120722984