19

I have unsuccessfully been attempting to install mysql-server for a while on my ubuntu vps

During a fresh install (Fully purged all mysql related packages) partway through the installation it asks for the root password to be set after which it presents an error screen containing:

An error occurred while setting the password for the MySQL administrative user. This may have happened because the account already has a password, or because of a communication problem with the MySQL server.

Unpacking mysql-server (from .../mysql-server_5.5.34-0ubuntu0.12.04.1_all.deb) ...
Processing triggers for man-db ...
Setting up libmysqlclient18 (5.5.34-0ubuntu0.12.04.1) ...
Setting up libdbd-mysql-perl (4.020-1build2) ...
Setting up mysql-client-core-5.5 (5.5.34-0ubuntu0.12.04.1) ...
Setting up mysql-client-5.5 (5.5.34-0ubuntu0.12.04.1) ...
Setting up mysql-server-core-5.5 (5.5.34-0ubuntu0.12.04.1) ...
Setting up mysql-server-5.5 (5.5.34-0ubuntu0.12.04.1) ...
131130 18:01:34 [Warning] Using unique option prefix key_buffer instead of key_buffer_size is deprecated and will be removed in a future release. Please use the full name instead.
start: Job failed to start
invoke-rc.d: initscript mysql, action "start" failed.
dpkg: error processing mysql-server-5.5 (--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.5; however:
  Package mysql-server-5.5 is not configured yet.
dpkg: error processing mysql-server (--configure):
 dependency problems - leaving unconfigured
Processing triggers for libc-bin ...
No apport report written because the error message indicates its a followup error from a previous failure.
                          ldconfig deferred processing now taking place
Errors were encountered while processing:
 mysql-server-5.5
 mysql-server
E: Sub-process /usr/bin/dpkg returned an error code (1)

I have attempted a few fixes involving apparmor related stuff before I realised that apparmor is not mentioned in the error logs unlike alot of other people having similar issues.

Any help on this matter would be greatly appreciated.

Edit:

Any attempts to continue or configure the installation after this point are simply met with further error messages

Braiam
  • 67,791
  • 32
  • 179
  • 269
  • For your information: I HAD THIS PROBLEM AS WELL and have found the cause: Simply put, if you, like me, mapped your /tmp (or whatever mysql tmp-dir is mapped to, by default /tmp) on an incompatible partition (say, ntfs-3g or something else equally incompatible) you will have problems. This is not the only program that seems to have problems with the ntfs partition, even if it is able to hold all the same files, it can't hold some of the special file types (i think, sockets, pipes, devices, fall into that category), however, try moving your tmp back to an ext4 partition, that should fix it! :) – osirisgothra Jul 25 '14 at 22:26

3 Answers3

29

Try to purge all dependencies and re-install mysql-server.

sudo apt-get purge mysql-server mysql-client mysql-common mysql-server-5.5
sudo apt-get install mysql-server
kiri
  • 28,246
  • 16
  • 81
  • 118
user233437
  • 291
  • 2
  • 3
  • 4
    Warning: I'm pretty sure purge will delete your databases. Have a backup. – flickerfly Jun 13 '14 at 17:09
  • ALSO - doing that will force you to purge everything that depends on it (for my case, it was ALOT of things). Reinstalling all that is a bad problem too since depending on what the dependency is, you could lose even more than just the databases. It seems upgrading has the same problems (5.6) – osirisgothra Jul 25 '14 at 20:54
  • I ran into this today on Debian 7 after I tried to upgrade MySQL and apt choked on the "Keep original or install package maintainer version?" dialog. Purging fixed it, and did not delete my databases. – LunkRat Feb 02 '16 at 15:34
  • 1
    @flickerfly I was almost certain it will delete my databases after "apt-get purge mysql*" but it didn't. Awesome! – L.S. Apr 23 '16 at 10:12
3

Open your terminal and type this

 sudo dpkg --configure mysql-server-5.5

it also mentioned that some dependencies issues are there

sudo apt-get install -f 

can help you to fix that issue.

Raja G
  • 102,391
  • 106
  • 255
  • 328
  • 9
    sudo dpkg --configure mysql-server-5.5 returns:
    Setting up mysql-server-5.5 (5.5.34-0ubuntu0.12.04.1)...
    start: Job failed to start
    invoke-rc.d: initscript mysql, action "start" failed.
    dpkg: error processing mysql-server-5.5 (--configure):
    subprocess installed post-installation script returned error exit status 1
    Errors were encountered while processing:
    mysql-server-5.5
    – user216845 Dec 01 '13 at 05:54
1

Actually, the following bug report helped me a lot: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=739846

The following commands should do the job:

echo "exit 0" >> /etc/init.d/mysql
dpkg --configure -a

However I had to configure it twice (the 2nd command).

bdesham
  • 343
  • 3
  • 12
  • dont see how that could possibly help... adding 'exit' at the end of the script like that, since the error return is '1' from within a nested part of the script, in the end it just does the same thing (i have the exact problem the question asker has) – osirisgothra Jul 25 '14 at 22:08