Connect to a local database from phpmyadmin with R


I have searched for a lot of threads explaining the connexion with a database with R but I still can't make it work.

At the moment, I know that I have to install the package 'ROBDC' and use either odbcConnect() or odbcDriverConnect(). But the first one seems harder since I have to set an OBDC connection (tried some things but didn't work too t.t).

My final goal is to extract some data in a database located in a web server but, first, I wanted to see how the functions work for a local database created with Wamp Server. I'm currently working on Windows 7.

My database's name is 'extraction' and the id is 'root' (no pwd, usually) so I wrote :

install.packages('RODBC',repos="http://cran.rstudio.com/") odbcDriverConnect(Driver='mysql'; Server=localhost; Database=extraction; Uid='root'; pwd='')

I don't know if the syntax is correct, I have tried a lot and always the same error with drivers and data source unobtainable.

Here the full message (in French sorry D:)

<hr /><blockquote>

"[RODBC] ERROR: state IM002, code 0, message [Microsoft][Gestionnaire de pilotes ODBC] Source de données introuvable et nom de pilote non spécifié"

</blockquote> <hr />

I used this function to avoid the dns thing required for obdcConnect() but still I don't know if I'm doing the right thing (obvsly not since he doesn't work :D) but it's my first time trying with R to interact with databases so I don't know where to go even with all the help I have looked for.

Thanks in advance.


Well, I found a solution with a package called RMySQL

install.packages('RMySQL') require(RMySQL) #if already installed con <- dbConnect(RMySQL::MySQL(), host = "localhost",dbname="extraction",user = "root", password = "") test_extraction <- dbReadTable(con, "utilisateurs") #utilisateurs is a table from my database called extraction


  • PDF Rendering with PDFBox 2.0 and Decrypting
  • Conditional required properties in interface
  • Android Get Mapview on Fling stopped animating
  • MIPS assembly - random integer range
  • Jhipster not loading font awesome icons
  • Autolayout collapsing space when removing intermediate views
  • Clojure: slurping structs from file fails with string attributes containing whitespaces
  • Swagger Codegen (with maven plugin) for OpenAPI 3.0
  • Rails 4: Using PostgreSQL function in order causes error in query due to the includes table not bein
  • add catalog product in wishlist programmatically in magento
  • Password_verify in PHP
  • Echo-ing unicode character
  • How to find unmatched rows in oracle without using set operator and join & also Query the unmatc
  • WooCommerce Free Shipping - Remove raw or change the text name on checkout and email
  • how to set onItemClickListener() in a dialog listview?
  • Missing App Store icon codename one build
  • NextJS auth with an external server
  • Repeatable job for Laravel json api
  • how to synchronize web site content while loading page
  • Google Geocoding API limit exceeded on cell network, but not on wifi
  • Python C binding error
  • iOS - open another application that exists on the phone?
  • Read specific column from Parquet without using Spark
  • Detect when MathJax has finished loading in UIWebView
  • What's the difference between using RDFS/OWL and XML?
  • Sorting Custom Listview Items Using Spinner Android
  • I need a PHP mySQL Login script that directs user to specific URL based on username and password
  • Shiny - change the size (padding?) of dropdown menu (select tags) smaller
  • Why do you need 2 Javascript files for cross-platform Cordova plugin?
  • content must have a ListView whose id attribute is 'android.R.id.list'
  • JavaMail connection problems [duplicate]
  • Calculate time from document
  • 'url' requires a non-empty first argument. The syntax changed in Django 1.5, see the docs
  • Amazon Elastick BeanStalk error: Failed to create the AWS Elastic Beanstalk application version
  • How to specify generic type when the type is only known at runtime?
  • Functions by reference or by variable, which to use when?
  • Excel VBA : conditional formatting of sheet1 cells from sheet2 values in excel 2007
  • Codeigniniter insert data through models and controller
  • How to use FirstOrDefault inside Include
  • Write to .csv file with PHP (Commas in Data Error)