Sq l Python Intro

Post on 15-Apr-2016

17 Views

Category:

Documents

4 Downloads

Preview:

Click to see full reader

DESCRIPTION

MySQL Python

Transcript

MySQL-Python connectivity Manual

( Prepared by Archana Purwar)

Step 1: Install the package MySQLdb for coonectivity . To check whether it is already exists ,

do following:

Step 2 : If not, install it :

Step 3: Check if it is installed or not.

Step 4: Open MySQL .

Step 5: Check the database to which you want to connect to.

Step 6: Open a new file to create a table through python script.

# Open database connection // to find user name type at mysql> select user();

# to find host name type at cmd> hostname

db = MySQLdb.connect(hostname, MYSQL username, MYSQL Password, databasename )

Step 7: Run the file.

Check the database. You will find there.

Step 8: (i) Insert the data ( one column) in the table.

(ii) Insert the data( all columns) in the table.

Step 9. Update operation :

Step 10.. Select operation: Retrieve the data .

Step 11.. Select operation: Retrieve few columns .

Step 12.. Delete operation .

Step 13.. Drop Table; .

top related