cmd下
mysql -hlocalhost -uroot -p123456
python下先安装MySQLdb
http://nchc.dl.sourceforge.net/project/mysql-python/mysql-python-test/1.2.4b4/MySQL-python-1.2.4b4.win32-py2.7.exe
import MySQLdb
db = MySQLdb.connect("localhost","student","root","123456" )
原文地址:http://mattien.blog.51cto.com/2140298/1744360