#########################
### connect to MySQL to fetch data
## load the required library
library(RMySQL)
#### create the connection
con <- dbConnect(MySQL(),
user = 'username',
password = 'password',
host = 'host address',
dbname='database name')
## write the mysql query to fetch the required data
data = dbGetQuery(conn = con, statement = "your MySQL statement")
### close the Mysql connection
dbDisconnect(con)
con=dbConnect(MySQL(),user="itlab",password="itlab@321", host="10.21.33.3",dbname="yelp_db")
business_data = dbGetQuery(conn = con, statement = "select * from business")
class(business_data)
### connect to MySQL to fetch data
## load the required library
library(RMySQL)
#### create the connection
con <- dbConnect(MySQL(),
user = 'username',
password = 'password',
host = 'host address',
dbname='database name')
## write the mysql query to fetch the required data
data = dbGetQuery(conn = con, statement = "your MySQL statement")
### close the Mysql connection
dbDisconnect(con)
con=dbConnect(MySQL(),user="itlab",password="itlab@321", host="10.21.33.3",dbname="yelp_db")
business_data = dbGetQuery(conn = con, statement = "select * from business")
class(business_data)
Comments
Post a Comment