daizhongxing

环境:

查看 Linux 版本:

uname -a

Linux instance-s5vs80kl 3.10.0-957.21.3.el7.x86_64 #1 SMP Tue Jun 18 16:35:19 UTC 2019 x86_64 x86_64 x86_64 GNU/Linux

查看 MySQL 版本:

mysql -V

mysql Ver 14.14 Distrib 5.7.26, for Linux (x86_64) using EditLine wrapper

1、用 root 用户登录 Mysql :

mysql -uroot -p

2、切换到mysql数据库:

use mysql;

3、添加用户:

create user \'用户名\'@\'主机名\' identified by \'密码\';

4、删除用户:

方法1:

drop user \'用户名\'@\'主机\';

方法2:

mysql> delete from mysql.user where user=\'用户名\'; 

5、新增权限:

grant select on 数据库.数据表 to \'用户名\' @ \'主机名\';

6、删除权限:

grant select on 数据库.数据表 from \'用户名\' @ \'主机名\';

刷新权限:

flush privileges;

 Enjoy it !

分类:

技术点:

相关文章:

  • 2021-11-25
  • 2022-01-04
  • 2021-06-22
  • 2022-12-23
  • 2022-12-23
  • 2021-09-28
  • 2022-12-23
  • 2021-09-02
猜你喜欢
  • 2022-12-23
  • 2021-04-18
  • 2022-12-23
  • 2021-10-02
  • 2022-12-23
  • 2021-12-12
  • 2021-12-22
相关资源
相似解决方案