Suddenly mysql/mariadb won't start

5,304

The issue is that the system cannot assign any memory to the process to be able to start, you either need to stop some other processes so that memory is free to be allocated to MariaDB or you need to add more RAM or SWAP space to the server so that the processes can start correctly.

Share:
5,304
Ryan Prentiss
Author by

Ryan Prentiss

Updated on September 18, 2022

Comments

  • Ryan Prentiss
    Ryan Prentiss over 1 year

    Suddenly, after simply adding a few tables to database within the install... the service won't start. Any help welcome.

    systemctl start mariadb
    Job for mariadb.service failed. See 'systemctl status mariadb.service' and 'journalctl -xn' for details.
    
    systemctl status mariadb
    mariadb.service - MariaDB database server
       Loaded: loaded (/usr/lib/systemd/system/mariadb.service; enabled)
       Active: failed (Result: exit-code) since Wed 2015-01-07 22:47:01 EST; 9s ago
      Process: 19037 ExecStartPost=/usr/libexec/mariadb-wait-ready $MAINPID (code=exited, status=1/FAILURE)
      Process: 19036 ExecStart=/usr/bin/mysqld_safe --basedir=/usr (code=exited, status=0/SUCCESS)
      Process: 19009 ExecStartPre=/usr/libexec/mariadb-prepare-db-dir %n (code=exited, status=0/SUCCESS)
     Main PID: 19036 (code=exited, status=0/SUCCESS)
    
    Jan 07 22:47:00 JX-Store systemd[1]: Starting MariaDB database server...
    Jan 07 22:47:00 JX-Store mysqld_safe[19036]: 150107 22:47:00 mysqld_safe Logging to '/var/log/mariadb/mariadb.log'.
    Jan 07 22:47:00 JX-Store mysqld_safe[19036]: 150107 22:47:00 mysqld_safe Starting mysqld daemon with databases from /var/lib/mysql
    Jan 07 22:47:00 JX-Store mysqld_safe[19036]: 150107 22:47:00 mysqld_safe mysqld from pid file /var/run/mariadb/mariadb.pid ended
    Jan 07 22:47:01 JX-Store systemd[1]: mariadb.service: control process exited, code=exited status=1
    Jan 07 22:47:01 JX-Store systemd[1]: Failed to start MariaDB database server.
    Jan 07 22:47:01 JX-Store systemd[1]: Unit mariadb.service entered failed state.
    
    Jan 07 22:47:00 JX-Store systemd[1]: Starting MariaDB database server...
    -- Subject: Unit mariadb.service has begun with start-up
    -- Defined-By: systemd
    -- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
    --
    -- Unit mariadb.service has begun starting up.
    Jan 07 22:47:00 JX-Store mysqld_safe[19036]: 150107 22:47:00 mysqld_safe Logging to '/var/log/mariadb/mariadb.log'.
    Jan 07 22:47:00 JX-Store mysqld_safe[19036]: 150107 22:47:00 mysqld_safe Starting mysqld daemon with databases from /var/lib/mysql
    Jan 07 22:47:00 JX-Store mysqld_safe[19036]: 150107 22:47:00 mysqld_safe mysqld from pid file /var/run/mariadb/mariadb.pid ended
    Jan 07 22:47:01 JX-Store systemd[1]: mariadb.service: control process exited, code=exited status=1
    Jan 07 22:47:01 JX-Store systemd[1]: Failed to start MariaDB database server.
    -- Subject: Unit mariadb.service has failed
    -- Defined-By: systemd
    -- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
    --
    -- Unit mariadb.service has failed.
    --
    -- The result is failed.
    Jan 07 22:47:01 JX-Store systemd[1]: Unit mariadb.service entered failed state.
    

    mariadb.log

    150107 22:47:00 mysqld_safe Starting mysqld daemon with databases from /var/lib/mysql
    150107 22:47:00 InnoDB: The InnoDB memory heap is disabled
    150107 22:47:00 InnoDB: Mutexes and rw_locks use GCC atomic builtins
    150107 22:47:00 InnoDB: Compressed tables use zlib 1.2.7
    150107 22:47:00 InnoDB: Using Linux native AIO
    150107 22:47:00 InnoDB: Initializing buffer pool, size = 128.0M
    InnoDB: mmap(137756672 bytes) failed; errno 12
    150107 22:47:00 InnoDB: Completed initialization of buffer pool
    150107 22:47:00 InnoDB: Fatal error: cannot allocate memory for the buffer pool
    150107 22:47:00 [ERROR] Plugin 'InnoDB' init function returned error.
    150107 22:47:00 [ERROR] Plugin 'InnoDB' registration as a STORAGE ENGINE failed.
    150107 22:47:00 [ERROR] mysqld: Out of memory (Needed 128917504 bytes)
    150107 22:47:00 [ERROR] mysqld: Out of memory (Needed 96681984 bytes)
    150107 22:47:00 [Note] Plugin 'FEEDBACK' is disabled.
    150107 22:47:00 [ERROR] Unknown/unsupported storage engine: InnoDB
    150107 22:47:00 [ERROR] Aborting
    
    150107 22:47:00 [Note] /usr/libexec/mysqld: Shutdown complete
    
    150107 22:47:00 mysqld_safe mysqld from pid file /var/run/mariadb/mariadb.pid ended
    
    • Michael Hampton
      Michael Hampton over 9 years
      Well, that error looks pretty obvious. What have you done so far to try to fix it?
    • Ryan Prentiss
      Ryan Prentiss over 9 years
      @MichaelHampton Lol, keep attempting to restart.
    • Chris Davidson
      Chris Davidson over 9 years
      What type of server is this @RyanPrentiss, if it's a VM that has no SWAP, a good place to start would be adding a swap partition.
  • Ryan Prentiss
    Ryan Prentiss over 9 years
    Thanks for answering. I ended up doubling my ram by moving the site to a larger instance.
  • Ryan Prentiss
    Ryan Prentiss over 9 years
    Just read your other comment. I was running on 512MB, but am now up to 1G. Will look to add a swap on top of that for any spikes.