Ubuntu16.04 Mysql离线安装

参考文章:https://www.cnblogs.com/tabCtrlShift/p/6564002.html

某部署环境,因网络限制无法直接访问外网,所以只能手动下载安装包方式进行mysql安装。参考文章中仍有使用apt-get命令安装依赖的部分,所以补充部分缺失依赖的离线安装过程。

操作系统版本:

No LSB modules are available.
Distributor ID:	Ubuntu
Description:	Ubuntu 16.04.2 LTS
Release:	16.04
Codename:	xenial

一 mysql下载

mysql官网-->download-->社区版,https://dev.mysql.com/downloads/mysql/,选择对应操作系统版本的mysql安装文件,如下,

下载mysql-server_5.7.22-1ubuntu16.04_amd64.deb-bundle.tar,完成后上传至安装机器。

 

tar -xf mysql-server_5.7.22-1ubuntu16.04_amd64.deb-bundle.tar命令解压,得到如下安装包:

-rw-r--r-- 1 xxx  xxx  1192920 Mar  4 21:37 libmysqlclient-dev_5.7.22-1ubuntu16.04_amd64.deb
-rw-r--r-- 1 xxx  xxx   839962 Mar  4 21:37 libmysqlclient20_5.7.22-1ubuntu16.04_amd64.deb
-rw-r--r-- 1 xxx xxx  17546554 Mar  4 21:37 libmysqld-dev_5.7.22-1ubuntu16.04_amd64.deb
-rw-r--r-- 1 xxx xxx  12322 Mar  4 21:37 mysql-client_5.7.22-1ubuntu16.04_amd64.deb
-rw-r--r-- 1 xxx xxx  15180 Mar  4 21:37 mysql-common_5.7.22-1ubuntu16.04_amd64.deb
-rw-r--r-- 1 xxx  xxx  7856138 Mar  4 21:37 mysql-community-client_5.7.22-1ubuntu16.04_amd64.deb
-rw-r--r-- 1 xxx  xxx  25396182 Mar  4 21:37 mysql-community-server_5.7.22-1ubuntu16.04_amd64.deb
-rw-r--r-- 1 xxx  xxx  48738976 Mar  4 21:37 mysql-community-source_5.7.22-1ubuntu16.04_amd64.deb
-rw-r--r-- 1 xxx  xxx  23857528 Mar  4 21:37 mysql-community-test_5.7.22-1ubuntu16.04_amd64.deb
-rw-r--r-- 1 xxx  xxx  12318 Mar  4 21:37 mysql-server_5.7.22-1ubuntu16.04_amd64.deb
-rw-r--r-- 1 xxx  xxx  12328 Mar  4 21:37 mysql-testsuite_5.7.22-1ubuntu16.04_amd64.deb

依次执行下面命令进行安装:

 sudo dpkg -i mysql-common_5.7.22-1ubuntu16.04_amd64.deb
 sudo dpkg-preconfigure mysql-community-server_5.7.22-1ubuntu16.04_amd64.deb
 sudo dpkg -i libmysqlclient20_5.7.22-1ubuntu16.04_amd64.deb
 sudo dpkg -i libmysqlclient-dev_5.7.22-1ubuntu16.04_amd64.deb
 sudo dpkg -i libmysqld-dev_5.7.22-1ubuntu16.04_amd64.deb

 sudo dpkg -i libc6_2.19-0ubuntu6_amd64.deb
 sudo dpkg -i libaio1_0.3.110-2_amd64.deb

 sudo dpkg -i mysql-community-client_5.7.22-1ubuntu16.04_amd64.deb
 sudo dpkg -i mysql-client_5.7.22-1ubuntu16.04_amd64.deb
 sudo dpkg -i mysql-common_5.7.22-1ubuntu16.04_amd64.deb
 sudo dpkg -i libmecab2_0.996-1.2ubuntu1_amd64.deb
 sudo dpkg -i mysql-community-server_5.7.22-1ubuntu16.04_amd64.deb

