1

I'm on Ubuntu 18.04, I'm installing Mysql,

i typed:

sudo apt-get install mysql-server

i received this with an error at the end:

Reading package lists... Done
Building dependency tree       
Reading state information... Done
mysql-server is already the newest version (5.7.28-0ubuntu0.18.04.4).
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
2 not fully installed or removed.
After this operation, 0 B of additional disk space will be used.
Do you want to continue? [Y/n] y
Setting up mysql-server-5.7 (5.7.28-0ubuntu0.18.04.4) ...
/var/lib/dpkg/info/mysql-server-5.7.postinst: line 191: /usr/share/mysql-common/configure-symlinks: No such file or directory
dpkg: error processing package mysql-server-5.7 (--configure):
 installed mysql-server-5.7 package post-installation script subprocess returned error exit status 127
dpkg: dependency problems prevent configuration of mysql-server:
 mysql-server depends on mysql-server-5.7; however:
  Package mysql-server-5.7 is not configured yet.

dpkg: error processing package mysql-server (--configure):
 dependency problems - leaving unconfigured
No apport report written because the error message indicates its a followup error from a previous failure.
                          Errors were encountered while processing:
 mysql-server-5.7
 mysql-server
E: Sub-process /usr/bin/dpkg returned an error code (1)

Additional Information:

When i typed: apt-cache policy mysql-common I got this response:

mysql-common:
  Installed: 1:10.4.11+maria~bionic
  Candidate: 1:10.4.11+maria~bionic
  Version table:
 *** 1:10.4.11+maria~bionic 100
        100 /var/lib/dpkg/status
     1:10.3.21+maria~bionic 500
        500 http://ftp.utexas.edu/mariadb/repo/10.3/ubuntu bionic/main ppc64el Packages
        500 http://ftp.utexas.edu/mariadb/repo/10.3/ubuntu bionic/main arm64 Packages
        500 http://ftp.utexas.edu/mariadb/repo/10.3/ubuntu bionic/main amd64 Packages
        500 http://sfo1.mirrors.digitalocean.com/mariadb/repo/10.3/ubuntu bionic/main ppc64el Packages
        500 http://sfo1.mirrors.digitalocean.com/mariadb/repo/10.3/ubuntu bionic/main arm64 Packages
        500 http://sfo1.mirrors.digitalocean.com/mariadb/repo/10.3/ubuntu bionic/main amd64 Packages
     1:10.3.20+maria~bionic 500
        500 http://ftp.utexas.edu/mariadb/repo/10.3/ubuntu bionic/main ppc64el Packages
        500 http://ftp.utexas.edu/mariadb/repo/10.3/ubuntu bionic/main arm64 Packages
        500 http://ftp.utexas.edu/mariadb/repo/10.3/ubuntu bionic/main amd64 Packages
        500 http://sfo1.mirrors.digitalocean.com/mariadb/repo/10.3/ubuntu bionic/main ppc64el Packages
        500 http://sfo1.mirrors.digitalocean.com/mariadb/repo/10.3/ubuntu bionic/main arm64 Packages
        500 http://sfo1.mirrors.digitalocean.com/mariadb/repo/10.3/ubuntu bionic/main amd64 Packages
     1:10.3.14+maria~bionic 500
        500 http://archive.mariadb.org/mariadb-10.3.14/repo/ubuntu bionic/main ppc64el Packages
        500 http://archive.mariadb.org/mariadb-10.3.14/repo/ubuntu bionic/main amd64 Packages
        500 http://archive.mariadb.org/mariadb-10.3.14/repo/ubuntu bionic/main arm64 Packages
     5.8+1.0.4 500
        500 http://fr.archive.ubuntu.com/ubuntu bionic/main amd64 Packages
        500 http://fr.archive.ubuntu.com/ubuntu bionic/main i386 Packages

I have tried SO MANY solutions, from desintalling mysql, installing mariadb, seeing different solutions on stackOverflow.. and didnt get to put my finger on the error exactly.

