Normally, autocompletion works fine in mysql command-line client (mysql-client-5.5
). I have a table called booking
. When I type the letter b
and pres TAB
the name of my table gets autocompleted:
SELECT * FROM b<TAB>
However, when I use rlwrap
(alias mysql='/usr/bin/rlwrap -s 99999 -a -pRED /usr/bin/mysql'
), autocompletion stops working.
It looks as if rlwrap
is interfering with the autocompletion feature.
I am using Debian Wheezy.
UPDATE 1:
When I start my command with strace
, ie:
strace /usr/bin/rlwrap -s 99999 -a -pRED /usr/bin/mysql --auto-rehash
I see following error
access("/usr/share/rlwrap/completions/mysql", R_OK) = -1 ENOENT (No such file or directory)
could it be, that rlwrap needs some file with mysql completions?
UPDATE 2
OK, I have created the file /usr/share/rlwrap/completions/mysql
and put 3 sample lines there:
select
from
where
Now when I start mysql
and type sele<TAB>
, the tab actually completes the word select
. That is progress, but that does not solve the whole problem. I mainly need autocompletion to help me complete obscure table names which I don't (want to) remember. But I cannot edit the autocomplete file every time I change/add/rename a table.
Is it not possible to tell rlwrap
to use the same autocomplete file as mysql
does? (I presume mysql
must use some such file)
UPDATE 3:
following are the other errors from strace
access("/etc/ld.so.nohwcap", F_OK) = -1 ENOENT (No such file or directory)
access("/etc/ld.so.preload", R_OK) = -1 ENOENT (No such file or directory)
access("/etc/ld.so.nohwcap", F_OK) = -1 ENOENT (No such file or directory)
access("/etc/ld.so.nohwcap", F_OK) = -1 ENOENT (No such file or directory)
access("/etc/ld.so.nohwcap", F_OK) = -1 ENOENT (No such file or directory)
access("/etc/ld.so.nohwcap", F_OK) = -1 ENOENT (No such file or directory)
access("/etc/ld.so.nohwcap", F_OK) = -1 ENOENT (No such file or directory)
access("/etc/ld.so.nohwcap", F_OK) = -1 ENOENT (No such file or directory)
stat("/home/martin/.terminfo", 0x7fff27ee6a70) = -1 ENOENT (No such file or directory)
access("/etc/terminfo/x/xterm-256color", R_OK) = -1 ENOENT (No such file or directory)
access("/home/martin/.mysql_completions", R_OK) = -1 ENOENT (No such file or directory)
access("/usr/share/rlwrap/completions/mysql", R_OK) = -1 ENOENT (No such file or directory)
connect(4, {sa_family=AF_FILE, path="/var/run/nscd/socket"}, 110) = -1 ENOENT (No such file or directory)
connect(4, {sa_family=AF_FILE, path="/var/run/nscd/socket"}, 110) = -1 ENOENT (No such file or directory)
access("/etc/ld.so.nohwcap", F_OK) = -1 ENOENT (No such file or directory)
access("/etc/ld.so.nohwcap", F_OK) = -1 ENOENT (No such file or directory)
access("/etc/ld.so.nohwcap", F_OK) = -1 ENOENT (No such file or directory)
access("/etc/ld.so.nohwcap", F_OK) = -1 ENOENT (No such file or directory)
stat("/home/martin/.inputrc", 0x7fff27ee7710) = -1 ENOENT (No such file or directory)
mysql
already used readline.mysql
(I am using Debian Wheezy)rlwrap -if dictfile sqlplus whatever
-i to ignore case and -f to use the file dictfile.