Mysql warning: InnoDB: Ignoring tablespace `foo`.`bar` because the DISCARD flag is set Whenever my MySQL 5.7 starts I get the warning

InnoDB: Ignoring tablespace `foo`.`bar` because the DISCARD flag is set


bar is a table I experimented with long time ago with import tablespace, but its long deleted and I don't see any files associated with it in the database directory.

drop table bar doesn't work.

How do I get ride of this warning ?
Why this warning pops up:

You discarded the tablespace and physically removed the .frm file from the data directory. But still, tablespace information is present in the InnoDB data dictionary table. (you can check innodb_sys_tables, innodb_sys_tablespace in information schema).

So whenever the server starts up, InnoDB tries to load all the table present in sys_tables, sys_tablespaces.  So it tries to open foo.bar table but the state is DISCARD. So that warning is issued.

How to remove the table/warning:


Create a fake bar.frm &amp; bar.ibd inside the foo folder of data
directory.
Start the server and give the drop table foo.bar. It
should remove the table from the dictionary and removes the warning too.