Bug #121525 Cannot connect to DigitalOcean MySQL 8.4 Managed Cluster with MySQL Workbench 26.7.0
Submitted: 15 Oct 18:42 Modified: 23 Oct 1:17
Reporter: Phi Stro Email Updates:
Status: Duplicate Impact on me:
None 
Category:MySQL Workbench Severity:S1 (Critical)
Version:26.7.0 OS:MacOS (27.0.1)
Assigned to: CPU Architecture:ARM (M4 Max)
Tags: MariaDB

[15 Oct 18:42] Phi Stro
Description:
After updating to 26.7.0, MySQL Workbench cannot connect to my DigitalOcean managed database cluster running MySQL 8.4. Pressing Test Connection or clicking the connection on the home page shows a spinning circle and never connects. If you launch from the terminal (on macOS this is `/Applications/MySQL\ Workbench.app/Contents/MacOS/MySQL\ Workbench`), you will get this error message when you try to connect:
```
[mysqlsh] Exception in thread sql-ServiceSession-13a18d68-c8c1-11f1-9eba-5d352f7f0c6d:
[mysqlsh] Traceback (most recent call last):
[mysqlsh] File "/Applications/MySQL Workbench.app/Contents/Resources/app/shell/lib/mysqlsh/lib/python3.13/threading.py", line 1044, in _bootstrap_inner
    self.run()
    ~~~~~~~~^^
  File "/Applications/MySQL Workbench.app/Contents/Resources/app/shell/lib/mysqlsh/plugins/gui_plugin/core/dbms/DbSession.py", line 517, in run
    self.terminate_thread()
    ~~~~~~~~~~~~~~~~~~~~~^^
[mysqlsh] File "/Applications/MySQL Workbench.app/Contents/Resources/app/shell/lib/mysqlsh/plugins/gui_plugin/core/dbms/DbSession.py", line 254, in terminate_thread
    self._message_callback("ERROR", self.thread_error)
    ~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^
TypeError: DbModuleSession.on_session_message() missing 1 required positional argument: 'result'
```

If you go to the Python file referenced in the stack trace at `/Applications/MySQL Workbench.app/Contents/Resources/app/shell/lib/mysqlsh/plugins/gui_plugin/core/dbms/DbSession.py` and go down to line 254, you will see `self._message_callback("ERROR", self.thread_error)`.
If you change that line to add an empty dictionary ( like this "{}" ) instead be:
```
self._message_callback("ERROR", self.thread_error, {})
```
and save it back, it will stop the spinning circle and give you an actual error message in the UI.
In my case, I get the message:
"""
The connection could not be opened: MySQL Error (1054): Unknown column 'sys' in 'where clause'
"""

This is not a very descriptive error. It is triggered by the "HeatWave Check" (which you can disable in the Advanced tab of the connection options.

This seems to be triggered by a bug in `/Applications/MySQL Workbench.app/Contents/Resources/app/shell/lib/mysqlsh/plugins/gui_plugin/core/dbms/DbMySQLSessionTasks.py` on lines 111 to 117. This query:
```
result = self.execute("""
  SELECT ROUTINE_NAME
  FROM information_schema.routines
  WHERE ROUTINE_SCHEMA="sys"
    AND ROUTINE_NAME="mle_explain_error"
    AND ROUTINE_TYPE="PROCEDURE"
  """).fetch_all()
```

fails because it uses double quotes. If ANSI_QUOTES is on, double quotes become identifiers instead of strings.

How to repeat:
Create a managed database cluster in DigitalOcean using MySQL 8.4. Download the CA certificate and then make sure to give the path to it in the SSL tab when setting up the new connection on MySQL Workbench. Set SSL Mode to "Require and Verify CA". Try to connect to the cluster and get an infinitely spinning circle. Edit the Python code as described in the Description and try again and you will get the "The connection could not be opened: MySQL Error (1054): Unknown column 'sys' in 'where clause'" error.

Suggested fix:
There's technically two bugs here. 

Bug #1
`/Applications/MySQL Workbench.app/Contents/Resources/app/shell/lib/mysqlsh/plugins/gui_plugin/core/dbms/DbSession.py` on line 254, hides the underlying error because it has the wrong number of parameters (needs a dummy dictionary as a third parameter).

Bug #2
In the Advanced tab of connection settings, you must check the "Disable HeatWave Check".
For Oracle to fix, you will want to change the function located at `/Applications/MySQL Workbench.app/Contents/Resources/app/shell/lib/mysqlsh/plugins/gui_plugin/core/dbms/DbMySQLSessionTasks.py` on lines 111 to 117 to use apostrophes like this:
```
result = self.execute("""
  SELECT ROUTINE_NAME
  FROM information_schema.routines
  WHERE ROUTINE_SCHEMA='sys'
    AND ROUTINE_NAME='mle_explain_error'
    AND ROUTINE_TYPE='PROCEDURE'
  """).fetch_all()
```

By changing it to that on my computer, I can connect to my DigitalOcean Managed Database cluster even if the "Disable HeatWave Check" option is unchecked.
[23 Oct 1:17] Alfredo Kojima
Duplicate of bug #121285
[23 Oct 1:23] Alfredo Kojima
FYI both issues should be fixed in 26.10.0