Connect to the database as below.
install.packages("odbc")
db = dbConnect(odbc(),
Driver = "MySQL ODBC 5.3 ANSI Driver",
Server = "127.0.0.1",
database = "database name",
uid = "username",
pwd = "password")
Install odbc, then provide database details. If successfully connected, the tables will be shown in the connection tab on the top right corner