PMa
PMa

Reputation: 1771

MySQL package for R version 3.0.3

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

Answers (1)

Ashvin Meena
Ashvin Meena

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

Related Questions