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

Bad Handshake error #320

Closed
ibrierley opened this issue Feb 25, 2020 · 16 comments
Closed

Bad Handshake error #320

ibrierley opened this issue Feb 25, 2020 · 16 comments

Comments

@ibrierley
Copy link

I've got a new Centos 8 install, with Perl 5.30.1 and I think DBD::mysql 4.050 connecting via DBI.

I am trying to connect to some old servers that are running mysql 5.1. When I try and connect I get a "bad handshake" error (when I look using strace). Reading around, typically it seems to be version mismatches with mysql.

I am unsure what dictates this, is it an underlying mysqllib on the Centos box, or something in the Perl version.

Does anyone have any ideas how to get around it, or what we'd need to downgrade to be able to connect to the other mysql servers ?

@Grinnz
Copy link
Contributor

Grinnz commented Feb 25, 2020

DBD::mysql is built against libmysqlclient on the local machine. Perhaps install a version of that matching the remote mysql servers, and then see https://metacpan.org/pod/distribution/DBD-mysql/lib/DBD/mysql/INSTALL.pod#SOURCE-INSTALLATION for how to build against it.

@pali
Copy link
Member

pali commented Feb 25, 2020

Hello @ibrierley! Meanwhile could you try DBD::MariaDB driver? We are running basic test suite of DBD::MariaDB driver compiled with new versions of MySQL and MariaDB clients against of the old MySQL 4.1.22 and MySQL 5.1.72 server versions and everything pass. So connecting with DBD::MariaDB compiled with recent version of client should be able to connect to old 4.1 or 5.1 servers.

@ibrierley
Copy link
Author

Hi,

Swapping in DBD::MariaDB rather than DBD::mysql still fails for me with 'bad handshake' still, that's connecting to a 5.1.73 server. It's not impossible something else has gone astray, but I'm not sure of anything else to try on the client aspect of it.

But I'm guessing from what Grinnz has said, it would still have the same problem, i.e is it using libmysqlclient still ?

@pali
Copy link
Member

pali commented Feb 25, 2020

If connecting with DBD::MariaDB fails too, could you provide perl code which you use to connect? And also whole output?

@ibrierley
Copy link
Author

Sure...

my $dsn = 'DBI:MariaDB:database=mydb;host=myhost.domain.net';
my $dbh = DBI->connect($dsn, 'someuser', 'somepass');
my $sql = q{ SELECT * FROM mydb.mytable LIMIT 2 };
my $sth = $dbh->prepare( $sql ) or die $dbh->errstr;

$sth->execute();

while( my $ref = $sth->fetchrow_hashref() ) {
        warn Dumper $ref;
}

DBI connect('database=mydb;host=myhost','someuser',...) failed: Bad handshake at bin/test_sql2.pl line 12.
Can't call method "prepare" on an undefined value at bin/test_sql2.pl line 24.

This is also the same with my $dsn = 'DBI:mysql:database=mydb;host=myhost.domain.net';

Just a note, connecting the other way is fine, from an old server I can connect (using mysql) to a new mariadb 10.3 server without a handshake error.

@pali
Copy link
Member

pali commented Feb 25, 2020

What is the exact version of mysql client version and mysql server version?
Can you run DBI->trace(0xFFFFFFFF) prior to calling DBI->connect and provide output again? It could contain verbose trace information including username and password, so do not forget to remove sensitive data.

@ibrierley
Copy link
Author

mysql server 5.1.73
Client wise, I think its this /usr/lib64/mysql/libmysqlclient.so.21.1.17 (happy to dig further if there's a specific way to tell, /usr/lib64/mysql/libmysqlclient.so links to it)

DBI 1.643-nothread default trace level set to 0xff0fff00/15 (pid 9538 pi 0) at test_sql2.pl line 12
    -> DBI->connect(DBI:MariaDB:database=mydb;host=myhost, myuser, ****)
    -> DBI->install_driver(MariaDB) for linux perl=5.030001 pid=9538 ruid=1000 euid=1000
       install_driver: DBD::MariaDB version 1.21 loaded from /opt/perl/lib/site_perl/5.30.1/x86_64-linux/DBD/MariaDB.pm
    New 'DBI::dr' (for DBD::MariaDB::dr, parent='', id=undef)
    dbih_setup_handle(DBI::dr=HASH(0x23da650)=>DBI::dr=HASH(0x23da5c0), DBD::MariaDB::dr, 0, Null!)
    dbih_make_com(Null!, 0, DBD::MariaDB::dr, 200, 0) thr#0
    dbih_setup_attrib(DBI::dr=HASH(0x23da5c0), Err, Null!) SCALAR(0x23533a8) (already defined)
    dbih_setup_attrib(DBI::dr=HASH(0x23da5c0), State, Null!) SCALAR(0x235fb38) (already defined)
    dbih_setup_attrib(DBI::dr=HASH(0x23da5c0), Errstr, Null!) SCALAR(0x2352fb8) (already defined)
    dbih_setup_attrib(DBI::dr=HASH(0x23da5c0), TraceLevel, Null!) 0 (already defined)
    dbih_setup_attrib(DBI::dr=HASH(0x23da5c0), FetchHashKeyName, Null!) 'NAME' (already defined)
install_method DBI::db::mariadb_sockfd
install_method DBI::db::mariadb_async_result
install_method DBI::db::mariadb_async_ready
install_method DBI::st::mariadb_async_result
install_method DBI::st::mariadb_async_ready
    <- install_driver= DBI::dr=HASH(0x23da650)
    >> connect     DISPATCH (DBI::dr=HASH(0x23da650) rc2/3 @5 g2 ima8001 pid#9538) at /opt/perl/lib/site_perl/5.30.1/x86_64-linux/DBI.pm line 679
    !! The warn '0' was CLEARED by call to connect method
    -> connect for DBD::MariaDB::dr (DBI::dr=HASH(0x23da650)~0x23da5c0 'database=mydb;host=myhost' 'myuser' **** HASH(0x1dc14c8))
    New 'DBI::db' (for DBD::MariaDB::db, parent=DBI::dr=HASH(0x23da5c0), id=HASH(0x23d9c18))
    dbih_setup_handle(DBI::db=HASH(0x23d9b10)=>DBI::db=HASH(0x23d9d38), DBD::MariaDB::db, 1e35890, HASH(0x23d9c18))
    dbih_make_com(DBI::dr=HASH(0x23da5c0), 239e1b0, DBD::MariaDB::db, 200, 0) thr#0
    dbih_setup_attrib(DBI::db=HASH(0x23d9d38), Err, DBI::dr=HASH(0x23da5c0)) SCALAR(0x1e35ae8) (already defined)
    dbih_setup_attrib(DBI::db=HASH(0x23d9d38), State, DBI::dr=HASH(0x23da5c0)) SCALAR(0x1e35b78) (already defined)
    dbih_setup_attrib(DBI::db=HASH(0x23d9d38), Errstr, DBI::dr=HASH(0x23da5c0)) SCALAR(0x1e35b30) (already defined)
    dbih_setup_attrib(DBI::db=HASH(0x23d9d38), TraceLevel, DBI::dr=HASH(0x23da5c0)) 0 (already defined)
    dbih_setup_attrib(DBI::db=HASH(0x23d9d38), FetchHashKeyName, DBI::dr=HASH(0x23da5c0)) 'NAME' (already defined)
    dbih_setup_attrib(DBI::db=HASH(0x23d9d38), HandleSetErr, DBI::dr=HASH(0x23da5c0)) undef (not defined)
    dbih_setup_attrib(DBI::db=HASH(0x23d9d38), HandleError, DBI::dr=HASH(0x23da5c0)) undef (not defined)
    dbih_setup_attrib(DBI::db=HASH(0x23d9d38), ReadOnly, DBI::dr=HASH(0x23da5c0)) undef (not defined)
    dbih_setup_attrib(DBI::db=HASH(0x23d9d38), Profile, DBI::dr=HASH(0x23da5c0)) undef (not defined)
imp_dbh->connect: dsn = 'database=mydb;host=myhost', uid = 'myuser', pwd = ****
imp_dbh->mariadb_db_my_login : dbname = mydb, uid = myuser, pwd = ****,host = myhost, port = 0
imp_dbh->mariadb_dr_connect: host = |myhost|, port = 0, uid = myuser, pwd = ****
imp_dbh->use_server_side_prepare: 0
imp_dbh->disable_fallback_for_server_prepare: 0
imp_dbh->mariadb_dr_connect: client_flags = 131074
		--> mariadb_dr_do_error
error 1043 recorded: Bad handshake
		<-- mariadb_dr_do_error
	mariadb_db_close_mysql: imp_dbh=1bee600 pmysql=2427ce0
    >> FETCH       DISPATCH (DBI::db=HASH(0x23d9d38) rc2/2 @2 g2 ima404 pid#9538) at /opt/perl/lib/site_perl/5.30.1/x86_64-linux/DBD/MariaDB.pm line 140 via  at bin/test_sql2.pl line 13
    -> FETCH for DBD::MariaDB::db (DBI::db=HASH(0x23d9d38)~INNER 'ChildHandles')
    .. FETCH DBI::db=HASH(0x23d9d38) 'ChildHandles' = ARRAY(0x23d54e8)
       ERROR: 1043 'Bad handshake' (err#0)
    <- FETCH= ( [ ] ) [1 items] at /opt/perl/lib/site_perl/5.30.1/x86_64-linux/DBD/MariaDB.pm line 140 via  at bin/test_sql2.pl line 13
    >> DESTROY     DISPATCH (DBI::db=HASH(0x23d9b10) rc1/1 @1 g2 ima10004 pid#9538) at /opt/perl/lib/site_perl/5.30.1/x86_64-linux/DBD/MariaDB.pm line 140 via  at bin/test_sql2.pl line 13
    <> DESTROY(DBI::db=HASH(0x23d9b10)) ignored for outer handle (inner DBI::db=HASH(0x23d9d38) has ref cnt 2)
    >> DESTROY     DISPATCH (DBI::db=HASH(0x23d9d38) rc1/1 @1 g2 ima10004 pid#9538) at /opt/perl/lib/site_perl/5.30.1/x86_64-linux/DBD/MariaDB.pm line 143 via  at bin/test_sql2.pl line 13
    -> DESTROY for DBD::MariaDB::db (DBI::db=HASH(0x23d9d38)~INNER)
       ERROR: 1043 'Bad handshake' (err#0)
    <- DESTROY= ( undef ) [1 items] at /opt/perl/lib/site_perl/5.30.1/x86_64-linux/DBD/MariaDB.pm line 143 via  at bin/test_sql2.pl line 13
    DESTROY (dbih_clearcom) (dbh 0x23d9d38, com 0x1bee600, imp DBD::MariaDB::db):
       FLAGS 0x100211: COMSET Warn PrintWarn AutoCommit 
       ERR 1043
       ERRSTR 'Bad handshake'
       PARENT DBI::dr=HASH(0x23da5c0)
       KIDS 0 (0 Active)
       IMP_DATA HASH(0x23d9c18)
    dbih_clearcom 0x23d9d38 (com 0x1bee600, type 2) done.

    !! ERROR: 1043 'Bad handshake' (err#0)
    <- connect= ( undef ) [1 items] at /opt/perl/lib/site_perl/5.30.1/x86_64-linux/DBI.pm line 679
    -> $DBI::errstr (&) FETCH from lasth=HASH
    >> DBD::MariaDB::dr::errstr
    <- $DBI::errstr= 'Bad handshake'
       DBI connect('database=mydb;host=myhost','myuser',...) failed: Bad handshake
DBI connect('database=mydb;myhost','myuser',...) failed: Bad handshake at bin/test_sql2.pl line 13.
Can't call method "prepare" on an undefined value at bin/test_sql2.pl line 25.
    -- DBI::END ($@: , $!: )
    >> disconnect_all DISPATCH (DBI::dr=HASH(0x23da650) rc1/3 @1 g2 ima801 pid#9538) at /opt/perl/lib/site_perl/5.30.1/x86_64-linux/DBI.pm line 758 via  at bin/test_sql2.pl line 0
    !! The ERROR '1043' was CLEARED by call to disconnect_all method
    -> disconnect_all for DBD::MariaDB::dr (DBI::dr=HASH(0x23da650)~0x23da5c0)
    <- disconnect_all= ( 1 ) [1 items] at /opt/perl/lib/site_perl/5.30.1/x86_64-linux/DBI.pm line 758 via  at bin/test_sql2.pl line 0
!   >> DESTROY     DISPATCH (DBI::dr=HASH(0x23da650) rc1/1 @1 g2 ima10004 pid#9538) during global destruction
!   <> DESTROY(DBI::dr=HASH(0x23da650)) ignored for outer handle (inner DBI::dr=HASH(0x23da5c0) has ref cnt 1)
!   >> DESTROY     DISPATCH (DBI::dr=HASH(0x23da5c0) rc1/1 @1 g2 ima10004 pid#9538) during global destruction
!   -> DESTROY in DBD::_::common for DBD::MariaDB::dr (DBI::dr=HASH(0x23da5c0)~INNER)
!   <- DESTROY= ( undef ) [1 items] during global destruction
    DESTROY (dbih_clearcom) (drh 0x23da5c0, com 0x239e1b0, imp global destruction):
       FLAGS 0x100215: COMSET Active Warn PrintWarn AutoCommit 
       PARENT undef
       KIDS 0 (0 Active)
    dbih_clearcom 0x23da5c0 (com 0x239e1b0, type 1) done.

@pali
Copy link
Member

pali commented Feb 25, 2020

If you have not used pre-compiled DBD::MariaDB, then in build log of DBD::MariaDB you should see path to either mariadb_config or mysql_config binary. If you call that binary it prints client version and also other flags.

If you have installed client library via package manager, then ask your package manager for version of installed package which provides that library file /usr/lib64/mysql/libmysqlclient.so.21.1.17

@ibrierley
Copy link
Author

I can't find anything that specifically lists that file (or any specific version)....closest I can get is

repoquery --list mysql-devel
/usr/bin/mysql_config
/usr/bin/mysql_config-64
/usr/include/mysql
/usr/include/mysql/errmsg.h
/usr/include/mysql/field_types.h
/usr/include/mysql/my_command.h
/usr/include/mysql/my_list.h
/usr/include/mysql/mysql
/usr/include/mysql/mysql.h
/usr/include/mysql/mysql/client_plugin.h
/usr/include/mysql/mysql/plugin_auth_common.h
/usr/include/mysql/mysql/udf_registration_types.h
/usr/include/mysql/mysql_com.h
/usr/include/mysql/mysql_time.h
/usr/include/mysql/mysql_version.h
/usr/include/mysql/mysqld_error.h
/usr/include/mysql/mysqlx_ername.h
/usr/include/mysql/mysqlx_error.h
/usr/include/mysql/mysqlx_version.h
/usr/lib/.build-id
/usr/lib/.build-id/d8/c229190d63305d0d80a3fd975fe4c5694600ed
/usr/lib64/mysql/libmysqlclient.so
/usr/lib64/pkgconfig/mysqlclient.pc
/usr/share/aclocal/mysql.m4
/usr/share/man/man1/mysql_config.1.gz

yum info mysql-devel

Installed Packages
Name         : mysql-devel
Version      : 8.0.17
Release      : 3.module_el8.0.0+181+899d6349
Architecture : x86_64
Size         : 337 k
Source       : mysql-8.0.17-3.module_el8.0.0+181+899d6349.src.rpm
Repository   : @System
From repo    : AppStream
Summary      : Files for development of MySQL applications




@ibrierley
Copy link
Author

Just going back to Grinnz comment, how would one install a different version of libmysqlclient ? Struggling to find info on that.

@pali
Copy link
Member

pali commented Feb 25, 2020

Thanks for details, important parts are:
server version: 5.1.73
client version: 8.0.17
connection error code: 1043

Seems that it is truth that in default configuration of MySQL 8.0.17 client does not allow connection to 5.1 servers. So compiling DBD::MariaDB either with mariadb client library or mysql 5.7 (or older) should help.

Anyway, even mysql 8.x client library should be able to connect to older mysql servers, but it would need some modifications in DBD::MariaDB driver. Please report this issue to our DBD::MariaDB issue tracker https://github.com/gooddata/DBD-MariaDB/issues and we can look at it.

@fredericve
Copy link

fredericve commented Aug 24, 2022

FWIW, we had the same issue establishing a connection from perl on Ubuntu jammy to an older mysql 5.1.41. Just switching to DBD::MariaDB fixed that problem for us.

The libdbd-mariadb-perl package is not available in jammy right now so we rolled our own package based on debian sid, but switched the build dependencies so it built with libmariadb3 instead of libmysqlclient.

See also https://bugs.launchpad.net/ubuntu/+source/libdbd-mariadb-perl/+bug/1971711

@ShyLionTjmn
Copy link

ShyLionTjmn commented Nov 24, 2022

I've got the same problem.
Server is:

mysql> show variables like '%version%';
+-------------------------+---------------------+
| Variable_name           | Value               |
+-------------------------+---------------------+
| protocol_version        | 10                  |
| version                 | 5.1.73              |

Client:

$ mysql --version
mysql  Ver 15.1 Distrib 10.3.37-MariaDB, for debian-linux-gnu (x86_64) using readline 5.2

mysql command works just fine, but perl script fails, no matter which driver: mysql or mariadb

$ mysql -u gowlcd -pgowlcd -h 10.96.37.103 ipdb -e 'select "boo" from dual;'
+-----+
| boo |
+-----+
| boo |
+-----+
#!/usr/bin/perl

use strict;
use DBI;

DBI->trace(0xFFFFFFFF);

my $dbh = DBI->connect("DBI:mysql:database=ipdb;host=10.96.37.103", "gowlcd", "gowlcd",
                       {'RaiseError' => 1}
                      );

$dbh->disconnect();
$ ./import_old.pl 
    DBI 1.643-ithread default trace level set to 0xff0fff00/15 (pid 1942702 pi 55c71f68e2a0) at import_old.pl line 6
    -> DBI->connect(DBI:mysql:database=ipdb;host=10.96.37.103, gowlcd, ****, HASH(0x55c71f691470))
    -> DBI->install_driver(mysql) for linux perl=5.030000 pid=1942702 ruid=1000 euid=1000
       install_driver: DBD::mysql version 4.050 loaded from /usr/lib/x86_64-linux-gnu/perl5/5.30/DBD/mysql.pm
    New 'DBI::dr' (for DBD::mysql::dr, parent='', id=undef)
    dbih_setup_handle(DBI::dr=HASH(0x55c71f9d4e80)=>DBI::dr=HASH(0x55c71fa055b0), DBD::mysql::dr, 0, Null!)
    dbih_make_com(Null!, 0, DBD::mysql::dr, 152, 0) thr#55c71f68e2a0
    dbih_setup_attrib(DBI::dr=HASH(0x55c71fa055b0), Err, Null!) SCALAR(0x55c71f7f7f60) (already defined)
    dbih_setup_attrib(DBI::dr=HASH(0x55c71fa055b0), State, Null!) SCALAR(0x55c71f8d1a10) (already defined)
    dbih_setup_attrib(DBI::dr=HASH(0x55c71fa055b0), Errstr, Null!) SCALAR(0x55c71f7f7f00) (already defined)
    dbih_setup_attrib(DBI::dr=HASH(0x55c71fa055b0), TraceLevel, Null!) 0 (already defined)
    dbih_setup_attrib(DBI::dr=HASH(0x55c71fa055b0), FetchHashKeyName, Null!) 'NAME' (already defined)
install_method DBI::db::mysql_fd    
install_method DBI::db::mysql_async_result
install_method DBI::db::mysql_async_ready
install_method DBI::st::mysql_async_result
install_method DBI::st::mysql_async_ready
    <- install_driver= DBI::dr=HASH(0x55c71f9d4e80)
    >> connect     DISPATCH (DBI::dr=HASH(0x55c71f9d4e80) rc2/3 @5 g2 ima8001 pid#1942702) at /usr/lib/x86_64-linux-gnu/perl5/5.30/DBI.pm line 679
    !! The warn '0' was CLEARED by call to connect method
    -> connect for DBD::mysql::dr (DBI::dr=HASH(0x55c71f9d4e80)~0x55c71fa055b0 'database=ipdb;host=10.96.37.103' 'gowlcd' **** HASH(0x55c71f862e98)) thr#55c71f68e2a0
    New 'DBI::db' (for DBD::mysql::db, parent=DBI::dr=HASH(0x55c71fa055b0), id=HASH(0x55c71fa06000))
    dbih_setup_handle(DBI::db=HASH(0x55c71fa05e80)=>DBI::db=HASH(0x55c71fa0f768), DBD::mysql::db, 55c71f8e8570, HASH(0x55c71fa06000))
    dbih_make_com(DBI::dr=HASH(0x55c71fa055b0), 55c71f75fdd0, DBD::mysql::db, 192, 55c71fa06018) thr#55c71f68e2a0
    dbih_setup_attrib(DBI::db=HASH(0x55c71fa0f768), Err, DBI::dr=HASH(0x55c71fa055b0)) SCALAR(0x55c71f8e87c8) (already defined)
    dbih_setup_attrib(DBI::db=HASH(0x55c71fa0f768), State, DBI::dr=HASH(0x55c71fa055b0)) SCALAR(0x55c71f8e8858) (already defined)
    dbih_setup_attrib(DBI::db=HASH(0x55c71fa0f768), Errstr, DBI::dr=HASH(0x55c71fa055b0)) SCALAR(0x55c71f8e8810) (already defined)
    dbih_setup_attrib(DBI::db=HASH(0x55c71fa0f768), TraceLevel, DBI::dr=HASH(0x55c71fa055b0)) 0 (already defined)
    dbih_setup_attrib(DBI::db=HASH(0x55c71fa0f768), FetchHashKeyName, DBI::dr=HASH(0x55c71fa055b0)) 'NAME' (already defined)
    dbih_setup_attrib(DBI::db=HASH(0x55c71fa0f768), HandleSetErr, DBI::dr=HASH(0x55c71fa055b0)) undef (not defined)
    dbih_setup_attrib(DBI::db=HASH(0x55c71fa0f768), HandleError, DBI::dr=HASH(0x55c71fa055b0)) undef (not defined)
    dbih_setup_attrib(DBI::db=HASH(0x55c71fa0f768), ReadOnly, DBI::dr=HASH(0x55c71fa055b0)) undef (not defined)
    dbih_setup_attrib(DBI::db=HASH(0x55c71fa0f768), Profile, DBI::dr=HASH(0x55c71fa055b0)) undef (not defined)
imp_dbh->connect: dsn = database=ipdb;host=10.96.37.103, uid = gowlcd, pwd = gowlcd
imp_dbh->my_login : dbname = ipdb, uid = gowlcd, pwd = gowlcd,host = 10.96.37.103, port = NULL
imp_dbh->mysql_dr_connect: host = |10.96.37.103|, port = 0, uid = gowlcd, pwd = gowlcd
imp_dbh->bind_type_guessing: 0
imp_dbh->use_server_side_prepare: 0
imp_dbh->disable_fallback_for_server_prepare: 0
imp_dbh->mysql_dr_connect: client_flags = 2
imp_dbh->mysql_dr_connect: <-		--> do_error
Bad handshake error 1043 recorded: Bad handshake
		<-- do_error
    >> DESTROY     DISPATCH (DBI::db=HASH(0x55c71fa05e80) rc1/1 @1 g2 ima10004 pid#1942702) at /usr/lib/x86_64-linux-gnu/perl5/5.30/DBD/mysql.pm line 157 via  at ./import_old.pl line 8
    <> DESTROY(DBI::db=HASH(0x55c71fa05e80)) ignored for outer handle (inner DBI::db=HASH(0x55c71fa0f768) has ref cnt 2)
    >> DESTROY     DISPATCH (DBI::db=HASH(0x55c71fa0f768) rc1/1 @1 g2 ima10004 pid#1942702) at /usr/lib/x86_64-linux-gnu/perl5/5.30/DBD/mysql.pm line 163 via  at ./import_old.pl line 8
    -> DESTROY for DBD::mysql::db (DBI::db=HASH(0x55c71fa0f768)~INNER) thr#55c71f68e2a0
       ERROR: 1043 'Bad handshake' (err#0)
    <- DESTROY= ( undef ) [1 items] at /usr/lib/x86_64-linux-gnu/perl5/5.30/DBD/mysql.pm line 163 via  at ./import_old.pl line 8
    DESTROY (dbih_clearcom) (dbh 0x55c71fa0f768, com 0x55c71f812260, imp DBD::mysql::db):
       FLAGS 0x100211: COMSET Warn PrintWarn AutoCommit 
       ERR 1043
       ERRSTR 'Bad handshake'
       PARENT DBI::dr=HASH(0x55c71fa055b0)
       KIDS 0 (0 Active)
       IMP_DATA HASH(0x55c71fa06000)
    dbih_clearcom 0x55c71fa0f768 (com 0x55c71f812260, type 2) done.

    !! ERROR: 1043 'Bad handshake' (err#0)
    <- connect= ( undef ) [1 items] at /usr/lib/x86_64-linux-gnu/perl5/5.30/DBI.pm line 679
    -> $DBI::errstr (&) FETCH from lasth=HASH
    >> DBD::mysql::dr::errstr
    <- $DBI::errstr= 'Bad handshake'
       DBI connect('database=ipdb;host=10.96.37.103','gowlcd',...) failed: Bad handshake
DBI connect('database=ipdb;host=10.96.37.103','gowlcd',...) failed: Bad handshake at ./import_old.pl line 8.
    -- DBI::END ($@: , $!: )
    >> disconnect_all DISPATCH (DBI::dr=HASH(0x55c71f9d4e80) rc1/3 @1 g2 ima801 pid#1942702) at /usr/lib/x86_64-linux-gnu/perl5/5.30/DBI.pm line 758 via  at ./import_old.pl line 0
    !! The ERROR '1043' was CLEARED by call to disconnect_all method
    -> disconnect_all for DBD::mysql::dr (DBI::dr=HASH(0x55c71f9d4e80)~0x55c71fa055b0) thr#55c71f68e2a0
    <- disconnect_all= ( ) [0 items] (not implemented) at /usr/lib/x86_64-linux-gnu/perl5/5.30/DBI.pm line 758 via  at ./import_old.pl line 0
!   >> DESTROY     DISPATCH (DBI::dr=HASH(0x55c71fa055b0) rc1/1 @1 g2 ima10004 pid#1942702) during global destruction
!   -> DESTROY in DBD::_::common for DBD::mysql::dr (DBI::dr=HASH(0x55c71fa055b0)~INNER) thr#55c71f68e2a0
!   <- DESTROY= ( undef ) [1 items] during global destruction
    DESTROY (dbih_clearcom) (drh 0x55c71f9d4e80, com 0x55c71f75fdd0, imp global destruction):
       FLAGS 0x100215: COMSET Active Warn PrintWarn AutoCommit 
       PARENT undef
       KIDS 0 (0 Active)
    dbih_clearcom 0x55c71f9d4e80 (com 0x55c71f75fdd0, type 1) done.

!   >> DESTROY     DISPATCH (DBI::dr=HASH(0x55c71f9d4e80) rc1/1 @1 g2 ima10004 pid#1942702) during global destruction
!   <> DESTROY for DBI::dr=HASH(0x55c71f9d4e80) ignored (inner handle gone)

@ibrierley
Copy link
Author

We never got this working, so ended up working on 5.7.38 enabled in our Centos (now Rocky) repos rather than Mariadb as an interim measure, but that hits end of support in Oct/23 so worth being aware there (but should be easier to migrate to 8 then iirc).

@ShyLionTjmn
Copy link

We never got this working, so ended up working on 5.7.38 enabled in our Centos (now Rocky) repos rather than Mariadb as an interim measure, but that hits end of support in Oct/23 so worth being aware there (but should be easier to migrate to 8 then iirc).

db is on production server, can't just upgrade it right away :(

@pali
Copy link
Member

pali commented Jul 23, 2023

Here is an update for this issue. I wrote details to comment: perl5-dbi/DBD-MariaDB#156 (comment)
This is bug in the MySQL 8.x client library and the external library needs to be fixed. Patch is attached to that comment.

@dveeden dveeden closed this as completed Aug 24, 2023
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

6 participants