ubuntu22.04安装mysql5.7.29

官网:mysql下载链接

https://downloads.mysql.com/archives/community/

我们新建一个文件夹,路径/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

解压下载下来的包

 tar -xvf ./mysql-server_5.7.29-1ubuntu18.04_amd64.deb-bundle.tar

ls一下看看有什么

 我们先安装这个

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

 然后再装下一个

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

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

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

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

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

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

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

 继续

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

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

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

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

看来是不行,包里没有这个,我们需要自己下载,访问下面的网址

https://pkgs.org/

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

 wget http://archive.ubuntu.com/ubuntu/pool/universe/n/ncurses/libtinfo5_6.3-2_amd64.deb

下载好了,安装

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

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

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

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

 成功,继续

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

 

client安装完成就该安装server啦

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

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

 或者使用命令

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

安装

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

 重新执行安装server

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

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

 source

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

检查mysql服务状态

systemctl status mysql

 登录mysql

 mysql -uroot

 接下来改密码和允许远程连接就OK啦

mysql -uroot -p

use mysql;
update user set host='%' where user='root';
flush privileges;

不能远程登录mysql的话

更改

sudo vim /etc/mysql/mysql.conf.d/mysqld.cnf

把bind-address  = 127.0.0.1
注释掉

service mysql restart

然后远程再登录

posted @ 2022-07-18 12:02  卷心菜的奇妙历险  阅读(7616)  评论(0编辑  收藏  举报