2

I am getting an error message " error in evaluating the argument 'drv' in selecting a method for function 'dbConnect': could not find function "MySQL""

Here is the part of the code:

library(DBI) 
conn <- dbConnect( drv = RMySQL::MySQL(), dbname = "xxx", host = "xxx", username = "xxx", password = "new_password") 
dbGetQuery(conn, "SELECT * FROM tech LIMIT 1;") 
dbDisconnect(conn)
Sam Firke
  • 21,571
  • 9
  • 87
  • 105
Mahmood
  • 21
  • 1
  • 2

1 Answers1

1

If you're using a script in an interactive session, call library(RMySQL) to load the package.

If you get this error while developing a package, add RMySQL to the Imports field of your DESCRIPTION file. You can do that with usethis::use_package("RMySQL").

Sam Firke
  • 21,571
  • 9
  • 87
  • 105