当前位置:网站首页>MySQL修改root账号密码
MySQL修改root账号密码
2022-07-31 03:55:00 【老师好我是大白】
修改root账号密码
示例一:
# IP地址
192.168.70.133
# root 账号密码
Ncayu@bNuPc3
# 更改密码:
ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY '[email protected]';
# 刷新一下
flush privileges;
# 测试账号密码修改后是否可以正常登录
mysql -u root -p Ncayu@bNuPc3
示例二:
先修改root账号的“%”权限为“localhost”权限;root账号只能本地使用
修改root账号的密码,密码具有复杂性,满足密码复杂度。
# IP地址 192.168.70.136
shang@Ds9Ed6
mysql> use mysql;
Database changed
mysql> update user set host = "localhost" where user = "root" and host = "%";
Query OK, 1 row affected (0.00 sec)
Rows matched: 1 Changed: 1 Warnings: 0
mysql> select user,host from mysql.user;
更改密码:
mysql> ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY '[email protected]';
Query OK, 0 rows affected (0.00 sec)
# 测试账号密码修改后是否可以正常登录
mysql -u root -p shang@Ds9Ed6
数据库账号权限回收
# 数据库账号权限回收
四、回收权限
删除ncayu这个用户的create权限,该用户将不能创建数据库和表。
revoke all privileges on `webapp`.* from 'ncayu'@'%';
mysql> revoke create on *.* from '[email protected]';
mysql> flush privileges;
3.revoke撤销权限
#revoke跟grant语法差不多,只需要把关键字 “to” 换成 “from” 即可,并且revoke语句中不需要跟密码设置。
注意:revoke可以回收所有权限,也可以回收部分权限。
边栏推荐
- Select the smoke test case, and make the first pass for the product package entering QA
- 自己的一些思考
- Mysql 45 study notes (23) How does MYSQL ensure that data is not lost
- 【AUTOSAR-RTE】-4-Port and Interface and Data Type
- Detailed explanation of TCP (1)
- 【动态规划】连续子数组的最大和
- Daily practice of LeetCode - palindrome structure of OR36 linked list
- What is a system?
- Redis 使用 sorted set 做最新评论缓存
- Smartcom Programming Level 4 - Magic Academy Lesson 6
猜你喜欢
LeetCode每日一练 —— 138. 复制带随机指针的链表
[C language] Three-pointed chess (classic solution + list diagram)
Just debuted "Fight to Fame", safety and comfort are not lost
Mysql 45 study notes (23) How does MYSQL ensure that data is not lost
Web container and IIS --- Middleware penetration method 1
A brief introduction to the CheckBox component of the basic components of Flutter
[Dynamic programming] Maximum sum of consecutive subarrays
「 每日一练,快乐水题 」1331. 数组序号转换
大小端模式
LeetCode每日一练 —— OR36 链表的回文结构
随机推荐
【AUTOSAR-RTE】-5-Explicit(显式)和Implicit(隐式) Sender-Receiver communication
安全20220715
端口排查步骤-7680端口分析-Dosvc服务
数据库文件中的未分配的块和未使用的块的区别
C# 实现PLC的定时器
从滴滴罚款后数据治理思考
(四)递归、可变参数、访问修饰符、理解 main 方法、代码块
[C language] Three-pointed chess (classic solution + list diagram)
问题7:列表的拼接
web容器及IIS --- 中间件渗透方法1
A brief introduction to the showDatePicker method of the basic components of Flutter
Why don't you programmers make a living off your own projects?And have to work for someone else?
(线段树) 基础线段树常见问题总结
C语言从入门到如土——数据的存储
组件传值 provide/inject
Select the smoke test case, and make the first pass for the product package entering QA
"DeepJIT: An End-To-End Deep Learning Framework for Just-In-Time Defect Prediction" paper notes
$attrs/$listeners
Zotero如何删除自动生成的标签
C language from entry to such as soil, the data store