After an installation of MySQL, I get a few errors and I can't run the MySQL daemon. I've tried uninstalling and reinstalling several times, and I'm not sure what's going on.

Here's a snippit of what I'm seeing:

Setting up mysql-server-5.5 (5.5.31-0ubuntu0.13.04.1) ...
runlevel:/var/run/utmp: No such file or directory
initctl: Unknown job: mysql

sudo service mysql start gives me an unknown job error, and mysqld isn't found on my system.

I'm not sure where to go from here, aside from maybe compiling from source and creating my own upstart script. Of course, I'd like to do things the easy way if possible.

How can I successfully run MySQL or fix this problem?

Here is the complete log of what happens when I run the installation command:

sudo apt-get install mysql-server
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following extra packages will be installed:
  libaio1 libdbd-mysql-perl libdbi-perl libnet-daemon-perl libplrpc-perl libterm-readkey-perl mysql-client-5.5 mysql-client-core-5.5
  mysql-server-5.5 mysql-server-core-5.5
Suggested packages:
  tinyca mailx
The following NEW packages will be installed:
  libaio1 libdbd-mysql-perl libdbi-perl libnet-daemon-perl libplrpc-perl libterm-readkey-perl mysql-client-5.5 mysql-client-core-5.5 mysql-server
  mysql-server-5.5 mysql-server-core-5.5
0 upgraded, 11 newly installed, 0 to remove and 13 not upgraded.
Need to get 0 B/25.4 MB of archives.
After this operation, 88.0 MB of additional disk space will be used.
Do you want to continue [Y/n]? Y
Preconfiguring packages ...
Selecting previously unselected package libaio1:i386.
(Reading database ... 159063 files and directories currently installed.)
Unpacking libaio1:i386 (from .../libaio1_0.3.109-3_i386.deb) ...
Selecting previously unselected package libnet-daemon-perl.
Unpacking libnet-daemon-perl (from .../libnet-daemon-perl_0.48-1_all.deb) ...
Selecting previously unselected package libplrpc-perl.
Unpacking libplrpc-perl (from .../libplrpc-perl_0.2020-2_all.deb) ...
Selecting previously unselected package libdbi-perl.
Unpacking libdbi-perl (from .../libdbi-perl_1.622-1_i386.deb) ...
Selecting previously unselected package libdbd-mysql-perl.
Unpacking libdbd-mysql-perl (from .../libdbd-mysql-perl_4.021-1_i386.deb) ...
Selecting previously unselected package mysql-client-core-5.5.
Unpacking mysql-client-core-5.5 (from .../mysql-client-core-5.5_5.5.31-0ubuntu0.13.04.1_i386.deb) ...
Selecting previously unselected package libterm-readkey-perl.
Unpacking libterm-readkey-perl (from .../libterm-readkey-perl_2.30-4build4_i386.deb) ...
Selecting previously unselected package mysql-client-5.5.
Unpacking mysql-client-5.5 (from .../mysql-client-5.5_5.5.31-0ubuntu0.13.04.1_i386.deb) ...
Selecting previously unselected package mysql-server-core-5.5.
Unpacking mysql-server-core-5.5 (from .../mysql-server-core-5.5_5.5.31-0ubuntu0.13.04.1_i386.deb) ...
Selecting previously unselected package mysql-server-5.5.
Unpacking mysql-server-5.5 (from .../mysql-server-5.5_5.5.31-0ubuntu0.13.04.1_i386.deb) ...
Selecting previously unselected package mysql-server.
Unpacking mysql-server (from .../mysql-server_5.5.31-0ubuntu0.13.04.1_all.deb) ...
Processing triggers for man-db ...
Processing triggers for ureadahead ...
Setting up libaio1:i386 (0.3.109-3) ...
Setting up libnet-daemon-perl (0.48-1) ...
Setting up libplrpc-perl (0.2020-2) ...
Setting up libdbi-perl (1.622-1) ...
Setting up libdbd-mysql-perl (4.021-1) ...
Setting up mysql-client-core-5.5 (5.5.31-0ubuntu0.13.04.1) ...
Setting up libterm-readkey-perl (2.30-4build4) ...
Setting up mysql-client-5.5 (5.5.31-0ubuntu0.13.04.1) ...
Setting up mysql-server-core-5.5 (5.5.31-0ubuntu0.13.04.1) ...
Setting up mysql-server-5.5 (5.5.31-0ubuntu0.13.04.1) ...
runlevel:/var/run/utmp: No such file or directory
initctl: Unknown job: mysql
runlevel:/var/run/utmp: No such file or directory
initctl: Unknown job: mysql
Setting up mysql-server (5.5.31-0ubuntu0.13.04.1) ...
Processing triggers for libc-bin ...
ldconfig deferred processing now taking place

