Friday, October 24, 2014

User Authentication Parameters in .my.cnf

The RMySQL documentation (http://cran.r-project.org/web/packages/RMySQL/RMySQL.pdf) recommends placing user authentication parameters (user, password, database, and host) in the config file. This file is read from $HOME/.my.cnf.  I found this file did not exist so I copied the my.cnf file from /etc/mysql to my home directory and changed ownership (sudo chown...).  Next I added a group and my authentication parameters to the file.  I could then used 'con <- dbConnect(MySQL(), group = "group name")' in R to connect to my database.  This might be more secure if I were to continue using R Studio server from a separate computer, but my plan is to run R scripts locally initiated from PHP files, so I don't think there is any enhancement security in my case, but it does work.

No comments:

Post a Comment