pip install MySQL-python
log in local machine
mysql -u root -p
conn=MySQLdb.connect(host=’localhost’,user=’root’,passwd=’123456’)
cur=conn.cursor()
cur.execute(‘create database if not exists python’)
- 中文乱码问题
show variables like “%char%”;
SET NAMES utf8