Install following packages: - RMySQL https://cran.r-project.org/web/packages/RMySQL/index.html

require(RMySQL)
## Loading required package: RMySQL
## Loading required package: DBI

Connect to database using following crudentials:

mydb <- dbConnect(MySQL(), user = "User", password = "Password", dbname = "tb", host = "localhost")

Retrieve the dataset:

reviews <- dbGetQuery(mydb, "select * from moviereviews")
reviews
##   movie_id          title rating viewer_name
## 1        1     Spider-Man      5         Sam
## 2        2     Wind River      4      Roland
## 3        3        Dunkirk      4     Barbara
## 4        4 The Dark Tower      2       Sofia
## 5        5    Tulip Fever      3        John
## 6        6  Atomic Blonde      5       James