没有用过ubuntu系统,以为和centos安装方法差不多,但是在网上看了一下5.7的安装流程感觉太烦琐了,于是尝试了两种安装方式那种简单:
1.在线安装
查询安装版本
apt-cache madison mysql-server
结果只能安装到最新的版本,然后我想要通过指定版本的方式安装:
apt-get install mysql-server-5.7.42
这样方式并不行,可能不在默认的 Ubuntu 存储库中,我就放弃了这种办法。
2.离线方式安装
将tar包下载下来,解压内容
tar -xf mysql-server_5.7.42-1ubuntu18.04_amd64.deb-bundle.tar
分步执行安装
dpkg -i mysql-common_5.7.42-1ubuntu18.04_amd64.deb
dpkg -i mysql-community-client_5.7.42-1ubuntu18.04_amd64.deb
执行到这里会发现报错,缺少依赖包
Selecting previously unselected package mysql-community-client.
(Reading database ... 157474 files and directories currently installed.)
Preparing to unpack mysql-community-client_5.7.42-1ubuntu18.04_amd64.deb ...
Unpacking mysql-community-client (5.7.42-1ubuntu18.04) ...
dpkg: dependency problems prevent configuration of mysql-community-client:
mysql-community-client depends on libtinfo5 (>= 6); however:
Package libtinfo5 is not installed.dpkg: error processing package mysql-community-client (--install):
dependency problems - leaving unconfigured
Processing triggers for man-db (2.9.1-1) ...
Errors were encountered while processing:
mysql-community-client
执行安装需要的依赖包
apt-get install libtinfo5
再次执行安装
dpkg -i mysql-community-client_5.7.42-1ubuntu18.04_amd64.deb
依然报错,这时候考虑依赖包是否有错,重新安装了依赖包
apt-get install libtinfo6
然后我选择了一把安装,执行命令
dpkg -i mysql-{common,community-client,client,community-server,server}_*.deb
依然会报错
(Reading database ... 157531 files and directories currently installed.)
Preparing to unpack mysql-common_5.7.42-1ubuntu18.04_amd64.deb ...
Unpacking mysql-common (5.7.42-1ubuntu18.04) over (5.7.42-1ubuntu18.04) ...
Preparing to unpack mysql-community-client_5.7.42-1ubuntu18.04_amd64.deb ...
Unpacking mysql-community-client (5.7.42-1ubuntu18.04) over (5.7.42-1ubuntu18.04) ...
Selecting previously unselected package mysql-client.
Preparing to unpack mysql-client_5.7.42-1ubuntu18.04_amd64.deb ...
Unpacking mysql-client (5.7.42-1ubuntu18.04) ...
Selecting previously unselected package mysql-community-server.
Preparing to unpack mysql-community-server_5.7.42-1ubuntu18.04_amd64.deb ...
Unpacking mysql-community-server (5.7.42-1ubuntu18.04) ...
Preparing to unpack mysql-server_5.7.42-1ubuntu18.04_amd64.deb ...
Unpacking mysql-server (5.7.42-1ubuntu18.04) over (5.7.42-1ubuntu18.04) ...
Setting up mysql-common (5.7.42-1ubuntu18.04) ...
dpkg: dependency problems prevent configuration of mysql-community-client:
mysql-community-client depends on libtinfo5 (>= 6); however:
Package libtinfo5 is not installed.dpkg: error processing package mysql-community-client (--install):
dependency problems - leaving unconfigured
dpkg: dependency problems prevent configuration of mysql-client:
mysql-client depends on mysql-community-client (= 5.7.42-1ubuntu18.04); however:
Package mysql-community-client is not configured yet.dpkg: error processing package mysql-client (--install):
dependency problems - leaving unconfigured
dpkg: dependency problems prevent configuration of mysql-community-server:
mysql-community-server depends on mysql-client (= 5.7.42-1ubuntu18.04); however:
Package mysql-client is not configured yet.
mysql-community-server depends on libmecab2; however:
Package libmecab2 is not installed.dpkg: error processing package mysql-community-server (--install):
dependency problems - leaving unconfigured
dpkg: dependency problems prevent configuration of mysql-server:
mysql-server depends on mysql-community-server (= 5.7.42-1ubuntu18.04); however:
Package mysql-community-server is not configured yet.dpkg: error processing package mysql-server (--install):
dependency problems - leaving unconfigured
Processing triggers for man-db (2.9.1-1) ...
Processing triggers for systemd (245.4-4ubuntu3.20) ...
Errors were encountered while processing:
mysql-community-client
mysql-client
mysql-community-server
mysql-server
存在依赖问题,这个时候,使用了下面命令来修复损坏的依赖关系
apt --fix-broken install
奇怪的是,这条命令执行后直接就进入了到安装状态,然后数据数据库密码,就完成了安装。反正是稀里糊涂的安装好了,至于为什么会这样我也不懂,懂得大佬可以解释一下。