mysql用户和权限管理
用户和权限管理
Information about account privileges is stored in the user, db, host, tables_priv, columns_priv, and procs_priv tables in the mysql database. The MySQL server reads the contents of these tables into memory when it starts and reloads them under the circumstances. Access-control decisions are based on the in-memory copies of the grant tables.
user: Contains user accounts, global privileges, and other non-privilege columns.
user: 用户帐号、全局权限、其他非权限字段
db: Contains database-level privileges.
db: 库级别权限
host: Obsolete.
host: 废弃
tables_priv: Contains table-level privileges.
表级别权限
columns_priv: Contains column-level privileges.
列级别权限
procs_priv: Contains stored procedure and function privileges.
存储过程和存储函数相关的权限
proxies_priv: Contains proxy-user privileges.
代理用户权限
There are several distinctions between the way user names and passwords are used by MySQL and the way they are used by your operating system:
User names, as used by MySQL for authentication purposes, have nothing to do with user names (login names) as used by Windows or Unix.
MySQL user names can be up to 16 characters long.
The server uses MySQL passwords stored in the user table to authenticate client connections using MySQL native authentication (against passwords stored in the mysql.user table).
MySQL encrypts passwords stored in the user table using its own algorithm. This encryption is the same as that implemented by the PASSWORD() SQL function but differs from that used during the Unix login process.
It is possible to connect to the server regardless of character set settings if the user name and password contain only ASCII characters.
用户帐号:
用户名@主机
用户名:16字符以内
主机:
主机名:www.magedu.com, mysql
IP: 172.16.10.177
网络地址:
172.16.0.0/255.255.0.0
通配符:%,_
172.16.%.%
%.magedu.com
--skip-name-resolve 略过名称(主机名)解析,提高用户连接的速度
权限级别:
全局级别: SUPER、
库
表: DELETE, ALTER, TRIGGER
列: SELECT, INSERT, UPDATE
存储过程和存储函数
字段级别:
临时表:内存表
heap: 16MB
触发器:主动数据库
INSERT, DELETE, UPDATE
user: log
创建用户:
CREATE USER username@host [IDENTIFIED BY 'password']
GRANT 授权时用户不存在则创建新用户
GRANT ALL PRIVILEGES ON [object_type] db.* TO username@'%';
TABLE
| FUNCTION
| PROCEDURE
GRANT EXECUTE ON FUNCTION db.abc TO username@'%';
创建用户:不会自动读取授权表
INSERT INTO mysql.user
mysql> FLUSH PRIVILEGES;
查看用户相关的授权信息:
SHOW GRANTS FOR 'username@host';
GRANT OPTION
| MAX_QUERIES_PER_HOUR count
| MAX_UPDATES_PER_HOUR count
| MAX_CONNECTIONS_PER_HOUR count
| MAX_USER_CONNECTIONS count
--skip-grant-tables 跳过授权表
--skip-name-resolve 略过名称(主机名)解析,提高用户连接的速度
--skip-networking 跳过网络,只能通过本机连接
DROP USER 'username'@'host' 删除用户
RENAME USER old_name TO new_name 重命名用户
REVOKE 收回权限
管理员密码忘记找回:
启动mysqld_safe时传递两个参数:
--skip-grant-tables
--skip-networking 跳过网络,只能通过本机连接
set password for 'root'@'localhost' IDENTIFIED by 'passed' --此方法不行,因为跳过了授权表
update user set password=password('passed') where USER = 'root'
通过更新授权表方式直接修改其密码,而后移除此两个选项重启服务器。
mysql用户和权限管理的更多相关文章
- Mysql 用户,权限管理的几点理解。
前两天项目数据库要移植到mysql,为此临时抓了几天很久没用的mysql. 公司的数据库比较简单,从oracle迁移到mysql很简单,但是,中间的权限管理让我感觉既简单又复杂..简单是因为网上关于m ...
- mysql 用户及权限管理 小结
MySQL 默认有个root用户,但是这个用户权限太大,一般只在管理数据库时候才用.如果在项目中要连接 MySQL 数据库,则建议新建一个权限较小的用户来连接. 在 MySQL 命令行模式下输入如下命 ...
- MySQL Study之--MySQL用户及权限管理
MySQL Study之--MySQL用户及权限管理 MySQLserver通过MySQL权限表来控制用户对数据库的訪问.MySQL权限表存放在mysql数据库里.由mysql_install ...
- MySQL用户与权限管理
执行mysql select 查询报错: SELECT command denied to user 'root'@'localhost' for table "xxx" 问题原因 ...
- Mysql 用户和权限管理
用户和权限管理: 语法 grant 权限 on 数据库.数据表 to '用户' @ '主机名'; 例:给 xiaogang 分配所有的权限 grant all on *.* to 'xiaogang' ...
- MariaDB/MySQL用户和权限管理
本文目录: 1.权限验证 1.1 权限表 1.2 图解认证和权限分配的两个阶段 1.3 权限生效时机 2.用户管理 2.1 创建用户 2.2 create user和alter user 2.3 记录 ...
- mysql用户与权限管理笔记
今天想使用一下李刚那本书上的hibernate的Demo,试出了点问题,过程中就发现mysql的用户管理和权限管理上也有点东西要注意,所以顺便就写一下mysql用户管理和权限管理的笔记. 先说一说my ...
- (九)MySQL用户和权限管理
(1)用户管理 1)登录和退出mysql 例: mysql -h192.168.111.150 -P3306 -uroot -predhat mysql -e 'select user,host,au ...
- MySQL 用户与权限管理
MySQL权限系统的主要功能是证实连接到一台给定主机的用户,而且赋予该用户在数据库上的相关DML,DQL权限.MySQL存取控制包括2个阶段,一是server检查是否同意你连接:二是假定你能连接,se ...
随机推荐
- 转:Excel转换XML工具<一>
http://blog.csdn.net/candle806/article/details/7441695最近在整理测试用例,所以想找一个合适的工具来完成对测试需求.测试用例的管理.对比了一翻,发现 ...
- C# 插入排序算法
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.T ...
- python lcd 时间显示
#!/usr/bin/python # QStopWatch -- a very simple stop watch # Copyright (C) 2006 Dominic Battre <d ...
- [置顶] ./build_native 时出现please define NDK_ROOT
在一次帮朋友弄cygwin交叉编译时出现了这个问题 cygwin是按照成功了,make-v,以及gcc-v都没出现问题,就是在./build_native 时出现please define NDK_R ...
- getAttribute()与getParameter的区别
当两个Web组件之间为转发关系时,转发源会将要共享 request范围内的数据先用setAttribute将数据放入到HttpServletRequest对象中,然后转发目标通过 getParamet ...
- ADO.Net总结
ADO.NET简介 一. ADO.NET的组成(ADO.NET是什么?能干什么)客户体验 ADO.NET就是一组类库可以让我们通过程序的方式访问数据库 ADO.NET主要包括5个对象, ...
- ios9API基础知识总结(二)
UIAlertView(警告框) UIAlertView *alert = [[UIAlertView alloc]initWithTitle:@"标题" message:@&qu ...
- Java如何获取当前的jar包路径以及如何读取jar包中的资源
写作业的时候要输出一个record.dat文件到jar包的同级目录,但是不知道怎么定位jar包的路径.百度到的方法不很靠谱,所以在这里记录一下. 一:使用类路径 String path = this. ...
- 给软件增加注册功能 c#
1.软件注册类 using System; using System.Collections.Generic; using System.Linq; using System.Text; using ...
- 客户端技术:Cookie 服务端技术:HttpSession
客户端技术:Cookie 服务端技术:HttpSession 07. 五 / android基础 / 没有评论 一.会话技术1.什么是会话:客户打开浏览器访问一个网站,访问完毕之后,关闭浏览器.这 ...