This is a port of the Python package myloginpath. It can read an encrypted login path file.
Install devtools, then run the following R command:
devtools::install_github("nickodell/rmyloginpath")
Create login path file with mysql_config_editor shell command:
$ mysql_config_editor set --login-path=client --host=localhost --user=localuser --password
Enter password: <Type password here>
Use it within R:
> library(rmyloginpath)
> login_parse("client")
$user
[1] "localuser"
$password
[1] "hunter2"
$host
[1] "localhost"