当前位置:网站首页>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可以回收所有权限,也可以回收部分权限。
边栏推荐
- [Compilation principle] Design principle and implementation of recursive descent parsing
- 【AUTOSAR-RTE】-4-Port和Interface以及Data Type
- No qualifying bean of type question
- LocalDate addition and subtraction operations and comparison size
- addressable in Golang
- Port inspection steps - 7680 port analysis - Dosvc service
- 慧通编程第4关 - 魔法学院第6课
- Distributed locks and three implementation methods
- interprocess communication
- [C language] General method of expression evaluation
猜你喜欢

type_traits元编程库学习

(八)Math 类、Arrays 类、System类、Biglnteger 和 BigDecimal 类、日期类

「 每日一练,快乐水题 」1331. 数组序号转换

pom文件成橘红色未加载的解决方案

Database implements distributed locks

Detailed explanation of TCP (2)
![[C language] General method of expression evaluation](/img/59/cf43b7dd16c203b4f31c1591615955.jpg)
[C language] General method of expression evaluation

(5) final, abstract class, interface, inner class

LeetCode每日一练 —— OR36 链表的回文结构
![Summary of Huawei Distributed Storage FusionStorage Knowledge Points [Interview]](/img/83/e0163b324448c6ef5b106862673637.jpg)
Summary of Huawei Distributed Storage FusionStorage Knowledge Points [Interview]
随机推荐
慧通编程第4关 - 魔法学院第6课
IDEA comment report red solution
(Line segment tree) Summary of common problems of basic line segment tree
自己的一些思考
[shell basics] determine whether the directory is empty
What skills do I need to learn to move from manual testing to automated testing?
浅识Flutter 基本组件之showDatePicker方法
IDEA常用快捷键与插件
【AUTOSAR-RTE】-4-Port and Interface and Data Type
日志级别 和 打印log注意
log level and print log note
LocalDate addition and subtraction operations and comparison size
LeetCode simple problem to find the subsequence of length K with the largest sum
PMP WeChat group daily exercises
RESTful api接口设计规范
Ambiguous method call.both
binom二项分布,
SQL Interview Questions (Key Points)
$parent/$children 与 ref
【AUTOSAR-RTE】-5-Explicit(显式)和Implicit(隐式) Sender-Receiver communication