Trying to start my mysql service.

/etc/init.d/mysql start

returns:

Job failed. See system logs and 'systemctl status' for details.

Further:

systemctl status mysql.service

returns:

mysql.service - LSB: Start the MySQL database server
      Loaded: loaded (/etc/init.d/mysql)
      Active: failed since Mon, 04 Aug 2014 16:20:43 -0400; 38s ago
     Process: 14148 ExecStop=/etc/init.d/mysql stop (code=exited, status=0/SUCCESS)
     Process: 16457 ExecStart=/etc/init.d/mysql start (code=exited, status=1/FAILURE)
      CGroup: name=systemd:/system/mysql.service

Any ideas how I can find out what's happening?

That latest entry in /var/log/mysql/mysqld.log:

140805 08:52:42 mysqld_safe Starting mysqld daemon with databases from /var/lib/mysql
140805  8:52:42 [ERROR] mysqld: Can't lock aria control file '/var/lib/mysql/aria_log_control' for exclusive use, error: 11. Will retry for 30 seconds
140805  8:53:13 [ERROR] mysqld: Got error 'Could not get an exclusive lock; file is probably in use by another process' when trying to use aria control file '/var/lib/mysql/aria_log_contr$
140805  8:53:13 [ERROR] Plugin 'Aria' init function returned error.
140805  8:53:13 [ERROR] Plugin 'Aria' registration as a STORAGE ENGINE failed.
140805  8:53:13 [ERROR] Failed to initialize plugins.
140805  8:53:13 [ERROR] Aborting

140805  8:53:13 [Note] /usr/sbin/mysqld: Shutdown complete

140805 08:53:13 mysqld_safe mysqld from pid file /var/run/mysql/mysqld.pid ended
  • 2
    Look in your MySQL logs. Their location may vary in different distros, but start looking in /var/log/mysql. You'll probably need to be root to access it. Post anything useful in your question. – garethTheRed Aug 4 '14 at 21:01
  • 1
    Have you ever setup mysql (run mysql_secure_installation as root)? – SailorCire Aug 4 '14 at 21:29
  • @SailorCire Yes, I believe that is what I did. – smilebomb Aug 5 '14 at 12:53
  • @garethTheRed Please see my edit. – smilebomb Aug 5 '14 at 12:56
  • It's telling you it can't start because the control file is opened by another process. Run lsof /var/lib/mysql/aria_log_control and it should tell you what has it open. On my system that file is opened by mysqld. – garethTheRed Aug 5 '14 at 13:09
up vote 4 down vote accepted

The /var/lib/mysql/aria_log_control file is open by another process and consequently, mysqld fails to start.

Check who/what is currently has the file open with:

lsof `/var/lib/mysql/aria_log_control`

It should list the process(es) that has it open.

COMMAND  PID  USER   FD   TYPE DEVICE SIZE/OFF   NODE NAME
mysqld  1506 mysql   10uW  REG  253,1       52 263948 /var/lib/mysql/aria_log_control

If the process definitely shouldn't be running, then shut it down with:

sudo kill -SIGTERM <PID>

If that fails:

sudo kill -SIGKILL <PID>

Or reboot.

Go to your /etc/my.cnf file, and check the datadir and tmpdir variables. Go to those directories, and check the permissions of the files within them. If there's any file owned by root, change the permissions to something like mysql:mysql and try again.


Example:

In /etc/my.cnf you found:

datadir = /var/lib/mysql

Try the following and then try to start mysql again:

chown mysql:mysql /var/lib/mysql
  • That is the same directory for datadir in my my.cnf. Everything in that directory is owned by mysql user and mysql group except for the directory itself and a subdirectory (/var/lib/mysql/mysql) that is owned by the mysql user and root group with drwx------ permissions. – smilebomb Aug 5 '14 at 13:04

The problem is the mysql_install_db script in packages mariadb-server-5.5.34-2.fc20 and community-mysql-server-5.5.35-1.fc20. It does not set up proper permissions on server data directory. Run following command as root to fix it:

chown -R mysql:mysql /var/lib/mysql

credits to: https://www.moucha.cc/charon/tag/mariadb/

Had this error on my Raspberry Pi. Went to /var/lib/mysql and found a file named raspberrypi.err. In it I saw that during startup it found a line in /etc/mysql/my.cnf that it didn't like. The offending line in my case was bind-address but it might be a good place to start looking.

Your Answer

 

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

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