MySQL 服务器安装问题,对 Ubuntu 来说完全是新手。抱歉

MySQL 服务器安装问题,对 Ubuntu 来说完全是新手。抱歉

当我尝试按照网站上的指南为我的 VPS 安装 MySQL 时https://dev.mysql.com/doc/mysql-apt-repo-quick-guide/en/#apt-repo-fresh-install它说的是:

root@CrispKnotty-VM:~# apt-get install mysql-server
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following package was automatically installed and is no longer required:
  gcc-4.8-base:i386
Use 'apt-get autoremove' to remove it.
The following extra packages will be installed:
  gcc-7-base gcc-7-base:i386 libaio1 libmecab2 libstdc++6 libstdc++6:i386
  mysql-client mysql-community-client mysql-community-server
The following NEW packages will be installed:
  gcc-7-base gcc-7-base:i386 libaio1 libmecab2 mysql-client
  mysql-community-client mysql-community-server mysql-server
The following packages will be upgraded:
  libstdc++6 libstdc++6:i386
2 upgraded, 8 newly installed, 0 to remove and 693 not upgraded.
2 not fully installed or removed.
Need to get 0 B/32.9 MB of archives.
After this operation, 239 MB of additional disk space will be used.
Do you want to continue? [Y/n] y
WARNING: The following packages cannot be authenticated!
  libaio1 gcc-7-base gcc-7-base:i386 libstdc++6:i386 libstdc++6 libmecab2
Install these packages without verification? [y/N] y
Preconfiguring packages ...
dpkg-deb: error: archive '/var/cache/apt/archives/libaio1_0.3.110-5_amd64.deb' has premature member 'control.tar.xz' before 'control.tar.gz', giving up
dpkg: error processing archive /var/cache/apt/archives/libaio1_0.3.110-5_amd64.deb (--unpack):
 subprocess dpkg-deb --control returned error exit status 2
dpkg-deb: error: archive '/var/cache/apt/archives/gcc-7-base_7.2.0-17_amd64.deb' has premature member 'control.tar.xz' before 'control.tar.gz', giving up
dpkg: error processing archive /var/cache/apt/archives/gcc-7-base_7.2.0-17_amd64.deb (--unpack):
 subprocess dpkg-deb --control returned error exit status 2
dpkg-deb: error: archive '/var/cache/apt/archives/gcc-7-base_7.2.0-17_i386.deb' has premature member 'control.tar.xz' before 'control.tar.gz', giving up
dpkg: error processing archive /var/cache/apt/archives/gcc-7-base_7.2.0-17_i386.deb (--unpack):
 subprocess dpkg-deb --control returned error exit status 2
Errors were encountered while processing:
 /var/cache/apt/archives/libaio1_0.3.110-5_amd64.deb
 /var/cache/apt/archives/gcc-7-base_7.2.0-17_amd64.deb
 /var/cache/apt/archives/gcc-7-base_7.2.0-17_i386.deb
E: Sub-process /usr/bin/dpkg returned an error code (1)

我完全不知道这意味着什么,也不知道该如何修复它... 抱歉。我搜索了所有地方都没找到这个。

编辑:试过了此解决方案, 没有运气:

root@CrispKnotty-VM:~# apt-get install --reinstall dpkg
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following package was automatically installed and is no longer required:
  libnuma1
Use 'apt-get autoremove' to remove it.
The following extra packages will be installed:
  libdpkg-perl
Suggested packages:
  debsig-verify debian-keyring gcc c-compiler binutils bzr
The following packages will be upgraded:
  dpkg libdpkg-perl
2 upgraded, 0 newly installed, 0 to remove and 691 not upgraded.
2 not fully installed or removed.
Need to get 0 B/3449 kB of archives.
After this operation, 1311 kB of additional disk space will be used.
Do you want to continue? [Y/n] y
WARNING: The following packages cannot be authenticated!
  libdpkg-perl dpkg
Install these packages without verification? [y/N] y
dpkg-deb: error: archive '/var/cache/apt/archives/libdpkg-perl_1.19.0.4_all.deb'                                    has premature member 'control.tar.xz' before 'control.tar.gz', giving up
dpkg: error processing archive /var/cache/apt/archives/libdpkg-perl_1.19.0.4_all                                   .deb (--unpack):
 subprocess dpkg-deb --control returned error exit status 2
dpkg-deb: error: archive '/var/cache/apt/archives/dpkg_1.19.0.4_amd64.deb' has p                                   remature member 'control.tar.xz' before 'control.tar.gz', giving up
dpkg: error processing archive /var/cache/apt/archives/dpkg_1.19.0.4_amd64.deb (                                   --unpack):
 subprocess dpkg-deb --control returned error exit status 2
Errors were encountered while processing:
 /var/cache/apt/archives/libdpkg-perl_1.19.0.4_all.deb
 /var/cache/apt/archives/dpkg_1.19.0.4_amd64.deb
E: Sub-process /usr/bin/dpkg returned an error code (1)

编辑:试过了此解决方案, 没有运气:

root@CrispKnotty-VM:~# dpkg -i --force-overwrite /var/cache/apt/archives/libaio1_0.3.110-5_amd64.deb
dpkg-deb: error: archive '/var/cache/apt/archives/libaio1_0.3.110-5_amd64.deb' has premature member 'control.tar.xz' before 'control.tar.gz', giving up
dpkg: error processing archive /var/cache/apt/archives/libaio1_0.3.110-5_amd64.deb (--install):
 subprocess dpkg-deb --control returned error exit status 2
Errors were encountered while processing:
 /var/cache/apt/archives/libaio1_0.3.110-5_amd64.deb

答案1

不要安装,而是MySQL安装MariaDB

MariaDB 是 MySQL 的直接替代品。

$ sudo apt install mariadb-server mariadb-client

启动 MariaDB

$ sudo systemctl start mariadb

要使 MariaDB 在启动时自动启动,请运行

$ sudo systemctl enable mariadb

现在运行安装后安全脚本

$ sudo mysql_secure_installation

访问 MySQL shell

$ mysql -u root -p

相关内容