Comments (3)
Hello,
To @kforner and all the other poor souls like me fighting to connect using SSL, I did finally manage to connect using the following strategy.
Before proceeding, update the DBI and RMariaDB libraries to the last version using the devtools from within R.
-
obtain the file
rds-combined-ca-bundle.pem
here and save it to disk on your home directory. -
provide a configuration file named
db.conf
(or whatever name you prefer) on your home directory having the following content
[connection_name]
database=database_name
host=your_host_address
user=your_user_name
password=your_password
ssl_ca=/path/to/rds-combined-ca-bundle.pem
- connect to the database via DBI and RMariaDB from R:
## install.packages("devtools")
## devtools::install_github("r-dbi/DBI")
## devtools::install_github("r-dbi/RMariaDB")
library(DBI)
library(RMariaDB)
mydb <- dbConnect(
RMariaDB::MariaDB()
,default.file = '/path/to/db.conf'
,group = 'connection_name'
)
## test the connection
dbGetQuery(mydb,'show tables;')
Hope that helps.
Best regards,
Rafael R. de Moraes
from rmysql.
Hello,
Any comment on this ?
I spent a lot of time providing a complete reproducible example with the mysql server and clients configured...
from rmysql.
for what it's worth, here's my connect function:
mysql_connect <- function(..., drv = MariaDB(), ssl = FALSE, ssl.ca = get_rds_ssl_certificates_bundle()) {
#mysql_connect <- function(..., drv = MariaDB()) {
### ... can be a list of params or a list of a list of params
### we make sure to always a list of params
args <- list(...)
if (length(args) == 1 && is.list(args[[1]])) args <- args[[1]]
if (is.null(args$drv)) args$drv <- drv
if (!is.null(args$ssl)) {
ssl <- args$ssl
args$ssl <- NULL
}
# dbConnect has a bug with a relative default.file
if (!is.null(args$default.file)) {
first_char <- substr(args$default.file, 1, 1)
if (first_char != .Platform$file.sep) # relative path
args$default.file <- paste0('.', .Platform$file.sep, args$default.file)
}
if (ssl) {
if (is.null(args$ssl.ca)) args$ssl.ca <- ssl.ca
}
do.call(DBI::dbConnect, args)
}
from rmysql.
Related Issues (20)
- SSL CA fails HOT 1
- Error when installing RMysql on RHEL 7.3 HOT 3
- Query table of many DECIMAL columns causes error in terminal HOT 5
- RMysql encoding utf8 issue
- mysqlHasDefault() broken on Linux? HOT 1
- SSL - check status HOT 1
- Date datetype is written as text
- Document default database name in the RMySQL::mysqlHasDefault() function
- dbWriteTable fails without row_names column HOT 1
- Installing with Homebrew on OS X Sierra; cannot find RMySQL.so file it just created?
- Implement RStudio Connection Contract HOT 1
- Rows missing on inserting data frame with large character field
- RMySQL fails build with mariadb >10.4 HOT 12
- GenomicFeatures and RMySQL HOT 4
- Cannot connect to MySQL 8.0.11 HOT 3
- Can't install
- Failure to use ~/.my.cnf beginning with v0.10.14 HOT 3
- Unable to install RMySQL on macOS 10.13.6 HOT 7
- host not read from .my.cnf HOT 15
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from rmysql.