ubuntu离线安装mysql
一:ubuntu离线安装mysql
转载来源:https://blog.csdn.net/liuhuoxingkong/article/details/80696574
参考文章: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