Using MySQL from an Anvil app

Re-posted from my inbox:

Is there any way to connect MySQL with Anvil, and how can we sync our external database with an Anvil Project?

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):

I hope this helps!

1 Like