Connecting and getting mysql connection object
Obvious (dumb) point - I'd suggest using logging instead of print
I would have some kind of builder for _CFG so I could choose if I use environment variables for configuration or something else
Instead of str.format, you may want to use fstring: f"{_CFG["user"]} connecting to {_CFG["database"]} on {_CFG["host"]}."
Instead of yield None you may want to reraise exception (from the docs, "If an exception is trapped merely in order to log it or to perform some action (rather than to suppress it entirely), the generator must reraise that exception"). Otherwise, your code will fail with a funny exception.