mysql授权

news/2024/12/28 12:34:42/

1.dml权限

mysql> grant select,delete,update,insert,create on netcentre.* to 'ln_sale'@'%' identified by 'password';
Query OK, 0 rows affected, 1 warning (0.00 sec)mysql> show grants for 'ln_sale'@'%';
+--------------------------------------------------------------------------------+
| Grants for ln_sale@%                                                           |
+--------------------------------------------------------------------------------+
| GRANT USAGE ON *.* TO 'ln_sale'@'%'                                            |
| GRANT SELECT, INSERT, UPDATE, DELETE, CREATE ON `netcentre`.* TO 'ln_sale'@'%' |
+--------------------------------------------------------------------------------+
2 rows in set (0.00 sec)

2. 查看information_schema权限

mysql> GRANT PROCESS, SUPER ON *.* TO 'infomn'@'%' IDENTIFIED BY 'infomn';
Query OK, 0 rows affected, 1 warning (0.00 sec)mysql> show grants for 'infomn'@'%';
+---------------------------------------------+
| Grants for infomn@%                         |
+---------------------------------------------+
| GRANT PROCESS, SUPER ON *.* TO 'infomn'@'%' |
+---------------------------------------------+
1 row in set (0.00 sec)

3.dml,函数,存储过程权限

mysql> grant alter routine,Create routine,execute,select,delete,update,insert,create on netcentre.* to 'ln_common'@'%' identified by 'password';                                                                 
Query OK, 0 rows affected, 1 warning (0.00 sec)mysql> show grants for 'ln_common'@'%';
+---------------------------------------------------------------------------------------------------------------------+
| GRANT USAGE ON *.* TO 'ln_common'@'%'                                                                                    |
| GRANT SELECT, INSERT, UPDATE, DELETE, CREATE, EXECUTE, CREATE ROUTINE, ALTER ROUTINE ON `netcentre`.* TO 'ln_common'@'%' |
+---------------------------------------------------------------------------------------------------------------------+
2 rows in set (0.00 sec)

4.普通dba权限

mysql> grant all privileges on *.* to 'test'@'%' identified by 'test';
Query OK, 0 rows affected, 1 warning (0.00 sec)mysql> select * from mysql.user where user='test'\G;
*************************** 1. row ***************************Host: %User: testSelect_priv: YInsert_priv: YUpdate_priv: YDelete_priv: YCreate_priv: YDrop_priv: YReload_priv: YShutdown_priv: YProcess_priv: YFile_priv: YGrant_priv: NReferences_priv: YIndex_priv: YAlter_priv: YShow_db_priv: YSuper_priv: YCreate_tmp_table_priv: YLock_tables_priv: YExecute_priv: YRepl_slave_priv: YRepl_client_priv: YCreate_view_priv: YShow_view_priv: YCreate_routine_priv: YAlter_routine_priv: YCreate_user_priv: YEvent_priv: YTrigger_priv: Y
Create_tablespace_priv: Yssl_type: ssl_cipher: x509_issuer: x509_subject: max_questions: 0max_updates: 0max_connections: 0max_user_connections: 0plugin: mysql_native_passwordauthentication_string: *94BDCEBE19083CE2A1F959FD02F964C7AF4CFC29password_expired: Npassword_last_changed: 2023-08-05 00:04:37password_lifetime: NULLaccount_locked: N
1 row in set (0.00 sec)

5. dba权限

mysql> select * from mysql.user where user='root' and host='localhost'\G;
*************************** 1. row ***************************Host: localhostUser: rootSelect_priv: YInsert_priv: YUpdate_priv: YDelete_priv: YCreate_priv: YDrop_priv: YReload_priv: YShutdown_priv: YProcess_priv: YFile_priv: YGrant_priv: YReferences_priv: YIndex_priv: YAlter_priv: YShow_db_priv: YSuper_priv: YCreate_tmp_table_priv: YLock_tables_priv: YExecute_priv: YRepl_slave_priv: YRepl_client_priv: YCreate_view_priv: YShow_view_priv: YCreate_routine_priv: YAlter_routine_priv: YCreate_user_priv: YEvent_priv: YTrigger_priv: Y
Create_tablespace_priv: Yssl_type: ssl_cipher: x509_issuer: x509_subject: max_questions: 0max_updates: 0max_connections: 0max_user_connections: 0plugin: mysql_native_passwordauthentication_string: *6BB4837EB74329105EE4568DDA7DC67ED2CA2AD9password_expired: Npassword_last_changed: 2023-06-07 01:40:36password_lifetime: NULLaccount_locked: N
1 row in set (0.00 sec)ERROR: 
No query specified

