Skip to content

Unable to connect to MySQL Database #1

Description

@amsharma9

Hi,

I am new to Rust and trying to build an API. I setup this application and .env file with proper values on Windows 10 machine running Wampserver MySql. I have created the users table in the database which I am using. It compiles but when I run I get the following error:

thread 'main' panicked at 'Failed to create db pool.: Error(Some("SSL connection error: unknown error number"))', src\db.rs:23:28

Switching on BackTrace provides some more details given below:

   0: std::panicking::begin_panic_handler
             at /rustc/4b91a6ea7258a947e59c6522cd5898e7c0a6a88f/library\std\src\panicking.rs:584
   1: core::panicking::panic_fmt
             at /rustc/4b91a6ea7258a947e59c6522cd5898e7c0a6a88f/library\core\src\panicking.rs:142
   2: core::result::unwrap_failed
             at /rustc/4b91a6ea7258a947e59c6522cd5898e7c0a6a88f/library\core\src\result.rs:1805
   3: enum$<core::result::Result<r2d2::Pool<diesel::r2d2::ConnectionManager<diesel::mysql::connection::MysqlConnection> >,r2d2::Error> >::expect<r2d2::Pool<diesel::r2d2::ConnectionManager<diesel::mysql::connection::MysqlConnection> >,r2d2::Error>
             at /rustc/4b91a6ea7258a947e59c6522cd5898e7c0a6a88f\library\core\src\result.rs:1055
   4: core::ops::function::FnOnce::call_once<r2d2::Pool<diesel::r2d2::ConnectionManager<diesel::mysql::connection::MysqlConnection> > (*)(),tuple$<> >
             at /rustc/4b91a6ea7258a947e59c6522cd5898e7c0a6a88f\library\core\src\ops\function.rs:248
   5: lazy_static::lazy::impl$0::get::closure$0<r2d2::Pool<diesel::r2d2::ConnectionManager<diesel::mysql::connection::MysqlConnection> >,r2d2::Pool<diesel::r2d2::ConnectionManager<diesel::mysql::connection::MysqlConnection> > (*)()>
             at C:\Users\MESPL\.cargo\registry\src\github.com-1ecc6299db9ec823\lazy_static-1.4.0\src\inline_lazy.rs:31
   6: std::sync::once::impl$4::call_once::closure$0<lazy_static::lazy::impl$0::get::closure_env$0<r2d2::Pool<diesel::r2d2::ConnectionManager<diesel::mysql::connection::MysqlConnection> >,r2d2::Pool<diesel::r2d2::ConnectionManager<diesel::mysql::connection::Mysq
             at /rustc/4b91a6ea7258a947e59c6522cd5898e7c0a6a88f\library\std\src\sync\once.rs:276

Searching on internet shows that probably the client trying to connect to DB is old and doesn't support latest protocols like TLS 1.2 etc. Just FYI, I was getting below errors earlier while creating Diesel CLI. To resolve the below issue I had installed MySQL client as given in the below link:
could not find native static library mysqlclient #3224

error: could not find native static library `mysqlclient`, perhaps an -L flag is missing?
error: could not compile `mysqlclient-sys` due to previous error
warning: build failed, waiting for other jobs to finish...

Kindly let me know if you have any suggestions to help me resolve this.

TIA

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions