I am new to ubuntu and trying to set up mysql. However when I run this command:

sudo apt-get install mysql-client mysql-server

I get this output that ends in an error code:

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- 
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:
E: Sub-process /usr/bin/dpkg returned an error code (1)

Am I missing a step in the install process? What can I do to fix this error and get mysql installed?

  • Are you sure there's not more to that error? Normally it would have spat out other error data... – Thomas Ward Jun 22 '18 at 19:50
  • Your problem seems to be something like this askubuntu.com/questions/203966/… – Kulfy Jun 22 '18 at 19:50
  • I updated the post with full output – ganele892 Jun 22 '18 at 20:05
  • 1
    I'm not sure this is the same problem that @Kulfy links to. In your case, a previous install of the package install-info hasn't finished correctly. Try sudo dpkg --configure -a first; if that doesn't work remove install-info and try again. – Jos Jun 22 '18 at 20:17
  • I have exactly the same problem and none of the solutions work. – Andor Kiss Jul 31 at 19:52

it seems your problem lies in the /etc/environment file? Can you show the contents of that file? The error seems to indicate you have a JAVA_HOME command instead of a setting.

| improve this answer | |
  • I don't understand how you conclude that the problem is in the </etc/environment> file? Could you please explain? – Andor Kiss Jul 31 at 19:31
  • It says so in the error message: Setting up install-info (6.5.0.dfsg.1-2) ... /usr/sbin/update-info-dir: 2: /etc/environment: JAVA_HOME: not found – nosklo Aug 1 at 14:14
  • Ahhh, somehow missed that... – Andor Kiss Aug 3 at 15:00

I also had many problem with both MySQL and MariaDB (ubuntu 18.04). I could not get MariaDB to work. I used both instructions from 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

Then installed MySQL as described at https://dev.mysql.com/doc/mysql-apt-repo-quick-guide/en/

Works well now, even after reboot.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.