将闪亮的应用程序连接到服务器上的 mysql 数据库
问题描述:
任何人都可以帮助如何将闪亮的 mysql 数据库连接到服务器上.我可以在我的系统上进行本地连接,但我们如何在服务器上进行相同的操作以使其在线可用
can anyone help on how t connect a shiny with mysql database on server. I can do the connection locally on my system but how can we do the same on server to make it available online
答
从 R 控制台安装下面的包
Install below package from R console
install.packages("RMySQL", dependencies = TRUE)
install.packages("RMySQL", dependencies = TRUE)
您可以通过以下方式访问 mysql 数据库:
And you can cennect mysql database as below:
server.R 中的代码:
library(RMySQL)
options(mysql = list(
"host" = "127.0.0.1",
"port" = 3306,
"user" = "myuser",
"password" = "mypassword"
))
databaseName <- "DATABASE NAME"
table <- "TABLE"
希望它能帮助您将您的应用程序连接到 mysql 数据库.如果您仍然需要帮助,请告诉我 :)
Hope it will help you to connect your application with mysql database. If you still need help let me know :)