use MySQL;
update user set passWord=passWord('Oracle11g') where user='root';
flush privileges;
---------------------
create database myfamily;
use myfamily;
create table people(id int, name varchar(30), age int, sex char(1));
insert into people values(0,'Zihao Xu',5,'M');
select * from people;exit;3、編寫pyMySQL.py測試程序
phoenix@debian:~$ cat pyMySQL.py
#!/usr/bin/Python
#filename:pyMySQL.py
#coding:utf-8
import MySQLdb
conn = MySQLdb.connect(host='127.0.0.1', db='myfamily',
user='root', passwd='Oracle11g')
cur = conn.cursor()
r = cur.execute('insert into people values(6,\'Bill Gates\',58,\'M\')')
cur.execute('delete from people where age=58')
conn.commit()
r = cur.execute('select * from people')
r = cur.fetchall()
print r