1

I'm new to Ubuntu so apologies if the answer to this is obvious. I tried searching for similar problems on the forum but couldn't find a solution. I'm trying to load mysql as part of a LAMP stack to run Moodle. However, I'm encountering an error trying to load mysql. This is all the info from the terminal:

sudo apt-get install apache2 mysql-client mysql-server php7.0 libapache2-mod-php7.0
Reading package lists... Done
Building dependency tree       
Reading state information... Done
apache2 is already the newest version (2.4.18-2ubuntu3.1).
libapache2-mod-php7.0 is already the newest version (7.0.8-0ubuntu0.16.04.3).
The following package was automatically installed and is no longer required:
  gnome-video-effects
Use 'sudo apt autoremove' to remove it.
The following additional packages will be installed:
  libevent-core-2.0-5 mysql-client-5.7 mysql-client-core-5.7 mysql-common
  mysql-server-5.7 mysql-server-core-5.7
Suggested packages:
  mailx tinyca
The following NEW packages will be installed
  libevent-core-2.0-5 mysql-client mysql-client-5.7 mysql-client-core-5.7
  mysql-common mysql-server mysql-server-5.7 mysql-server-core-5.7 php7.0
0 to upgrade, 9 to newly install, 0 to remove and 0 not to upgrade.
Need to get 10.0 kB/18.2 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://gb.archive.ubuntu.com/ubuntu xenial-updates/main amd64 mysql-client all 5.7.16-0ubuntu0.16.04.1 [10.0 kB]
Fetched 10.0 kB in 0s (82.3 kB/s)       
Preconfiguring packages ...
Selecting previously unselected package libevent-core-2.0-5:amd64.
(Reading database ... 209205 files and directories currently installed.)
Preparing to unpack .../libevent-core-2.0-5_2.0.21-stable-2_amd64.deb ...
Unpacking libevent-core-2.0-5:amd64 (2.0.21-stable-2) ...
Selecting previously unselected package mysql-common.
Preparing to unpack .../mysql-common_5.7.16-0ubuntu0.16.04.1_all.deb ...
Unpacking mysql-common (5.7.16-0ubuntu0.16.04.1) ...
Selecting previously unselected package mysql-client-core-5.7.
Preparing to unpack .../mysql-client-core-5.7_5.7.16-0ubuntu0.16.04.1_amd64.deb ...
Unpacking mysql-client-core-5.7 (5.7.16-0ubuntu0.16.04.1) ...
Selecting previously unselected package mysql-client-5.7.
Preparing to unpack .../mysql-client-5.7_5.7.16-0ubuntu0.16.04.1_amd64.deb ...
Unpacking mysql-client-5.7 (5.7.16-0ubuntu0.16.04.1) ...
Selecting previously unselected package mysql-server-core-5.7.
Preparing to unpack .../mysql-server-core-5.7_5.7.16-0ubuntu0.16.04.1_amd64.deb ...
Unpacking mysql-server-core-5.7 (5.7.16-0ubuntu0.16.04.1) ...
Processing triggers for man-db (2.7.5-1) ...
Setting up mysql-common (5.7.16-0ubuntu0.16.04.1) ...
update-alternatives: error: alternative path /etc/mysql/my.cnf.fallback doesn't exist
dpkg: error processing package mysql-common (--configure):
 subprocess installed post-installation script returned error exit status 2
Errors were encountered while processing:
 mysql-common
E: Sub-process /usr/bin/dpkg returned an error code (1)

I subsequently ran dist-upgrade and got this message:

sudo apt-get dist-upgrade
Reading package lists... Done
Building dependency tree       
Reading state information... Done
Calculating upgrade... Done
The following packages were automatically installed and are no longer required:
  gnome-video-effects libevent-core-2.0-5 mysql-client-5.7
  mysql-client-core-5.7 mysql-common mysql-server-core-5.7
Use 'sudo apt autoremove' to remove them.
0 to upgrade, 0 to newly install, 0 to remove and 0 not to upgrade.
5 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 libevent-core-2.0-5:amd64 (2.0.21-stable-2) ...
Setting up mysql-client-core-5.7 (5.7.16-0ubuntu0.16.04.1) ...
Setting up mysql-common (5.7.16-0ubuntu0.16.04.1) ...
update-alternatives: error: alternative path /etc/mysql/my.cnf.fallback doesn't exist
dpkg: error processing package mysql-common (--configure):
 subprocess installed post-installation script returned error exit status 2
dpkg: dependency problems prevent configuration of mysql-client-5.7:
 mysql-client-5.7 depends on mysql-common (>= 5.5); however:
  Package mysql-common is not configured yet.

dpkg: error processing package mysql-client-5.7 (--configure):
 dependency problems - leaving unconfigured
Setting up mysql-server-core-5.7 (5.7.16-0ubuntu0.16.04.1) ...
No apport report written because the error message indicates it's a follow-up error from a previous failure.
                            Processing triggers for libc-bin (2.23-0ubuntu4) ...
Errors were encountered while processing:
 mysql-common
 mysql-client-5.7
E: Sub-process /usr/bin/dpkg returned an error code (1)
5
  • Please, run sudo apt-get update, then, sudo apt-get dist-upgrade, after that, do sudo apt-get autoremove, and finally, sudo apt-get autoclean. Then reboot your computer, and try the installation again. – GTRONICK Nov 17 '16 at 13:02
  • Hi - thanks for getting back to me. I followed the instructions but the same thing happened again. There was an error message is got when running the dist-upgrade - which I will try to post below as it's too long for a comment – sim89 Nov 17 '16 at 13:59
  • 1
    Possible duplicate of askubuntu.com/questions/643251/… – slowko Nov 17 '16 at 14:31
  • 1
    I think you are right - I checked out the first solution on this thread and it worked. Thanks for your help – sim89 Nov 17 '16 at 15:41
  • 3
    Possible duplicate of Having trouble in installing and removing mysql in ubuntu – Zanna Mar 21 '17 at 21:42
0

Try installing mysql workbench for running db queries. Installing lampp and starting it by

sudo /opt/lampp/lampp start

will connect mysql.

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.