MySQL数据库用户创建
来源:互联网 发布:以父之名 知乎 编辑:程序博客网 时间:2024/05/29 07:14
创建一个密码为test1234,用户名为yii2db
CREATE USER 'yii2db'@'localhost' IDENTIFIED BY 'test1234';
给创建的用户授权
语法: GRANT [type of permission] ON [database name].[table name] TO '[username]'@'localhost’;
数据库权限种类
+ ALL PRIVILEGES- as we saw previously, this would allow a MySQL user all access to a designated database (or if no database is selected, across the system)
+ CREATE- allows them to create new tables or databases
+ DROP- allows them to them to delete tables or databases
+ DELETE- allows them to delete rows from tables
+ INSERT- allows them to insert rows into tables
+ SELECT- allows them to use the Select command to read through databases
+ UPDATE- allow them to update table rows
+ GRANT OPTION- allows them to grant or remove other users’ privileges
例子:
GRANT CREATE,DELETE,INSERT,SELECT,UPDATE,DROP ON *.* TO 'yii2db'@'localhost';GRANT ALL PRIVILEGES ON *.* TO 'yii2db'@'localhost';
刷新权限
FLUSH PRIVILEGES;
实例:删除一个数据库用户,然后创建数据库用户并赋予权限。
DROP USER 'yii2dbuser'@'localhost';
CREATE USER 'yii2dbuser'@'localhost' IDENTIFIED BY 'dbpassword';
GRANT CREATE,DELETE,INSERT,SELECT,UPDATE,DROP ON yii2db.* TO 'yii2dbuser'@'localhost';
FLUSH PRIVILEGES;
参考:https://dev.mysql.com/doc/refman/5.1/en/grant.html
- Mysql数据库创建用户
- MySQL数据库用户创建
- mysql数据库和用户创建
- mysql创建用户及数据库
- Mysql 创建用户和数据库
- mysql 创建用户及数据库
- mysql -创建 用户 和 数据库
- mysql创建用户和数据库
- MySQL创建用户、数据库、远程登录用户
- mysql 用户创建、数据库创建、数据库授权给用户问题
- Mysql数据库创建、删除用户和数据库
- 创建数据库用户,并且赋予权限--mysql
- mysql 添加用户和创建数据库
- Mysql创建用户、数据库、授权【转载】
- mysql+postgresql创建数据库、用户、权限
- mysql 创建一个用户,指定一个数据库
- mysql 创建一个用户,指定一个数据库
- mysql创建用户和数据库、授权
- Unity3d下 spine 2D骨骼制作
- spring aop 切入点
- java IO简介及演变的历史
- 最新版SDWebImage的使用
- 启动android后没有应用图标,找不到应用程序
- MySQL数据库用户创建
- String.format用法
- 中文 unicode互转
- Android Xutils 框架
- java 复选框的取值与验证(checkbox)
- java保留2位小数
- 得到日期相差天数
- JS加分隔符
- 【转】 只能输入数字, 正则限制input框只能输入数字,英文等