【Linux】【MySQL】 CentOS 安装MySQL 8.0

5 篇文章 0 订阅
5 篇文章 0 订阅

第一步: 下载 rpm 安装包 

卸载 mariadb
# 查看 mariadb 的安装包
rpm -qa | grep mariadb
# 卸载 mariadb 的安装包
rpm -e  mariadb-libs-5.5.60-1.el7_5.x86_64 --nodeps
# 再次查看
rpm -qa | grep mariadb

 

我这里使用 wget https://dev.mysql.com/get/mysql80-community-release-el7-3.noarch.rpm 的方式。

当然也可以使用SFTP, 或者 直接在Linux的GUI界面的浏览器下载, 或者使用 scp 命令从 windows拷入到虚拟机。

第二步: 安装 rpm 包

sudo rpm -Uvh  mysql80-community-release-el7-3.noarch.rpm

这里安装包的名字 根据第一步下载的文件名来,版本可能会更新。

yum install mysql-community-server

根据官方文档,以及我的测试,这一步会自动把系统安装过的mariaDB 或者别的版本的mysql卸载掉。

不需要再安装流程前,把所有类似的软件全部卸载光光,很省力。

自动就卸载了mariaDB

第三步: 打开服务

sudo systemctl start mysqld.service        // 打开服务

sudo systemctl status mysqld.service     // 查看状态

第四步:获取初始密码

A superuser account 'root'@'localhost is created. A password for the superuser is set and stored in the error log file. To reveal it, use the following command:

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

Change the root password as soon as possible by logging in with the generated, temporary password and set a custom password for the superuser account:

shell> mysql -uroot -p
mysql> ALTER USER 'root'@'localhost' IDENTIFIED BY 'MyNewPass4!';
  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值