当前位置:网站首页>MYSQL架构——用户权限与管理
MYSQL架构——用户权限与管理
2022-07-04 22:17:00 【swttws.】
目录
一、MYSQL用户管理
1、创建用户
create user lisi identified by '123456';表示创建用户名为lisi,密码为123456的用户
2、了解用户user表
查询用户表特定字段
select host,user,authentication_string,select_priv,insert_priv,drop_priv from mysql.user;
(1)host表示连接类型
①%表示远程连接,其他机器可以通过该机器的IP地址进行连接;
②localhost表示本地连接,如mysql -u root -p;
(2)user表示用户名,同一用户不同连接方式权限不同
(3)select_priv , insert_priv为·用户权限
3、修改用户密码
(1)修改当前用户密码
set password =password('123456')(2)修改某个用户密码,必须使用root用户修改
update mysql.user set authentication_string=password('111111') where user='lisi';所有修改完用户表后,需要执行以下指令才能生效
flush privileges;
4、删除用户
drop user 'lisi';
注:不要使用以下语句删除,系统会有残留信息
delete from user where user='lisi'
二、权限管理
1、授权命令
授权命令需要在root用户下执行
grant 权限1,权限2,...,权限n on 数据库名.表名 to 用户名@用户地址 identified by 用户密码如:
grant select,insert,delete,update on mytabl.* to [email protected] identified by ‘123456该命令给lisi授予mytabl库下所有表的增删改查的权限,用户lisi必须存
2、收回权限
收回权限命令需要在root用户下执行
revoke 权限1,权限2,...,权限n on 数据库名.表名 to 用户名@用户地址如:
REVOKE select,insert,update,delete ON *.* FROM [email protected]'%';收回在lisi用户下,操作所有表的增删改查命令,执行完该指令后,需要lisi重新登录才有效
3、查看权限
(1)show grants:查看当前用户权限;
(2)查看某用户全局权限:
select * from mysql.user
三、远程访问
1、授予用户远程连接权限
grant all privileges on *.* to 用户@'%' identified by '密码';2、先ping一下数据库IP地址
ping 数据库所在机器IP地址 -t3、防火墙设置
(1)关闭防火墙
systemctl stop firewalld.service(2)或者开放端口
firewall-cmd --add-port=3306/tcp --permanent #重启防火墙 firewall-cmd --reload
4、测试连接

边栏推荐
- How diff are the contents of the same configuration item in different environments?
- SPSS installation and activation tutorial (including network disk link)
- leetcode 72. Edit Distance 编辑距离(中等)
- The proofreading activity of data science on the command line second edition was restarted
- 我在linux里面 通过调用odspcmd 查询数据库信息 怎么静默输出 就是只输出值 不要这个
- 记录:关于Win10系统中Microsoft Edge上的网页如何滚动截屏?
- i. Mx6ull driver development | 24 - platform based driver model lights LED
- Solana链上应用Crema因黑客攻击停运
- Google Earth Engine(GEE)——以MODIS/006/MCD19A2为例批量下载逐天AOD数据逐天的均值、最大值、最小值、标准差、方差统计分析和CSV下载(北京市各区为例)
- [acwing] solution of the 58th weekly match
猜你喜欢

TLA+ 入门教程(1):形式化方法简介

传智教育|如何转行互联网高薪岗位之一的软件测试?(附软件测试学习路线图)

The sandbox has reached a cooperation with digital Hollywood to accelerate the economic development of creators through human resource development

都说软件测试很简单有手就行,但为何仍有这么多劝退的?

Logo special training camp Section IV importance of font design

Radio and television Wuzhou signed a cooperation agreement with Huawei to jointly promote the sustainable development of shengteng AI industry

Naacl-22 | introduce the setting of migration learning on the prompt based text generation task

Domestic database chaos

将QA引入软件开发生命周期是工程师要遵循的最佳实践

2022-07-04: what is the output of the following go language code? A:true; B:false; C: Compilation error. package main import “fmt“ func main() { fmt.Pri
随机推荐
Huawei Nova 10 series released Huawei application market to build a solid application security firewall
PostgreSQL服务端编程聚合和分组
TLA+ 入门教程(1):形式化方法简介
如何实现轻松管理1500万员工?
Google Earth Engine(GEE)——基于 MCD64A1 的 GlobFire 日常火灾数据集
Common shortcut keys for hbuilder x
10 schemes to ensure interface data security
NFT Insider #64:电商巨头eBay提交NFT相关商标申请,毕马威将在Web3和元宇宙中投入3000万美元
NFT insider 64: e-commerce giant eBay submitted an NFT related trademark application, and KPMG will invest $30million in Web3 and metauniverse
Recommendation of mobile app for making barcode
Mysql root 账号如何重置密码
蓝队攻防演练中的三段作战
安装人大金仓数据库
Tla+ introductory tutorial (1): introduction to formal methods
Alibaba launched a new brand "Lingyang" and is committed to becoming a "digital leader"
leetcode 72. Edit distance edit distance (medium)
About stack area, heap area, global area, text constant area and program code area
odps 中 对表进行了一次备份,为什么在元数据库查m_table 时,两张表的逻辑大小不一致,但数
You don't have to run away to delete the library! Detailed MySQL data recovery
Close system call analysis - Performance Optimization
