Install the MySQLdb module in linux

Source: Internet
Author: User

Install MySQLdb Module 1 in linux and check whether the MySQLdb module has been installed to go To the python command line. Enter import MySQLdb. If no error is reported, this module has been installed. Skip the following steps. 2, download the latest MySQLdb Installer: wget-O python-1.2.3c1.tar.gz http://cdnetworks-kr-1.dl.sourceforge.net/project/mysql-python/mysql-python-test/1.2.3c1/MySQL-python-1.2.3c1.tar.gz Tar xzvf python-1.2.3c1.tar.gz cd MySQL-python-1.2.3c13, enter the user MySQLdb source code directory, run python setup. py build. Error: ImportError: No module named setuptools solution: Install setuptools wget-O setuptools-0.6c8.tar.gz http://pypi.python.org/packages/source/s/setuptools/setuptools-0.6c8.tar.gz Tar xzvf setuptools-0.6c8.tar.gz cd setuptools-0.6c8 python setup. py build sudo python setup. py install error: mysql_config not found cause: mysql_config command not found. Solution: 1) run the whereis mysql command to find the mysql installation directory. Assume that mysql is installed in/usr/local/mysql 2) and return to the MySQLdb source code directory. Run vi setup_posix.py or vimsetup_posix.py to open the configuration file, find mysql_config.path and change the path to the bin directory under the mysql installation path, that is, mysql_config.path = "/usr/local/mysql/bin/mysql_config ". If MySQL is installed in the default system path, the mysql_config script file is located in "/usr/bin/mysql_config ". (If mysql_config is not available, install the mysql-dev package.) error:/usr/bin/ld: cannot find-lmysqlclient_r solution: switch to the root user, run echo "/usr/local/mysql/lib/mysql">/etc/ld. so. conf # Please advise this/etc/ld. so. conf. This is the default configuration file of the ld, which varies depending on the system. /Usr/local/mysql/lib/mysql is related to the mysql installation directory. Force refresh the ld configuration file. Use ldconfig to enter the mysql lib directory such as/usr/local/mysql/lib/mysql #, which is related to the mysql installation directory. If libmysqlclient_r.so is not available, a soft connection ln-s libmysqlclient is established. so libmysqlclient_r.so exit root and switch to the current user. error: _ mysql. c: 2810: error: expected declaration specifiers before 'init _ mysql' solution: install python-dev, yum install python-devel 4, enter the MySQLdb source code directory, and run

sudo python setup.py install

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.