mysql查看用户密码、权限等
创建用户mysql> CREATE USER 'monty'@'localhost' IDENTIFIED BY 'some_pass';mysql> GRANT ALL PRIVILEGES ON *.* TO 'monty'@'localhost'->WITH GRANT OPTION;mysql> CREATE USER 'monty'@'%' IDENTIFIED
·
- 创建用户
mysql> CREATE USER 'monty'@'localhost' IDENTIFIED BY 'some_pass';
mysql> GRANT ALL PRIVILEGES ON *.* TO 'monty'@'localhost'
-> WITH GRANT OPTION;
mysql> CREATE USER 'monty'@'%' IDENTIFIED BY 'some_pass';
mysql> GRANT ALL PRIVILEGES ON *.* TO 'monty'@'%'
-> WITH GRANT OPTION;
mysql> CREATE USER 'admin'@'localhost' IDENTIFIED BY 'admin_pass';
mysql> GRANT RELOAD,PROCESS ON *.* TO 'admin'@'localhost';
mysql> CREATE USER 'dummy'@'localhost';
其中,用户名@后面的localhost代表:该用户只能通过本地进行连接。
%通配符代表在任何的主机都可以连接数据库。
- 查看用户权限
mysql> SHOW GRANTS FOR 'admin'@'localhost';
+-----------------------------------------------------+
| Grants for admin@localhost |
+-----------------------------------------------------+
| GRANT RELOAD, PROCESS ON *.* TO 'admin'@'localhost' |
+-----------------------------------------------------+
flush privileges;
- 删除用户
mysql> DROP USER 'jeffrey'@'localhost';
- 修改密码
mysql> ALTER USER 'jeffrey'@'localhost'
-> IDENTIFIED BY 'mypass';
更多推荐
已为社区贡献1条内容
所有评论(0)