r-dbi / RMariaDB

An R interface to MariaDB
https://rmariadb.r-dbi.org
Other
128 stars 40 forks source link

SSL connection to MySQL #341

Open mingchangtsai opened 1 month ago

mingchangtsai commented 1 month ago

I am trying to connect to MySQL using RStudio on macbook pro M1 Max running on MacOS Sonoma 14.5

platform aarch64-apple-darwin20
arch aarch64
os darwin20
system aarch64, darwin20
status
major 4
minor 4.0
year 2024
month 04
day 24
svn rev 86474
language R
version.string R version 4.4.0 (2024-04-24) nickname Puppy Cup

the code that I am using to connect to the database is con <- dbConnect( RMariaDB::MariaDB(), database=‘database_name', host='database_hostname, sslmode='REQUIRED', user = ‘username', password=‘password' )

I get the error Error: Failed to connect: Connections using insecure transport are prohibited while --require_secure_transport=ON.

I checked the connection to database from terminal and I was able to connect without a problem using the command mysql -h dabase_hostname -u username -p

Since I am able to connect without certification (ca-cert.pem, client-cert.pem, client-key.pem) files, then I don’t think I need to use the arguments in the dbConnect command. However, I tried it and still didn’t work for me.

Looking at RMariaDB documentation, there is no argument for sslmode but in mysql documentation, there is argument for —ssl-mode

any advice would be greatly appreciated.

thank you!

krlmlr commented 1 month ago

Thanks. Can you try

con <- dbConnect(
  RMariaDB::MariaDB(),
  database = ‘database_name',
  host = 'database_hostname,
  user = ‘username',
  password = ‘password'
)

without sslmode='REQUIRED', ?

mingchangtsai commented 1 month ago

Hi,

It gave me the same error.

thanks

ming

On Aug 1, 2024, at 7:36 AM, Kirill Müller @.***> wrote:

Thanks. Can you try

con <- dbConnect( RMariaDB::MariaDB(), database = ‘database_name', host = 'database_hostname, user = ‘username', password = ‘password' ) without sslmode='REQUIRED', ?

— Reply to this email directly, view it on GitHub https://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fr-dbi%2FRMariaDB%2Fissues%2F341%23issuecomment-2263238795&data=05%7C02%7C%7Cf4886129154c46d0713a08dcb237568e%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C638581197945723399%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C0%7C%7C%7C&sdata=T5LL0k%2F4N3W4mD%2FNAI39fjCr4xUL%2FJUOKB2tMvoMb40%3D&reserved=0, or unsubscribe https://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fnotifications%2Funsubscribe-auth%2FAKW2CFDDWS72UVPDIDGEOXLZPJBW7AVCNFSM6AAAAABLRFKCB6VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDENRTGIZTQNZZGU&data=05%7C02%7C%7Cf4886129154c46d0713a08dcb237568e%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C638581197945744988%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C0%7C%7C%7C&sdata=A8gN9K6dPysHpcmWuMv07zBIlrSoCwX1UAB4o1fNaos%3D&reserved=0. You are receiving this because you authored the thread.