Firstly, thank you for Test::mysqld!
I've been using it to test scripts against different distributions of
MySQL from mysql.com, with the tarballs untarred to a local directory
(but not installed) and adding the bin directory to my $PATH, for
example, PATH=~/mysql-5.1.48-linux-x86_64-glibc23/bin:$PATH
This is sufficient for the module to locate mysqld and
mysql_install_db, however running a script results in mysqld failing to
start with "[ERROR] Can't find
messagefile '/usr/local/mysql/share/english/errmsg.sys'"
You can get around with by setting basedir= appropriately in the my_cnf
hash:
my $mysqld = Test::mysqld->new(
my_cnf => {
'skip-networking' => '',
'basedir' => '~/mysql-5.1.48-linux-x86_64-glibc23',
},
);
It would be useful to not have to set this explicitly in every script
for different mysql distributions, the following patch will add the
attribute to the generated my.cnf where we're using a mysqld from
<somewhere>/bin/mysqld:
==== Test-mysqld-0.13/lib/Test/mysqld.pm#1 (text) - Test-mysqld-
0.13/lib/Test/mysqld.pm#2 (text) ==== content
@@ -168,6 +168,10 @@
? "$_=$v" . "\n"
: "$_\n";
} sort keys %{$self->my_cnf};
+ if (my ($basedir) = ($self->mysqld =~ m#(.*)/bin/mysqld#)) {
+ # Using local installation, set basedir to match
+ print $fh "basedir=$basedir\n";
+ }
close $fh;
# mysql_install_db
if (! -d $self->base_dir . '/var/mysql') {
Thank you for your consideration.