diff --git a/lib/MySQL_Monitor.cpp b/lib/MySQL_Monitor.cpp index b7cfc8391..b905933b3 100644 --- a/lib/MySQL_Monitor.cpp +++ b/lib/MySQL_Monitor.cpp @@ -1501,7 +1501,7 @@ __exit_set_wait_timeout: bool MySQL_Monitor_State_Data::create_new_connection() { mysql=mysql_init(NULL); assert(mysql); - if (use_ssl) { + if (use_ssl && port) { mysql_ssl_set(mysql, mysql_thread___ssl_p2s_key, mysql_thread___ssl_p2s_cert, diff --git a/lib/mysql_connection.cpp b/lib/mysql_connection.cpp index 1abe046f1..467dca398 100644 --- a/lib/mysql_connection.cpp +++ b/lib/mysql_connection.cpp @@ -710,7 +710,7 @@ void MySQL_Connection::connect_start() { } mysql_options4(mysql, MYSQL_OPT_CONNECT_ATTR_ADD, "mysql_bug_102266", "Avoid MySQL bug https://bugs.mysql.com/bug.php?id=102266 , https://github.com/sysown/proxysql/issues/3276"); } - if (parent->use_ssl) { + if (parent->use_ssl && parent->port) { mysql_ssl_set(mysql, mysql_thread___ssl_p2s_key, mysql_thread___ssl_p2s_cert, @@ -857,6 +857,7 @@ void MySQL_Connection::connect_start() { async_exit_status=mysql_real_connect_start(&ret_mysql, mysql, host_ip, userinfo->username, auth_password, userinfo->schemaname, parent->port, NULL, client_flags); } else { + client_flags &= ~(CLIENT_COMPRESS); // disabling compression for connections made via Unix socket async_exit_status=mysql_real_connect_start(&ret_mysql, mysql, "localhost", userinfo->username, auth_password, userinfo->schemaname, parent->port, parent->address, client_flags); } fd=mysql_get_socket(mysql);