Bug #66589 mysqlhotcopy does not exclude performance_schema
Submitted: 29 Aug 2012 8:46 Modified: 19 Jun 2014 5:53
Reporter: Dominic Benson Email Updates:
Status: Won't fix Impact on me:
None 
Category:MySQL Server: Command-line Clients Severity:S3 (Non-critical)
Version:5.5, 5.6.7 OS:Any
Assigned to: CPU Architecture:Any

[29 Aug 2012 8:46] Dominic Benson
Description:
When called with the --regex option, mysqlhotcopy automatically skips information_schema, even if it would have matched the specified expression.

performance_schema should be similarly skipped, as it is subject to the same problems (command denied to user * for table 'cond_instances'), and it likewise does not have on-disk MyISAM table files to back up.

This is a particular problem if the --regex='.*' method is used to back up all databases.

How to repeat:
mysqlhotcopy.sh --regex='.*' /path/to/backup

On MySQL server 5.5+:
DBD::mysql::db do failed:  command denied to user '<user>'@'localhost' for table 'cond_instances' at /usr/bin/mysqlhotcopy line 489.

On MySQL server <=5.1:
Backup completes successfully

Suggested fix:
--- mysql-5.5.27-old/scripts/mysqlhotcopy.sh	2012-07-20 18:38:03.000000000 +0100
+++ mysql-5.5.27/scripts/mysqlhotcopy.sh	2012-08-29 09:22:31.314342303 +0100
@@ -268,6 +268,7 @@ if ( defined $opt{regexp} ) {
     $sth_dbs->execute;
     while ( my ($db_name) = $sth_dbs->fetchrow_array ) {
 	next if $db_name =~ m/^information_schema$/i;
+        next if $db_name =~ m/^performance_schema$/i;
 	push @db_desc, { 'src' => $db_name, 't_regex' => $t_regex } if ( $db_name =~ m/$opt{regexp}/o );
     }
 }
[29 Aug 2012 9:39] Valeriy Kravchuk
Thank you for the problem report. Verified with 5.6.7 also.
[30 Aug 2012 7:49] Hartmut Holzgraefe
Also add ndbinfo while you're on it?
[19 Jun 2014 5:53] Erlend Dahl
[16 Jun 2014 2:04] Georgi Kodinov

mysqlhotcopy was deprecated in 5.6 and removed in 5.7, due to it not really
delivering to what it was supposed to do.
Please consider using the innodb incremental backup instead.