Search code examples
mysqlccentosmariadbconnector

Installing Connector C for Mariadb


So, I want to use Mariadb. There is this Connector-C for it. https://downloads.mariadb.org/connector-c/

How do I install it? Quiet frankly, the documentation for it is horrible. Even the src file for 3.0.5 is linked to 3.0.4 page.

I did not find a way to install the binary, and the documentation for building from src is quiet vague. I would prefer to know how to install both ways (binary and build from source)

I'm using CentOS7 64bit.


Solution

  • The easiest way to install it would be to use the MariaDB package repository.

    curl -sS https://downloads.mariadb.com/MariaDB/mariadb_repo_setup | sudo bash
    sudo yum -y install MariaDB-devel
    

    As for building from source, these steps should work on CentOS 7.

    sudo yum -y install git gcc openssl-devel make cmake
    git clone https://github.com/MariaDB/mariadb-connector-c.git
    mkdir build && cd build
    cmake ../mariadb-connector-c/ -DCMAKE_INSTALL_PREFIX=/usr
    make
    sudo make install