Database backups in production

what is your best recipe for keeping production database backups ?
obviously I have multiple options for backups, but my question is related to scenario lik this:

the production dB got hacked and the admin has not noticed until the next day (or even a week).
if the backup is created then malicious code (within the table) is stored in dB,
how to avoid it ?
how to scan database against it ?
what’s your best approach ?
run it externally VS internally (from the project) ?

In my case it’s MySQL, but the same will probably apply to all SQL databases.

It is not simple answer to this question. It is some (not so cheap) solutions to contain this case scenario.

If you wish simple solution, I suggest to have backups like snapshoots for the long period of time. At my personal oppinion is the best solution if you make your backups on data tapes. When you store it, it cannot spread across the system. Then you can restore on a separate server and play with it to figure out the solution.

For more complex and automated solution, you can contact me personally.

I hope this helped somehow.