0

Say, a client browser is accessing my website and data is flowing between it and my backend MySQL server. At this particular moment, a superuser on the server side issues an unscheduled system shutdown or scheduled cron job that results in a restart of LAMP stack (i.e., Apache, PHP-FQM and MySQL servers). Will that potentially corrupt the MySQL database?

What would be a good practice in this scenario?

0

This ** should** not cause any issues, for 2 reasons -

  1. If a shutdown/restart command is issued, a signal is sent to the database server to allow it to get to a sane state before shutting down.

  2. Modern databases (and filesystems) - including modern version of MySQL have a journaling system which ensure consistency in event if a sudden loss of power/shutdown.

Caveat - this answer assumes a properly written approval - one that, where a nber if changes need to be written as a single block - uses a transaction, and/or the database has appropriate consistency restraints. (If everything does not write, it rolls back). It is possible for a badly written app and database schema to write a partial set of changes which can cause errors at the application level because assumptions about relationships if data are invalidated by some data being written - but this is nor technically data corruption.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.