复习mysql语句
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'
【推荐】还在用 ECharts 开发大屏?试试这款永久免费的开源 BI 工具!
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步