Some information is so important that you cannot afford to lose it.
Consider the name and password for authenticating users. If a person
registers at a site that charges a subscription fee, it would be
unfortunate if his subscription details were lost the next time the
web server was restarted. In this case, the information must be
stored in a non-volatile way, and that usually means on disk. Several
options are available, ranging from flat files to DBM files to
fully-fledged relational databases. Which one you choose will depend
on a number of factors, including:

The size of each record and the volume of the data to be stored

The number of concurrent accesses (to the server or even to the same
data)

Data complexity (do all the records fit into one row, or are there
relations between different kinds of record?)

Budget (some database implementations are great but very expensive)

Failover and backup strategies (how important it is to avoid
downtime, how soon the data must be restored in the case of a system
failure)