mysql命令

作者: 疯狂小兵 | 2017-06-27 | - | 字数 168 | 阅读
「编辑」 「本文源码」

前提

安装好mysql数据库

特别注意在更改用户权限后,修改使用flush privileges刷新权限表。

mysql 命令

创建用户

insert into mysql.user(Host,User,Password) values("%","test",password("1234"));

创建数据库

create database testDB

为用户授权

授权格式:grant 权限 on 数据库.* to 用户名@登录主机 identified by "密码";

授权test用户拥有testDB数据库的所有权限(某个数据库的所有权限)

grant all privileges on testDB.* to test@localhost identified by '1234';

flush privileges;//刷新系统权限表

指定部分权限给一用户

grant select,delete,update,create,drop on *.* to test@"%" identified by "1234";

并使用FLUSH PRIVILEGES 刷新。

分区表

查看表状态

show table status;

查看表分区信息

-- 查看表的分区信息
 select 
  TABLE_SCHEMA as dbName,
  TABLE_NAME as tableName,
  partition_name as `partition`,  
  PARTITION_ORDINAL_POSITION as ordinal,
  PARTITION_METHOD as method,
  partition_expression as expr,  
  partition_description as `desc`,
  table_rows  
from information_schema.partitions  where 
  table_schema = schema()  
  and table_name='test'; 

版权声明:本文由 在 2017年06月27日发表。本文采用CC BY-NC-SA 4.0许可协议,非商业转载请注明出处,不得用于商业目的。
文章题目及链接:《mysql命令




  相关文章:

「游客及非Github用户留言」:

「Github登录用户留言」:

TOP