当前位置:网站首页>MySQL to revise the root password
MySQL to revise the root password
2022-07-31 04:02:00 【Hi teacher, I'm Dabai】
修改root账号密码
示例一:
# IP地址
192.168.70.133
# root 账号密码
Ncayu@bNuPc3
# 更改密码:
ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY '[email protected]';
# 刷新一下
flush privileges;
# Test whether you can log in normally after changing the account password
mysql -u root -p Ncayu@bNuPc3
示例二:
先修改root账号的“%”权限为“localhost”权限;rootAccounts can only be used locally
修改root账号的密码,Passwords are complex,meet password complexity.
# 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)
# Test whether you can log in normally after changing the account password
mysql -u root -p shang@Ds9Ed6
Database account permission recovery
# Database account permission recovery
四、回收权限
删除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可以回收所有权限,也可以回收部分权限.
边栏推荐
- Notes on the establishment of the company's official website (6): The public security record of the domain name is carried out and the record number is displayed at the bottom of the web page
- Detailed explanation of TCP and UDP
- (5) final, abstract class, interface, inner class
- 【SemiDrive源码分析】【MailBox核间通信】44 - 基于Mailbox IPCC RPC 实现核间通信(RTOS侧 IPCC_RPC Server 消息接收及回复 原理分析篇)
- Database implements distributed locks
- Automation strategies for legacy systems
- [C language] General method for finding the sum of the greatest common factor and the least common multiple of two integers m and n, the classical solution
- Safety 20220722
- type_traits元编程库学习
- Redis 使用LIST做最新评论缓存
猜你喜欢

已解决(最新版selenium框架元素定位报错)NameError: name ‘By‘ is not defined
![[C language] General method of base conversion](/img/28/954af5f47a79ff02d3cc0792ac8586.jpg)
[C language] General method of base conversion

With 7 years of experience, how can functional test engineers improve their abilities step by step?

Knowledge Distillation 7: Detailed Explanation of Knowledge Distillation Code

识Flutter 基本组件之showTimePicker 方法

Just debuted "Fight to Fame", safety and comfort are not lost

浅识Flutter 基本组件之CheckboxListTile组件

Learning DAVID Database (1)

Daily practice of LeetCode - palindrome structure of OR36 linked list

LocalDate addition and subtraction operations and comparison size
随机推荐
addressable in Golang
Redis 使用LIST做最新评论缓存
[C language] General method for finding the sum of the greatest common factor and the least common multiple of two integers m and n, the classical solution
Based on the local, linking the world | Schneider Electric "Industrial SI Alliance" joins hands with partners to go to the future industry
"A daily practice, happy water problem" 1331. Array serial number conversion
IDEA common shortcut keys and plug-ins
「 每日一练,快乐水题 」1331. 数组序号转换
els block to the right
【论文阅读】Mastering the game of Go with deep neural networks and tree search
idea工程明明有依赖但是文件就是显示没有,Cannot resolve symbol ‘XXX‘
open failed: EACCES (Permission denied)
C primer plus study notes - 8, structure
pom文件成橘红色未加载的解决方案
Bubble sort, selection sort, insertion sort, binary search directly
el-image标签绑定点击事件后没有有用
【SemiDrive源码分析】【MailBox核间通信】44 - 基于Mailbox IPCC RPC 实现核间通信(RTOS侧 IPCC_RPC Server 消息接收及回复 原理分析篇)
A brief introduction to the CheckBox component of the basic components of Flutter
[Swift] Customize the shortcut that pops up by clicking the APP icon
Difference between unallocated blocks and unused blocks in database files
SIP Protocol Standard and Implementation Mechanism