当前位置:网站首页>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可以回收所有权限,也可以回收部分权限.
边栏推荐
- C语言从入门到如土——数据的存储
- "A daily practice, happy water problem" 1331. Array serial number conversion
- $attrs/$listeners
- 安全20220712
- [C language] General method of expression evaluation
- Key Technologies of Interface Testing
- SIP Protocol Standard and Implementation Mechanism
- 从滴滴罚款后数据治理思考
- Redis uses sorted set to cache latest comments
- Detailed explanation of TCP (2)
猜你喜欢
立足本土,链接全球 | 施耐德电气“工业SI同盟”携手伙伴共赴未来工业
A brief introduction to the CheckboxListTile component of the basic components of Flutter
Learning DAVID Database (1)
已解决(最新版selenium框架元素定位报错)NameError: name ‘By‘ is not defined
Redis implements distributed locks
With 7 years of experience, how can functional test engineers improve their abilities step by step?
IDEA common shortcut keys and plug-ins
组件传值 provide/inject
[C language] Three-pointed chess (classic solution + list diagram)
$attrs/$listeners
随机推荐
[shell basics] determine whether the directory is empty
扫雷游戏(c语言写)
Redis counts new and retained users
RESTful api interface design specification
Safety 20220712
C primer plus study notes - 8, structure
The els block moves the boundary to the right, and accelerates downward.
Safety 20220709
识Flutter 基本组件之showTimePicker 方法
three.js 制作3D相册
Based on the local, linking the world | Schneider Electric "Industrial SI Alliance" joins hands with partners to go to the future industry
Win10 CUDA CUDNN 安装配置(torch paddlepaddle)
问题7:列表的拼接
VS QT - ui does not display newly added members (controls) || code is silent
type_traits metaprogramming library learning
Select the smoke test case, and make the first pass for the product package entering QA
IDEA comment report red solution
安全20220709
三子棋的代码实现
IDEA常用快捷键与插件