Non-root users install Python + mysqldb and use

Source: Internet
Author: User

Make full use of subjective initiative when resources are insufficient.



You do not have the root permission for the test machine. To use a Python script to perform a stress test on the database, you can only install it in your own directory. Therefore, the -- prefix of configure and the path options when installing mysqldb are very important.



1.
Python tar xvf Python-2.6.5.tar.bz2

CD Python-2.6.5

./Configure -- prefix = your_python_dir

Make & make instal

 

 

2.
MySQL-python-1.2.3c1.tar.gz mysqldb tar xzvf

CD MySQL-python-1.2.3c1

VI site. cfg modify mysql_config = your_mysql_dir/MySQL-bin/mysql_config

Your_python_dir/bin/Python setup. py build

Your_python_dir/bin/Python setup. py install -- prefix = you_python_dir

This step may prompt

Importerror: No module named setuptools

 

 

3.
Setuptool tar xzvf setuptools-0.6c11.tar.gz

CD setuptools-0.6c11

Your_python_dir/bin/Python
Setup. py build

Your_python_dir/bin/
PY
Thon setup. py install

Back

Mysq
L-python-1.2.3c1 directory, execute the last step to install mysqldb:

Your_python_dir/bin/Python setup. py install -- prefix = you_python_dir

 

 

4.
Import mysqldb error importerror: libmysqlclient_r.so.16:

Cannot open shared object file: no such file or directory

Solution: Find ~ -Name "libmysqlclient_r.so.16 ":

You_mysql_dir/MySQL-bin/lib/MySQL

Cd ~ & VI. bashrc

Add export LD_LIBRARY_PATH = "your_mysql_dir/MySQL-bin/lib/MySQL $ LD_LIBRARY_PATH"

Restart the session. Import mysqldb is normal.

 



 

Thank you, Cat.
Xiao Hong
.

Related Article

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.