创建数据库表
--删除数据库
drop database if exists blog;
--创建数据库
create database if not exists blog default character set utf8;
--切换数据库
use blog;
drop table `blog`.`user`;
drop table `blog`.`userinfo`;
drop table `blog`.`type`;
drop table `blog`.`blog`;
drop table `blog`.`blogcomment`;
drop table `blog`.`message`;
drop table `blog`.`photo`;
/*1.博客用户表*/
create table `blog`.`user`(
`id` int not null auto_increment,
`loginname` varchar(255) default '' not null unique,
`pwd` varchar(255) default '' not null,
`domainname` varchar(255) default '' not null unique,
primary key (`id`)
)ENGINE=InnoDB DEFAULT CHARSET=utf8;
/*2.博客用户详细信息表*/
create table `blog`.`userinfo`(
`id` int not null auto_increment,
`nickname` varchar(255) default '' not null unique,
`selfsign` varchar(255),
`motto` varchar(255),
`nowlive` varchar(255),
`gender` char(1),
`age` tinyint,
`brith` varchar(255),
`blood` varchar(255),
`selfphoto` varchar(255),
`homepagephoto` varchar(255),
`job` varchar(255),
`interest` varchar(255),
primary key (`id`)
)ENGINE=InnoDB DEFAULT CHARSET=utf8;
alter table `blog`.`userinfo`
add constraint `FKF02772F94B65D7F3`
foreign key (`id`)
references `blog`.`user`(`id`);
/*3.用户日志类型*/
create table `blog`.`type`(
`id` int not null auto_increment,
`typeName` varchar(255) default '' not null unique,
primary key (`id`)
)ENGINE=InnoDB DEFAULT CHARSET=utf8;
/*4.用户日志表*/
create table `blog`.`blog`(
`id` int not null auto_increment,
`title` varchar(255) default '' not null unique,
`content` text,
`ptime` datetime not null,
`typeid` int,
`userid` int,
`bid` int,
primary key (`id`)
)ENGINE=InnoDB DEFAULT CHARSET=utf8;
alter table `blog`.`blog`
add constraint `FK2E2FA21835241C`
foreign key (`typeid`)
references `blog`.`type`(`id`);
alter table `blog`.`blog`
add constraint `FK2E2FA21990FCFE`
foreign key (`userid`)
references `blog`.`user`(`id`);
/*5.用户日志评论表*/
create table `blog`.`blogcomment`(
`id` int not null auto_increment,
`bcname` varchar(255) default '' not null,
`bccontent` varchar(255) default '' not null,
`bctime` datetime not null,
`blogid` int,
`bcid` int,
primary key (`id`)
)ENGINE=InnoDB DEFAULT CHARSET=utf8;
alter table `blog`.`blogcomment`
add constraint `FK5C73447DF8BDEAEC`
foreign key (`blogid`)
references `blog`.`blog`(`id`);
/*6.用户留言表*/
create table `blog`.`message`(
`id` int not null auto_increment,
`name` varchar(255) default '' not null,
`content` varchar(255) default '' not null,
`headphoto` varchar(255) default '' not null,
`publishTime` datetime not null,
`userid` int,
`mid` int,
primary key (`id`)
)ENGINE=InnoDB DEFAULT CHARSET=utf8;
alter table `blog`.`message`
add constraint `FK38EB00071990FCFE`
foreign key (`userid`)
references `blog`.`user`(`id`);
/*7.用户相册*/
create table `blog`.`photo`(
`oid` int not null auto_increment,
`photoname` varchar(255) default '' not null unique,
`photopath` varchar(255) default '' not null,
`photoid` int,
`pid` int,
primary key (`oid`)
)ENGINE=InnoDB DEFAULT CHARSET=utf8;
alter table `blog`.`photo`
add constraint `FK65B3E3227EA51A5`
foreign key (`photoid`)
references `blog`.`user`(`id`);
数据库
--用户表
INSERT INTO `user` VALUES (1,'test','test','test');
--用户详细表
INSERT INTO `userinfo` VALUES (1,'测试人员','测试人员的签名','测试人员的座右铭','测试人员的现居地','男',0,'8.11','AB',NULL,NULL,'测试人员的工作','测试人员的
--用户日志分类
INSERT INTO `type` VALUES(1,'搞笑');
INSERT INTO `type` VALUES (2,'情感');
--用户日志
INSERT INTO `blog` VALUES (1,'如果没有丘处机','<DIV> /r/n<DIV>1 、假如当时丘处机没有路过牛家村。 那么,秘密跟踪他的那些金兵就不会死在郭,杨二人的院子里,同样,完颜洪烈也不会见到包惜弱而对她念念不忘。 <BR>2、那些金兵不会死在丘处机手里,而郭,杨两家以后不会受到牵连。 <BR>3、郭,杨两家不受波及,李萍不会流亡大漠,郭靖和杨康将会平平安安出生在牛家村。江南七怪自然也不会前往大漠。 <BR>4、而要是没有郭靖和七怪相助,铁木真就会死在扎木合他们手里,蒙古各部也就不能统一。 <BR>5、蒙古不能统一,也就不会有什么西征。火药就不会传入欧洲。 <BR>6、没有火药,铁甲士在欧洲的统治就不会动摇。因此,黑暗的中世纪将延长一千年,也就没有文艺复兴。 <BR>7、没有了文艺复兴,自然也没有大航海。北美洲将始终是游牧的印第安人的家园。 <BR>8、同样,西班牙人不会将铁炮传入日本。长筱会战是武田方面获胜,日本战国时代将一直持续不能统一。 <BR>9、在另一国度,完颜洪烈没有包惜弱,只能全力参加权力斗争。金国因此会内乱。 <BR>10、没有蒙古,金国又内乱,因此,宋不但不会灭亡,反而会统一。宋朝注重商贸,因此,资本主义萌芽将在中国出现。 <BR>11、如果发展到今天,中国将是最发达的国家,远远领先于日本,西班牙,西欧,美洲。 <BR>12、今天的金融危机也就不会出现,所有的一切,都怪丘处机,你说你一道士,没事干嘛路过什么牛家村嘛。</DIV></DIV>','2009-06-04 12:58:41',1,1,0);
INSERT INTO `blog` VALUES (2,'想你,却不能告诉你','<DIV> 想你,却不能告诉你;我知道,我们不能在一起;我知道,我不能告诉你;我想你,夜是那样的静,静的让我能听到心碎的声音。终于明白,有些距离永远无法逾越。明知道孤独总是无所不在的。 /r/n<P> 于是,偷偷的远远的望着你,我不知道,我真的不知道,一个人一生能爱几次?望着你,我可以不说话,可以不流泪。可以在心里对自己说,你快乐所以我快乐,就是没法告诉你,我想你。 /r/n<P> 恋你是一种美丽的痛。就像一场无法醒来的梦。 /r/n<P> 它是一种节制而哀伤的情感,可它的残忍又是显而易见的。那种近在咫尺却又远隔天涯的距离感,那种注定无法被成全的宿命感,都让人体会到近乎尖锐的疼痛和绝望到底的无助,没有切身经历的人,是无法了解这种感觉的。 /r/n<P> 我真的不知道--我不知道, 我真的不知道, 一个人一生能爱几次? /r/n<P> 但是!真爱也许就一次!这种爱,不是门当户对,也不是一见钟情,真爱的至上境界,一个人的一生也许能遇到,也许不能遇到。 /r/n<P> 拥有的人,若你再多一些责任!曾经拥有的人,若你再多一些珍存! /r/n<P> 没有人能够告诉我,长长的路上只有我一个人,一个人慢慢的走着,种种无端的忧愁袭击着我,也许是日久生情,对你思念也越来越深, 我很想找一个宁静的深夜,把许多心底的惆怅、寂寞 向你倾诉。深夜,对着孤灯,我陷入深深的思念之中。此刻比任何时候都孤独,我怀疑自己的真实。怀疑现实的真实,岁月对于人来说如同延伸的铁轨,没有回头的可能。而现在的我却真的不知道如何来调整这个步伐。也许伤痛的心灵需要静静安抚,也许时间会将这一切尘封 哪?--我不知道。为什么?我也不知道! /r/n<P> 人生充满了遗憾。有时候,遗憾也未尝不是一种美,只是,这美是要付出昂贵的代价的,常常会心痛,常常怀念,却永远深埋在那里,这一种爱是刻骨铭心的,无论怎样努力也无法从心头驱散。一切是不是错?一切是不是很荒唐?我很矛盾。 /r/n<P> 孤独的徘徊在这荒漠的世界上,人生注定是孤的……心痛了,心碎了不会有人看见。其实我们都是熟悉的陌生人。只希望我们每个人都多一些宽容,多一些真诚,多一些爱!</P></DIV>','2009-06-04 13:16:13',2,1,1);
--用户日志评论
INSERT INTO `blogcomment` VALUES (1,'测试人员','恩,丘处机真的还不该存在哦','2009-06-04 12:59:00',1,0);
--用户日志留言
INSERT INTO `message` VALUES (1,'测试人员','我是测试的哦','./UserFace/0.bmp','2009-06-04 12:59:09',1,0);
INSERT INTO `message` VALUES (2,'测试人员','我真的是测试的哦','./UserFace/0.bmp','2009-06-04 12:59:17',1,1);
--用户相册
INSERT INTO `photo` VALUES (1,'MH_1','http://xyq.163.com/images/wallpaper/1024/2009-6(1024x768).jpg',1,0);
INSERT INTO `photo` VALUES(2,'MH_2','http://xyq.163.com/images/wallpaper/1024/2009021403(1024x768).jpg',1,1);
INSERT INTO `photo` VALUES(3,'MH_3','http://xyq.163.com/images/wallpaper/1024/2009-3(1024x768).jpg',1,2);