Does this help?
https://dev.mysql.com/doc/connector-python/en/connector-python-example-connecting.html
Note, OnlineGDB does not have support for the package mentioned in the above solution, but on your own PC you can install whatever packages you'd like (see how here).