zoukankan      html  css  js  c++  java
  • MySQL之权限索引学习整理


    显示本地root用户权限
    show grants for root@localhost\G;
    显示任意%域用户权限
    show grants for root\G;
    查询所有用户
    select * from mysq.user;
    给某个用户授权语法
    grant all privileges on *.* to a@'%' identified by '123';  //授权所有权利
    flush privileges;  //刷新,使之生效
    grant 具体权限 on 表 to 用户名@'域' identified by 'password';
    域包括本地与远程:localhost|'%'|'127.0.3.*'
    具体权限包括:
    全局管理权限:
    FILE 在mYSql服务器上读写文件;
    PROCESS 显示或杀死属于其他用户的线程;
    RELOAD 重载访问控制表,刷新日志等;
    SHUTDOWN 关闭mysql服务
    数据库/数据表的权限修改:
    create|alter|select|insert|update|delete|drop|index(索引)
    特别的权限:
    all | usage 
    去除权限
    revoke all on表名 from 用户名@'%'或者Localhost ;

    创建索引
    create index 索引名 on 表名(列名);
    添加索引
    alter table 表名 add index 索引名 (列名,列名。。。);
    删除索引
    drop index 索引名 on 表名;
    alter table 表名 drop index 索引名;
    Mysql explain
    Mysql explain 来查询sql语句的效率如何。。。
    MySql explain select_type包括
    一      simple-----最简单的查询,没有任何依赖
    二     primary -------最外层查询
    三     diriver --------驱动查询 ;
    四     union ,union result  查询合并结果
    五     subquery --------子查询
    六      dependent  subquery
    mysql 索引细则可以参考http://www.perfgeeks.com/?p=460的内容;

    删除触发器
    drop trigger tri_name;

    外键关联删除,更新很方便!!!
    添加外键
    alter table borrowRecord add constraint FK_STUDENT foreign key(studentid) references student(studentid) on delete cascade on update cascade;
         
  • 相关阅读:
    如何让nodejs使用多线程执行
    web input光标的颜色
    web视频自定义规划
    webgl 学习注意事项
    前端url创建,以及base64与url的转化
    微信 input 照相机 呼出
    js 资源下载方法
    在React项目中使用React-intl实现多语言支持,以及对react-init各组件的解读
    React Native 的组件定义及使用
    AMD模块&CommonJs模块&ES6模块
  • 原文地址:https://www.cnblogs.com/benshan/p/2464984.html
Copyright © 2011-2022 走看看