dbcli / mycli

A Terminal Client for MySQL with AutoCompletion and Syntax Highlighting.

Home Page:http://mycli.net

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Cannot establish connection with mysql proxy server

richard-yao opened this issue · comments

I am try to establish connection with right username, password, but I got a exception:

Exception in thread completion_refresh:
Traceback (most recent call last):
  File "/usr/local/Cellar/python@3.11/3.11.2/Frameworks/Python.framework/Versions/3.11/lib/python3.11/threading.py", line 1038, in _bootstrap_inner
    self.run()
  File "/usr/local/Cellar/python@3.11/3.11.2/Frameworks/Python.framework/Versions/3.11/lib/python3.11/threading.py", line 975, in run
    self._target(*self._args, **self._kwargs)
  File "/usr/local/Cellar/mycli/1.26.1_1/libexec/lib/python3.11/site-packages/mycli/completion_refresher.py", line 63, in _bg_refresh
    refresher(completer, executor)
  File "/usr/local/Cellar/mycli/1.26.1_1/libexec/lib/python3.11/site-packages/mycli/completion_refresher.py", line 90, in refresh_databases
    completer.extend_database_names(executor.databases())
                                    ^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/Cellar/mycli/1.26.1_1/libexec/lib/python3.11/site-packages/mycli/sqlexecute.py", line 299, in databases
    cur.execute(self.databases_query)
  File "/usr/local/Cellar/mycli/1.26.1_1/libexec/lib/python3.11/site-packages/pymysql/cursors.py", line 148, in execute
    result = self._query(query)
             ^^^^^^^^^^^^^^^^^^
  File "/usr/local/Cellar/mycli/1.26.1_1/libexec/lib/python3.11/site-packages/pymysql/cursors.py", line 310, in _query
    conn.query(q)
  File "/usr/local/Cellar/mycli/1.26.1_1/libexec/lib/python3.11/site-packages/pymysql/connections.py", line 548, in query
    self._affected_rows = self._read_query_result(unbuffered=unbuffered)
                          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/Cellar/mycli/1.26.1_1/libexec/lib/python3.11/site-packages/pymysql/connections.py", line 775, in _read_query_result
    result.read()
  File "/usr/local/Cellar/mycli/1.26.1_1/libexec/lib/python3.11/site-packages/pymysql/connections.py", line 1156, in read
    first_packet = self.connection._read_packet()
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/Cellar/mycli/1.26.1_1/libexec/lib/python3.11/site-packages/pymysql/connections.py", line 692, in _read_packet
    packet_header = self._read_bytes(4)
                    ^^^^^^^^^^^^^^^^^^^
  File "/usr/local/Cellar/mycli/1.26.1_1/libexec/lib/python3.11/site-packages/pymysql/connections.py", line 748, in _read_bytes
    raise err.OperationalError(
pymysql.err.OperationalError: (2013, 'Lost connection to MySQL server during query')

In .mycli.log, I found the reason: My company use a mysql proxy server to control connection, this proxy server ban some mysql function, such as: LAST_INSERT_ID()、CONNECTION_ID()、FOUND_ROWS()、ROW_COUNT(), if client use these functions, connection will broken, and response: The session level function can only be used in transactions,

My Question:

mycli use which function when establish connection, am I can disable it or skip the process?

Ignore this issue, my company's proxy server has supported mycli connection