标签:获得 password 相关 usr 对象 bye 管理类 dir 线程
常见的权限类别:库级别、表级别、字段级别、管理类权限、程序类权限
管理类权限:
CREATE TEMPORARY TABLES
创建临时表,一般为16M;CREATE USER
:创建用户权限FILE
:在数据库导出某文件中,或者从文件加载至数据库中SUPER
:在数据库执行管理操作的权限;跟复制、授权等相关的高级管理权限SHOW DATABASES
: 一般授权给每个用户RELOAD
:重新装载授权表还有其他功能SHOUTDOWN
:关闭数据库权限REPLICATION SLAVE
:是否能创建连接实现从服务器以复制的方式复制的权限连接至数据服务器端REPLICATION CLIENT
:是否有权限从主服务器请求复制相关事件到本地,就是请求复制相关主数据库产生的时间LOCK TABLES
:请求在服务器上锁表权限PROCESS
:程序类权限:
FUNCTION
存储函数:CREATE,ALTER,DROP,EXCUTEPROCEDURE
存储过程:CREATE,ALTER,DROP,EXCUTETRIGGER
触发器:CREATE,ALTER,DROP,EXCUTE
CREATE FUNCTION
:创建存储函数权限CREATE PROCEDURE
:创建存储过程权限CREATE TRIGGER
:创建触发器权限ALTER FUNCTION
:修改存储函数权限ALTER PROCEDURE
:修改存储过程权限ALTER TRIGGER
:修改触发器权限DROP FUNCTION
:删除存储函数权限DROP PROCEDURE
:删除存储过程权限DROP TEIGGER
:删除触发器权限EXCUTE FUNCTION
:执行存储函数权限EXCUTE PROCEDURE
执行存储过程权限EXCUTE TRIGGER
:执行触发器权限库和表级别的权限:TABLE,DATABASE
ALTER
:可修改库或表权限;无需指明关键字,因为ALTER就代表仅对二者有效CREATE
:创建库或表权限CREATE VIEW
:创建视图权限DROP
:删除库或表权限INDEX
:创建过删除索引权限SHOW VIEW
:查看视图权限GRANT OPTION
:能够把自己获得的权限赠送给其他用户一个副本的权限;一般手机时不建议使用with grant option
数据操作的权限:
SELECT
INSERT
DELETE
UPDATE
字段级别权限:
SELECT(col1,col2,...)
:定义查看指定字段的权限UPDATE(col1,col2,...)
:定义更新/改指定字段权限INSERT(col1,col2,...)
:定义插入指定字段的权限所有权限: ALL PRIVIEGES, ALL
columns_priv,tables_priv,procs_priv,proxies_priv
:用来设定专门的权限‘USERNAME‘@‘HOST‘
skip_name_resolve=ON
:跳过名称解析CREATE USER ‘user‘@‘host’ [IDENTIFIED BY [PASSWORD] ‘password‘] [,‘user‘@‘host‘ [IDENTIFIED BY [PASSWORD] ‘password‘]...]
RENAME USER old_user TO new_user[,old_user TO new_user] ...
DROP USER ‘user‘@‘host‘ [,‘user‘@‘host‘] ...
FLUSH PRIVILEGES
SET PASSWORD [FOR ‘user‘@‘host‘] = PASSWORD(‘cleartext password‘);
UPDATE mysql.user SET Password=PASSWORD(‘cleartext password‘) WHERE User=‘USERNAME‘ AND Host=‘HOST‘;
mysqladmin -uUSERNAME -hHOST -p password ‘NEW_PASS‘;
FLUSH PRIVILEGES
CentOS 7: mariadb.serivce
CentOS 6: /etc/init.d/mysqld
(2) 通过UPDATE 命令修改管理员密码
(3) 以正常方式启动mysqld进程
操作示例:以CentOS7为例
[root@localhost ~]# systemctl stop mariadb
[root@localhost ~]# vim /usr/lib/systemd/system/mariadb.service
修改如下内容:
ExecStart=/usr/bin/mysqld_safe --basedir=/usr --skip-grant-tables --skip-networking
[root@localhost ~]# systemctl daemon-reload
[root@localhost ~]# systemctl start mariadb.service
[root@localhost ~]# mysql
Welcome to the MariaDB monitor. Commands end with ; or \g.
Your MariaDB connection id is 2
Server version: 5.5.60-MariaDB MariaDB Server
Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.
Type ‘help;‘ or ‘\h‘ for help. Type ‘\c‘ to clear the current input statement.
MariaDB [(none)]> UPDATE mysql.user SET password=PASSWORD(‘inspur‘) WHERE user=‘root‘;
Query OK, 2 rows affected (0.02 sec)
Rows matched: 3 Changed: 2 Warnings: 0
MariaDB [(none)]> FLUSH PRIVILEGES;
MariaDB [(none)]> EXIT
Bye
[root@localhost ~]# systemctl stop mariadb.service
[root@localhost ~]# vim /usr/lib/systemd/system/mariadb.service
修改如下内容:
ExecStart=/usr/bin/mysqld_safe --basedir=/usr
[root@localhost ~]# systemctl deamon-reload
标签:获得 password 相关 usr 对象 bye 管理类 dir 线程
原文地址:https://www.cnblogs.com/wanghuaijun/p/11963636.html