NAME

Test::mysqld - mysqld runner for tests

SYNOPSIS

use DBI;
use Test::mysqld;

my $mysqld = Test::mysqld->new(
  my_cnf => {
    'skip-networking' => '', # no TCP socket
  }
);
my $dbh = DBI->connect(
  "DBI:mysql:...;mysql_socket=" . $mysqld->base_dir . "/tmp/mysql.sock",
  ...
);

DESCRIPTION

Test::mysqld automatically setups a mysqld instance in a temporary directory, and destroys it when the perl script exits.

FUNCTIONS

new

Create and run a mysqld instance. The instance is terminated when the returned object is being DESTROYed.

base_dir

Returns directory under which the mysqld instance is being created. The property can be set as a parameter of the new function, in which case the directory will not be removed at exit.

my_cnf

A hash containing the list of name=value pairs to be written into my.cnf. The property can be set as a parameter of the new function.

mysql_install_db

mysqld

Path to mysql_install_db script or mysqld program bundled to the mysqld distribution. If not set, the program is automatically search by looking up $PATH and other prefixed directories.

pid

Returns process id of mysqld (or undef if not running).

start

Starts mysqld.

stop

Stops mysqld.

setup

Setups the mysqld instance.

COPYRIGHT

Copyright (C) 2009 Cybozu Labs, Inc. Written by Kazuho Oku.

LICENSE

This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.

See http://www.perl.com/perl/misc/Artistic.html