Question

MySQL stopped and it can't be restart

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.

Subscribe
Share

Submit an 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.

Check this, my friend: I find this info: https://github.com/laradock/laradock/issues/1492 and Dryr commented on 1 May 2018 there

Looks like NO_AUTO_CREATE_USER is causing the issue. Removing it from the ‘mysql/my.cnf’ file seems to fix the issue as well.

I did this and works for me! Try it! ;)

I am also facing the same problem. I do not understand why they are making changes internally. In the starting period its working fine no issue. After a few months, it showing such error. I did not understand what is the business policy? Why every one suggesting increase size? I already increase the size to 2 GB still having the same issue. Many times server going down.

I am also facing the same problem. I do not understand why they are making changes internally. In the starting period its working fine no issue. After a few months, it showing such error. I did not understand what is the business policy? Why every one suggesting increase size? I already increase the size to 2 GB still having the same issue. Many times server going down.

Guys, what the hell…

  1. One-click MySQL install.
  2. Connect from remote serve; You know, the only thing a database does in this configuration…
  3. 3hrs, 5 third party blog tutorials, 10 StackOverflow questions later…
  4. Now I’m here. With a useless database instance, no intelligible errors and nowhere left to turn

This very un-DigitalOcean like. Kind of unreal

Guys, what the hell…

  1. One-click MySQL install.
  2. Connect from remote serve; You know, the only thing a database does in this configuration…
  3. 3hrs, 5 third party blog tutorials, 10 StackOverflow questions later…
  4. Now I’m here. With a useless database instance, no intelligible errors and nowhere left to turn

This very un-DigitalOcean like. Kind of unreal

Hi,

here you have what you asked me:

2017-04-25T11:05:06.131450Z 0 [Note] Binlog end
2017-04-25T11:05:06.131597Z 0 [Note] Shutting down plugin 'CSV'
2017-04-25T11:05:06.132363Z 0 [Note] /usr/sbin/mysqld: Shutdown complete

2017-04-25T11:05:36.361208Z 0 [Warning] Changed limits: max_open_files: 1024 (requested 5000)
2017-04-25T11:05:36.361401Z 0 [Warning] Changed limits: table_open_cache: 431 (requested 2000)
2017-04-25T11:05:36.688896Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
2017-04-25T11:05:36.694729Z 0 [Note] /usr/sbin/mysqld (mysqld 5.7.17-0ubuntu0.16.04.2) starting as process 7624 ...
2017-04-25T11:05:36.708734Z 0 [Note] InnoDB: PUNCH HOLE support available
2017-04-25T11:05:36.708823Z 0 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
2017-04-25T11:05:36.708835Z 0 [Note] InnoDB: Uses event mutexes
2017-04-25T11:05:36.708845Z 0 [Note] InnoDB: GCC builtin __atomic_thread_fence() is used for memory barrier
2017-04-25T11:05:36.708855Z 0 [Note] InnoDB: Compressed tables use zlib 1.2.8
2017-04-25T11:05:36.708865Z 0 [Note] InnoDB: Using Linux native AIO
2017-04-25T11:05:36.709647Z 0 [Note] InnoDB: Number of pools: 1
2017-04-25T11:05:36.710008Z 0 [Note] InnoDB: Using CPU crc32 instructions
2017-04-25T11:05:36.714526Z 0 [Note] InnoDB: Initializing buffer pool, total size = 128M, instances = 1, chunk size = 128M
2017-04-25T11:05:36.714649Z 0 [ERROR] InnoDB: mmap(137428992 bytes) failed; errno 12
2017-04-25T11:05:36.714679Z 0 [ERROR] InnoDB: Cannot allocate memory for the buffer pool
2017-04-25T11:05:36.714707Z 0 [ERROR] InnoDB: Plugin initialization aborted with error Generic error
2017-04-25T11:05:36.714729Z 0 [ERROR] Plugin 'InnoDB' init function returned error.
2017-04-25T11:05:36.714741Z 0 [ERROR] Plugin 'InnoDB' registration as a STORAGE ENGINE failed.
2017-04-25T11:05:36.714767Z 0 [ERROR] Failed to initialize plugins.
2017-04-25T11:05:36.714775Z 0 [ERROR] Aborting

