2

I know that there are lots of questions about this out there but unfortunately none of the solution seems to fix my problem. I have been spending lot of time finding the solution and did not achieve much from my reading with my limited knowledge.

I am using Amazon free tier and hosting a Wordpress site. I have installed LAMP and Wordpress. The website is now in the development mode. Initially everything was good but after some time suddenly I started to receive problem of Error Establishing Database Connection very frequent.

Some findings when the problem appeared:

  1. sudo service mysqld status returned mysqld dead but subsys locked
  2. Deeper in the log:

    InnoDB: Initializing buffer pool, size = 10.0M
    InnoDB: mmap(10731520 bytes) failed; errno 12
    InnoDB: Completed initialization of buffer pool
    InnoDB: Fatal error: cannot allocate memory for the buffer pool
    Completed initialization of buffer pool
    InnoDB: Fatal error: cannot allocate memory for the buffer pool
    [ERROR] Plugin 'InnoDB' init function returned error.
    [ERROR] Plugin 'InnoDB' registration as a STORAGE ENGINE failed.
    [ERROR] Unknown/unsupported storage engine: InnoDB
    [ERROR] Aborting
    /usr/libexec/mysql55/mysqld: Shutdown complete
    

So what I have done are as below but none of them works for me yet:

  1. Restart httpd and mysqld >>>>> OK for few minutes then got the problem again
  2. Make swap file of 1GB >>>>> even 2GB did not work for me. OK for a while (few hours) but the problem come back
  3. Decreased innodb_buffer_pool_size down to 10MB but still not happy

I really have no idea on how to sort this issue. What I realized is whenever I start on the new server, it is good for a while then the problem comes. Any help and guidance are greatly appreciated.

Thanks.

UserProg
  • 599
  • 1
  • 6
  • 21
  • Have you tried solution from here ? http://stackoverflow.com/questions/10284532/amazon-ec2-mysql-aborting-start-because-innodb-mmap-x-bytes-failed-errno-12 – Mukesh Ram May 11 '16 at 09:46
  • @MukeshRam thanks for the suggestion. I have gone through it and I have tried the solution by adding the swap file. That did not work for me too. When it become worse, now I cannot even SSH to my server. Looks like I will need to setup another instance and set this before installing LAMP perhaps? – UserProg May 11 '16 at 17:16

1 Answers1

0

All the above problems you have mentioned happens when you run MYSQL on a AWS free tier EC2 micro instance as it already has less memory. This problem will escalate more when you launch your site live. I will suggest you launch a separate AWS RDS MYSQL server in free tier and use that as the database for your Wordpress website. Check this link AWS RDS Free Tier

You will have many advantages like there is no need to keep up with vendor security and performance patches when you use Amazon RDS, this is taken care of by the AWS. RDS also includes backup and recovery services, eliminating another common task on to-do lists.

error2007s
  • 11,474
  • 5
  • 25
  • 45
  • At the moment I don't have much time to do research on RDS. That is the reason I went to the option above. While changing the value of `innodb_buffer_pool_size` directly in file `my.cnf` works based in the log, I have problem where after I copy file `my-small.cnf` to replace `my.cnf`, the log does not show the value of `innodb_buffer_pool_size` as stated in the new file but rather than showing 128M. Any part I am missing? – UserProg May 26 '16 at 03:44