Online External Database Connection

Using MySQL in Anvil

Yes, you can connect to MySQL with Anvil! Here are some resources:

Code snippets for connecting and querying MySQL:

A video guide to using an external database from Anvil (it uses Postgres rather than MySQL, but the architecture is all the same):
https://anvil.works/blog/dashboard

And here is a more fleshed out example that uses an external DB (again, Postgres rather than MySQL, but the only difference is how you connect):

(This was also mentioned in Using MySQL from an Anvil app)


Data Tables

Regarding Data Tables, they are accessed using Anvil’s ORM, so the underlying database engine is not exposed to the user (but for completeness: it’s Postgres).

Do you have a specific requirement that MySQL satisfies or is it just that you have legacy data in a MySQL instance?

1 Like