CREATE ROLE IF NOT EXISTS 'root' WITH SUPERUSER = true AND LOGIN = false; CREATE ROLE IF NOT EXISTS 'root' WITH SUPERUSER = true AND PASSWORD = 'root';
修改权限
1 2 3 4 5
ALTER ROLE role_name [WITH [PASSWORD = 'password'] [LOGIN = true | false] [SUPERUSER = true | false] [OPTIONS = map_literal]]
示例
1
ALTER ROLE root WITH PASSWORD = 'NewPassword';
Key Space
查询
1 2
# 列出所有 keysapces desc keyspaces;
创建
1 2 3 4 5 6 7
CREATE KEYSPACE [IF NOTEXISTS] keyspace_name WITH REPLICATION = { 'class' : 'SimpleStrategy', 'replication_factor' : N } |'class' : 'NetworkTopologyStrategy', 'dc1_name' : N [, ...] } [AND DURABLE_WRITES =true|false] ;
示例
1 2 3 4
CREATE KEYSPACE IF NOTEXISTS "trace" WITH REPLICATION = { 'class' : 'NetworkTopologyStrategy', 'vg' : 2 }
Table
查询
1
desc <keyspace-name>;
1 2
use <keyspace-name>; desc tables;
创建
1 2 3 4 5 6 7
CREATE TABLE [IF NOT EXISTS] [keyspace_name.]table_name ( column_definition [, ...] PRIMARY KEY (column_name [, column_name ...]) [WITH table_options | CLUSTERING ORDER BY (clustering_column_name order]) | ID = 'table_hash_tag' | COMPACT STORAGE]
-Waddress -Warray-bounds (only with -O2) -Wc++0x-compat -Wchar-subscripts -Wenum-compare (in C/Objc; this is on by default in C++) -Wimplicit-int (C and Objective-C only) -Wimplicit-function-declaration (C and Objective-C only) -Wcomment -Wformat -Wmain (only for C/ObjC and unless -ffreestanding) -Wmissing-braces -Wnonnull -Wparentheses -Wpointer-sign -Wreorder -Wreturn-type -Wsequence-point -Wsign-compare (only in C++) -Wstrict-aliasing -Wstrict-overflow=1 -Wswitch -Wtrigraphs -Wuninitialized -Wunknown-pragmas -Wunused-function -Wunused-label -Wunused-value -Wunused-variable -Wvolatile-register-var
-Wextra
1 2 3 4
-Wclobbered -Wempty-body -Wignored-qualifiers -Wmissing-field-initializers -Wmissing-parameter-type (C only) -Wold-style-declaration (C only) -Woverride-init -Wsign-compare -Wtype-limits -Wuninitialized -Wunused-parameter (only with -Wunused or -Wall) -Wunused-but-set-parameter (only with -Wunused or -Wall)