看你提示是mysql安装路径下的data文件夹已经存在了,你把mysql服务关了,
net stop mysql然后把data文件夹删除,重新运行命令
net start mysqlmysqld --initialize
执行完成之后,会打印 root 用户的初始默认密码,在执行输出结果里面有一段:
[Note] [MY-010454] [Server] A temporary password is generated for root@localhost: fwefhwi
你需要记住这个密码,登录之后可以修改
MySQL数据库基础与实例教程的课件,涉及到触发器的使用。地址如下:http://wenku.baidu.com/view/0f08e657ff00bed5b8f31d25.html
我另外给你一段代码,给你参考:
create table organization(
o_no int not null auto_increment,
o_name varchar(32) default '',
primary key (o_no)
) engine=innodb
create table member(
m_no int not null auto_increment,
m_name varchar(32) default '',
o_no int,
primary key (m_no),
constraint organization_member_fk foreign key (o_no) references organization(o_no)
) engine=innodb
insert into organization(o_no, o_name) values
(null, 'o1'),
(null, 'o2')
insert into member(m_no,m_name,o_no) values
(null, 'm1',1),
(null, 'm2',1),
(null, 'm3',1),
(null, 'm4',2),
(null, 'm5',2)
delimiter $$
create trigger organization_delete_before_trigger before delete on organization for each row
begin
delete from member where o_no=old.o_no
end
$$
delimiter
select * from member
delete from organization where o_no=1
select * from member
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)