ubantu 22.4
sudo vim /etc/apt/sources.list.d/mysql.list
deb http://repo.mysql.com/apt/ubuntu/ bionic mysql-apt-config
deb http://repo.mysql.com/apt/ubuntu/ bionic mysql-5.7
deb http://repo.mysql.com/apt/ubuntu/ bionic mysql-tools
deb-src http://repo.mysql.com/apt/ubuntu/ bionic mysql-5.7
保存后执行
sudo apt update
然后就会出现以下情况
不要急
sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 这里换成上面缺的公钥
接着
sudo apt update
新问题又来了
执行
cd /etc/apt
sudo cp trusted.gpg trusted.gpg.d
sudo apt update
最后进入安装
sudo apt-cache policy mysql-server
选择需要的版本安装即可
sudo apt install mysql-client=5.7.42-1ubuntu18.04
sudo apt install mysql-server=5.7.42-1ubuntu18.04