Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
bkysela opened this issue Jan 17, 2024 · 2 comments
Open

Comments

@bkysela
Copy link

bkysela commented Jan 17, 2024

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.

@dzdidi
Copy link

dzdidi commented Jan 22, 2024

same problem on same OS verion

@asrul10
Copy link

asrul10 commented May 8, 2024

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants