mysql-connector-python
wget http://cdn.mysql.com//Downloads/Connector-Python/mysql-connector-python-2.1.3.tar.gz tar mysql-connector-python-2.1.3.tar.gz cd ysql-connector-python-2.1.3 python setup.py install [root@localhost mysql-connector-python-2.1.3]# pip list mysql-connector-python (2.1.3) MySQL-python (1.2.3) mysql-utilities (1.5.6) pip (8.1.2) queuelib (1.4.2) setuptools (23.1.0)
>>>import mysql.connector
>>>conn = mysql.connector.connect(user='root', password='', database='test', use_unicode=True)
>>>cursor = conn.cursor() >>>cursor.execute('create table user (id varchar(20) primary key, name varchar(20))') >>>cursor.execute('insert into user (id, name) values (%s, %s)', ['1', 'Michael']) >>>cursor.rowcount
>>>conn.commit() >>>cursor.close()