conn = pymysql.connect(host='localhost', port=3306, user='<your_user>',
    passwd='<your_pwd>', db='<your_db>', charset='utf8')
cur = conn.cursor()
sql = 'SELECT * FROM <your_favourite_table>'
cur.execute(sql)
How to use MySQL with Anaconda's Python IDE