Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

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
share|improve this question
    
Can you please post the complete log messages, when you do sudo apt-get install mysql-server? –  thefourtheye May 18 '13 at 3:59
    
@thefourtheye Log posted. Hopefully it's helpful. Thanks for your time –  Ian Hunter May 18 '13 at 5:03

5 Answers 5

sudo apt-get install mysql-server

Then once it's installed make sure /var/lib/mysql exists and that /etc/init.d/mysql exists.

/usr/bin/mysqld and /usr/bin/mysqld_safe should also exist.

If your still having problems then there's a problem with package (assuming you get no errors there). You can "purge" it, "update" and then "install" the package to see if that clears the error.

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

If that still doesn't work you will need to file a bug with the package maintainers.

share|improve this answer
    
/usr/bin/mysqld does not exist. Purging, updating, and reinstalling did not fix the issue, unfortunately. –  Ian Hunter May 18 '13 at 4:57
    
post the complete log as thefourtheeye suggests. –  coteyr May 18 '13 at 5:02
    
The CLI output should be there now--I'm assuming that's what you're talking about, unless there's some aptitude log I should be pulling from. –  Ian Hunter May 18 '13 at 5:04
    
This would appear to be a packing bug, however I know mysql installs on 64bit systems. Do you have anything other then the official repos enabled in software sources? –  coteyr May 18 '13 at 7:18
    
I have added Google Chrome and Node sources, but that should be it. –  Ian Hunter May 18 '13 at 17:40

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

share|improve this answer
    
After creating /var/run/utmp/, I no longer get the error about it missing. But initctl: Unknown job: mysql is still showing up. –  Ian Hunter May 18 '13 at 5:49
    
Look for errors related to mysql or initctl in /var/log/syslog –  thefourtheye May 18 '13 at 6:03
    
/var/log/syslog doesn't exist, but I did find /var/log/mysql/error.log. I've posted its contents in my question. Looks like the same thing as here: gossamer-threads.com/lists/mythtv/mythtvnz/519022 –  Ian Hunter May 18 '13 at 18:20
    
Updated the answer. Please check that –  thefourtheye May 18 '13 at 19:25
    
The remove everything technique worked for me. Thanks!!! –  Ciro Santilli Mar 17 at 7:35

This is probably not a tech solution but more a work around. I've tried this and everything else that's making rounds on the internet to fix this problem. Nothing worked. At last I downgraded the packages back to MYSQL 5.29 and it worked like a charm. Thanks.

share|improve this answer

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.

share|improve this answer

I just had this problem now and solved it.

Although you installed mysql-server, the daemon needs to be running in order for the client to connect to it.

First check to see if mysql server is running:

netsat -tap | grep mysql

You should see something like this:

$ sudo netstat -tap | grep mysql
tcp        0      0 localhost:mysql         *:*          LISTEN     6639/mysqld     

If you don't have the server running, start the daemon by the following command:

/etc/init.d/mysql restart

This should solve your problem if it's installed.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.