Teach MySQL CLI Autocomplete to List Only Table Names

command lineMySQL

When starting to write a MySQL query, e.g. describe myt and hitting TAB, MySQL autocomplete will list not just the table names starting with myt (e.g. mytable), but all fields/columns of each matching table. E.g. mytable.id, mytable.name, etc.

This can easily result in Display all 505 possibilities? (y or n), and makes the autocomplete less useful than it could be.

Is there a setting or a trick to let MySQL (or MariaDB) only show the table names, not the field names? Or in other words, to treat the dot in the same way that regular shell/bash autocomplete treats the directory separator?

Best Answer

Interesting question! This is one reason I don't use the autocomplete.

It's called auto-rehash if you want to check out the documentation on it.

But, no, looking at the code, I don't believe you can configure this.