It kind of follows a set of best practices regarding secured connections and networking rather than CMS connecting to a DB Server.
For example, if your ecosystem is all on the same machine, as mentioned above, connection is done through sockets.
If you need to separate the database layer from the web layer, usually this is done in private networks so that the SQL server has no connection with the outside world (i.e. the case with AWS EC2 + RDS).
Connecting via internet between a web server and a dbase server is not a recommended approach as, even if encrypted, you have the security issue of the “man-in-the-middle” and someone can sniff your traffic and try to decrypt it.
I hope this brings a bit more context to your question and the answers provided.