Connection DB with Shiny

As you know you can not connect your LOCAL MYSQL DB with Shiny. You can see the explanation in below:

So how do we allow local MySQL database? Anyone using Shiny and MySQL before? What do I have to do?

Thank you!

That is not what the linked article says, it is perfectly possible to connect Shiny with almost any local database server, including MySQL for sure, you just need to configure proper access rights and make sure that the database is reachable from outside your local network (assuming your Shiny app is deployed outside your local network).

You need to give more details about your setup and what have you tried so far that is not working, for us been able to help you.

My Code:

con=DBI::dbConnect(RMySQL::MySQL(),
                           dbname='db_name',
                           host='my_ip',
                           username='username',
                           password='pass')

I use MySQL Workbench at MacBook. I closed firewall on my PC. How can I give an access to Shiny to reach my DB?

By the way it is worked for the database that I created at www.freesqldatabase.com.

Thank you.

This is not related to shiny but to your network configuration. Your public IP is assigned to your router/modem, not to a specific computer in your network, if you want your database to be accessible from the internet you need to configure port forwarding in your router to redirect incoming traffic on MySQL's port towards your server, sadly this is extremely system specific and outside this forum's scope so I can only give you general pointers but not specific instructions about how to proceed.

1 Like