Reputation: 1771
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?
Thanks,
Upvotes: 1
Views: 242
Reputation: 309
It is available. Other option is RODBC
Connect R and MySQL
Please follow these 3 commands to connect R and MySQL database and perform queries.
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")
Upvotes: 1