title: Connect to MySQL database with RMySQL
body: <p>I am making the move from <code>RSQLite</code> to <code>RMySQL</code> and I am confused by the <code>user</code> and <code>password</code> fields. FWIW, I'm running Windows 7, R 2.12.2, MySQL 5.5 (all 64 bit), and RMySQL 0.7-5. </p>
  
  <p>I installed <code>RMySQL</code> as prescribed in this <a href="https://stackoverflow.com/questions/5223113/using-mysql-in-r-for-windows">previous SO question</a>, and as far as I know it works (i.e., I can load the package with <code>library(RMySQL)</code>). But when I try to run the tutorial from the <a href="http://cran.r-project.org/doc/manuals/R-data.html" rel="nofollow noreferrer">R data import guide</a>, I get a "failed to connect to database..." error. This is the code from the tutorial from the guide:</p>
  
  <pre><code>library(RMySQL) # will load DBI as well
  ## open a connection to a MySQL database
  con &lt;- dbConnect(dbDriver("MySQL"), user = "root", password = "root", dbname = "pookas")
  ## list the tables in the database
  dbListTables(con)
  ## load a data frame into the database, deleting any existing copy
  data(USArrests)
  dbWriteTable(con, "arrests", USArrests, overwrite = TRUE)
  dbListTables(con)
  ## get the whole table
  dbReadTable(con, "arrests")
  ## Select from the loaded table
  dbGetQuery(con, paste("select row_names, Murder from arrests",
                        "where Rape &gt; 30 order by Murder"))
  dbRemoveTable(con, "arrests")
  dbDisconnect(con)
  </code></pre>
  
  <p>On the second line I get the following error:</p>
  
  <pre><code>&gt; con &lt;- dbConnect(dbDriver("MySQL"), user = "richard", password = "root", dbname = "pookas")
  Error in mysqlNewConnection(drv, ...) : 
    RS-DBI driver: (Failed to connect to database: Error: Access denied for user 'richard'@'localhost' (using password: NO)
  )
  </code></pre>
  
  <p>I have tried with and without <code>user</code> and <code>password</code> and with admin as <code>user</code>. I have also tried using a <code>dbname</code> that I made before with the command line and with one that doesn't exist.</p>
  
  <p>Any tips? Is there a good reference here? Thanks!</p>