2017-04-25T11:05:36.714803Z 0 [Note] Binlog end
2017-04-25T11:05:36.714950Z 0 [Note] Shutting down plugin 'CSV'
2017-04-25T11:05:36.715472Z 0 [Note] /usr/sbin/mysqld: Shutdown complete

I also checked RAM memory usage with htop, I have 103 Mb free now.

Thank you in advance

Check your droplet’s memory usage and if it’s very high then give it some time to come down and then try again to restart MySQL server.

You can also try restarting Apache2 server by running “service apache2 restart” and then again start mysql server by running “sudo service mysql start”.

I hope it helps.

Hi! I am new to Ubuntu and started coding in Python few days back. Now I’m stuck because of this problem, please help.

afsana@afsana-k:~$ sudo /etc/init.d/mysql start [sudo] password for afsana: […] Starting mysql (via systemctl): mysql.serviceJob for mysql.service failed because the control process exited with error code. See “systemctl status mysql.service” and “journalctl -xe” for details. failed! afsana@afsana-k:~$ /etc/mysql/mysql.conf.d/mysqld.cnf bash: /etc/mysql/mysql.conf.d/mysqld.cnf: No such file or directory afsana@afsana-k:~$ systemctl status mysql.service ● mysql.service - LSB: Start and stop the mysql database server daemon Loaded: loaded (/etc/init.d/mysql; generated) Active: failed (Result: exit-code) since Wed 2019-01-30 20:12:47 +06; 11min a Docs: man:systemd-sysv-generator(8) Process: 3901 ExecStart=/etc/init.d/mysql start (code=exited, status=1/FAILURE

Jan 30 20:12:17 afsana-k systemd[1]: Starting LSB: Start and stop the mysql data Jan 30 20:12:17 afsana-k mysql[3901]: * Starting MariaDB database server mysqld Jan 30 20:12:47 afsana-k mysql[3901]: …fail! Jan 30 20:12:47 afsana-k systemd[1]: mysql.service: Control process exited, code Jan 30 20:12:47 afsana-k systemd[1]: mysql.service: Failed with result 'exit-cod Jan 30 20:12:47 afsana-k systemd[1]: Failed to start LSB: Start and stop the mys lines 1-12/12 (END)…skipping… ● mysql.service - LSB: Start and stop the mysql database server daemon Loaded: loaded (/etc/init.d/mysql; generated) Active: failed (Result: exit-code) since Wed 2019-01-30 20:12:47 +06; 11min ago Docs: man:systemd-sysv-generator(8) Process: 3901 ExecStart=/etc/init.d/mysql start (code=exited, status=1/FAILURE)

Jan 30 20:12:17 afsana-k systemd[1]: Starting LSB: Start and stop the mysql database server daemon… Jan 30 20:12:17 afsana-k mysql[3901]: * Starting MariaDB database server mysqld Jan 30 20:12:47 afsana-k mysql[3901]: …fail! Jan 30 20:12:47 afsana-k systemd[1]: mysql.service: Control process exited, code=exited status=1 Jan 30 20:12:47 afsana-k systemd[1]: mysql.service: Failed with result ‘exit-code’. Jan 30 20:12:47 afsana-k systemd[1]: Failed to start LSB: Start and stop the mysql database server daemon. ~ ~ ~

afsana@afsana-k:~$ tail -30 /var/log/mysql/error.log tail: cannot open ‘/var/log/mysql/error.log’ for reading: No such file or directory afsana@afsana-k:~$ cd tail -30 /var/log/mysql/error.log bash: cd: too many arguments afsana@afsana-k:~$ tail -30 /var/log/mysql/error.log tail: cannot open ‘/var/log/mysql/error.log’ for reading: No such file or directory afsana@afsana-k:~$ ^C afsana@afsana-k:~$ journalctl -xe Jan 30 20:09:04 afsana-k NetworkManager[765]: <info> [1548857344.0713] dhcp4 (enp1s0): nameserver ‘8.8.8.8’ Jan 30 20:09:04 afsana-k NetworkManager[765]: <info> [1548857344.0713] dhcp4 (enp1s0): state changed bound -> bound Jan 30 20:09:04 afsana-k dbus-daemon[742]: [system] Activating via systemd: service name=‘org.freedesktop.nm_dispatcher’ unit='dbus-o Jan 30 20:09:04 afsana-k systemd[1]: Starting Network Manager Script Dispatcher Service… – Subject: Unit NetworkManager-dispatcher.service has begun start-up – Defined-By: systemd – Support: http://www.ubuntu.com/support

– Unit NetworkManager-dispatcher.service has begun starting up. Jan 30 20:09:04 afsana-k dbus-daemon[742]: [system] Successfully activated service ‘org.freedesktop.nm_dispatcher’ Jan 30 20:09:04 afsana-k systemd[1]: Started Network Manager Script Dispatcher Service. – Subject: Unit NetworkManager-dispatcher.service has finished start-up – Defined-By: systemd – Support: http://www.ubuntu.com/support

– Unit NetworkManager-dispatcher.service has finished starting up.

– The start-up result is RESULT. Jan 30 20:09:04 afsana-k nm-dispatcher[3805]: req:1 ‘dhcp4-change’ [enp1s0]: new request (2 scripts) Jan 30 20:09:04 afsana-k nm-dispatcher[3805]: req:1 ‘dhcp4-change’ [enp1s0]: start running ordered scripts… Jan 30 20:09:04 afsana-k dhclient[1134]: bound to 192.168.1.105 – renewal in 3088 seconds. Jan 30 20:12:17 afsana-k sudo[3885]: afsana : TTY=pts/0 ; PWD=/home/afsana ; USER=root ; COMMAND=/etc/init.d/mysql start Jan 30 20:12:17 afsana-k sudo[3885]: pam_unix(sudo:session): session opened for user root by (uid=0) Jan 30 20:12:17 afsana-k systemd[1]: Starting LSB: Start and stop the mysql database server daemon… – Subject: Unit mysql.service has begun start-up – Defined-By: systemd – Support: http://www.ubuntu.com/support

– Unit mysql.service has begun starting up. Jan 30 20:12:17 afsana-k mysql[3901]: * Starting MariaDB database server mysqld Jan 30 20:12:47 afsana-k /etc/init.d/mysql[4448]: 0 processes alive and '/usr/bin/mysqladmin --defaults-file=/etc/mysql/debian.cnf pi Jan 30 20:12:47 afsana-k /etc/init.d/mysql[4448]: [61B blob data] Jan 30 20:12:47 afsana-k /etc/init.d/mysql[4448]: error: 'Can’t connect to local MySQL server through socket '/var/run/mysqld/mysqld. Jan 30 20:12:47 afsana-k mysql[3901]: …fail! Jan 30 20:12:47 afsana-k /etc/init.d/mysql[4448]: Check that mysqld is running and that the socket: ‘/var/run/mysqld/mysqld.sock’ exi Jan 30 20:12:47 afsana-k systemd[1]: mysql.service: Control process exited, code=exited status=1 Jan 30 20:12:47 afsana-k /etc/init.d/mysql[4448]: Jan 30 20:12:47 afsana-k systemd[1]: mysql.service: Failed with result ‘exit-code’. Jan 30 20:12:47 afsana-k systemd[1]: Failed to start LSB: Start and stop the mysql database server daemon. – Subject: Unit mysql.service has failed – Defined-By: systemd – Support: http://www.ubuntu.com/support

– Unit mysql.service has failed.

– The result is RESULT. Jan 30 20:12:47 afsana-k sudo[3885]: pam_unix(sudo:session): session closed for user root Jan 30 20:14:07 afsana-k gnome-shell[2235]: Some code accessed the property ‘WindowPreviewMenu’ on the module ‘windowPreview’. That p Jan 30 20:17:01 afsana-k CRON[4631]: pam_unix(cron:session): session opened for user root by (uid=0) Jan 30 20:17:01 afsana-k CRON[4632]: (root) CMD ( cd / && run-parts --report /etc/cron.hourly) Jan 30 20:17:01 afsana-k CRON[4631]: pam_unix(cron:session): session closed for user root

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)

