SniptoolsSniptools | Design & Technology Observations

RSS

Fix for Cpanel update that breaks mysqlhotcopy

Apr 2nd 2007
4 Comments

Respond
Trackback

The recent upgrades of Cpanel have been a pain because they’ve broken mysqlhotcopy. Not kosher. Fortunately fixing this is pretty straightforward by simply downgrading the DBD module of Perl, on which mysqlhotcopy relies.

The recent upgrades of Cpanel have been a pain because they’ve broken mysqlhotcopy. Not kosher. Fortunately fixing this is pretty easy, by simply downgrading the DBD module of Perl, which mysqlhotcopy relies on.

Usually the error is something like this:

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

To solve this, simply downgrade the DBD to version 4.001. Create a script anywhere on your root folder as, say, dbd-downgrade.sh:

#!/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 executable (644) and run it:

./dbd-downgrade.sh

Then try your mysqlhotcopy command again. It should work. The only thing to consider is that if your Cpanel is setup to upgrade automatically, it may rebuild DBD. You may need to downgrade the DBD again, until this thing is fixed!

If after this update, you see the error for RELOAD privileges, like this…

DBD::mysql::db do failed: Access denied; you need the RELOAD privilege

for this operation at /usr/bin/mysqlhotcopy line 472.

…then simply login to mysql as “root” user through the root SSH terminal, and execute the following 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 couple of suggested fixes. If you are comfortable with Perl, you can edit the code in /usr/bin/mysqlhotcopy and have it solved in a better way.




This post is tagged , , , ,

4 Comments

  1. EP

    Thanks so much for this! I have been asking this on the Cpanel forums: http://forums.cpanel.net/showthread.php?p=307175 - and finally I find an answer!

  2. ProbChild

    Hi, thanks for this info. It fixed things for a while. Now I am getting this error. Any thoughts? — DBI connect(‘;host=localhost;mysql_read_default_group=mysqlhotcopy’,”,…) failed: Access denied for user ‘ecuito_user’@’localhost’ (using password: YES) at /usr/bin/mysqlhotcopy line 178 — 

  3. Did this…

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

    then it tells me the directory already exists, because — allowold or — addtodest options were not given. But I’m running the script with a wrapper script… anyway, my root user gets the line 178 error, while the actual MySQL user from my normal connects gets the RELOAD line 472 error…

    It’s a loop! I’ve gone through the process several times, still get the same things. Also applied the Perl fix to line 835 of mysqlhotcopy 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!

  4. Fixed!

    The problem was that we needed to set ALL PRIVILIEGES for the actual db user, NOT ROOT. When you try to run mysqlhotcopy into MySQL as ‘root’ you get the ‘access denied’ error.

    When you apply all these fixes and actually grant privs to the real
    db user, then everything seems to work just fine.

    Thanks all!

Incoming Links