当前位置:首页 > 开发 > 数据库 > 正文

MySQL访问权限

发表于: 2011-04-05   作者:SuperCustomer   来源:转载   浏览:
摘要: 1、创建用户 语法:grant privileges on * | *.* |db_name.* |db_name.tbl_name to 'user'@'host' identified by 'password' with with_option 例如:grant usage on db_test.tbl_user to 'super'@'localhost' iden

1、创建用户

语法:grant privileges on * | *.* |db_name.* |db_name.tbl_name to 'user'@'host' identified by 'password' with with_option

例如:grant usage on db_test.tbl_user to 'super'@'localhost' identified by '123456' with grant option;

 

2、授权

语法:grant privileges on * | *.* |db_name.* |db_name.tbl_name to 'user'@'host' identified by 'password' with with_option

例如:grant select,update on db_test.tbl_user to 'super'@'localhost' identified by '123456' with MAX_USER_CONNECTIONS 3;

 

3、撤消权限

语法:revoke privileges on * | *.* |db_name.* |db_name.tbl_name from 'user'@'host';

例如:revoke insert on db_test.tbl_user from 'super'@'localhost';

 

4、删除用户

语法:drop user 'user'@'host';

例如:drop user 'super'@'localhost';

 

5、修改密码

例如:把root密码由123456改为空

mysqladmin -uroot -p123456 password ''

MySQL访问权限

  • 0

    开心

    开心

  • 0

    板砖

    板砖

  • 0

    感动

    感动

  • 0

    有用

    有用

  • 0

    疑问

    疑问

  • 0

    难过

    难过

  • 0

    无聊

    无聊

  • 0

    震惊

    震惊

版权所有 IT知识库 CopyRight © 2009-2015 IT知识库 IT610.com , All Rights Reserved. 京ICP备09083238号