I tried all posiible solution and yours solutions, but same error with error log,please help me am stuck,your an expert and iam newbie to servers and thanks in adavance: Job for mysql.service failed because the control process exited with error code. See “systemctl status mysql.service” and “journalctl -xe” for details.

root@CampuseraDroplet:~# tail -30 /var/log/mysql/error.log 2018-01-05T11:56:22.047595Z 0 [Note] Shutting down plugin ‘INNODB_FT_DELETED’ 2018-01-05T11:56:22.047599Z 0 [Note] Shutting down plugin ‘INNODB_FT_DEFAULT_STO PWORD’ 2018-01-05T11:56:22.047602Z 0 [Note] Shutting down plugin ‘INNODB_METRICS’ 2018-01-05T11:56:22.047605Z 0 [Note] Shutting down plugin ‘INNODB_TEMP_TABLE_INF O’ 2018-01-05T11:56:22.047608Z 0 [Note] Shutting down plugin ‘INNODB_BUFFER_POOL_ST ATS’ 2018-01-05T11:56:22.047611Z 0 [Note] Shutting down plugin ‘INNODB_BUFFER_PAGE_LR U’ 2018-01-05T11:56:22.047615Z 0 [Note] Shutting down plugin ‘INNODB_BUFFER_PAGE’ 2018-01-05T11:56:22.047618Z 0 [Note] Shutting down plugin ‘INNODB_CMP_PER_INDEX_ RESET’ 2018-01-05T11:56:22.047621Z 0 [Note] Shutting down plugin ‘INNODB_CMP_PER_INDEX’ 2018-01-05T11:56:22.047625Z 0 [Note] Shutting down plugin ‘INNODB_CMPMEM_RESET’ 2018-01-05T11:56:22.047628Z 0 [Note] Shutting down plugin ‘INNODB_CMPMEM’ 2018-01-05T11:56:22.047649Z 0 [Note] Shutting down plugin ‘INNODB_CMP_RESET’ 2018-01-05T11:56:22.047653Z 0 [Note] Shutting down plugin ‘INNODB_CMP’ 2018-01-05T11:56:22.047656Z 0 [Note] Shutting down plugin ‘INNODB_LOCK_WAITS’ 2018-01-05T11:56:22.047659Z 0 [Note] Shutting down plugin ‘INNODB_LOCKS’ 2018-01-05T11:56:22.047661Z 0 [Note] Shutting down plugin ‘INNODB_TRX’ 2018-01-05T11:56:22.047664Z 0 [Note] Shutting down plugin ‘InnoDB’ 2018-01-05T11:56:22.047855Z 0 [Note] InnoDB: FTS optimize thread exiting. 2018-01-05T11:56:22.048380Z 0 [Note] InnoDB: Starting shutdown… 2018-01-05T11:56:22.149021Z 0 [Note] InnoDB: Dumping buffer pool(s) to /var/lib/ mysql/ib_buffer_pool 2018-01-05T11:56:22.149466Z 0 [Note] InnoDB: Buffer pool(s) dump completed at 18 0105 11:56:22 2018-01-05T11:56:23.370580Z 0 [Note] InnoDB: Shutdown completed; log sequence nu mber 2674079 2018-01-05T11:56:23.372460Z 0 [Note] InnoDB: Removed temporary tablespace data f ile: “ibtmp1” 2018-01-05T11:56:23.372481Z 0 [Note] Shutting down plugin ‘MEMORY’ 2018-01-05T11:56:23.372494Z 0 [Note] Shutting down plugin ‘CSV’ 2018-01-05T11:56:23.372500Z 0 [Note] Shutting down plugin ‘sha256_password’ 2018-01-05T11:56:23.372503Z 0 [Note] Shutting down plugin ‘mysql_native_password ‘ 2018-01-05T11:56:23.372914Z 0 [Note] Shutting down plugin ‘binlog’ 2018-01-05T11:56:23.373409Z 0 [Note] /usr/sbin/mysqld: Shutdown complete