[R-SIG-Finance] RMySQL - setDefaults requires clear text name/password?

Mark Knecht markknecht at gmail.com
Fri Dec 20 20:03:19 CET 2013


I'm using RMySQL saving data from Yahoo. It's working nicely, but as
best I can tell the setDefaults function seems to require me to put
the MySQL account name and password in clear text in my R program
which I don't like. I.e. - the one commented out below works, the one
currently not commented out fails later when using
getSymbols(,src="MySQL")

As best I can tell everything else I'm using - most of which I think
comes from the DBI package - is using /home/mark/.my.cnf to get these
values. I can connect to the database, read and write it, etc. It's
only the getSymbols command I'm having trouble with.

Is there a way around this that keeps the password out of my files and
out of the file.Rout file when I run in batch mode?

Thanks,
Mark


if (UseMySQL){
  if (MyAdjust) { dbName = paste0(dbName, "Adjust")}
  dbc = dbConnect(MySQL(), dbname=dbName)
#  setDefaults(getSymbols.MySQL, user="mark", password="TmpPasswd",
dbname=dbName)
  setDefaults(getSymbols.MySQL, dbname=dbName)
}



More information about the R-SIG-Finance mailing list