Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ Features
* Let the `--dsn` argument accept literal DSNs as well as aliases.
* Accept `--character-set` as an alias for `--charset` at the CLI.
* Add SSL/TLS version to `status` output.
* Add extra error output on connection failure for possible SSL mismatch (#1584)
* Accept `socket` as a DSN query parameter.
* Accept new-style `ssl_mode` in DSN URI query parameters, to match CLI argument.
* Fully deprecate the built-in SSH functionality.
Expand Down
11 changes: 11 additions & 0 deletions mycli/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@
from prompt_toolkit.output import ColorDepth
from prompt_toolkit.shortcuts import CompleteStyle, PromptSession
import pymysql
from pymysql.constants.CR import CR_SERVER_LOST
from pymysql.constants.ER import ACCESS_DENIED_ERROR, HANDSHAKE_ERROR
from pymysql.cursors import Cursor
import sqlglot
Expand Down Expand Up @@ -724,6 +725,16 @@ def _connect(retry_ssl: bool = False, retry_password: bool = False) -> None:
)
connection_info["password"] = new_password
_connect(retry_password=True)
elif e1.args[0] == CR_SERVER_LOST:
self.echo(
(
"Connection to server lost. If this error persists, it may be a mismatch between the server and "
"client SSL configuration. To troubleshoot the issue, try --ssl-mode=off or --ssl-mode=on."
),
err=True,
fg='red',
)
raise e1
else:
raise e1

Expand Down