skip to Main Content

I’ve compiled and installed Python 3.10.9 (from .tar) and mariadb-c-connector (from official Github repo) on my Debian 11 (bullseye) machine.
I also installed: ufw, fail2ban, mariadb-server, mariadb-client.

Now if i install mariadb in my Python pipenv and run i got the error: mariadb.OperationalError: This feature is not implemented or disabled.

On my Manjaro it works fine. This is how i create a connection to the database.

def connect(self):

    if self.conn:
        return

    # Connect to MariaDB Platform
    try:
        self.conn = mariadb.connect(
            user=self.user,
            password=self.password,
            host=self.host,
            port=self.port,
            database=self.database,
            reconnect=True,
        )
    except mariadb.Error as e:
        log.exception(f"Error connecting to MariaDB Platform: {e}")
        self.conn = None
        return

What i do wrong or what is missing?

Thank you in advance.

Edit:

Output of mariadb_config --cc_version --libs

3.3.4
-L/usr/lib/mariadb/ -lmariadb

Output of ldd /home/USER/.local/share/virtualenvs/PROJEKT/lib/python3.10/site-packages/mariadb/_mariadb.cpython-310-x86_64-linux-gnu.so

linux-vdso.so.1 (0x00007fffa2eec000)
libmariadb.so.3 => /lib/x86_64-linux-gnu/libmariadb.so.3 (0x00007f6911918000)
libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f6911743000)
libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2 (0x00007f691173d000)
libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007f691171b000)
libssl.so.1.1 => /lib/x86_64-linux-gnu/libssl.so.1.1 (0x00007f6911688000)
libcrypto.so.1.1 => /lib/x86_64-linux-gnu/libcrypto.so.1.1 (0x00007f6911394000)
libz.so.1 => /lib/x86_64-linux-gnu/libz.so.1 (0x00007f6911375000)
/lib64/ld-linux-x86-64.so.2 (0x00007f6911988000)

2

Answers


  1. This is the check in source code:

    #if MARIADB_PACKAGE_VERSION_ID > 30301
       if (mysql_optionsv(self->mysql, MARIADB_OPT_STATUS_CALLBACK, MrdbConnection_process_status_info, self))
          goto end;
    #endif
    

    It fails, since mysql_optionsv doesn’t support the option MARIADB_OPT_STATUS_CALLBACK and returns error CR_NOT_IMPLEMENTED.

    Update (after more details were added to the original question):

    So it looks like you built (installed) the mariadb module with the correct required Connector/C version (> 3.3.1) , however there is an older Connector/C version in your default library path libmariadb.so.3 => /lib/x86_64-linux-gnu/libmariadb.so.3 (which was likely installed with package libmariadb-dev)

    Login or Signup to reply.
  2. I had the same problem in a docker environment with python 3.11-slim and mariadb 10.11-rc. I also installed mariadb==1.1.5.post3.

    I updated the MariaDB Connector/C using the following instruction.

    Here’s what I did in my Dockerfile

    RUN apt-get update && apt-get install -y gcc curl wget
    RUN wget https://downloads.mariadb.com/MariaDB/mariadb_repo_setup
    RUN chmod +x mariadb_repo_setup
    RUN ./mariadb_repo_setup  --mariadb-server-version="mariadb-10.6"
    RUN apt install -y libmariadb3 libmariadb-dev
    

    These commands helped me update the library to the new version.
    In my connection code, I also replaced host with the name of the service from the docker-compose.yml file. In my case it will be db

    from os import getenv
    
    import mariadb
    
    con = mariadb.connect(
        host='db',
        user=getenv('DB_USER', default=''),
        password=getenv('DB_PASS', default=''),
        database=getenv('DB_NAME', default=''),
    )
    cur = con.cursor()
    

    I hope these commands help resolve the issue in your environment

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search