查询用户信息

select host,user,authentication_string from mysql.user;
mysql8创建及删除用户
host为下文的localhost,user为下文的jerry,对照着自己的修改即可。
*
创建用户*
create user ‘jerry’@‘localhost’ identified by ‘123456’;
mysql8创建及删除用户
mysql8创建及删除用户
赋予用户数据库操作权限
Grant all privileges on test.* to ‘jerry’@‘localhost’;
mysql8创建及删除用户
其中 test为数据库。
修改用户密码
ALTER USER ‘jerry’@‘localhost’ IDENTIFIED WITH mysql_native_password BY ‘123456’;
mysql8创建及删除用户
登陆查看
mysql -ujerry -p123456
记住这里后面没有;,否则会报错。
mysql8创建及删除用户
登录成功之后在数据库操作后面语句都要加;,用show databases; 查看该用户可以操作的数据库。
删除用户
DROP USER ‘jerry’@‘localhost’;

相关文章:

  • 2021-08-29
  • 2021-06-16
  • 2021-11-02
  • 2022-12-23
  • 2022-12-23
  • 2021-12-10
  • 2021-07-18
猜你喜欢
  • 2022-02-09
  • 2022-02-08
  • 2022-03-08
  • 2021-09-19
  • 2021-12-10
  • 2021-12-10
相关资源
相似解决方案