当前位置:网站首页>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可以回收所有权限,也可以回收部分权限。
边栏推荐
- Ambiguous method call.both
- Redis 统计用户新增和留存
- errno error code and meaning (Chinese)
- RESTful api接口设计规范
- "A daily practice, happy water problem" 1331. Array serial number conversion
- 安全20220722
- 组件传值 provide/inject
- Learning DAVID Database (1)
- Why SocialFi achievement Web3 decentralized social in the future
- (八)Math 类、Arrays 类、System类、Biglnteger 和 BigDecimal 类、日期类
猜你喜欢

Learning DAVID Database (1)
![Summary of Huawei Distributed Storage FusionStorage Knowledge Points [Interview]](/img/83/e0163b324448c6ef5b106862673637.jpg)
Summary of Huawei Distributed Storage FusionStorage Knowledge Points [Interview]
![[Paper reading] Mastering the game of Go with deep neural networks and tree search](/img/4f/899da202e13bd561bbfdbaeebe4d2e.jpg)
[Paper reading] Mastering the game of Go with deep neural networks and tree search

The BP neural network

Mysql 45 study notes (twenty-five) MYSQL guarantees high availability

"A daily practice, happy water problem" 1331. Array serial number conversion

Understanding and Using Unity2D Custom Scriptable Tiles (4) - Start to build a custom tile based on the Tile class (below)

endian mode

Know the showTimePicker method of the basic components of Flutter

Regarding the primary key id in the mysql8.0 database, when the id is inserted using replace to be 0, the actual id is automatically incremented after insertion, resulting in the solution to the repea
随机推荐
组件传值 provide/inject
【AUTOSAR-RTE】-4-Port和Interface以及Data Type
Safety 20220715
RESTful api interface design specification
顺序表的实现
RESTful api接口设计规范
els 方块向左移动条件判断
(5) final, abstract class, interface, inner class
The use of beforeDestroy and destroyed
数据库文件中的未分配的块和未使用的块的区别
binom二项分布,
微软 AI 量化投资平台 Qlib 体验
No qualifying bean of type question
大小端模式
[CV project debugging] CUDNN_CONVOLUTION_FWD_SPECIFY_WORKSPACE_LIMIT problem
[Dynamic programming] Maximum sum of consecutive subarrays
SIP协议标准和实现机制
Ambiguous method call.both
[C language] General method of base conversion
IDEA常用快捷键与插件