Report this

What is the reason for this report?

MySQL stopped and it can't be restart

Posted on April 25, 2017

Hi there,

I have a big issue on my droplet.

Today, after pull from my git repo, I install a php extension (imagick).

After that, mysql began to start/stop frequenty, and now I am not able to restart it.

If i try:

sudo service mysql restart

It says me

Job for mysql.service failed because the control process exited with error code. See "systemctl status mysql.service" and "journalctl -xe" for details.

Log of journalctl -xe says:

-- Subject: Unit mysql.service has failed
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
-- 
-- Unit mysql.service has failed.
-- 
-- The result is failed.
Apr 25 10:41:38 wordpress-512mb-ams3-01 systemd[1]: mysql.service: Unit entered failed state.
Apr 25 10:41:38 wordpress-512mb-ams3-01 systemd[1]: mysql.service: Failed with result 'exit-code'.
Apr 25 10:41:38 wordpress-512mb-ams3-01 systemd[1]: mysql.service: Service hold-off time over, scheduling restart.
Apr 25 10:41:38 wordpress-512mb-ams3-01 systemd[1]: Stopped MySQL Community Server.
-- Subject: Unit mysql.service has finished shutting down
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
-- 
-- Unit mysql.service has finished shutting down.
Apr 25 10:41:38 wordpress-512mb-ams3-01 systemd[1]: Starting MySQL Community Server...
-- Subject: Unit mysql.service has begun start-up
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
-- 
-- Unit mysql.service has begun starting up.
Apr 25 10:41:38 wordpress-512mb-ams3-01 audit[3864]: AVC apparmor="DENIED" operation="open" profile="/usr/sbin/mysqld" name="/proc/3864/status" pid=3864 comm="mysqld" requested_mask="r" denied_mask="r" fsuid=112 ouid=112
Apr 25 10:41:38 wordpress-512mb-ams3-01 kernel: audit: type=1400 audit(1493116898.796:1567): apparmor="DENIED" operation="open" profile="/usr/sbin/mysqld" name="/proc/3864/status" pid=3864 comm="mysqld" requested_mask="r" denied_mask="r" fsuid=112 ouid=112
Apr 25 10:41:38 wordpress-512mb-ams3-01 audit[3864]: AVC apparmor="DENIED" operation="open" profile="/usr/sbin/mysqld" name="/sys/devices/system/node/" pid=3864 comm="mysqld" requested_mask="r" denied_mask="r" fsuid=112 ouid=0
Apr 25 10:41:38 wordpress-512mb-ams3-01 audit[3864]: AVC apparmor="DENIED" operation="open" profile="/usr/sbin/mysqld" name="/proc/3864/status" pid=3864 comm="mysqld" requested_mask="r" denied_mask="r" fsuid=112 ouid=112
Apr 25 10:41:38 wordpress-512mb-ams3-01 kernel: audit: type=1400 audit(1493116898.812:1568): apparmor="DENIED" operation="open" profile="/usr/sbin/mysqld" name="/sys/devices/system/node/" pid=3864 comm="mysqld" requested_mask="r" denied_mask="r" fsuid=112 ouid=0
Apr 25 10:41:38 wordpress-512mb-ams3-01 kernel: audit: type=1400 audit(1493116898.812:1569): apparmor="DENIED" operation="open" profile="/usr/sbin/mysqld" name="/proc/3864/status" pid=3864 comm="mysqld" requested_mask="r" denied_mask="r" fsuid=112 ouid=112
Apr 25 10:41:39 wordpress-512mb-ams3-01 systemd[1]: mysql.service: Main process exited, code=exited, status=1/FAILURE

And finally, /var/log/mysql/error.log says:

2017-04-25T10:45:43.868541Z 0 [ERROR] InnoDB: Plugin initialization aborted with error Generic error
2017-04-25T10:45:43.868576Z 0 [ERROR] Plugin 'InnoDB' init function returned error.
2017-04-25T10:45:43.868596Z 0 [ERROR] Plugin 'InnoDB' registration as a STORAGE ENGINE failed.
2017-04-25T10:45:43.868615Z 0 [ERROR] Failed to initialize plugins.
2017-04-25T10:45:43.868629Z 0 [ERROR] Aborting

