The Python environment is already installed and the version is 2.7.8, you need to call the database, so you need to install the MYSQLDB module package: http://download.csdn.net/download/fhqsse220/5602861Installation process:
Decompression and Installation# TAR-XF Mysql-python-1.2.3.tar.gz#cd mysql-python-1.2.3#python setup.py Build#python setup.py Install
2. Error resolutionImport Module Error:/usr/local/lib/python2.7/site-packages/mysql
#-*-Coding:utf-8-*- #mysqldb Import time, MySQLdb #连接 Conn=mysqldb.connect (host= "localhost", user= "root", passwd= "root", db= "test", charset= "UTF8") cursor = Conn.cursor () The return value of the tuple The return value of the Conn.cursor (cursorclass=mysqldb.cursors.dictcursor) dictionary #删除表 sql = "DROP table if exists user" Cursor.execute (SQL) #创建 sql = "CREATE table if not exists user (name va
Label: Take Ubuntu under installation as an example: : https://pypi.python.org/pypi/MySQL-python/ After decompression, go directly to the unzip directory to run the installation command. Install View Code If successful, the MYSQLDB module can be used successfully. However, the following problems generally occur: 1) importerror:no module named Setuptools Solution: wget http://pypi.python.org/packages/source/s/setuptools/setuptools-0.6c11.tar.gz
tar z
Label:DescriptionTo use Python to connect to MySQL we need a driver this program is Mysql-python, so we first want to the next corresponding version of the Mysql-python (note that this driver only 32-bit version, so your Python The environment is best if 32 people)0th step: Download the 32-bit Python and install: http://yunpan.cn/cQQnKwfeIRHq7 access password Def6First step: Download MySQLdb and install: http://yunpan.cn/cQQtnsLcsGyEr access password
This article describes the Python mysqldb Linux installation notes, this article explains the rapid installation and manual compilation and installation of two methods, and explained the operation steps, the need for friends can refer to the nextPrimarily for centos6.5 64-bit systemsThe default Python version is 2.6Coded installation of python2.7 and python3.4First, yum Quick InstallYum Install Mysql-pythonYum Install Python-setuptoolsRegular contacts
_ Mysql. c: 2422: error: the initial value setting element is not a constant._ Mysql. c: 2422: Error :( near the initialization of '_ mysql_ResultObject_memberlist [0]. offset)_ Mysql. c: In function '_ mysql_ConnectionObject_getattr ':_ Mysql. c: 2444: Error: '_ mysql_ConnectionObject' does not have a member named 'open '.Error: command 'gcc 'failed with exit status 1
Solution
vi site.cfgSet#mysql_config = /usr/local/bin/mysql_configComment out and change it to the correct local location:mysql_
Solve the Problem of installing mysqldb using pip in centos
On the centos-6.4 pip install mysql-python, the error is as follows [sentry @ kjtest111 mysql-python] $ pip install mysql-python
Downloading/unpacking mysql-python
Running setup. py egg_info for package mysql-python
Sh:/usr/bin/mysql_config: No such file or directory
Traceback (most recent call last ):
File "
File "/tmp/pip-build-sentry/mysql-python/setup. py", line 18, in
Metadata, options
/Usr/lib/python2.4/Site-packages/MySQL_python-1.2.3-py2.4-linux-i686.egg/_ MySQL. PY: 3: userwarning: module _ MySQL was already imported from/usr/lib/python2.4/Site-packages/MySQL_python-1.2.3-py2.4-linux-i686.egg/_ MySQL. pyC, but/root/soft/MySQL-python-1.2.3 is being added to SYS. path
The reason is that after install, The mysqldb module has been put in the site-pachages directory of Python; however, the same module exists in the current direc
MySQL is an excellent open-source database and is widely used. Therefore, it is necessary to briefly introduce how to operate MySQL databases using python. Python operating database needs to install a third-party module in the http://mysql-python.sourceforge.net/Download and documentation are available.Because the python database module has specific specifications for the database module, no matter which database method is used, it is similar. Here we will provide a demonstration.Code:
#-*-Enc
.)
Cursor
The
default cursor class. This class is composed of
cursorwarningmixin,
cursorstoreresultmixin,
cursortuplerowsmixin, and basecursor, i.e. it raises Warning, uses mysql_store_result (), and returns rows a S tuples.
Dictcursor
like
Cursor except it returns rows as dictionaries.
Sscursor
A "server-side" cursor. Like the
Cursor but uses
cursoruser
First, install the Easy_installReference article:Http://www.cnblogs.com/huangjacky/archive/2012/03/28/2421866.htmlInstallationwget https://bootstrap.pypa.io/ez_setup.py-o-| python Installed in the default version of python2.6.6 "If it is a 2.7.5 version, refer to the bottom of the reference article"Test whether the installation was successful Easy_installEasy_install TwistedSecond, Python into the installation of MySQLEasy_install Mysql-pythonThird, testingPython entryImport MySQLdbNo error occ
Tags: style blog color using OS filesPython operation MySQL requires installation of Python-mysqlCan be searched from the Internet, and the same as the normal Python package installationAfter installation, the module name is MYSQLDB, can be used in Windows and Linux environment, the test is very useful,But also found the annoying mess problem, finally used a few ways, solved!I have used the following measures to ensure that MySQL output is not mess:1
One. InstallationInstall the setuptools required by Python setup.py firstYum Install Python-setuptoolsMYSQLDB ModuleDownloadwget Https://pypi.python.org/packages/source/M/MySQL-python/MySQL-python-1.2.5.zipInstallationUnzip Mysql-python-1.2.5.zipCD mysql-python-1.2.5Python setup.py Build(See below for an error)Python setup.py InstallOkTwo. Error and resolutionPython setup.py build timeWrongError:mysql_config not found found Mysql_configSolveFind/-name Mysql_config/data/mysql5537/bin/mysql_config
Label:mysql-server-5.5:depends:mysql-client-5.5 (>= 5.5.35-0ubuntu0.13.10.2) but it isn't going to be installedDepends:libdbi-perl but it isn't going to being installeddepends:mysql-server-core-5.5 (= 5.5.35-0ubuntu0.13.10.2) but 5.5.43-0ubuntu0.12.04.1 was to be installedRecommends:libhtml-template-perl but it isn't going to being installed Install Mysql-common First, as it is not dependent on: wget http://ports.ubuntu.com/ubuntu-ports/pool/main/m/mysql-5.6/mysql-common_5.6.24-0ubuntu2_all.deb
The premise is to install Python and the corresponding versions of Eclipse and MySQL. This article Python is 2.7,mysql 5.1Eclipse for 3.6.2After downloading MySQLdb, the installation can be done directly. When you enable it in Eclipse, be aware of the problems you see below:Article source http://www.chengxuyuans.com/Python/32723.htmlPydev is a good development tool, there is always a problem that makes me very headache, when using a third-party librar
Label:1. See if the MYSQLDB module is installed Enter the command line of Python, enter import mysqldb if there is no error, prove that the module has been installed, you can skip the following steps. 2. Download the latest MYSQLDB installation package: Wget-o python-1.2.3c1.tar.gz http://cdnetworks-kr-1.dl.sourceforge.net/project/mysql-python/mysql-python-test/
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.