当前位置:网站首页>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可以回收所有权限,也可以回收部分权限。
边栏推荐
- [C language] Three-pointed chess (classic solution + list diagram)
- 浅识Flutter 基本组件之CheckBox组件
- Knowledge Distillation 7: Detailed Explanation of Knowledge Distillation Code
- beforeDestroy与destroyed的使用
- IDEA common shortcut keys and plug-ins
- LocalDate加减操作及比较大小
- 【论文阅读】Mastering the game of Go with deep neural networks and tree search
- 【AUTOSAR-RTE】-5-Explicit(显式)和Implicit(隐式) Sender-Receiver communication
- BUG definition of SonarQube
- Mysql 45 study notes (23) How does MYSQL ensure that data is not lost
猜你喜欢

Daily practice of LeetCode - palindrome structure of OR36 linked list

Mysql 45 study notes (23) How does MYSQL ensure that data is not lost

IDEA常用快捷键与插件
![[C language] Preprocessing operation](/img/69/0aef065ae4061edaf0d96b89846bf2.png)
[C language] Preprocessing operation

$attrs/$listeners

Database implements distributed locks

LeetCode每日一练 —— 138. 复制带随机指针的链表

Safety 20220712

组件传值 provide/inject

$attrs/$listeners
随机推荐
Know the showTimePicker method of the basic components of Flutter
[Paper reading] Mastering the game of Go with deep neural networks and tree search
Detailed explanation of TCP (1)
TCP和UDP详解
[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
[shell basics] determine whether the directory is empty
Automation strategies for legacy systems
A brief introduction to the CheckboxListTile component of the basic components of Flutter
(五)final、抽象类、接口、内部类
[C language] Three-pointed chess (classic solution + list diagram)
组件传值 provide/inject
LocalDate加减操作及比较大小
Bubble sort, selection sort, insertion sort, binary search directly
type_traits元编程库学习
SocialFi 何以成就 Web3 去中心化社交未来
The els block moves the boundary to the right, and accelerates downward.
Distributed locks and three implementation methods
Select the smoke test case, and make the first pass for the product package entering QA
PMP WeChat group daily exercises
"A daily practice, happy water problem" 1331. Array serial number conversion