Fix for Cpanel update that breaks mysqlhotcopy

The recent upgrades of Cpanel have been a pain because they've bro­ken mysql­hot­copy. Not kosher. For­tu­nately fix­ing this is pretty straight­for­ward by sim­ply down­grad­ing the DBD mod­ule of Perl, on which mysql­hot­copy relies.

The recent upgrades of Cpanel have been a pain because they've bro­ken mysqlhotcopy. Not kosher. For­tu­nately fix­ing this is pretty easy, by sim­ply down­grad­ing the DBD mod­ule of Perl, which mysqlhotcopy relies on.

Usu­ally the error is some­thing like this:

Invalid db.table name 'DBNAME.USERNAME`.`campaign' at /usr/bin/mysqlhotcopy line 854.

To solve this, sim­ply down­grade the DBD to ver­sion 4.001. Cre­ate a script any­where on your root folder as, say, dbd-downgrade.sh:

1
2
3
4
5
6
7
8
9
#!/bin/sh
cd /usr/src
wget -O dbd.tar.gz  "http_//search.cpan.org/CPAN/authors/id/C/CA/CAPTTOFU/DBD-mysql-4.001.tar.gz"
gzip -cd dbd.tar.gz | tar xf -
rm -rf dbd.tar.gz
cd DBD-mysql-4.001
perl Makefile.PL
make
make install

Then of course chmod the file to exe­cutable (644) and run it:

./dbd-downgrade.sh

Then try your mysqlhotcopy com­mand again. It should work. The only thing to con­sider is that if your Cpanel is setup to upgrade auto­mat­i­cally, it may rebuild DBD. You may need to down­grade the DBD again, until this thing is fixed!

If after this update, you see the error for RELOAD priv­i­leges, like this…

DBD::mysql::db do failed: Access denied; you need the RELOAD privilege for this operation at /usr/bin/mysqlhotcopy line 472.

…then sim­ply login to mysql as "root" user through the root SSH ter­mi­nal, and exe­cute the fol­low­ing command:

mysql>  grant all privileges on *.* to root@localhost;
mysql>  flush privileges;

Done. That should do it. Let me know if it doesn't.

A more long term fix

MySQL bug list has a cou­ple of sug­gested fixes. If you are com­fort­able with Perl, you can edit the code in /usr/bin/mysqlhotcopy and have it solved in a bet­ter way.

  • EP

    Thanks so much for this! I have been ask­ing this on the Cpanel forums: http://forums.cpanel.net/showthread.php&p=307175 — and finally I find an answer!

  • ProbChild

    Hi, thanks for this info. It fixed things for a while. Now I am get­ting this error. Any thoughts?


    DBI connect(';host=localhost;mysql_read_default_group=mysqlhotcopy','',…) failed: Access denied for user 'ecuito_user'@'localhost' (using pass­word: YES) at /usr/bin/mysqlhotcopy line 178

  • http://www.level1diet.com/ Tom Bond

    Did this…

    mysql> grant all priv­i­leges on *.* to root@localhost;
    mysql> flush privileges;

    then it tells me the direc­tory already exists, because –allowold or –addtodest options were not given. But I'm run­ning the script with a wrap­per script… any­way, my root user gets the line 178 error, while the actual MySQL user from my nor­mal con­nects gets the RELOAD line 472 error…

    It's a loop! I've gone through the process sev­eral times, still get the same things. Also applied the Perl fix to line 835 of mysql­hot­copy to remove the appended name to the front of the db etc. So that worked.

    Now what will fix this repeated RELOAD priv. thing? Thanks for the help and ideas!

  • http://www.level1diet.com/ Tom Bond

    Fixed!

    The prob­lem was that we needed to set ALL PRIVILIEGES for the actual db user, NOT ROOT. When you try to run mysql­hot­copy into MySQL as 'root' you get the 'access denied' error.

    When you apply all these fixes and actu­ally grant privs to the real
    db user, then every­thing seems to work just fine.

    Thanks all!