Learn R language, want to get the data on the MySQL database through Rmysql, but the installation rmysql often can not be one-time installation success, sometimes entangled on a few hours, or even a few days, like I tangled up a night just to fix, follow the steps below, in Rstudio R (PS: Recommended Rstu Dio software) A successful installation in the language integration development environment. It was also a lot of posts before it was successfully installed on the Win7 system.
Specific steps:
1. Install R-3.0.0 (installation directory: F:program FilesRR-3.0.0)
2. Install Rtools (installation directory: F:rtools)
Rtools Download Address http://cran.r-project.org/bin/windows/Rtools/(find the corresponding version to rtools installation)
This step is important to add R and Rtools directories to the environment variable Path:f:program filesrr-3.0.0binx64; F:rtoolsbin; F:rtoolsgcc-4.6.3bin;
3. Install Rmysql Dependency Pack "DBI"
Open R x64 3.0.0, run install.packages (' DBI ')
4. Download Rmysql
Install.packages (' Rmysql ', type= ' source ')
The installation process prompts "Error:configuration failed for package ' rmysql '."
No matter what, remember the package download the saved directory
5. Create a file under the F:program filesrr-3.0.0etc folder Renviron.site
Mysql_home= "D:/program files/mysql/mysql Server 5.5"
(Note that if the path contains spaces, it must be quoted in double quotes)
6. Under D:program filesmysqlmysql Server 5.5lib folder, create new folder opt, and copy Libmysql.dll and libmysql.lib to opt folder
7. Copy Libmysql.dll to D:program filesmysqlmysql Server 5.5bin
8. Open the command line cmd.exe, and enter the following command to install:
R CMD INSTALL "< package download directory >/rmysql_0.9-3.tar.gz"
can be installed successfully.
Possible reasons for installation failure:
1. Check the MySQL installation directory contains spaces, if the contents of the Renviron.site file must be quoted in double quotes.
2. Check if the bin directory for R and Rtools is included in the environment variable path, if there is no need for manual additions.
3. The direct operation of Install.packages (' Rmysql ', type= ' source ') is not successful and needs to be installed on the command line using R CMD install.