mysql socket error when running an app through io runs fine locally

Anyone,
I am receiving the following error when I publish an app I built which uses the results of certain mysql queries to fill in the choices for some select inputs. It runs fine locally. However, when try to run the app through io: I get the following error: "Failed to connect to database: Error: Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock'" .
I have scoured the web trying to find a solution to this to no avail. Please help me! Thanks.
Also, I have created the app on a Windows 10 machine. I am using Mysql 5.5. R version 3.5.
If you need more info please let know. Thanks in advance.

How are you making the connection to your Mysql server? is your Mysql server configured to accept remote connections? have in minde that shinyapps.io server is outside your local network and it might have no access to your Mysql server.

andresrcs,
I am using this to code to make the connection:

dbConnect(dbDriver("MySQL"), user='me',password='stuff', dbname = 'dbname',host='',port = 3306)

I am able to pull data from this mysql when I'm logged onto other machines within my LAN at work, provided I'm using to correct ip for host. I am not sure about shinyapps.io. Is there something I must do in order to get it going to make a connection? Perhaps the problem is that I am trying to access mysql from this app within my LAN here at my job which is secured heavily and the outside connection from shinyapps.io is being refused because of firewall protections? Maybe if set this data up on a machine outside of this LAN and tried this I'd have better luck?

If you are using a local ip as host for your connection there is no way that shinyapps.io can connect to it, you need to use a public ip that could be reached remotely, also, you may need to talk with your IT department to figure out if your Mysql server is configured to accept remote connections and what logging method is needed.

Yes, that is an option, you can upload your data to a sql server on a cloud computing service for example, also if you don't need to update your data very frequently you can export your data to a file (e.g. a .csv file), deploy this file along your app and read the data from it.

adresrcs,
I think I can at least verify this with a test at home. If that's the case I won't worry too much about it. However, there will be a time where I will want to be able to publish things within my work LAN that will be dependent on data in databases here. I'm sure there's a work around but I can worry about that later. I appreciate your help.

This is confusing, if you want to deploy apps within your LAN then you need to set up your own shiny-server, and in that case you're not going to have problems at all with your sql connection, but when you deploy to shinyapps.io, you are deploying to a server that is outside your work LAN, that is the reason you are having problems with your connection.

This topic was automatically closed 54 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.