mysql 删除当前数据库下所有表 hibernate 自动建立的表,都引用了一些外键,现在没用了,想全部删掉,怎么办,坐等解答.谢谢 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 这是我写的一段代码,很好用的,你看看能不能用。。set names utf8; create database jol;use jol;CREATE TABLE `compileinfo` ( `solution_id` int(11) NOT NULL DEFAULT '0', `error` text, PRIMARY KEY (`solution_id`)) ENGINE=MyISAM DEFAULT CHARSET=utf8;CREATE TABLE `contest` ( `contest_id` int(11) NOT NULL AUTO_INCREMENT, `title` varchar(255) DEFAULT NULL, `start_time` datetime DEFAULT NULL, `end_time` datetime DEFAULT NULL, `defunct` char(1) NOT NULL DEFAULT 'N', `description` text, `private` tinyint(4) NOT NULL DEFAULT '0', `langmask` int NOT NULL DEFAULT '0' COMMENT 'bits for LANG to mask', PRIMARY KEY (`contest_id`)) ENGINE=MyISAM AUTO_INCREMENT=1000 DEFAULT CHARSET=utf8;CREATE TABLE `contest_problem` ( `problem_id` int(11) NOT NULL DEFAULT '0', `contest_id` int(11) DEFAULT NULL, `title` char(200) NOT NULL DEFAULT '', `num` int(11) NOT NULL DEFAULT '0') ENGINE=MyISAM DEFAULT CHARSET=utf8;CREATE TABLE `loginlog` ( `user_id` varchar(20) NOT NULL DEFAULT '', `password` varchar(40) DEFAULT NULL, `ip` varchar(100) DEFAULT NULL, `time` datetime DEFAULT NULL) ENGINE=MyISAM DEFAULT CHARSET=utf8;CREATE TABLE `mail` ( `mail_id` int(11) NOT NULL AUTO_INCREMENT, `to_user` varchar(20) NOT NULL DEFAULT '', `from_user` varchar(20) NOT NULL DEFAULT '', `title` varchar(200) NOT NULL DEFAULT '', `content` text, `new_mail` tinyint(1) NOT NULL DEFAULT '1', `reply` tinyint(4) DEFAULT '0', `in_date` datetime DEFAULT NULL, `defunct` char(1) NOT NULL DEFAULT 'N', PRIMARY KEY (`mail_id`), KEY `uid` (`to_user`)) ENGINE=MyISAM AUTO_INCREMENT=1013 DEFAULT CHARSET=utf8;CREATE TABLE `news` ( `news_id` int(11) NOT NULL AUTO_INCREMENT, `user_id` varchar(20) NOT NULL DEFAULT '', `title` varchar(200) NOT NULL DEFAULT '', `content` text NOT NULL, `time` datetime NOT NULL DEFAULT '0000-00-00 00:00:00', `importance` tinyint(4) NOT NULL DEFAULT '0', `defunct` char(1) NOT NULL DEFAULT 'N', PRIMARY KEY (`news_id`)) ENGINE=MyISAM AUTO_INCREMENT=1004 DEFAULT CHARSET=utf8;CREATE TABLE `privilege` ( `user_id` char(20) NOT NULL DEFAULT '', `rightstr` char(30) NOT NULL DEFAULT '', `defunct` char(1) NOT NULL DEFAULT 'N') ENGINE=MyISAM DEFAULT CHARSET=utf8;CREATE TABLE `problem` ( `problem_id` int(11) NOT NULL AUTO_INCREMENT, `title` varchar(200) NOT NULL DEFAULT '', `description` text, `input` text, `output` text, `sample_input` text, `sample_output` text, `spj` char(1) NOT NULL DEFAULT '0', `hint` text, `source` varchar(100) DEFAULT NULL, `in_date` datetime DEFAULT NULL, `time_limit` int(11) NOT NULL DEFAULT '0', `memory_limit` int(11) NOT NULL DEFAULT '0', `defunct` char(1) NOT NULL DEFAULT 'N', `accepted` int(11) DEFAULT '0', `submit` int(11) DEFAULT '0', `solved` int(11) DEFAULT '0', PRIMARY KEY (`problem_id`)) ENGINE=MyISAM AUTO_INCREMENT=1001 DEFAULT CHARSET=utf8;CREATE TABLE `reply` ( `rid` int(11) NOT NULL AUTO_INCREMENT, `author_id` varchar(20) NOT NULL, `time` datetime NOT NULL DEFAULT '0000-00-00 00:00:00', `content` text NOT NULL, `topic_id` int(11) NOT NULL, `status` int(2) NOT NULL DEFAULT '0', `ip` varchar(30) NOT NULL, PRIMARY KEY (`rid`), KEY `author_id` (`author_id`)) ENGINE=MyISAM DEFAULT CHARSET=utf8; 直接 drop database db1;然后再重新 create database db1; 还有一段代码,两两段加起来CREATE TABLE `sim` ( `s_id` int(11) NOT NULL, `sim_s_id` int(11) DEFAULT NULL, `sim` int(11) DEFAULT NULL, PRIMARY KEY (`s_id`)) ENGINE=MyISAM DEFAULT CHARSET=utf8;CREATE TABLE `solution` ( `solution_id` int(11) NOT NULL AUTO_INCREMENT, `problem_id` int(11) NOT NULL DEFAULT '0', `user_id` char(20) NOT NULL, `time` int(11) NOT NULL DEFAULT '0', `memory` int(11) NOT NULL DEFAULT '0', `in_date` datetime NOT NULL DEFAULT '0000-00-00 00:00:00', `result` smallint(6) NOT NULL DEFAULT '0', `language` tinyint(4) NOT NULL DEFAULT '0', `ip` char(15) NOT NULL, `contest_id` int(11) DEFAULT NULL, `valid` tinyint(4) NOT NULL DEFAULT '1', `num` tinyint(4) NOT NULL DEFAULT '-1', `code_length` int(11) NOT NULL DEFAULT '0', `judgetime` datetime DEFAULT NULL, `pass_rate` DECIMAL(2,2) UNSIGNED NOT NULL DEFAULT 0, PRIMARY KEY (`solution_id`), KEY `uid` (`user_id`), KEY `pid` (`problem_id`), KEY `res` (`result`), KEY `cid` (`contest_id`)) ENGINE=MyISAM AUTO_INCREMENT=1001 DEFAULT CHARSET=utf8;CREATE TABLE `source_code` ( `solution_id` int(11) NOT NULL, `source` text NOT NULL, PRIMARY KEY (`solution_id`)) ENGINE=MyISAM DEFAULT CHARSET=utf8;CREATE TABLE `topic` ( `tid` int(11) NOT NULL AUTO_INCREMENT, `title` varbinary(60) NOT NULL, `status` int(2) NOT NULL DEFAULT '0', `top_level` int(2) NOT NULL DEFAULT '0', `cid` int(11) DEFAULT NULL, `pid` int(11) NOT NULL, `author_id` varchar(20) NOT NULL, PRIMARY KEY (`tid`), KEY `cid` (`cid`,`pid`)) ENGINE=MyISAM DEFAULT CHARSET=utf8;CREATE TABLE `users` ( `user_id` varchar(20) NOT NULL DEFAULT '', `email` varchar(100) DEFAULT NULL, `submit` int(11) DEFAULT '0', `solved` int(11) DEFAULT '0', `defunct` char(1) NOT NULL DEFAULT 'N', `ip` varchar(20) NOT NULL DEFAULT '', `accesstime` datetime DEFAULT NULL, `volume` int(11) NOT NULL DEFAULT '1', `language` int(11) NOT NULL DEFAULT '1', `password` varchar(32) DEFAULT NULL, `reg_time` datetime DEFAULT NULL, `nick` varchar(100) NOT NULL DEFAULT '', `school` varchar(100) NOT NULL DEFAULT '', PRIMARY KEY (`user_id`)) ENGINE=MyISAM DEFAULT CHARSET=utf8;CREATE TABLE `online` ( `hash` varchar(32) collate utf8_unicode_ci NOT NULL, `ip` varchar(20) character set utf8 NOT NULL default '', `ua` varchar(255) character set utf8 NOT NULL default '', `refer` varchar(255) collate utf8_unicode_ci default NULL, `lastmove` int(10) NOT NULL, `firsttime` int(10) default NULL, `uri` varchar(255) collate utf8_unicode_ci default NULL, PRIMARY KEY (`hash`), UNIQUE KEY `hash` (`hash`)) ENGINE=MEMORY DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;CREATE TABLE `runtimeinfo` ( `solution_id` int(11) NOT NULL DEFAULT '0', `error` text, PRIMARY KEY (`solution_id`)) ENGINE=MyISAM DEFAULT CHARSET=utf8; 版主说的是DROP 库然后再创建空库。汗~~~~~~~ mysql 排序问题 关于子分区表的问题 sql查询的Where中,or 和 and 不能同时用么 在虚拟主机上如何创建MySQL数据库? 向ACMAIN_CHM请教 mysql查询中区分大小写的问题 --------------------select 问题————————————————?? 为什么mysql 里用!=null查找不出字符等于0的记录 请问那有mysql的jdbc driver库? 死锁问题 , 在线等!! WHERE条件中匹配的问题 mysql load data 的问题
set names utf8;
create database jol;
use jol;CREATE TABLE `compileinfo` (
`solution_id` int(11) NOT NULL DEFAULT '0',
`error` text,
PRIMARY KEY (`solution_id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
CREATE TABLE `contest` (
`contest_id` int(11) NOT NULL AUTO_INCREMENT,
`title` varchar(255) DEFAULT NULL,
`start_time` datetime DEFAULT NULL,
`end_time` datetime DEFAULT NULL,
`defunct` char(1) NOT NULL DEFAULT 'N',
`description` text,
`private` tinyint(4) NOT NULL DEFAULT '0',
`langmask` int NOT NULL DEFAULT '0' COMMENT 'bits for LANG to mask',
PRIMARY KEY (`contest_id`)
) ENGINE=MyISAM AUTO_INCREMENT=1000 DEFAULT CHARSET=utf8;CREATE TABLE `contest_problem` (
`problem_id` int(11) NOT NULL DEFAULT '0',
`contest_id` int(11) DEFAULT NULL,
`title` char(200) NOT NULL DEFAULT '',
`num` int(11) NOT NULL DEFAULT '0'
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
CREATE TABLE `loginlog` (
`user_id` varchar(20) NOT NULL DEFAULT '',
`password` varchar(40) DEFAULT NULL,
`ip` varchar(100) DEFAULT NULL,
`time` datetime DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=utf8;CREATE TABLE `mail` (
`mail_id` int(11) NOT NULL AUTO_INCREMENT,
`to_user` varchar(20) NOT NULL DEFAULT '',
`from_user` varchar(20) NOT NULL DEFAULT '',
`title` varchar(200) NOT NULL DEFAULT '',
`content` text,
`new_mail` tinyint(1) NOT NULL DEFAULT '1',
`reply` tinyint(4) DEFAULT '0',
`in_date` datetime DEFAULT NULL,
`defunct` char(1) NOT NULL DEFAULT 'N',
PRIMARY KEY (`mail_id`),
KEY `uid` (`to_user`)
) ENGINE=MyISAM AUTO_INCREMENT=1013 DEFAULT CHARSET=utf8;CREATE TABLE `news` (
`news_id` int(11) NOT NULL AUTO_INCREMENT,
`user_id` varchar(20) NOT NULL DEFAULT '',
`title` varchar(200) NOT NULL DEFAULT '',
`content` text NOT NULL,
`time` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
`importance` tinyint(4) NOT NULL DEFAULT '0',
`defunct` char(1) NOT NULL DEFAULT 'N',
PRIMARY KEY (`news_id`)
) ENGINE=MyISAM AUTO_INCREMENT=1004 DEFAULT CHARSET=utf8;
CREATE TABLE `privilege` (
`user_id` char(20) NOT NULL DEFAULT '',
`rightstr` char(30) NOT NULL DEFAULT '',
`defunct` char(1) NOT NULL DEFAULT 'N'
) ENGINE=MyISAM DEFAULT CHARSET=utf8;CREATE TABLE `problem` (
`problem_id` int(11) NOT NULL AUTO_INCREMENT,
`title` varchar(200) NOT NULL DEFAULT '',
`description` text,
`input` text,
`output` text,
`sample_input` text,
`sample_output` text,
`spj` char(1) NOT NULL DEFAULT '0',
`hint` text,
`source` varchar(100) DEFAULT NULL,
`in_date` datetime DEFAULT NULL,
`time_limit` int(11) NOT NULL DEFAULT '0',
`memory_limit` int(11) NOT NULL DEFAULT '0',
`defunct` char(1) NOT NULL DEFAULT 'N',
`accepted` int(11) DEFAULT '0',
`submit` int(11) DEFAULT '0',
`solved` int(11) DEFAULT '0',
PRIMARY KEY (`problem_id`)
) ENGINE=MyISAM AUTO_INCREMENT=1001 DEFAULT CHARSET=utf8;CREATE TABLE `reply` (
`rid` int(11) NOT NULL AUTO_INCREMENT,
`author_id` varchar(20) NOT NULL,
`time` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
`content` text NOT NULL,
`topic_id` int(11) NOT NULL,
`status` int(2) NOT NULL DEFAULT '0',
`ip` varchar(30) NOT NULL,
PRIMARY KEY (`rid`),
KEY `author_id` (`author_id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
然后再重新 create database db1;
CREATE TABLE `sim` (
`s_id` int(11) NOT NULL,
`sim_s_id` int(11) DEFAULT NULL,
`sim` int(11) DEFAULT NULL,
PRIMARY KEY (`s_id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
CREATE TABLE `solution` (
`solution_id` int(11) NOT NULL AUTO_INCREMENT,
`problem_id` int(11) NOT NULL DEFAULT '0',
`user_id` char(20) NOT NULL,
`time` int(11) NOT NULL DEFAULT '0',
`memory` int(11) NOT NULL DEFAULT '0',
`in_date` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
`result` smallint(6) NOT NULL DEFAULT '0',
`language` tinyint(4) NOT NULL DEFAULT '0',
`ip` char(15) NOT NULL,
`contest_id` int(11) DEFAULT NULL,
`valid` tinyint(4) NOT NULL DEFAULT '1',
`num` tinyint(4) NOT NULL DEFAULT '-1',
`code_length` int(11) NOT NULL DEFAULT '0',
`judgetime` datetime DEFAULT NULL,
`pass_rate` DECIMAL(2,2) UNSIGNED NOT NULL DEFAULT 0,
PRIMARY KEY (`solution_id`),
KEY `uid` (`user_id`),
KEY `pid` (`problem_id`),
KEY `res` (`result`),
KEY `cid` (`contest_id`)
) ENGINE=MyISAM AUTO_INCREMENT=1001 DEFAULT CHARSET=utf8;CREATE TABLE `source_code` (
`solution_id` int(11) NOT NULL,
`source` text NOT NULL,
PRIMARY KEY (`solution_id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;CREATE TABLE `topic` (
`tid` int(11) NOT NULL AUTO_INCREMENT,
`title` varbinary(60) NOT NULL,
`status` int(2) NOT NULL DEFAULT '0',
`top_level` int(2) NOT NULL DEFAULT '0',
`cid` int(11) DEFAULT NULL,
`pid` int(11) NOT NULL,
`author_id` varchar(20) NOT NULL,
PRIMARY KEY (`tid`),
KEY `cid` (`cid`,`pid`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;CREATE TABLE `users` (
`user_id` varchar(20) NOT NULL DEFAULT '',
`email` varchar(100) DEFAULT NULL,
`submit` int(11) DEFAULT '0',
`solved` int(11) DEFAULT '0',
`defunct` char(1) NOT NULL DEFAULT 'N',
`ip` varchar(20) NOT NULL DEFAULT '',
`accesstime` datetime DEFAULT NULL,
`volume` int(11) NOT NULL DEFAULT '1',
`language` int(11) NOT NULL DEFAULT '1',
`password` varchar(32) DEFAULT NULL,
`reg_time` datetime DEFAULT NULL,
`nick` varchar(100) NOT NULL DEFAULT '',
`school` varchar(100) NOT NULL DEFAULT '',
PRIMARY KEY (`user_id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;CREATE TABLE `online` (
`hash` varchar(32) collate utf8_unicode_ci NOT NULL,
`ip` varchar(20) character set utf8 NOT NULL default '',
`ua` varchar(255) character set utf8 NOT NULL default '',
`refer` varchar(255) collate utf8_unicode_ci default NULL,
`lastmove` int(10) NOT NULL,
`firsttime` int(10) default NULL,
`uri` varchar(255) collate utf8_unicode_ci default NULL,
PRIMARY KEY (`hash`),
UNIQUE KEY `hash` (`hash`)
) ENGINE=MEMORY DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;CREATE TABLE `runtimeinfo` (
`solution_id` int(11) NOT NULL DEFAULT '0',
`error` text,
PRIMARY KEY (`solution_id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
版主说的是DROP 库然后再创建空库。汗~~~~~~~