I’m testing the possibility to connect to a Digital Ocean managed mySql instance from a Cloudflare Worker. Cloudflare provides a mySql driver for Workers, but reading the docs I understood that in order for it to work, you need to setup a Cloudflare tunnel, and that the server running mySql needs to run cloudflared in order to securely access the tunnel. Did I understand correclty? Has anyone faced this problem before, and how did you solve it?
References:
This textbox defaults to using Markdown to format your answer.
You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!
These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.
Hi there,
Cloudflare recently announced
connect()
which is a new API for creating TCP sockets from Cloudflare Workers. The full announcement post can be found here:As far as I can tell from that announcement post, they’re aiming for the adding two popular MySQL drivers, mysql and mysql2, to work on Workers soon, with more to follow.
I’ve also been looking into a similar setup but for Postgres, however, the complexity of the old approach has always kept me reluctant of trying it. This will enormously simplify the whole setup!
Hope that this helps!
Best,
Bobby