• 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;
         
  • 相关阅读:
    Using zend-paginator in your Album Module
    Using zend-navigation in your Album Module
    Unit Testing a zend-mvc application
    Conclusion
    Forms and actions
    Database and models
    Routing and controllers
    Modules
    Java开发的基础条件:
    com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: Communications link failure 数据库报错
  • 原文地址:https://www.cnblogs.com/benshan/p/2464984.html
Copyright © 2020-2023  润新知