As you know that Mysql is database software. We store data in it with the help of SQL (structured query language). Approximately 512 MB (Megabyte) ram is recommended to proper work MySql.
For example, If you create a droplet on the Digitalocean cloud server with 1 GB of ram and 1 CPU. And, then Install a server operating system like ubuntu and web server software apache to run WordPress on it. In this case, Only MySQL software will consume almost 512 MB (0.5 GB) of RAM. So now the remaining 0.5 GB ram will be used by the operating system (and other processes).
Now, almost 90% ram is used and you edit some heavy posts on WordPress dashboard or your website gets some traffic. You will see “Error establishing a database connection” when you visit your site because MySql database engine has stopped on the server because of the least RAM.
To restart MySql again use command-
sudo systemctl start mysql