6.回收权限

mysql> revoke all on *.* from 'test'@'%';
Query OK, 0 rows affected (0.00 sec)mysql> show grants for 'test'@'%'\G;
*************************** 1. row ***************************
Grants for test@%: GRANT USAGE ON *.* TO 'test'@'%'
1 row in set (0.00 sec)ERROR: 
No query specifiedmysql> select * from mysql.user where user='test' and host='%'\G;
*************************** 1. row ***************************Host: %User: testSelect_priv: NInsert_priv: NUpdate_priv: NDelete_priv: NCreate_priv: NDrop_priv: NReload_priv: NShutdown_priv: NProcess_priv: NFile_priv: NGrant_priv: NReferences_priv: NIndex_priv: NAlter_priv: NShow_db_priv: NSuper_priv: NCreate_tmp_table_priv: NLock_tables_priv: NExecute_priv: NRepl_slave_priv: NRepl_client_priv: NCreate_view_priv: NShow_view_priv: NCreate_routine_priv: NAlter_routine_priv: NCreate_user_priv: NEvent_priv: NTrigger_priv: N
Create_tablespace_priv: Nssl_type: ssl_cipher: x509_issuer: x509_subject: max_questions: 0max_updates: 0max_connections: 0max_user_connections: 0plugin: mysql_native_passwordauthentication_string: *94BDCEBE19083CE2A1F959FD02F964C7AF4CFC29password_expired: Npassword_last_changed: 2023-08-05 00:04:37password_lifetime: NULLaccount_locked: N
1 row in set (0.00 sec)

http://www.ppmy.cn/news/1009132.html

相关文章

CentOS7安装Maven详细教程

😊 作者: Eric 💖 主页: https://blog.csdn.net/weixin_47316183?typeblog 🎉 主题:CentOS7安装Maven详细教程 ⏱️ 创作时间: 2023年08月06日 第一步:上传或下载安装包&#x…

ADS版图画封装联合仿真学习视频

ADS版图画封装 因为晶体管ATF54143在ADS中是没有封装的,所以要在ADS中画ATF54143的封装,操作步骤如下: 在ADS中新建layout,命名为ATF54143_layout, 根据datasheet知道封装的大小,进行绘制 在layout的con…

开源全文搜索引擎汇总

1、Apache Lucene Java 全文搜索框架 许可证:Apache-2.0 开发语言:Java 官网:https://lucene.apache.org/。Apache Lucene 是完全用 Java 编写的高性能、功能齐全的全文检索引擎架构,提供了完整的查询引擎和索引引擎、部分文本分析引擎。目的是为软件开发人员提供一个简单…

第5集丨Vue 江湖 —— 监视属性/侦听属性

目录 一、基本使用1.1 watch配置监视1.2 vm.$watch动态监视1.3 深度监视(deep watch)1.4 简写形式 二、computed和watch的对比2.1 使用watch实现setTimeout操作2.2 用computed无法实现setTimeout 三、其他注意事项3.1 vue devtools的bug3.2 xxxyyy格式3.3 将window传入data中 V…

python性能调试

py-spy生成cpu火焰图 ft5.svg env/xxxx/bin pid26443$env/py-spy record -o /tmp/$f --pid $pid --nativememray实时查看内存 env/xxxx/bin$env/python -m memray run --live --trace-python-allocators --native run_demo.pymemray生成内存火焰图报告 frun_demo_042.bin en…

【数学】这可能是全网最容易的贝叶斯公式讲解

背景 上午在B站连续刷到两个讲贝叶斯的视频,都讲的极好,而且一个视频是从应用的角度,一个是从原理的角度。我将两个视频反复对照观看发现之前怎么都无感的贝叶斯,这次居然通透了!视频链接我将放到最下方。 正文 第一…

Session与Cookie的区别(四)

咖啡寄杯的烦恼 虽然店里生意还可以,但小明无时无刻不想着怎么样发大财赚大钱,让店里的生意变得更好。 他观察到最近好多便利商店开始卖起了咖啡,而且时不时就买一送一或是第二件半价,并且贴心地提供了寄杯的服务。 寄杯就是指说你…

【Linux:线程池】

文章目录 1 线程池概念2 第一个版本的线程池3 第二个版本的线程池4 第三个版本的线程池5 STL中的容器以及智能指针的线程安全问题6 其他常见的各种锁7 读者写者问题(了解) 1 线程池概念 一种线程使用模式。线程过多会带来调度开销,进而影响缓存局部性和整体性能。而…