Bug #90994 libmysqlclient connecting to older MySQL 5 servers results in Bad Handshake
Submitted: 23 May 2018 15:56 Modified: 23 Aug 2023 20:54
Reporter: Seth Willits Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: C API (client library) Severity:S1 (Critical)
Version:8.0.11 OS:MacOS (10.13.4)
Assigned to: CPU Architecture:x86

[23 May 2018 15:56] Seth Willits
Description:
Using libmysqlclient from 8.0.11 to connect to older versions of MySQL 5 (5.0.92, 5.1.7) ends up with a "bad handshake" (1043) error — but connecting to newer versions (5.7.9) works fine.

The older servers are not using old 4.1-style password hashing, so should be using the native password mechanism and should still work. SSL is not being used when connecting.

How to repeat:
I built libmysqlclient from the 8.0.11 source:

cmake -G "Unix Makefiles" -DWITH_SSL=/usr/local/Cellar/openssl/1.0.2k -DCMAKE_OSX_DEPLOYMENT_TARGET=10.10.0 -DCMAKE_OSX_SYSROOT=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk  -DCMAKE_INSTALL_PREFIX=./ -DDOWNLOAD_BOOST=1 -DWITH_BOOST=./boost -DWITH_UNIT_TESTS=OFF -DENABLED_LOCAL_INFILE=1 -DWITH_EDITLINE=system
[25 May 2018 11:22] Gareth Tunley
I was just about to raise a ticket for the exact same symptoms using MySQL Workbench 8.0.11rc on Windows to connect to anything older than 5.7

Just returns "Bad Handshake".

Unless advised to raise as a seperate ticket I'll just start watching this one for a solution as I suspect it's the same underlying bug.
[25 May 2018 12:39] Chiranjeevi Battula
Hello Seth Willits,

Thank you for the bug report.
Verified based on internal discussion with dev's.

Thanks,
Chiranjeevi.
[4 Jun 2018 19:20] Seth Willits
If possible, please let me know if there's some work around for this, or perhaps a different 8.x.x library I could use in the mean time. I'm stuck between needing to support older servers with an older library, and 8.0 servers with a newer library because of the authentication changes.
[6 Jun 2018 13:54] Christian Viken
This bug also applies on bundled libmysql.dll with the new MySQL Workbench 8.0.11 build 12872684 CE x64 on Windows 10 as well.
I get "Bad handshake" on all attempts to TCP/IP connect to all mysql servers running 5.0 and 5.1 (no SSL)
[27 Jul 2018 10:33] Gareth Tunley
I see 8.0.12 has just appeared on the website - has this bug been fixed in that?
[27 Jul 2018 20:45] Brad Jackson
The bug is there in 8.0.12 with server 5.1.72, and 5.1.73.
[6 Aug 2018 20:54] Sebastien How
I have this same issue on Linux (Fedora 27). mysql-workbench-community-8.0.12-1.fc27.src.rpm. Can not connect to mysql server 5.1. fails with "bad handshake"
[7 Aug 2018 9:02] K Borngraber
I upgraded my workbench to 8.0.12 and get the same on my connection to a previously working MySQL DB connection.
[9 Aug 2018 21:26] Bob Caverly
Any info on when this may be fixed?  How far back do I need to go in Workbench versions to not have this issue?
[10 Aug 2018 8:59] K Borngraber
I went back to Workbench 6.3 to be able to get it working again.
[14 Aug 2018 9:10] Luca Bueti
Same error on Workbench 8.0.12 x64  on Windows 10 and server 5.1.71 on Linux.
[5 Sep 2018 0:57] Sergio de la Cruz
Same here with WB 8.0.12 CE on Linux while trying to connect to a MySQL 5.1.52 server running on Linux.

Relevant log entries:

17:48:00 [ERR][SQL Editor Form]: SqlEditorForm: exception in do_connect method: Exception: Bad handshake
17:48:00 [ERR][  GRTDispatcher]: exception in grt execute_task, continuing: Exception: Bad handshake
17:48:00 [ERR][  GRTDispatcher]: worker: task 'execute sql queries' has failed with error:.Bad handshake
17:48:00 [ERR][    WQE backend]: Got an exception during connection: Bad handshake
17:48:00 [ERR][SQL Editor Form]: SQL editor could not be connected: Bad handshake
[24 Oct 2018 20:17] Brad Jackson
Version 8.0.13 was released on 10/22 and the change list says:

"Support for MySQL 5.5 by MySQL Workbench 8.0 was removed. If you still need to use MySQL Workbench on a MySQL 5.5 server, you can use MySQL Workbench 6.3"

I guess we're all stuck on the old version until we upgrade our servers.
[29 Nov 2018 18:36] Ed Gage
Attempted connects with both V8 ANSI and Unicode ODBC drivers to 5.7 server - same issue - bad handshake.
[9 Aug 2023 12:28] Georgi Kodinov
Posted by developer:
 
I can confirm that the bug is reproducible with a 5.1.73-community server (latest on the mysql.com site) and a mysql-8.0 client.
[23 Aug 2023 20:54] Christine Cole
Posted by developer:
 
Fixed as of the upcoming MySQL 8.0.35 and MySQL 8.2.0 releases, and here's the proposed changelog entry from the documentation team:

Earlier distributions, such as MySQL 5.1 and MySQL 5.0, included servers
that did not advertise pluggable authentication. When a newer client using
any pluggable authentication method attempted to connect to one of these
older servers, the server emitted a “bad handshake” error message.
This fix now ensures that client-side authentication (specifically, the
–default-auth option) works properly for all servers, including those
that do not support pluggable authentication. In addition,
mysql_native_password now replaces caching_sha2_password as the default
authentication method when the server does not support pluggable
authentication.

Thank you for the bug report.