*可使用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
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服务器
% 匹配全部主机
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
all privileges (关键字 “privileges” 能够省略)
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/】