您好, 欢迎来到 !    登录 | 注册 | | 设为首页 | 收藏本站

复习mysql语句

bubuko 2022/1/25 20:06:59 mysql 字数 1141 阅读 871 来源 http://www.bubuko.com/infolist-5-1.html

1.创建用户 create user 'lai'@'localhost' identified by '123';2.修改用户 rename user 'lai'@'localhost' to 'tong'@'localhost';3.删除用户 drop user 'tong'@'localhost ...

1.创建用户
create user ‘lai‘@‘localhost‘ identified by ‘123‘;
2.修改用户
rename user ‘lai‘@‘localhost‘ to ‘tong‘@‘localhost‘;
3.删除用户
drop user ‘tong‘@‘localhost‘;
4.查看权限
show grants for ‘tong‘@‘localhost‘;
5.授予权限
grant select on db1.student to ‘tong‘@‘localhost‘;
6.取消权限
revoke select on db1.student from ‘tong‘@‘localhost‘;
7.创建表与主键和 外键
create table color(
color_id int not null auto_increment primary key,
color_style varchar(255) not null);
create table fruit(
fruit_id int not null auto_increment,
f_color varchar(255) not null,
co_id int not null ,
primary key(fruit_id,co_id),
constraint fk_co_id foreign key (co_id) references color(color_id)
);
8.修改navicate登录名的密码:
alter user ‘root‘@‘localhost‘ identified with mysql_native_password by ‘123‘

 

复习mysql语句

原文:https://www.cnblogs.com/startl/p/12452515.html


如果您也喜欢它,动动您的小指点个赞吧

除非注明,文章均由 laddyq.com 整理发布,欢迎转载。

转载请注明:
链接:http://laddyq.com
来源:laddyq.com
著作权归作者所有。商业转载请联系作者获得授权,非商业转载请注明出处。


联系我
置顶