返回列表 發帖

Ubuntu20中安装MySQL5.7

Preface
本文是对在Ubuntu20.04中安装MySQL5.7的记录

安装MySQL
首先在MySQL官网根据你的需求找到所需要安装的版本链接

https://dev.mysql.com/downloads/mysql/
https://downloads.mysql.com/archives/community/
1.png

下载deb安装包

1
wget https://dev.mysql.com/get/Downlo ... md64.deb-bundle.tar
新建目录
mkdir mysql5.7.31
mv mysql-server_5.7.31-1ubuntu18.04_amd64.deb-bundle.tar ./mysql5.7.31

解压
cd mysql5.7.31
sudo tar -vxf mysql-server_5.7.31-1ubuntu18.04_amd64.deb-bundle.tar

解压出来的deb安装包如下

1
2
3
4
5
6
7
8
9
10
11
libmysqlclient20_5.7.31-1ubuntu18.04_amd64.deb
mysql-client_5.7.31-1ubuntu18.04_amd64.deb
mysql-community-source_5.7.31-1ubuntu18.04_amd64.deb
mysql-server_5.7.31-1ubuntu18.04_amd64.deb
mysql-common_5.7.31-1ubuntu18.04_amd64.deb
mysql-testsuite_5.7.31-1ubuntu18.04_amd64.deb
libmysqlclient-dev_5.7.31-1ubuntu18.04_amd64.deb
mysql-community-client_5.7.31-1ubuntu18.04_amd64.deb
mysql-community-server_5.7.31-1ubuntu18.04_amd64.deb
libmysqld-dev_5.7.31-1ubuntu18.04_amd64.deb
mysql-community-test_5.7.31-1ubuntu18.04_amd64.deb
删除2个测试相关的包
sudo rm -f mysql-testsuite_5.7.31-1ubuntu18.04_amd64.deb
sudo rm -f mysql-community-test_5.7.31-1ubuntu18.04_amd64.deb

安装依赖
sudo apt-get install libtinfo5
sudo apt-get install libmecab2

使用deb安装
sudo dpkg -i mysql-*.deb

基本命令
1
2
3
4
5
6
7
8
9
10
11
#启动mysql
sudo service mysql start

#停止mysql
sudo service mysql stop

#重启mysql
sudo service mysql restart

#查看mysql状态
sudo service mysql status

在處理時有錯誤發生:

mysql-community-server

mysql-community-client



安裝libaio1包即可

sudo apt-get install libaio1

TOP

apt --fix-broken install

出錯執行缺的原件

TOP

返回列表