The first thing you need to do is to create a connection to the database using the connect method. After that, you will need a cursor that will operate with that connection.
Use the execute method of the cursor to interact with the database, and every once in a while, commit the changes using the commit method of the connection object.
Once everything is done, don't forget to close the cursor and the connection.
Here is a Dbconnect class with everything you'll need.
self.dbconection = MySQLdb.connect(host='host_example',
self.dbcursor = self.dbconection.cursor()