So the partition MySQL was mounted on ran out of space. As a quick fix, I decided to move mysql's data directory to /home/minecraft/mysql/. I then changed the datadir in the config to the correcy location. After doing that, it still wouldn't stary amd then someone mentioned apparmor. After changing the proper lines in the apparmor config, it still didn't work.

At this point I relized that I copied the files while MySQL was running, which most likely corrupted them. After removing the potentially corrupt files, I re-copied the files from /var/lib/mysql/. Still mysql would not start, it gave me a socket error and said it could not connect. I then tried to uninstall mysql completely, but when reinstalling Igot yet another error that reads:

Errors were encountered while processing: mysql-server-5.5 mysql-server E: Sub-process /usr/bin/dpkg returned an error code (1)

At this point I am completely lost and I have no idea what to do. I changed all the apparmor and mysql settings back to default now. I just need to get mysql back and running. It is apparently still installed, but only partially. This is the error I get when trying to remove it again: http://pastebin.com/Fc3gMCBn

migrated from stackoverflow.com Apr 19 '14 at 1:31

This question came from our site for professional and enthusiast programmers.


You're right, you probably did corrupt the files if you were copying them from a running server. I hope you shut down MySQL before you re-copied them.

BTW, another option is to use Percona XtraBackup, which can create a fast physical backup from a running system (and it's free).

I would recommend to examine your MySQL error log to diagnose the reason for it not starting up. The error log is in the data directory by default, probably called hostname.err.

My guess is that the file ownership and file permissions on your copied files aren't right.

You should fix that:

$ chown -R mysql:mysql /home/minecraft/mysql
$ chmod -R ug+rwX /home/minecraft/mysql

The permissions issue would prevent the MySQL instance from starting. That would explain why the post-installation part failed.

  • That did not work for me. When reinstalling mysql I still get this error: Errors were encountered while processing: mysql-server-5.5 mysql-server E: Sub-process /usr/bin/dpkg returned an error code (1) – user3550432 Apr 19 '14 at 1:27
  • What do you see in the MySQL error log? – Bill Karwin Apr 19 '14 at 2:06

Your Answer

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