Really appreciate the help i have been stuck with this for a while...

4
  • You received more than that error. Ironically, the bit that you have chosen not to show to people, immediately preceding that, is the bit that indicates what the error was. One has to read log files as well. And probably the Ubuntu release notes. Absent telepathy, people in the rest of the world are not able to read these on your computer, and since you did not put them in the question you are going to at best get a lot of guesswork that will probably be very wide of the mark.
    – JdeBP
    Jan 10 '20 at 18:01
  • @JdeBP Thank you for your comment, i am pretty new to Ubuntu... now i have edited it and i added the whole response, hope it will be more clear, one thing though, after i restarted the computer, the comment sudo apt update no longer gives me any error. so i added the response for the command systemctl status mysql.service after i typed: systemctl start mysql Jan 10 '20 at 20:22
  • My amazing psychic powers tell me that the output of apt-cache policy mysql-common in the question will give potential answerers even more of a clue. (-:
    – JdeBP
    Jan 10 '20 at 21:44
  • @JdeBP hehe i hope so :-), i just added the response of your command above in my question in the additional information part. Jan 11 '20 at 0:05
0

You have mixed MariaDB with MySQL.

Witness in the output of apt-cache policy mysql-common:

        500 http://archive.mariadb.org/mariadb-10.3.14/repo/ubuntu bionic/main amd64 Packages
…
        500 http://fr.archive.ubuntu.com/ubuntu bionic/main amd64 Packages

They both have a mysql-common package. As you can see, the MariaDB one (note the +maria version strings) comes from third-party MariaDB repositories, and the MySQL one comes from an Ubuntu package repository.

Unfortunately, the contents of the packages are not the same. Moreover, the installation of MySQL depends from parts of the MySQL mysql-common package that the MariaDB version of that package does not have, in particular the /usr/share/mysql-common/configure-symlinks program, which sets up Debian/Ubuntu "alternatives" for /etc/mysql/my.cnf.

This has stopped the MySQL mysql-server-5.7 package from performing the final step of installation, its "configure" step.

You need to uninstall the third-party MariaDB version of the mysql-common package, and install (and configure) the MySQL version that is from the Ubuntu repository. Then the "configure" step of the mysql-server-5.7 package will work.

You can do this by picking the correct version of mysql-common in (for example) aptitude and installing it. But probably the simplest and cleanest way of achieving this is:

  • Remove all traces of the third-party MariaDB repositories from your sources.list and sources.list.d/.
  • Purge all of the orphaned MariaDB packages.
  • Install MySQL mysql-server-5.7 and its dependencies again.

The next step will be solving problems in your my.cnf file caused by this back and forth, which might arise and be the next reason that mysql-server-5.7 fails to complete installation. That is in the Ubuntu release notes.

Further reading

  • "MySQL 5.7". Ubuntu 16.04 LTS Release Notes. Canonical. 2016. wiki.ubuntu.com.
1
  • Thank you for this detailed response! i i tried the three steps , i did eliminate anything related to mariadb in sources.list, but the rest: purge and install it doesnt work and it gives me the same error that i mentioned above with the sudo apt-get install mysql-server, what i noticed though, is that my.cnf is all configured for mariadb, it even begins with # MariaDB database server configuration file. , so do i remove it then install mysql again so it install a new my.cnf file ? Jan 11 '20 at 13:01
0

Note: this error could also happens if the port (3306) is being used by another app. In my case, I had a docker container running mysql which was using the 3306 port, hence my local mysql installation fialed to configure.

$ sudo netstat -nltp | grep LISTEN | grep 3306
$ sudo netstat -nltp | grep LISTEN | grep 3306
tcp6       0      0 :::3306                 :::*                    LISTEN      1017033/docker-prox 

sudo apt purge --auto-remove mysql*
sudo rm -r /etc/mysql
sudo rm -r /var/lib/mysql*

sudo apt install mysql-client-8.0 mysql-server-8.0 --fix-broken -y

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.