# Using SSL with MySQL.jl?

**URL:** https://discourse.julialang.org/t/using-ssl-with-mysql-jl/26181
**Category:** New to Julia
**Created:** [July 9, 2019, 10:05am UTC](https://discourse.julialang.org/t/using-ssl-with-mysql-jl/26181 "2019-07-09T10:05:17Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![julien\_goo](https://avatars.discourse-cdn.com/v4/letter/j/ce73a5/32.png) [@julien\_goo](https://discourse.julialang.org/u/julien_goo)
#### Post date: [July 9, 2019, 10:05am UTC](https://discourse.julialang.org/t/using-ssl-with-mysql-jl/26181/1 "2019-07-09T10:05:17Z")

</div>

Hi all !  
I’m trying to connect to a MySQL db using MySQL.jl  
I have hard time using the SSL protocol.  
The connection :

```julia
conn = MySQL.connect(
        db_ip,
        user,
        password,
        db=db_name,
        opts=Dict(
            MySQL.API.MYSQL_OPT_SSL_CA => "mysql-root.pem",
            MySQL.API.MYSQL_OPT_SSL_CERT => "mysql-reader.crt",
            MySQL.API.MYSQL_OPT_SSL_KEY => "mysql-reader.key"
        )
    )

```

returns the error:

```julia
(3159): Connections using insecure transport are prohibited while --require_secure_transport=ON.
#connect#11(::String, ::Int64, ::String, ::UInt32, ::Dict{Any,Any}, ::Function, ::String, ::String, ::String) at MySQL.jl:38
#connect at none:0 [inlined]
connect_weenai() at SqlUtils.jl:11
top-level scope at none:0

```

Any idea how to set up correctly the SSL connection ?  
I use this database via Python (and R) without any problem, following:

```julia
MySQLdb.connect(
        host=db_ip, 
        user=user, 
        passwd=password,
        db=db_name,
        ssl={
                'ca' : "mysql-root.pem",
                'cert' : "ween-mysql-reader.crt",
                'key' : "ween-mysql-reader.key"
                }
    )

```

I suspect it is only my connection definition in Julia that is poorly defined. Thx for any advice !

---

<div class="post-metadata">

### Author: ![quinnj](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/quinnj/32/11_2.png) [@quinnj](https://discourse.julialang.org/u/quinnj)
#### Post date: [July 10, 2019, 4:41am UTC](https://discourse.julialang.org/t/using-ssl-with-mysql-jl/26181/2 "2019-07-10T04:41:07Z")

</div>

I’m not familiar enough w/ how mysql + ssl work together to know what’s wrong here, but I tend to agree; it seems like there’s some setting or something that’s not set right. If you do a bit of research, either mysql docs or another language package docs, I’m happy to help debug and walk through the MySQL.jl package side of things to help figure it out.

---

<div class="post-metadata">

### Author: ![julien\_goo](https://avatars.discourse-cdn.com/v4/letter/j/ce73a5/32.png) [@julien\_goo](https://discourse.julialang.org/u/julien_goo)
#### Post date: [July 15, 2019, 10:27am UTC](https://discourse.julialang.org/t/using-ssl-with-mysql-jl/26181/3 "2019-07-15T10:27:25Z")

</div>

I’m back on this issue. I tried some potential tricks to solve it, including:

- Absolute paths for the certificates
- modify the my.cnf file to allow secure and remote transactions
- replace mariadb dep by mysql-client

without success.

_Local_ MySQL connections without SSL do work fine using `MySQL.jl`.

---

<div class="post-metadata">

### Author: ![mrufsvold](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/mrufsvold/32/31600_2.png) [@mrufsvold](https://discourse.julialang.org/u/mrufsvold)
#### Post date: [November 4, 2022, 11:24pm UTC](https://discourse.julialang.org/t/using-ssl-with-mysql-jl/26181/4 "2022-11-04T23:24:41Z")

</div>

Did anyone ever solve this? Python SQLAlchemy is connecting to the database on AWS without any SSL info (just user and password). But MySQL.jl is throwing the same `insecure_transport` error.
