Reputation: 167
I can access the database if I run the app from my local machine without problems, but after deployment on shinyapps.io, I get an error ("The application failed to start."). I suppose that I need to change to host IP from localhost to something else, but the IP address of my database instance does not work either.
pool<- dbPool(
drv = RMySQL::MySQL(),
dbname = 'XXXXXX',
username = 'XXXXXX',
password = 'XXXXXX',
host = '127.0.0.1',
port = 3307
)
For the local connection, I use Cloud SQL Proxy.
This question is similar but without Cloud hosting: Error to connect to database (Mysql) when publising shiny app
Upvotes: 1
Views: 304
Reputation: 480
To connect to your Cloud SQL
instance using public ip, the IP address of your Shiny server where your app is deployed must configured as an authorized network
You may check this link on how to configure authorized networks and connect your Cloud SQL
instance using public ip address.
Note: If you're going to deploy your application, you may need to modify the host IP and use your sql instance public ip address in your code.
Upvotes: 1