其中,

libc6_2.19-0ubuntu6_amd64.deb   libaio1_0.3.110-2_amd64.deb  libmecab2_0.996-1.2ubuntu1_amd64.deb

是安装过程中依赖的包,这个根据实际安装环境不同可能会有不同的错误提示,只要按照错误日志提示,下载依赖包,并使用dpkg -i命令执行安装就可以解决。依赖包的下载,可在https://pkgs.org/上寻找,选择自己的系统版本即可。以libaio1为例:

缺失依赖包提示日志:

:~/environments$ sudo dpkg -i mysql-community-client_5.7.22-1ubuntu16.04_amd64.deb 
Selecting previously unselected package mysql-community-client.
(Reading database ... 70413 files and directories currently installed.)
Preparing to unpack mysql-community-client_5.7.22-1ubuntu16.04_amd64.deb ...
Unpacking mysql-community-client (5.7.22-1ubuntu16.04) ...
dpkg: dependency problems prevent configuration of mysql-community-client:
 mysql-community-client depends on libaio1 (>= 0.3.93); however:
  Package libaio1 is not installed.

dpkg: error processing package mysql-community-client (--install):
 dependency problems - leaving unconfigured
Processing triggers for man-db (2.7.5-1) ...
Errors were encountered while processing:
 mysql-community-client

 

https://pkgs.org/download/libaio1 

 

 

mysql server安装过程中会提示输入root用户密码,待所有安装完成后,使用命令登陆即可。如密码设置为123456

mysql -uroot -p123456

 

 

mysql官网上下载mysql-server_5.7.21-1ubuntu14.04_amd64.deb-bundle.tar,然后进行离线安装,解压该安装包,会出现11个依赖包,按照顺序依次使用sudo dpkg -i 进行安装,中间会报错,显示缺少相应的依赖,具体如下: *******@ubuntu:/opt/mysql$ sudo dpkg -i mysql-community-client_5.7.21-1ubuntu14.04_amd64.deb Selecting previously unselected package mysql-community-client. (Reading database ... 208518 files and directories currently installed.) Preparing to unpack mysql-community-client_5.7.21-1ubuntu14.04_amd64.deb ... Unpacking mysql-community-client (5.7.21-1ubuntu14.04) ... dpkg: dependency problems prevent configuration of mysql-community-client: mysql-community-client depends on libaio1 (>= 0.3.93); however: Package libaio1 is not installed. dpkg: error processing package mysql-community-client (--install): dependency problems - leaving unconfigured Processing triggers for man-db (2.6.7.1-1ubuntu1) ... Errors were encountered while processing: mysql-community-client 和 ********@ubuntu:/opt/mysql$ sudo dpkg -i mysql-community-server_5.7.21-1ubuntu14.04_amd64.deb Selecting previously unselected package mysql-community-server. (Reading database ... 208598 files and directories currently installed.) Preparing to unpack mysql-community-server_5.7.21-1ubuntu14.04_amd64.deb ... Unpacking mysql-community-server (5.7.21-1ubuntu14.04) ... dpkg: dependency problems prevent configuration of mysql-community-server: mysql-community-server depends on libmecab2 (>= 0.996-1.1); however: Package libmecab2 is not installed. dpkg: error processing package mysql-community-server (--install): dependency problems - leaving unconfigured Processing triggers for man-db (2.6.7.1-1ubuntu1) ... Processing triggers for ureadahead (0.100.0-16) ... ureadahead will be reprofiled on next reboot Errors were encountered while processing: mysql-community-server 附上依赖包安装顺序: 1.mysql-common_5.7.21-1ubuntu14.04_amd64.deb 2.libmysqlclient20_5.7.21-1ubuntu14.04_amd64.deb 3.libmysqlclient-dev_5.7.21-1ubuntu14.04_amd64.deb 4.libmysqld-dev_5.7.21-1ubuntu14.04_amd64.deb
评论 5
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值