Opening your local machine up to the internet is generally not possible, or at least not advised. Whether you can host a database locally and make it publicly available will be a function of whether your internet provider allows this sort of functionality (through static IP addresses, opening firewall ports, etc.)
From a Streamlit perspective, Streamlit sharing will have secrets management released in about a month or so. This will allow you to have your passwords securely managed via the Streamlit sharing interface, without having your credentials in your publicly-available code. So shortly, yes, you will be able to securely access a database from Streamlit.
Secrets management is now available in Streamlit sharing! You need to upgrade to version 0.80 of Streamlit, the temporary documentation location is linked below.