Download the software to connect R to MySQL database:-
1:- Download and Install MySQL database for Windows from link
2:- Download the latest version of R and Install.
Here is the link:- Download R
3:- Download and Install MySQL ODBC connector for Windows.
Here is the link to download:- MySQL ODBC connector
4:- Configuring MySQL ODBC connector using this link:
Configuring a Connector/ODBC DSN on Windows
5:- Start R and go to Packages option, select load package option and select RODBC package.
channel <- odbcConnect("MySQL_ODBC", uid="root")
result <- paste("select * from t_target")
Where DSN(Data Source Name) = MySQL_ODBC or whatever you gave at step 4.