When `SslStream.AuthenticateAsClientAsync` fails, a `MySqlException` with error code 0 is thrown. It should be `MySqlErrorCode.UnableToConnectToHost`. Note that this will break some clients that are currently detecting error code 0: https://github.com/mysql-net/MySqlConnector/issues/621#issuecomment-496237102 In general, all exceptions along the connection path should use `UnableToConnectToHost`.