Non-serverless database connection

Is there a way to connect a deployed Netlify application to a non-serverless database?

I’m using express and want to connect to either a Google Cloud SQL DB or a Planet Scale SQL database, and the only integration solutions I find are serverless. For my current project I used express with mysql2 and successfully accessed PSDB and GCDB, but upon deployment I find I’m forced to discard the server altogether along with the routing.

Serverless is a fine option, but is there an alternative to keep the server and routes? What would be the network configurations for doing so? does someone have a step-by-step solution to configure ip addresses in firewalls, auth keys, and so on? suggestions greatly appreciated.

@magis You can achieve this by hosting your backend elsewhere then proxying to it:

To redirect using a proxy in a _redirects file for a MySQL connection string, you would need to use the Proxy directive. But MySQL connections don’t work over HTTP or HTTPS like typical web requests. MySQL connections use the MySQL protocol, which requires a MySQL client library to establish the connection. So you cannot directly proxy a MySQL connection string using Netlify redirects.

@magis I never suggested connecting to MySQL directly via a redirect.

You indicated that you have an express implementation, I’d presumed that was your “backend”, basically an API that your frontend would make requests to.

If it’s “your entire application”, (e.g. your express server is also returning page content at runtime), then you simply want to use another hosting provider.

The PS database is MySQL

@magis Precisely where/what the database is doesn’t matter much.

You’ve indicated you want an option other than serverless, and there is only the one, if you have a “server” it has to be hosted elsewhere.