mysql: error while loading shared libraries: libncurses.so.5: cannot open shared object file

Geetanjali Mehra
2 min readDec 7, 2023

As the title of this post suggests, this is all about troubleshooting the title error. I got below error when tried to execute mariadb client after mariadb11.2 is installed on RHEL9.

[root@vmachine ~]# mariab

mysql: error while loading shared libraries: libncurses.so.5: cannot open shared object file: No such file or directory

Above error suggests that mariadb client requires libcurses.so.5 library file.

To troubleshoot above error, lets first check what package provides the mentioned library file.

[root@vmachine ~]# dnf provides libncurses.so*
Updating Subscription Management repositories.
Unable to read consumer identity

This system is not registered with an entitlement server. You can use subscription-manager to register.

ncurses-libs-6.2–8.20210508.el9.x86_64 : Ncurses libraries
Repo : @System
Matched from:
Provide : libncurses.so.6()(64bit)

Above output shows that ncurses-libs-6.2 package provides the required library file. Lets verify whether the said package is installed.

dnf list installed |grep ncurses*

If above command lists the said package, then this is already installed. Then, why the error in question is raised. The error is raised because of version mismatch. The version of required library ; libncurses.so.5 does not match with the installed one ; libncurses.so.6.

System library files resides under /usr/lib64 on RHEL9.0. To troubleshoot the error, you do not need to install another version of the package, but just create a symbolic link as below:

cd /usr/lib64

ln -s libncurses.so.6 libncurses.so.5

ls -l libncurses.so.5
lrwxrwxrwx. 1 root root 15 Dec 5 19:06 libncurses.so.5 -> libncurses.so.6

This will create a soft link which is named same as the required file. The created soft link points to the installed one.

Reattempting to run mariadb client, we receive:

[root@vmachine ~]# mariadb

mysql: error while loading shared libraries: libtinfo.so.5: cannot open shared object file: No such file or directory

[root@vmachine ~]#

This time, error is reported for missing libtinfo.so.5 library . Previous error is gone now. First verify whether the library file matching libtinfo.so is located under /usr/lib64.

cd /usr/lib64
ls -l libtinfo.so*
-rwxr-xr-x. 1 root root 191600 Aug 10 2021 libtinfo.so.6.2

Here, we have again the higher version of the required library installed. So, error will be solved by again creating a soft link named libtinfo.so.5 that points to the installed version of the same library.

cd /usr/lib64

ln -s libtinfo.so.6 libtinfo.so.5

That creates a soft link named libtinfo.so.5 that points to libtinfo.so.6.

Reattempting to execute mariadb client would execute successfully:

[root@vmachine ~]# mariadb

Welcome to the MariaDB monitor. Commands end with ; or \g.

Your MariaDB connection id is 3

Server version: 11.2.2-MariaDB MariaDB Server

Copyright © 2000, 2018, Oracle, MariaDB Corporation Ab and others.

Type ‘help;’ or ‘\h’ for help. Type ‘\c’ to clear the current input statement.

MariaDB [(none)]>

Now, the error is gone.

Learn MySQL Administration with Geetanjali Mehra , an experienced IT professional and co-author of a Linux-based book. For details, click on https://alltechmantra.wordpress.com/mysql-administration/

--

--

Geetanjali Mehra

I am a database administrator, an author, a blogger and a mother of a girl child.