MySQL – Determine if Built with Libedit or Readline

command lineMySQL

How to tell whether mysql was built with libedit or readline?

I'm trying to configure the mysql client tool to use Ctrl-R for searching command history but not sure which input library my installation is using.

Best Answer

If on Linux you can just use ldd to check which libraries it's dynamically linked against:

phil@ironforge:~$  ldd `which mysql`
        linux-vdso.so.1 =>  (0x00007ffd5add5000)
        libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007eff0a44e000)
        libreadline.so.5 => /lib/x86_64-linux-gnu/libreadline.so.5 (0x00007eff0a210000)
        libncurses.so.5 => /lib/x86_64-linux-gnu/libncurses.so.5 (0x00007eff09fee000)
        libtinfo.so.5 => /lib/x86_64-linux-gnu/libtinfo.so.5 (0x00007eff09dc4000)
        libz.so.1 => /lib/x86_64-linux-gnu/libz.so.1 (0x00007eff09baa000)
        libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2 (0x00007eff099a6000)
        libstdc++.so.6 => /usr/lib/x86_64-linux-gnu/libstdc++.so.6 (0x00007eff09623000)
        libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007eff0931a000)
        libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007eff08f50000)
        /lib64/ld-linux-x86-64.so.2 (0x000055960d9f2000)
        libgcc_s.so.1 => /lib/x86_64-linux-gnu/libgcc_s.so.1 (0x00007eff08d39000)
phil@ironforge:~$

In this example on my host, it's linked against libreadline.

It's also in the --help output:

phil@ironforge:~$ mysql --help | grep readline
mysql  Ver 15.1 Distrib 10.0.36-MariaDB, for debian-linux-gnu (x86_64) using readline 5.2
phil@ironforge:~$