centos7操作系统yum安装mysql8.0.19

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

  1. 安装MySQL Yum Repository
    下载https://dev.mysql.com/downloads/repo/yum/
    此处下载 Red Hat Enterprise Linux 7 / Oracle Linux 7 (Architecture Independent), RPM Package
    上传rpm到linux上
    yum localinstall Red Hat Enterprise Linux 7 / Oracle Linux 7 (Architecture Independent), RPM Package
    查看安装结果
    yum repolist all | grep mysql

  2. yum网络安装mysql8.0
    yum-config-manager --disable mysql57-community
    yum-config-manager --enable mysql80-community

    yum install mysql-community-server

  3. yum 本地安装mysql8.0
    下载rpm.tar https://dev.mysql.com/downloads/mysql/
    Red Hat Enterprise Linux 7 / Oracle Linux 7 (x86, 64-bit), RPM Bundle
    mysql-8.0.19-1.el7.x86_64.rpm-bundle.tar
    上传rpm.tar到linux
    解压:
    tar -xvf mysql-8.0.19-1.el7.x86_64.rpm-bundle.tar
    安装
    yum localinstall mysql-community-server.rpm
    删除
    rm -rf mysql*

  4. 启动mysql服务器
    service mysqld start
    grep ‘temporary password’ /var/log/mysqld.log
    mysql -uroot -p

  5. 修改root密码
    ALTER USER ‘root’@‘localhost’ IDENTIFIED BY ‘MyNewPass4!’;

  6. 重装
    yum remove mysql
    rm -rf /var/lib/mysql
    rm -rf /var/log/mysqld.log
    找不到临时密码
    rm -rf /var/lib/mysql
    systemctl restart mysqld
    grep ‘temporary password’ /var/log/mysqld.log

你可能感兴趣的:(软件)