Bug #68015 mysqlcheck handles table names with dots incorrectly
Submitted: 2 Jan 2013 20:22 Modified: 17 Feb 2014 17:45
Reporter: Nils Breunese Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: Command-line Clients Severity:S3 (Non-critical)
Version:5.5.28 OS:Any
Assigned to: CPU Architecture:Any

[2 Jan 2013 20:22] Nils Breunese
Description:
mysqlcheck does not handle tables with dots in their names correctly.

How to repeat:
1. Create a database, for instance name it "database".
2. Create a table in this database with a dot in its name, for instance "foo.bar". According to http://dev.mysql.com/doc/refman/5.1/en/identifiers.html this is a valid identifier since MySQL 5.1.6.
2. Run 'mysqlcheck --all-databases --auto-repair'
3. You get the following error:

----
Repairing tables
foo.bar
Error    : Table 'foo.bar' doesn't exist
status   : Operation failed
----

Suggested fix:
Possibly mysqlcheck needs to add backticks to the table names:

----
mysql> DESCRIBE `foo.bar`; -- Works fine

mysql> DESCRIBE foo.bar;
ERROR 1146 (42S02): Table 'foo.bar' doesn't exists
----
[3 Jan 2013 5:41] Shane Bester
verified as described.  mysqlcheck, and any client utility should always surround any schema, table, column, routine, user variable with backticks.
[9 Oct 2013 8:06] Fredric Johansson
We hit a similar issue when running 
'mysqlcheck -o -udbuser -p testdb'
to optimize the tables and ended up with this error when it was trying to optimize `testdb`.`tmp.backlog` :
mysqlcheck: Got error: 1142: SELECT,INSERT command denied to user 'dbuser'@'localhost' for table 'backlog' when executing 'OPTIMIZE TABLE ... ' .

The bug seems to reside in function fix_table_name in mysqlcheck.c according to another user
[7 Feb 2014 9:00] Ståle Deraas
Hi Xiaobin Lin,

Thank you for your contribution. We have chosen to fix this in another way, so we will not take it. Note that with your contribution the following test case fails:

create table `t.1`(a int) engine=myisam;
--replace_result 'Table is already up to date' OK
--exec $MYSQL_CHECK --auto-repair --all-databases
drop table `t.1`;
[17 Feb 2014 17:45] Paul Dubois
Noted in 5.6.17, 5.7.4 changelogs.

mysqlcheck did not correctly handle table names containing dots.
[17 Mar 2014 5:59] Erlend Dahl
bug#71331 was marked as a duplicate.
[29 Mar 2014 18:32] Laurynas Biveinis
This bug is closed as fixed in 5.6.17, but the testcase by Staale still fails there. Bug 72161.
[1 Apr 2014 12:32] Paul Dubois
Correction: This bug is fixed in 5.7.4 only.