2017-04-25T10:45:43.868673Z 0 [Note] Binlog end
2017-04-25T10:45:43.868837Z 0 [Note] Shutting down plugin 'CSV'
2017-04-25T10:45:43.869563Z 0 [Note] /usr/sbin/mysqld: Shutdown complete

Any help would be appreciated, thank you in advance.



This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

I have similar problem. MariaDB is installed, works fine, but I cannot “stop” or “restart” it.

Although I have requested service stop, MariaDB is still “running” in the background and seems to me - ignores anything further :)

This is my

systemctl status mysql.service

output:

root@mysql-master:~# systemctl status mysql.service
● mysql.service - LSB: Start and stop the mysql database server daemon
   Loaded: loaded (/etc/init.d/mysql; bad; vendor preset: enabled)
   Active: failed (Result: exit-code) since Tue 2018-02-27 11:50:59 UTC; 4min 57s ago
     Docs: man:systemd-sysv-generator(8)
  Process: 22040 ExecStop=/etc/init.d/mysql stop (code=exited, status=1/FAILURE)
  Process: 21767 ExecStart=/etc/init.d/mysql start (code=exited, status=0/SUCCESS)
    Tasks: 27
   Memory: 394.3M
      CPU: 3.161s
   CGroup: /system.slice/mysql.service
           ├─21795 /bin/bash /usr/bin/mysqld_safe
           ├─21936 /usr/sbin/mysqld --basedir=/usr --datadir=/var/lib/mysql --plugin-dir=/usr/lib/mysql/plugin --user=mysql --skip-log-error --pid-file=/var/run/mysqld/mysqld.pid --socket=/var/run/mysqld/mys
           └─21937 logger -t mysqld -p daemon error

Feb 27 11:50:59 mysql-master systemd[1]: Stopping LSB: Start and stop the mysql database server daemon...
Feb 27 11:50:59 mysql-master mysql[22040]:  * Stopping MariaDB database server mysqld
Feb 27 11:50:59 mysql-master mysql[22040]:    ...fail!
Feb 27 11:50:59 mysql-master systemd[1]: mysql.service: Control process exited, code=exited status=1
Feb 27 11:50:59 mysql-master systemd[1]: Stopped LSB: Start and stop the mysql database server daemon.
Feb 27 11:50:59 mysql-master systemd[1]: mysql.service: Unit entered failed state.
Feb 27 11:50:59 mysql-master systemd[1]: mysql.service: Failed with result 'exit-code'.
Feb 27 11:51:59 mysql-master systemd[1]: Stopped LSB: Start and stop the mysql database server daemon.
Feb 27 11:53:43 mysql-master systemd[1]: Stopped LSB: Start and stop the mysql database server daemon.
Feb 27 11:53:45 mysql-master systemd[1]: Stopped LSB: Start and stop the mysql database server daemon.
lines 1-24/24 (END)

@hansen @jtittle Ok guys, I resized my droplet to 1Gb and now everything seems to be ok (and website also seems to go faster).

I also activated an alert if RAM consume is greater than 70% for above 10 minutes.

Do you suggest me some other tool to install or run some optimisation to avoid RAM usage problems?

Is 1Gb droplet suitable for a wordpress site with average traffic of maybe is required the 2Gb solution?

Thanks again for your help guys, I really appreciated it :)

Hi @gianmarcotoscano

Can you run and post tail -30 /var/log/mysql/error.log? Just need to get a few more lines of the crash. You need to run it after MySQL stopped.

I suspect you’re running out of RAM, but the log will tell us.

The developer cloud

Scale up as you grow — whether you're running one virtual machine or ten thousand.

Get started for free

Sign up and get $200 in credit for your first 60 days with DigitalOcean.*

*This promotional offer applies to new accounts only.