1

I installed fresh XUbuntu desktop 14.04 (as a dev system) and then lamp server using sudo apt-get install lamp-server^. I can type mysql and mysql console run but if I try service mysql start I got:

start: Unknown job: mysql

How to deal with that?

Joe
  • 333
  • 1
  • 6
  • 12
  • 1
    try `sudo service mysql start` – exussum May 30 '14 at 11:51
  • also, verify mysql-server is installed and lamp-server didn't do anything wonky: `dpkg -l 'mysql-server*'` – Andrew Domaszek May 30 '14 at 12:12
  • Exussum gave good solution. I'm not great at linux yet so I assumed if I added myself to the sudo group and edited `sudoers` file I should have done that without typing sudo. It seems I have to do that anyway. – Joe Jun 05 '14 at 09:43

4 Answers4

2

You can also try

sudo /etc/init.d/mysql start

If even in this way it doesn't start try reinstalling it:

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

By the way, this issue seems similar to a problem caused by a bug, have a look at this discussion: Why did installation of MySQL 5.6 on Ubuntu 14.04 fail?

shardan
  • 321
  • 1
  • 8
1

You don’t have permission.

sudo service mysql status

This should know show you the status of the mysql job.

0

I have the same problem, even with the command :

sudo service mysql status

The result was:

status: Unknown job: mysql

But it work perfect with:

/etc/init.d/mysql start

And also like Shardan said, you can purge, update and install it again.

0

I faced the same problem on Linux Mint 17.2 (Ubuntu based) distro and KDE, MySQL 5.5.

I identified two problems:

  1. Using a terminal in KDE I'm not able to stop and start the mysql service and I got the error: Unknown job: mysql ;
  2. I got an error in the log Can't start server, Bind on unix socket: Permission denied , mysql had no permission to create the mysqld socket and the mysql process fails to start.

The first 'KDE related' problem is a Mystery, I suppose it is related to the Akonadi service using his own mysqld instance. The solution is.. let's work out of KDE, directly using a textual shell (pressing CTRL-ALT-F?), in this way I was able to start and stop the mysql service (service mysql start/stop).

The second one, in my case, was caused by wrong Apparmor configurations, I suggest to check inside the /etc/apparmor.d folder and look for these files: ./local/usr.sbin.mysqld ./usr.sbin.mysqld

They may be lacking or may contain errors (yes, apparmor mis-configuration or they have been damaged), in my case I changed the two configuration files in this way:

./usr.sbin.mysqld

# vim:syntax=apparmor
# Last Modified: Tue Jun 19 17:37:30 2007
#include <tunables/global>

/usr/sbin/mysqld {
  #include <abstractions/base>
  #include <abstractions/nameservice>
  #include <abstractions/user-tmp>
  #include <abstractions/mysql>
  #include <abstractions/winbind>

  capability dac_override,
  capability sys_resource,
  capability setgid,
  capability setuid,

  network tcp,

  /etc/hosts.allow r,
  /etc/hosts.deny r,

  /etc/mysql/*.pem r,
  /etc/mysql/conf.d/ r,
  /etc/mysql/conf.d/* r,
  /etc/mysql/*.cnf r,
  /usr/lib/mysql/plugin/ r,
  /usr/lib/mysql/plugin/*.so* mr,
  /usr/sbin/mysqld mr,
  /usr/share/mysql/** r,
  /var/log/mysql.log rw,
  /var/log/mysql.err rw,
  /var/lib/mysql/ r,
  /var/lib/mysql/** rwk,
  /var/lib/mysql-files/ r,
  /var/lib/mysql-files/** rwk,
  /var/log/mysql/ r,
  /var/log/mysql/* rw,
  /var/run/mysqld/mysqld.pid rw,
  /var/run/mysqld/mysqld.sock w,
  /run/mysqld/mysqld.pid rw,
  /run/mysqld/mysqld.sock w,

  /sys/devices/system/cpu/ r,

  # Site-specific additions and overrides. See local/README for details.
  #include <local/usr.sbin.mysqld>
}

./local/usr.sbin.mysqld

# Site-specific additions and overrides for usr.sbin.mysqld.
# For more details, please see /etc/apparmor.d/local/README.
/var/lib/mysql/** rwk,
/var/log/mysql/ r,
/var/log/mysql/* rw,
/{,var/}run/mysqld/mysqld.pid w,
/{,var/}run/mysqld/mysqld.sock w,

/sys/devices/system/cpu/ r,
/home/manolinux/.opentpv/** rw,

I applied the major changes to the ./local/usr.sbin.mysqld configuration file.

Please note that you have to adapt them to the paths in your current distro/enviromet.

In conclusion, the mysql error may be due to strange KDE "interactions" or Apparmor misconfiguration. Very important: in case, do not use a KDE terminal to start/stop the mysql service. Hope useful