Bad handshake while connecting with jdbc:mysql:thin://<host>:<port>/
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
MariaDB |
Invalid
|
Undecided
|
Michael Widenius |
Bug Description
The problem was initially reported in Tungsten replicator backtracking system as http://
From what I see after installing Tungsten and running connection tests with it, the problem is not related to binlog dump.
Tungsten uses two kinds of url-s to connect to the database: usually it connects as
"jdbc:mysql:
but sometimes as
"jdbc:mysql:
The latter fails on 5.2.8 and higher (and on 5.3, too), with the "bad handshake" error. On 5.2.7 both lines work fine. 5.1.60 looks okay too.
My wild guess is that it's somehow related to client plugin authentication, namely to a corner(?) case when server on some reason thinks the client is using plugin authentication while in fact it does not. It's pure speculation though.
I've attached a simple Java test case that uses the same classes as Tungsten for database connection, but does not do anything else. The tarball contains everything (apart from java itself) needed to run the test case -- the compiled test, libraries and the runner. Extract the archive, cd into the 'test' folder, launch ./run (you need to have your DB server already running). If you are using a port other than 3306, edit the 'run' file to add -Dport=<port> property to run the java class.
The test code is below.
Test case:
import com.continuent.
import com.continuent.
import java.sql.
public class test
{
public static void main (String argv[])
{
try
{
String port = System.
if (port == null) {
}
String conLine1 = "jdbc:mysql:
String conLine2 = "jdbc:mysql:
Database conn1 = DatabaseFactory
Database conn2 = DatabaseFactory
try {
}
catch (SQLException e)
{
}
}
catch (Exception e)
{
}
}
}
summary: |
- Bad handshake while connecting as connecting with - jdbc:mysql:thin://<host>:<port>/ + Bad handshake while connecting with jdbc:mysql:thin://<host>:<port>/ |
Further investigation has shown that the problem does not occur with an up-to-date version of drizzle-jdbc. Tungsten packages still contain drizzle- jdbc-0. 91-SNAPSHOT, while a recent version is 1.1.
According to serg's analysis, the old version of drizzle-jdbc was incorrectly setting CLIENT_PLUGIN_AUTH bit in the handshake packet, without actually supporting pluggable auth. It has been fixed in 1.1.
If I simply replace the jar by the newer one, the handshake goes normally, both with the simplified test case above and with the actual Tungsten startup. Tungsten proceeds to the next step, where it does fail, not due to a handshake problem, but with UnsupportedEnco dingException, apparently due to incompatibility with the new version of drizzle-jdbc.