在 18.04 上安装 mysql 时出现问题

在 18.04 上安装 mysql 时出现问题

我是 ubuntu 新手,正在尝试设置 mysql。但是当我运行此命令时:

sudo apt-get install mysql-client mysql-server

我得到了以错误代码结尾的输出:

Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following additional packages will be installed:
libaio1 libevent-core-2.1-6 libhtml-template-perl mysql-client-5.7
mysql-client-core-5.7 mysql-common mysql-server-5.7 mysql-server-core- 
5.7
Suggested packages:
libipc-sharedcache-perl mailx tinyca
The following NEW packages will be installed:
libaio1 libevent-core-2.1-6 libhtml-template-perl mysql-client
mysql-client-5.7 mysql-client-core-5.7 mysql-common mysql-server
mysql-server-5.7 mysql-server-core-5.7
0 upgraded, 10 newly installed, 0 to remove and 54 not upgraded.
1 not fully installed or removed.
Need to get 9,820 B/20.4 MB of archives.
After this operation, 160 MB of additional disk space will be used.
Do you want to continue? [Y/n] y
Get:1 http://us.archive.ubuntu.com/ubuntu bionic-updates/main amd64 
mysql-client all 5.7.22-0ubuntu18.04.1 [9,820 B]
Fetched 9,820 B in 0s (373 kB/s)         
Preconfiguring packages ...
Setting up install-info (6.5.0.dfsg.1-2) ...
/usr/sbin/update-info-dir: 2: /etc/environment: JAVA_HOME: not found
dpkg: error processing package install-info (--configure):
installed install-info package post-installation script subprocess 
returned error exit status 127
Errors were encountered while processing:
install-info
E: Sub-process /usr/bin/dpkg returned an error code (1)

我在安装过程中是否遗漏了某个步骤?我该怎么做才能修复此错误并安装 mysql?

答案1

看来您的问题出在/etc/environment文件上?您能显示该文件的内容吗?该错误似乎表明您有一个 JAVA_HOME 命令而不是设置。

答案2

我在使用 MySQL 和 MariaDB (ubuntu 18.04) 时也遇到了很多问题。我无法让 MariaDB 工作。我使用了https://stackoverflow.com/questions/50573787/how-to-forcefully-remove-mysql-and-mariadb-from-ubuntu-16-04-without-apt-get

$ dpkg --list|grep -i mysql 

$ dpkg --list|grep -i mariadb

$ dpkg-remove --force-remove-reinstreq

然后按照说明安装 MySQLhttps://dev.mysql.com/doc/mysql-apt-repo-quick-guide/en/

即使重启后也能正常运行。

相关内容