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 ...
随机推荐
- hdu 5392 Infoplane in Tina Town(数学)
Problem Description There is a big stone with smooth surface in Tina Town. When people go towards it ...
- 必看谷歌HTML/CSS规范
背景 这篇文章定义了 HTML 和 CSS 的格式和代码规范,旨在提高代码质量和协作效率. 通用样式规范 协议 省略图片.样式.脚本以及其他媒体文件 URL 的协议部分( http:,https: ) ...
- [原创作品] Express 4.x 接收表单数据
好久没有写博客,从现在开始,将介绍用nodejs进行web开发的介绍.欢迎加群讨论:164858883. 之前的express版本在接收表单数据时,可以统一用res.params['参数名'],但在4 ...
- Android控件属性大全[整理转载]
控件属性: android属性 Android功能强大,界面华丽,但是众多的布局属性就害苦了开发者,下面这篇文章结合了网上不少资料, 第一类:属性值为true或falseandroid:layout_ ...
- DEV GridControl 获取选中行的数据
private void gridView1_FocusedRowChanged(object sender, DevExpress.XtraGrid.Views.Base.FocusedRowCha ...
- Javascript进阶篇——(DOM—getAttribute()、setAttribute()方法)—笔记整理
getAttribute()方法通过元素节点的属性名称获取属性的值.语法: elementNode.getAttribute(name) 1. elementNode:使用getElementById ...
- C#中DataTable转化JSON
[WebMethod(Description = "将一个DataTable对象转化成JSON")] public string GetJSON() { JavaScriptSer ...
- Emacs显示行号
在配置.emacs文件中加上 (global-linum-mode t) 启动emacs后按 m-x global-linum-mode 就可以显示行号,但是每次打开emacs,要重新 ...
- Java如何获取当前的jar包路径以及如何读取jar包中的资源
写作业的时候要输出一个record.dat文件到jar包的同级目录,但是不知道怎么定位jar包的路径.百度到的方法不很靠谱,所以在这里记录一下. 一:使用类路径 String path = this. ...
- eclipse修改字体
修改xml字体: window→Preferences→General→Colors and Fonts→Basic→Text Font