Why is MySQL installation failing on my freshly-created droplet?

July 1, 2017 216 views
MySQL Ruby on Rails Ubuntu 16.04

I have been following the steps in these tutorials:
https://www.digitalocean.com/community/tutorials/how-to-install-ruby-on-rails-with-rvm-on-ubuntu-16-04
https://www.digitalocean.com/community/tutorials/how-to-install-mysql-on-ubuntu-16-04

I am at step 2 of the MySQL setup, where I am instructed to run sudo mysql_secure_installation. Unfortunately, I encounter the following error:

Process: 12721 ExecStartPre=/usr/share/mysql/mysql-systemd-start pre (code=exi ted, status=1/FAILURE)

This is my first time deploying a Rails application and I don't have much idea how to interpret/solve technical problems like this. I just want to deploy my app. Can anyone help?

1 Answer

Hi @rjayhutchinson

Can you show the last 40 lines from the MySQL error log?

tail -40 /var/log/mysql/error.log

It might be crashing because of low RAM - how much do you have in your droplet?

  • My droplet is small -- 512 MB RAM

    Your command returned the following:

    tail: cannot open '/var/log/mysql/error.log' for reading: Permission denied

  • Got the tail command to work. I had to prepend sudo to the command.

    2017-06-30T23:46:41.918168Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
    2017-06-30T23:46:41.934011Z 0 [ERROR] InnoDB: mmap(137428992 bytes) failed; errno 12
    2017-06-30T23:46:41.934038Z 0 [ERROR] InnoDB: Cannot allocate memory for the buffer pool
    2017-06-30T23:46:41.934043Z 0 [ERROR] InnoDB: Plugin initialization aborted with error Generic error
    2017-06-30T23:46:41.934048Z 0 [ERROR] Plugin 'InnoDB' init function returned error.
    2017-06-30T23:46:41.934052Z 0 [ERROR] Plugin 'InnoDB' registration as a STORAGE ENGINE failed.
    2017-06-30T23:46:41.934057Z 0 [ERROR] Failed to initialize plugins.
    2017-06-30T23:46:41.934059Z 0 [ERROR] Aborting
    
    2017-06-30T23:47:52.316892Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
    2017-06-30T23:47:52.321542Z 0 [Note] mysqld (mysqld 5.7.18-0ubuntu0.16.04.1) starting as process 17632 ...
    2017-06-30T23:47:52.342074Z 0 [Note] InnoDB: PUNCH HOLE support available
    2017-06-30T23:47:52.342170Z 0 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
    2017-06-30T23:47:52.342185Z 0 [Note] InnoDB: Uses event mutexes
    2017-06-30T23:47:52.342190Z 0 [Note] InnoDB: GCC builtin __atomic_thread_fence() is used for memory barrier
    2017-06-30T23:47:52.342194Z 0 [Note] InnoDB: Compressed tables use zlib 1.2.8
    2017-06-30T23:47:52.342197Z 0 [Note] InnoDB: Using Linux native AIO
    2017-06-30T23:47:52.343256Z 0 [Note] InnoDB: Number of pools: 1
    2017-06-30T23:47:52.347196Z 0 [Note] InnoDB: Using CPU crc32 instructions
    2017-06-30T23:47:52.353490Z 0 [Note] InnoDB: Initializing buffer pool, total size = 128M, instances = 1, chunk size = 128M
    2017-06-30T23:47:52.353713Z 0 [ERROR] InnoDB: mmap(137428992 bytes) failed; errno 12
    2017-06-30T23:47:52.353726Z 0 [ERROR] InnoDB: Cannot allocate memory for the buffer pool
    2017-06-30T23:47:52.353730Z 0 [ERROR] InnoDB: Plugin initialization aborted with error Generic error
    2017-06-30T23:47:52.353736Z 0 [ERROR] Plugin 'InnoDB' init function returned error.
    2017-06-30T23:47:52.354847Z 0 [ERROR] Plugin 'InnoDB' registration as a STORAGE ENGINE failed.
    2017-06-30T23:47:52.354862Z 0 [ERROR] Failed to initialize plugins.
    2017-06-30T23:47:52.354865Z 0 [ERROR] Aborting
    
    2017-06-30T23:47:52.354934Z 0 [Note] Binlog end
    2017-06-30T23:47:52.356034Z 0 [Note] mysqld: Shutdown complete
    
    • @rjayhutchinson

      You need to increase your pool size, but my guess would be that you're also maxing out your RAM already.
      Try changing the pool size to 256MB by editing the innodb-buffer-pool-size usually located in /etc/mysql/my.cnf

Have another answer? Share your knowledge.