好吧,我的电脑是有毒的~安装东西总要出点问题,经过各种百度谷歌也是解决了这个安装问题,遂记录一波~
首先你需要卸载之前安装的版本
选择最后一个Remove
这时请注意,电脑内还存在缓存文件和注册文件,你需要以下两步:
1.删除安装目录下所有文件夹。
2.删除MySQL注册文件。
以我自己为例:
我默认安装在C盘 :C:\Program Files\MySQL 找到这个目录删除整个文件夹
然后运行控制台打开注册表:具体操作为 win+R ->输入regedit 打开注册表编辑器使用Ctrl+F查找MySQL
或者
你找到这个路径然后选中MySQL整个文件夹并删除
重新安装你的mysql程序。安装完成后,你可以在系统的服务中查看,mysql是否已经启动,如果没有启动,右击,点击启动(我的电脑->管理->服务与应用程序->服务),找到MySQL启动就行。
希望能帮助到大家!
MySQL建表和增删改查语句
首先你需要安装服务器和NativeCat
这里用户名默认root密码是你安装MySQLserver时注册的密码,然后点击确定并连接,这时就可以在test表中创建自己的数据库了。
create table sanguo(id char(2) primary key not null,name char(10) not null);
create table knight(id int primary key auto_increment,name char(16) not null,sex char not null check(sex='男'),country char(20));
alter table knight add constraint foreign key(country) references sanguo(id) on delete cascade;
create table knight2(id int primary key auto_increment,name char(16) not null,sex char not null check(sex='男'),country char(20));
alter table knight2 add constraint foreign key(country) references sanguo(id) on delete cascade;
create table knight3(id int primary key auto_increment,name char(16) not null,sex char not null check(sex='男'),country char(20));
alter table knight3 add constraint foreign key(country) references sanguo(id) on delete cascade;
以上语句我创建了sanguo、knight、knight2、knight3四个表,并让三个knight表的country属性和sanguo表的id属性进行匹配。
insert into knight(id,name,sex,country) values(16,'马超','','蜀');
insert into knight2(id,name,sex,country) values(20,'','','蜀');
insert into knight3 values(14,'吕布','男','魏');
delete from knight2 where id=20;
delete from knight where name='赵云' and sex='男' and country='蜀';
delete from knight where id=3 or id=16;
delete from knight3 where id > 10;
update knight set name='孙尚香' where name='马超';
update knight2 set country='魏' where id >= 4;
update knight3 set sex='m', country='魏' where id=1;
select name from stu where id=1;
select * from sanguo;
select name from knight;
select name, sex from knight where id > 10;
select * from knight2 where country='吴';
就是介绍一下简单的增删改查操作~~
欢迎补充和提出你们宝贵的建议~~