Hi:

Because R does not have a direct interface to MySQL?

You need to load a communication package - the two most common ones are
RODBC and RMySQL. The former requires that you register your MySQL database
table(s) with ODBC before using the RODBC package on them, whereas the
latter works with specific version combinations of MySQL and R. The RODBC
package has a very informative vignette; for information re the RMySQL
package, see
http://biostat.mc.vanderbilt.edu/wiki/Main/RMySQL

HTH,
Dennis

On Mon, Jan 17, 2011 at 1:30 PM, schlafly <andrewschlafly@gmail.com> wrote:

>
> I have a local installation of MySQL on my computer.
>
> I enter the following to access MySQL from the command line:
> /Applications/MAMP/Library/bin/mysql -h localhost -u root -p
> I am then prompted for a password, and I use: root
> This connects me to MySQL in the command line.
>
> I now want to access MySQL databases in R. I enter the following:
> mysql <- dbDriver("MySQL")
> conn <- dbConnect(mysql,user='root',host='localhost', password='root')
>
> I get the following error message: Error in mysqlNewConnection(drv, ...) :
> RS-DBI driver: (Failed to connect to database: Error: Access denied for
> user
> 'root'@'localhost' (using password: YES)
>
> Does anyone know why these aren't equivalent?
> --
> View this message in context:
> http://r.789695.n4.nabble.com/Accessing-MySQL-Database-in-R-tp3221264p3221264.html
> Sent from the R help mailing list archive at Nabble.com.
>
> ______________________________________________
> R-help@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide
> http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>

	[[alternative HTML version deleted]]

