参考文章: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_8.0.11-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