diff --git a/client/mysqlcheck.c b/client/mysqlcheck.c index 011a0e2d738..75f841f3c5e 100644 --- a/client/mysqlcheck.c +++ b/client/mysqlcheck.c @@ -756,7 +756,7 @@ static int fix_table_storage_name(const char *name) if (strncmp(name, "#mysql50#", 9)) DBUG_RETURN(1); - my_snprintf(qbuf, sizeof(qbuf), "RENAME TABLE `%s` TO `%s`", + my_snprintf(qbuf, sizeof(qbuf), "RENAME TABLE %`s TO %`s", name, name + 9); rc= run_query(qbuf); @@ -773,7 +773,7 @@ static int fix_database_storage_name(const char *name) if (strncmp(name, "#mysql50#", 9)) DBUG_RETURN(1); - my_snprintf(qbuf, sizeof(qbuf), "ALTER DATABASE `%s` UPGRADE DATA DIRECTORY " + my_snprintf(qbuf, sizeof(qbuf), "ALTER DATABASE %`s UPGRADE DATA DIRECTORY " "NAME", name); rc= run_query(qbuf); if (verbose) diff --git a/mysql-test/r/mysqlcheck.result b/mysql-test/r/mysqlcheck.result index c5ba3e7dc79..d2f4745c5f1 100644 --- a/mysql-test/r/mysqlcheck.result +++ b/mysql-test/r/mysqlcheck.result @@ -339,3 +339,8 @@ Repairing views test.v1 OK drop view v1; drop table t1; +create table `#mysql50#t1``1` (a int) engine=myisam; +show tables; +Tables_in_test +t1`1 +drop table `t1``1`; diff --git a/mysql-test/t/mysqlcheck.test b/mysql-test/t/mysqlcheck.test index ac42e1e184d..7da14e3742a 100644 --- a/mysql-test/t/mysqlcheck.test +++ b/mysql-test/t/mysqlcheck.test @@ -350,3 +350,8 @@ create table t1(a int); --exec $MYSQL_CHECK --process-views --check-upgrade --auto-repair test drop view v1; drop table t1; + +create table `#mysql50#t1``1` (a int) engine=myisam; +--exec $MYSQL_CHECK --fix-table-names --databases test +show tables; +drop table `t1``1`;