10

So today I installed MariaDB so I can login through phpmyadmin, apparently it didn't work so I removed it, tried again like four times and I failed. Decided to go with MySQL Server instead. I couldn't install it after removing MariaDB.

Here's what I'm trying to do and the outputs:

shavit@dedi:~$ sudo apt-get install mysql-server
[sudo] password for shavit:
Reading package lists... Done
Building dependency tree
Reading state information... Done
mysql-server is already the newest version (5.7.12-0ubuntu1).
0 to upgrade, 0 to newly install, 0 to remove and 0 not to upgrade.
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.12-0ubuntu1) ...
mysql_upgrade: Got error: 1524: Plugin 'unix_socket' is not loaded while connect                                                                                                                                                             ing to the MySQL server
Upgrade process encountered error and will not continue.
mysql_upgrade failed with exit status 11
dpkg: error processing package mysql-server-5.7 (--configure):
 subprocess installed post-installation script returned error exit status 1
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 it's a follow-up er                                                                                                                                                             ror 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)

shavit@dedi:~$ sudo apt-get remove mysql-server
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following packages were automatically installed and are no longer required:
  libaio1 mysql-client-5.7 mysql-client-core-5.7 mysql-common mysql-server-5.7
  mysql-server-core-5.7
Use 'sudo apt autoremove' to remove them.
The following packages will be REMOVED
  mysql-server
0 to upgrade, 0 to newly install, 1 to remove and 0 not to upgrade.
2 not fully installed or removed.
After this operation, 159 kB disk space will be freed.
Do you want to continue? [Y/n] y
(Reading database ... 35749 files and directories currently installed.)
Removing mysql-server (5.7.12-0ubuntu1) ...
Setting up mysql-server-5.7 (5.7.12-0ubuntu1) ...
mysql_upgrade: Got error: 1524: Plugin 'unix_socket' is not loaded while connecting to the MySQL server
Upgrade process encountered error and will not continue.
mysql_upgrade failed with exit status 11
dpkg: error processing package mysql-server-5.7 (--configure):
 subprocess installed post-installation script returned error exit status 1
Errors were encountered while processing:
 mysql-server-5.7
E: Sub-process /usr/bin/dpkg returned an error code (1)

I'm really lost right now.. Googling told me I should run apt-get install -f but that's what I get:

shavit@dedi:~$ sudo apt-get install -f
Reading package lists... Done
Building dependency tree
Reading state information... Done
0 to upgrade, 0 to newly install, 0 to remove and 0 not to upgrade.
2 not fully installed or removed.
After this operation, 0 B of additional disk space will be used.
Setting up mysql-server-5.7 (5.7.12-0ubuntu1) ...
mysql_upgrade: Got error: 1524: Plugin 'unix_socket' is not loaded while connecting to the MySQL server
Upgrade process encountered error and will not continue.
mysql_upgrade failed with exit status 11
No apport report written because the error message indicates it's a follow-up error from a previous failure.
                                                                                                            dpkg: error processing package mysql-server-5.7 (--configure):
 subprocess installed post-installation script returned error exit status 1
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
Errors were encountered while processing:
 mysql-server-5.7
 mysql-server
E: Sub-process /usr/bin/dpkg returned an error code (1)

So I ran sudo apt-get autoremove and proceed to install again:

dpkg: error processing package mysql-server (--configure):
 dependency problems - leaving unconfigured
Processing triggers for libc-bin (2.23-0ubuntu3) ...
No apport report written because the error message indicates it's a follow-up 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)

I'm a newbie with anything related to Linux and especially Ubuntu. Could anyone lend their hand and help me? Much appreciated!

3
  • Maybe try this
    – Alex Lowe
    Jun 21 '16 at 18:09
  • @Alex I actually did try it, Kaz Wolfe's solution worked though
    – shavit
    Jun 21 '16 at 18:14
  • Glad that we could help.
    – Alex Lowe
    Jun 21 '16 at 18:17
12

I think the fact that you had MariaDB installed caused this problem. The configs that MariaDB set up do not exactly play nice with vanilla MySQL. If you were to purge all of the old configs and set everything up from scratch, it should work. Note though that this will delete your current DBs! Back up any important data.

Try running the following command to reset and purge all MySQL related things:

sudo apt purge mysql-client-5.7 mysql-client-core-5.7 mysql-common mysql-server-5.7 mysql-server-core-5.7 mysql-server

Once this is done, run the below to update your system and "clean up" your package cache.

sudo apt update && sudo apt dist-upgrade && sudo apt autoremove && sudo apt -f install

Then, try re-installing MySQL Server:

sudo apt install mysql-server
5
  • 1
    While running the first command, I've got this output: dpkg: warning: while removing mysql-common, directory '/etc/mysql' not empty so not removed - should I remove /etc/mysql?
    – shavit
    Jun 21 '16 at 18:07
  • @shavit Yeah, it's probably a good idea to remove those files.
    – Kaz Wolfe
    Jun 21 '16 at 18:09
  • Thank you, I've installed MySQL Server successfully! One last thing as it seems you're experienced: the brand new MySQL server I installed doesn't let me access it via sudo mysql_secure_installation, it worked when I had MariaDB. Do you have any idea about what might be wrong?
    – shavit
    Jun 21 '16 at 18:12
  • @shavit You should ask this in a new question. Link it here, and I'll see what I can do. Please be sure to include any error messages you get.
    – Kaz Wolfe
    Jun 21 '16 at 18:15
  • Thank You! I was trying to fix the issue from hours. :)
    – BlueSuiter
    Jan 21 '18 at 15:04
7

This error can occur when you install mariadb-server before mysql-server. To resolve this error, you must delete directories /var/lib/mysql* and /etc/mysql* to remove all configurations and dependencies files, before trying to install MySQL again.

sudo apt purge mysql-client-5.7 mysql-client-core-5.7 mysql-common mysql-server-5.7 mysql-server-core-5.7 mysql-server
sudo apt update && sudo apt dist-upgrade && sudo apt autoremove && sudo apt -f install
sudo apt install mysql-server
1

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.