首页 /网络技术 / 正文

mysql用户管理

创始人 2025-07-09 12:48:37 0 次浏览

1、新建用户

create user username@host  identified by 'password';

例如:

create user root@10.110.21.31 identified by '1234';


2、删除用户

drop user username@host;

例如:

drop user root@10.110.21.31;


3、修改用户密码

alter user user() identified by 'password';

或

set password for username@host='newpassword';

例如:

alter user user() identified by '123456';

或

set password for root@10.110.21.31='123456';


4、授权

grant privileges on database.table to username@host;

例如:

grant all [privileges] on dt.* to root@10.110.21.31;

grant all on *.* to 'root'@'%';


5、撤消授权

revoke privileges on database.table from username@host;

例如:

revoke all on dt.* from root@10.110.21.31;


6、查看授权

show grants for username@host;

例如:

show grants for root@10.110.21.31;


7、刷新权限

flush privileges;



热门资讯
vcenter因证书问题无法上...
解决方法:导入root CA证书。主要操作步骤如下:1、下载root CA证书,并解压。2、右击5a...
在rockylinux9上安装...
一、安装准备1. 更新 + 装依赖dnf update -ydnf install -y curl ...
centos7支持中文
1、使用locale命令查看当前使用的语言2、使用locale -a 查看安装的语言包,如果没有中文...
mariadb galera ...
mariadb server下载地址:https://mariadb.org/download/?...
rockylinux9下安装p...
1、更新系统软件包dnf update2、安装PostgreSQLdnf install postg...
rockylinux 9中安装...
1、开启ipv4内核转发vi /etc/sysctl.conf,加入:net.ipv4.ip_for...
centos7 LVM(逻辑卷...
一、LVM简介 LVM是 Logical Volume Manager(逻辑卷管理)的简写,它...
winddows使用syspr...
1、查看sidwhoami /user2、使用sysprep重新生成sid运行如下命令:打开“系统准...
nginx配置实例:只允许内部...
#配置清单location / { deny 192.168.1.1; ...
mysql用户管理
1、新建用户create user username@host identified by 'pa...