sql语句查询用户权限
时间: 2023-09-02 15:10:47 浏览: 119
根据引用\[3\]中的内容,可以使用以下SQL语句查询用户的权限:
```sql
SELECT DISTINCT(e.AUTHKEY)
FROM USER a
LEFT JOIN USER_ROLE b ON a.USERID=b.USERID
LEFT JOIN ROLE c ON b.ROLEID=c.ROLEID
LEFT JOIN ROLE_AUTHORITY d ON c.ROLEID=d.ROLEID
LEFT JOIN AUTHORITY e ON d.AUTHID=e.AUTHID
WHERE a.USERID = 1;
```
这个查询语句会从用户的组角色表中查询用户的权限,并去掉重复的记录,返回用户的权限列表。
#### 引用[.reference_title]
- *1* [mysql 创建用户 sql语句,以及权限设置,创建表](https://blog.csdn.net/m0_61688531/article/details/123134818)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v91^insert_down28v1,239^v3^insert_chatgpt"}} ] [.reference_item]
- *2* [MySQL(入门篇18)SQLyog 的用户权限管理 ; SQL语句的用户权限管理。](https://blog.csdn.net/jarvan5/article/details/106395851)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v91^insert_down28v1,239^v3^insert_chatgpt"}} ] [.reference_item]
- *3* [查询用户权限的SQL语句](https://blog.csdn.net/iw1210/article/details/82688985)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v91^insert_down28v1,239^v3^insert_chatgpt"}} ] [.reference_item]
[ .reference_list ]
阅读全文