MySQL MHA and Perl pathing

I am certainly not a knowledgeable Perl person, however I recently ran into the error Can’t locate MHA/ on Red Hat 6.x. I have installed MySQL MHA on various systems before without any issues.

$ masterha_manager -version
Can't locate MHA/ in @INC (@INC contains: /usr/local/lib64/perl5 /usr/local/share/perl5 /usr/lib64/perl5/vendor_perl /usr/share/perl5/vendor_perl /usr/lib64/perl5 /usr/share/perl5 .) at /usr/bin/masterha_manager line 26.
BEGIN failed--compilation aborted at /usr/bin/masterha_manager line 26.

The issue was that MySQL MHA is not installed in any of the acceptable default paths for this disto default installation.

$ find / -type d -name MHA

The fix was simple on this OS, but I expect there is a correct Perl approach?

ln -s /usr/lib/perl5/vendor_perl/MHA /usr/lib64/perl5/vendor_perl/
$ cat /etc/*release
Red Hat Enterprise Linux Server release 6.3 (Santiago)
Red Hat Enterprise Linux Server release 6.3 (Santiago)

Tags: ,

2 Responses to “MySQL MHA and Perl pathing”

  1. Hi Ronald,

    Standard perl module directory is different between RHEL5 and RHEL6. You need to use MHA RHEL5 rpm for RHEL5, and to use MHA RHEL6 rpm for RHEL6 (

    MHA RHEL6 rpm installs perl modules under /usr/share/perl5/vendor_perl/, which is standard perl module location in RHEL6 so dependency problem should not happen.

  2. ronald says:

    Thanks Yoshinori,

    You are indeed right, here is what I ran on this server, and I am downloading the el5 version (command copied from previous installs), not the el6 version.

    cd /tmp
    sudo yum install -y
    sudo yum install -y perl-Config-Tiny perl-Log-Dispatch perl-Parallel-ForkManager perl-Time-HiRes
    sudo rpm -ivh mha4mysql-manager-*.noarch.rpm
    # Needed in CentOS 6.x
    ln -s /usr/lib/perl5/vendor_perl/MHA /usr/lib64/perl5/vendor_perl/
    masterha_manager -version