创建用户三种方式:
CREATE USER username1 IDENTIFIED BY 'password';
CREATE USER 'username1'@'localhost' IDENTIFIED BY 'password';
在 MySQL 中,可以使用 password() 函数获取密码的哈希值,查看 test1 哈希值的 SQL 语句和执行过程如下:
mysql> SELECT password('test1');
+-------------------------------------------+
| password('test1') |
+-------------------------------------------+
| *06C0BF5B64ECE2F648B5F048A71903906BA08E5C |
+-------------------------------------------+
1 row in set, 1 warning (0.00 sec)
CREATE USER 'test1'@'localhost'IDENTIFIED BY PASSWORD '*06C0BF5B64ECE2F648B5F048A71903906BA08E5C';
更改用户密码:
alter user 'root'@'localhost' identified by 'password';
授权用户权限:
grant all privileges on *.* to 'username'@'%' identified by 'password';
更新权限:
flush privileges;
关闭授权:
revoke all on *.* from username@localhost;
标签:语句,基本,CREATE,IDENTIFIED,USER,test1,Mysql,password,localhost From: https://www.cnblogs.com/zhoubai/p/17284780.html