"Error establishing a database connection" When BOT attacks occur

My Wordpress website gets “Error establishing a database connection” error with a simple BOT attack. It reopens after a few minutes. This attack is sent from free BOT sites. My CloudFlare account is in “UnderAttack” mode. But why can’t he even afford such a simple attack? Because anyone can do it. I tried it myself. My website crashed instantly. I really need help. What should I do?