【数据库】权限

【mysql 5以后】


*可使用rename 表 属性名 to 旧属性名;
*以前删除用户时必须先使用revoke 删除用户权限,而后删除用户,mysql5以后drop 命令能够删除用户的同时删除用户的相关权限html

 

更改密码:

set password for 用户=password(‘’);
update  mysql.user  set  password=password('xxxx')  where user='otheruser'mysql

 

查看用户权限:

show grants for zx_root;linux

 

回收权限:

revoke  select on dmc_db.*  from  zx_root;  //若是权限不存在会报错sql

 

多个权限:

mysql> grant select,update,delete  ,insert  on dmc_db.*  to  zx_root;数据库


当即看到结果使用:

【flush  privileges 】刷新服务apache

 

grant和revoke能够在几个层次上控制访问权限


1,整个服务器,使用 grant ALL  和revoke  ALL  on *.*
2,整个数据库,使用on  database.*
3,特色表,使用on  database.table
4,特定的列 ,使用select(id, se, rank) on testdb.apache_log
5,特定的存储过程、函数,使用execute on procedure /execute on function testdb.fn_add服务器

 

user表中host列的值的意义


%                  匹配全部主机
localhost      localhost不会被解析成IP地址,直接经过UNIXsocket链接
127.0.0.1      会经过TCP/IP协议链接,而且只能在本机访问;
::1                 ::1就是兼容支持ipv6的,表示同ipv4的127.0.0.1socket

 

【不用人员权限】


#普通数据用户:

select 、insert 、update 、delete函数


#数据库开发人员(建立表、索引、视图、存储过程、函数。。。等权限):

create 、alter 、drop (表操做)
references (外键)
 create temporary tables (临时表)
index (索引)
create/show view (视图)
create routine(can show procedure status) 、alter routine (can drop a procedure)、execute (存储过程、函数)spa


#普通DBA管理某个库:

all privileges (关键字 “privileges” 能够省略)


#高级DBA管理全部库:

all on *.*

 

权限表

权限 说明
all  
alter  
alter routine 使用alter procedure 和drop procedure
create  
create routine 使用create  procedure
create temporary tables 使用create temporary table
create  user  
create view  
delete  
drop  
execute 使用call和存储过程
file 使用select into outfile  和load data infile
grant option 可使用grant和revoke
index 可使用create index 和drop index
insert  
lock tables 锁表
process 使用show full processlist
reload    使用flush
replication client 服务器位置访问
replocation slave 由复制从属使用
select  
show databases  
show view  
shutdown 使用mysqladmin shutdown 来关闭mysql
super  
update  
usage 无访问权限

revoke all PRIVILEGES,GRANT OPTION from 'B';

 

事务提交

方式:显示提交、隐式提交、自动提交 

COMMIT、ROLLBACK、SAVEPOINT、SET ISOLATION LEVEL,查询不一样用户操做的结果。

设置事务会话级别:

SET [SESSION当前会话 | GLOBAL全局] TRANSACTION ISOLATION LEVEL {

READ UNCOMMITTED读取未提交内容,也被称之为脏读(Dirty Read))

| READ COMMITTED 读取提交内容支持所谓的不可重复读(Nonrepeatable Read),由于同一事务的其余实例在该实例处理其间可能会有新的commit,因此同一select可能返回不一样结果。数据库系统默认

| REPEATABLE READ可重读,mysql默认)

| SERIALIZABLE}

事务内容来自:

http://blog.itpub.net/195110/viewspace-1080777/

隔离级别详解:

http://bbs.linuxtone.org/thread-7681-1-1.html

http://www.cnblogs.com/JohnABC/p/3521061.html

相关文章
相关标签/搜索