Plugin: connect to external database without showing password

I think that it’s rare for a plugin to make a direct DB connection, for the very reason you’re citing (among others, like port concerns, DB security best practices, etc.).

In most cases, if you want your plugins to connect to an external data source, it’s best to do it using an API. So you’d access the information via HTTP, rather than a DB connection.

If the information you’re providing to the plugin is not sensitive, this is way easy to accomplish: just create an endpoint (yourserver.com/some-info/) that provides the info as JSON (or some other structured data format like XML). Your plugin can then request that info via a plain ol’ GET request.

If your data is sensitive, or if you need the clients to have write permissions, you’ll want to add an auth mechanism to your API. Users would then need to authenticate, and to provide a valid token in order to access the data.

It might sound daunting at first, but most good PHP frameworks make it pretty easy to roll your own API–you just need basic routing, and authentication. And Apigee provides a good (free, in exchange for your contact info) overview of API design here.