R ++ 3.0.3的MySQL包

时间:2021-07-27 04:23:04

I want to be able to connect to MySQL database from R and run qry in R. I found a package called RMySQL but it is not available for R version 3.0.3. Is there another solution?

我希望能够从R连接到MySQL数据库并在R中运行qry。我找到了一个名为RMySQL的包,但它不适用于R 3.0.3版。还有其他解决方案吗?

Thanks,

谢谢,

1 个解决方案

#1


1  

It is available. Other option is RODBC

它是可用的。其他选择是RODBC

Connect R and MySQL

连接R和MySQL

Please follow these 3 commands to connect R and MySQL database and perform queries.

请按照这3个命令连接R和MySQL数据库并执行查询。

require(RMySQL)
con <- dbConnect(MySQL(),user='username',password='password',host='host name/server id',dbname='database_name') #connect R with MySQL database
res <- dbSendQuery(con, "Your SQL query") #Run your SQL query in R
sql_data <- fetch(res, n = -1) #Extract all row(you can set number of rows by changing the value of "n")

#1


1  

It is available. Other option is RODBC

它是可用的。其他选择是RODBC

Connect R and MySQL

连接R和MySQL

Please follow these 3 commands to connect R and MySQL database and perform queries.

请按照这3个命令连接R和MySQL数据库并执行查询。

require(RMySQL)
con <- dbConnect(MySQL(),user='username',password='password',host='host name/server id',dbname='database_name') #connect R with MySQL database
res <- dbSendQuery(con, "Your SQL query") #Run your SQL query in R
sql_data <- fetch(res, n = -1) #Extract all row(you can set number of rows by changing the value of "n")