Changed pymysql to MySQLdb