1.官网:mysql下载链接
官网地址

 

2.我们新建一个文件夹,路径/usr/local/mysql
这里选择下载5.7.29的ubuntu版本注意是amd64不是arm64,或者执行下面命令

wget https://downloads.mysql.com/archives/get/p/23/file/mysql-server_5.7.29-1ubuntu18.04_amd64.deb-bundle.tar
1
解压下载下来的包

tar -xvf ./mysql-server_5.7.29-1ubuntu18.04_amd64.deb-bundle.tar
1
ls一下看看有什么

我们先安装这个

sudo dpkg -i ./mysql-common_5.7.29-1ubuntu18.04_amd64.deb
1
然后再装下一个

sudo dpkg -i ./mysql-community-server_5.7.29-1ubuntu18.04_amd64.deb
1

喜闻乐见的报错,说我们没有安装红圈里的两个,我们去安装

sudo dpkg -i ./mysql-community-client_5.7.29-1ubuntu18.04_amd64.deb
1

好嘛,server依赖client,client又缺少libtinfo5,那就不能先装client了,先把其他的安装

sudo dpkg -i ./libmysqlclient20_5.7.29-1ubuntu18.04_amd64.deb
1

不错,成功了,再安装其他的

sudo dpkg -i ./libmysqlclient-dev_5.7.29-1ubuntu18.04_amd64.deb
1

继续

sudo dpkg -i ./libmysqlclient-dev_5.7.29-1ubuntu18.04_amd64.deb
1


sudo dpkg -i ./libmysqld-dev_5.7.29-1ubuntu18.04_amd64.deb
1

接下来可以装client了,试一下

sudo dpkg -i ./mysql-community-client_5.7.29-1ubuntu18.04_amd64.deb
1
看来是不行,包里没有这个,我们需要自己下载,访问下面的网址
网址


搜一下适配的版本下载,或者使用下面命令:

wget http://archive.ubuntu.com/ubuntu/pool/universe/n/ncurses/libtinfo5_6.3-2_amd64.deb
1
下载好了,安装

sudo dpkg -i ./libtinfo5_6.3-2_amd64.deb
1

ok啦,接下来就可以安装client了

sudo dpkg -i ./mysql-community-client_5.7.29-1ubuntu18.04_amd64.deb
1


sudo dpkg -i ./mysql-client_5.7.29-1ubuntu18.04_amd64.deb
1

成功,继续

sudo dpkg -i ./mysql-community-source_5.7.29-1ubuntu18.04_amd64.deb
1

client安装完成就该安装server啦

sudo dpkg -i ./mysql-community-server_5.7.29-1ubuntu18.04_amd64.deb
1

好吧,看来还少东西,去搜一下


或者使用命令

wget http://archive.ubuntu.com/ubuntu/pool/main/m/mecab/libmecab2_0.996-14build9_amd64.deb
1
安装

sudo dpkg -i ./libmecab2_0.996-14build9_amd64.deb
1

重新执行安装server

sudo dpkg -i ./mysql-community-server_5.7.29-1ubuntu18.04_amd64.deb
1


sudo dpkg -i ./mysql-server_5.7.29-1ubuntu18.04_amd64.deb
1

source

sudo dpkg -i ./mysql-community-source_5.7.29-1ubuntu18.04_amd64.deb
1

检查mysql服务状态

systemctl status mysql
1
登录mysql

mysql -uroot
1
接下来改密码和允许远程连接就OK啦

mysql -uroot -p

use mysql;
update user set host='%' where user='root';
flush privileges;
1
2
3
4
5
不能远程登录mysql的话

更改

sudo vim /etc/mysql/mysql.conf.d/mysqld.cnf
//把bind-address = 127.0.0.1 注释掉
service mysql restart
1
2
3
然后远程再登录