Mysql – Phantom Table in MySQL

command lineMySQL

Programmer here, be gentle.

I'm working in a MySQL database with only a single table, as shown by show tables:

mysql> show tables;
+----------------------+
| Tables_in_widget_web |
+----------------------+
| widget_signups       |
+----------------------+
1 row in set (0.00 sec)

At some point earlier in development there might have been other tables as well, but for what we were doing we decided that we were probably over-architecting and nixed them.

I noticed the other day that auto-complete within mysql was not working properly in this database. When I am using the particular database and I type SELECT * FROM widget<TAB> I wasn't getting my good old auto-complete that I was used to. Double tabbing to see possible auto-completions yields:

mysql> SELECT * FROM widget<TAB><TAB>
widget_date
widget_signups
[... columns on widget_signups ...]

Yet when I try to DROP this mysterious and previously deleted widget_date table, I predictably get errors saying the table doesn't exist.

My question is this: how can I repair my beloved mysql auto-complete by removing this phantom table? I would assume (wrongly?) that auto-complete suggestions within the mysql command line are drawn from a table within mysql. Where can I go to zap this safely – or do I just need to man up and get used to typing the entire table name?

Best Answer

This is happening because the auto-complete isn't context aware & it's offering you a column name of widget_date as well as the table name you're expecting.