Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to install the MySQLdb extension corresponding to mariadb in Python

2025-04-06 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/02 Report--

This article mainly explains how Python installs the MySQLdb extension corresponding to mariadb. Interested friends may wish to have a look at it. The method introduced in this paper is simple, fast and practical. Let's let the editor take you to learn "Python how to install the MySQLdb extension corresponding to mariadb"!

Install under debian

For example, the online solution is:

Apt-get install libmysql-devapt-get install libmysqlclient-devapt-get install python-devpip install mysqlclient

These commands are generally fine, but maraidb is installed on this machine, so that's bullshit.

MariaDB [(none)] > select version (); +-+ | version () | +-+ | 10.1.38-MariaDB-0+deb9u1 | +-+

Search for the source of apt and find that there is no corresponding libmysql-dev or the like. The search is as follows:

Ljf@ljf:/var/www/python$ sudo apt-cache search libmysqllibglpk40-linear programming kit with integer (MIP) supportlibcrypt-mysql-perl-Perl module to emulate the MySQL PASSWORD () functionlibmysql-diff-perl-module for comparing the table structure of two MySQL databaseslibreoffice-base-drivers-Database connectivity drivers for LibreOfficesolr-common-Enterprise search server based on Lucene3-common fileslibmariadbclient-dev-compat-MariaDB database development files (libmysqlclient compatibility) libmysql++-dev-MySQL C++ library bindings (development) libmysql++-doc-MySQL C++ library bindings (documentation and examples) libmysql++3v5-MySQL C++ library Bindings (runtime) libmysqlcppconn-dev MySQL Connector for C++ (development files) libmysqlcppconn7v5-MySQL Connector for C++ (library) libmysql-java-Java database (JDBC) driver for MySQLlibmysql-cil-dev-MySQL database connector for CLIlibmysql6.4-cil-MySQL database connector for CLIdefault-libmysqlclient-dev-MySQL database development files (metapackage) libmysql-ocaml- OCaml bindings for MySql (runtime package) libmysql-ocaml-dev-OCaml bindings for MySql (development package) node-mysql-MySQL client implementation for Node.js

The search for the source does not feel so right, but there is a source whose name is libmariadbclient-dev-compat, so is it possible that you want to download the source file of libmariadb? search the corresponding extension of libmariadb:

Ljf@ljf:/var/www/python$ sudo apt-cache search libmariadblibmariadbclient-dev-MariaDB database development fileslibmariadbclient-dev-compat-MariaDB database development files (libmysqlclient compatibility) libmariadbclient18-MariaDB database client librarylibmariadbd-dev-MariaDB embedded database, development fileslibmariadbd18-MariaDB embedded database, shared librarylibmariadb-dev-MariaDB Connector/C, development fileslibmariadb-dev-compat-MariaDB Connector/C, compatibility symlinkslibmariadb2-MariaDB Connector/Cdefault-libmysqlclient-dev-MySQL database development files (metapackage

Sure enough, the source file of libmariadb is very similar to the recommended command, so try to install it:

Apt-get install libmariadbd-devapt-get install libmariadbdclient-devapt-get install python-devpip install mysqlclient

After the execution is complete, test:

Ljf@ljf:/var/www/python$ pythonPython 2.7.13 (default, Sep 26 2018, 18:42:22) [GCC 6.3.0 20170516] on linux2Type "help", "copyright", "credits" or "license" for more information. > > import MySQLdb > exit () so far, I believe everyone on the "Python how to install mariadb corresponding MySQLdb extension" have a deeper understanding, might as well to the actual operation of it! Here is the website, more related content can enter the relevant channels to inquire, follow us, continue to learn!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report