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

Database connection failed: error('unpack requires a buffer of 4 bytes').

bkysela opened this issue · comments

When connecting using mycli I see the following on the console.

$ mycli
Connecting to socket /var/run/mysqld/mysqlx.sock, owned by user mysql
unpack requires a buffer of 4 bytes
$ 

Running with DEBUG, this is in the log.

2024-01-17 12:16:16,402 (2797336/MainThread) mycli.sqlexecute DEBUG - Connection DB Params: 
        database: 'xxxxxxx'     user: 'xxxxxxxx'    host: xxxxx      port: xxxxx      socket: '/var/run/mysqld/mysqlx.sock'   charset: 'utf8' local_infile: False     ssl: None             ssh_user: None  ssh_host: None  ssh_port: 22    ssh_password: None      ssh_key_filename: None  init_command: None
2024-01-17 12:16:16,402 (2797336/MainThread) mycli.main DEBUG - Database connection failed: error('unpack requires a buffer of 4 bytes').
2024-01-17 12:16:16,402 (2797336/MainThread) mycli.main ERROR - traceback: 'Traceback (most recent call last):\n  File "/usr/lib/python3/dist-packages/mycli/main.py", line 482, in connect\n    _connect()\n  File "/usr/lib/python3/dist-packages/mycli/main.py", line 456, in _connect\n    self.sqlexecute = SQLExecute(\n  File "/usr/lib/python3/dist-packages/mycli/sqlexecute.py", line 119, in __init__\n    self.connect()\n  File "/usr/lib/python3/dist-packages/mycli/sqlexecute.py", line 177, in connect\n    conn = pymysql.connect(\n  File "/usr/lib/python3/dist-packages/pymysql/connections.py", line 353, in __init__\n    self.connect()\n  File "/usr/lib/python3/dist-packages/pymysql/connections.py", line 632, in connect\n    self._get_server_information()\n  File "/usr/lib/python3/dist-packages/pymysql/connections.py", line 1065, in _get_server_information\n    self.server_thread_id = struct.unpack("<I", data[i : i + 4])\nstruct.error: unpack requires a buffer of 4 bytes\n'
$ mycli --version
Version: 1.27.0
$ mysqld --version
/usr/sbin/mysqld  Ver 8.0.35-0ubuntu0.22.04.1 for Linux on x86_64 ((Ubuntu))

The regular MySQL client connects without issue.

commented

same problem on same OS verion

Any update?
I had same issue with ubuntu 24.04, mysql 8.0.36, and mycli 1.27.0