R Connect MySQL

Source: Internet
Author: User
Tags mysql odbc driver

You can use R to analyze directly, in the following steps:
1, R download RODBC package, installed.
2, in Http://dev.mysql.com/downloads/connector/odbc
Download MySQL ODBC and install it properly.
3. Windows: Control Panel, administrative Tools, data source (ODBC), double-click Add, select MySQL ODBC driver
Fill in: Data source name an entry you want to use the name, you name it, for example: Mysql_data;
Description A random fill, such as MyData
TCP/IP server fills in the native server IP, generally: 127.0.0.1
User fills in your MySQL username
Password fill in your MySQL password
The database will then appear in your MySQL database, select a database.
Are you sure.

4. Open the interface of R to call the database:

  1 
2
3
4
  library  ( R ODBC )  ;    
channel  <-  odbcconnect ( "MySQL _ data" ,  uid = "root" , pwd = "123 ) ; &NBSP
SqlTables ( channel ) ; #查看数据中的表  
Data <- sqlFetch ( channel , "Kegg" ) # View the contents of the table, save in the data frame
Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.