0

I am new to aws server configuration. I have setup an nginx web server with mariadb database server for my php/laravel web application. My database server was running good for the last few days hence my website was running without any error. But yesterday the database server has been stopped working automatically. I tried to start mariadb but it is not starting.

I noticed that the database server (mariadb) stops working after a few days of my fresh server installation. I suspect it could be a memory problem but I cannot find out the problem.

I have setup the the server following the aws documentation: https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ec2-lamp-amazon-linux-2.html

Can anyone give some ideas about the problem?

2
  • 1
    Check your logs. Commented Jan 15, 2021 at 20:42
  • Where is the log file? I cannot find mysql folder inside log folder but there is a mariadb folder.Here is the screenshot prnt.sc/wvhnb2
    – Rejaul
    Commented Jan 16, 2021 at 16:53

2 Answers 2

0

Kindly check the error logs. The error log contains a record of critical errors that occurred during the server's operation, table corruption, start and stop information.

On Linux, the default location is /var/log/mysql/ 

You will find the actual reason for what is the problem of the MariaDB server once you check the error log.

2
  • I cannot find mysql folder inside log folder but there is a mariadb folder.Here is the screenshot prnt.sc/wvhnb2
    – Rejaul
    Commented Jan 16, 2021 at 16:53
  • Ok then open mariadb file and check it.
    – Stanley
    Commented Jan 17, 2021 at 4:38
0

I have solved my own problem. Following Stanley's answer, I opened the log file: /var/log/mariadb/mariadb.log. There I found line

mariadb Cannot allocate memory

That means, the RAM size of my server was not enough to run all the applications. That's why mariadb server was getting stopped. There are two solution:

  1. Increasing the RAM size
  2. Creating a swap space

I choose the second option and followed amazon's documentation: https://aws.amazon.com/premiumsupport/knowledge-center/ec2-memory-swap-file/

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .