#!/usr/bin/perl use strict; use warnings; use DBI qw(:sql_types); my $tmp_dbh = DBI->connect( 'dbi:mysql:database=mysql', 'root', undef, { AutoCommit => 1, PrintError => 0, RaiseError => 1 } ); $tmp_dbh->do('CREATE DATABASE IF NOT EXISTS test'); $tmp_dbh->disconnect(); #my $dsn = 'dbi:mysql:database=test;mysql_server_prepare=1'; # Crashes my $dsn = 'dbi:mysql:database=test;mysql_emulated_prepare=1'; # OK my $dbh = DBI->connect( $dsn, 'root', undef, { AutoCommit => 1, PrintError => 0, RaiseError => 1 } ); $dbh->do("SELECT 1 AS num", { mysql_emulated_prepare => 1 }); my $sth = $dbh->prepare("SELECT 1 AS num", { mysql_emulated_prepare => 1 }); $sth->execute(); my $rows = $sth->fetchall_arrayref({}); $sth->finish(); print "$rows->[0]{num}\n"; $dbh->disconnect();