找回密码
 立即注册

推荐阅读

  • 便民服务
  • 关注我们
  • 社区新手

权限和内连接,左右外连接

[复制链接]
创建新用户-进行授权-查看权限-取消权限
1.use mysql  先进入数据库
2.select host,user from user; 在查询即可
如果没有远程权限: grant all privileges on *.* to 'root'@'%' identified by '123456';
3、创建用户不赋予权限
新增加一个用户赋予本地访问权限,用户名称是qian
insert into user (host,user,password)values('localhost','用户名',password('123456'));
4、创建用户后进行授权(方法二)
grant select,update,delete,drop on *.* to '用户名'@'localhost' identified by '123456'
5、查询指定用户拥有哪些权限
show grants for '用户名'@'localhost';
6、取消指定用户的权限
revoke all on *.* from '用户名'@'localhost';
7、删除用户
delete from user where user='qian' and host='localhost';
8、改用户密码
在user表中把root用户的密码改为123456
update user set password=password('123456') where user='root';


基本连接语法:
select * from a,b where a.id=b.id;
左连接
select * from a left join b on a.id=b.id;
select * from b left join a on a.id=b.id;
左连接以左边表为基准
如果主表的值是大于子表的值,字表缺省的值自动补齐null
如果主表的值是小于子表的值,只取和主表相同的值其它不显示
右连接
select * from a right join b on a.id=b.id;
select * from b right join a on a.id=b.id;
右连接是以右表为主表
如果主表的值是大于子表的值,子表缺省的值自动补齐null
如果主表的值是小于子表的值,只取和主表相同的值其它不显示

分享至 : QQ空间
收藏

0 个回复

您需要登录后才可以回帖 登录 | 立即注册