Here are the contents of /var/log/mysql/error.log immediately after the apt-get command is run to install it.

130518 12:14:36 [Note] Plugin 'FEDERATED' is disabled.
130518 12:14:36 InnoDB: The InnoDB memory heap is disabled
130518 12:14:36 InnoDB: Mutexes and rw_locks use GCC atomic builtins
130518 12:14:36 InnoDB: Compressed tables use zlib 1.2.7
130518 12:14:36 InnoDB: Using Linux native AIO
130518 12:14:36 InnoDB: Initializing buffer pool, size = 128.0M
130518 12:14:36 InnoDB: Completed initialization of buffer pool
130518 12:14:36 InnoDB: highest supported file format is Barracuda.
130518 12:14:36  InnoDB: Waiting for the background threads to start
130518 12:14:37 InnoDB: 5.5.31 started; log sequence number 1595675
130518 12:14:37  InnoDB: Starting shutdown...
130518 12:14:38  InnoDB: Shutdown completed; log sequence number 1595675
130518 12:14:38 [Note] Plugin 'FEDERATED' is disabled.
130518 12:14:38 InnoDB: The InnoDB memory heap is disabled
130518 12:14:38 InnoDB: Mutexes and rw_locks use GCC atomic builtins
130518 12:14:38 InnoDB: Compressed tables use zlib 1.2.7
130518 12:14:38 InnoDB: Using Linux native AIO
130518 12:14:38 InnoDB: Initializing buffer pool, size = 128.0M
130518 12:14:38 InnoDB: Completed initialization of buffer pool
130518 12:14:38 InnoDB: highest supported file format is Barracuda.
130518 12:14:38  InnoDB: Waiting for the background threads to start
130518 12:14:39 InnoDB: 5.5.31 started; log sequence number 1595675
ERROR: 1064  You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'AL
TER TABLE user ADD column Show_view_priv enum('N','Y') CHARACTER SET utf8 NOT ' at line 1
130518 12:14:39 [ERROR] Aborting

130518 12:14:39  InnoDB: Starting shutdown...
130518 12:14:40  InnoDB: Shutdown completed; log sequence number 1595675
130518 12:14:40 [Note] /usr/sbin/mysqld: Shutdown complete

Looks like many applications rely on /var/run/utmp for logon session information.

sudo touch /var/run/utmp
sudo chmod 664 /var/run/utmp
sudo reboot

after the reboot, execute these commands, as @coteyr suggested, to clean install mysql

sudo apt-get purge mysql-server
sudo apt-get update
sudo apt-get install mysql-server 

This should resolve your problem.

EDIT:

sudo apt-get purge mysql-server
sudo apt-get purge mysql-common
sudo rm -rf /var/log/mysql
sudo rm -rf /var/log/mysql.*
sudo rm -rf /var/lib/mysql
sudo rm -rf /etc/mysql
sudo apt-get install mysql-server --fix-missing --fix-broken

This seems to be working for so many people, as per this blog post


The problem is not directly related to MySql. The init daemon control tool is not starting the mysql server daemon into /etc/init.

You can restore by hand:

sudo initctl reload-configuration

Now mysql server starts as expected.