欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

fedora 更新 mysql 到 8.0

程序员文章站 2022-05-29 08:19:17
...

移除旧版本

# 卸载
sudo dnf remove mysql
rpm -ev mysql57-community-release-el7-11.noarch

移除仓库,否则报冲突

[[email protected] bernard]# sudo dnf install https://repo.mysql.com//mysql80-community-release-fc31-1.noarch.rpm
Docker CE Stable - x86_64                                                                 10 kB/s | 2.3 kB     00:00    
Errors during downloading metadata for repository 'docker-ce-stable':
  - Status code: 404 for https://mirrors.aliyun.com/docker-ce/linux/centos/34/x86_64/stable/repodata/repomd.xml (IP: 182.105.147.118)
Error: Failed to download metadata for repo 'docker-ce-stable': Cannot download repomd.xml: Cannot download repodata/repomd.xml: All mirrors were tried
google-chrome                                                                            8.0 kB/s | 1.3 kB     00:00    
google-chrome                                                                            9.6 kB/s | 3.5 kB     00:00    
正在忽略仓库:docker-ce-stable
mysql80-community-release-fc31-1.noarch.rpm                                               28 kB/s |  27 kB     00:00    
错误:
 问题: package mysql80-community-release-fc31-1.noarch conflicts with mysql57-community-release provided by mysql57-community-release-el7-11.noarch
  - 冲突的请求
  - 安装的软件包的问题 mysql57-community-release-el7-11.noarch
(尝试在命令行中添加 '--allowerasing' 来替换冲突的软件包 或 '--skip-broken' 来跳过无法安装的软件包)
[[email protected] bernard]# rpm -ev mysql57-community-release-el7-11.noarch
软件包准备中...
mysql57-community-release-el7-11.noarch

安装新源

sudo dnf install https://repo.mysql.com//mysql80-community-release-fc31-1.noarch.rpm

安装mysql

sudo dnf install mysql-community-server

开启后台启动

sudo systemctl start mysqld
sudo systemctl enable mysqld

获取初始密码

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

配置

sudo mysql_secure_installation

这里还是上个版本的密码

使用

sudo mysql -u root -p

卸载

sudo rpm -e --nodeps mysql-community-libs mysql-community-common mysql-community-server

重置密码

[[email protected] ~]$ sudo grep 'temporary password' /var/log/mysqld.log
[sudo] bernard 的密码:
2021-11-06T10:07:09.422964Z 1 [Note] A temporary password is generated for [email protected]: dmc;i*0<#b:Y
[[email protected] ~]$ sudo mysql_secure_installation

Securing the MySQL server deployment.

Enter password for user root: 
Error: Access denied for user 'root'@'localhost' (using password: YES)
sudo systemctl stop mysqld
sudo mysqld --user=root --skip-grant-tables &