1 查看用户
use mysql ;
select * from user;
2 添加用户并授权:
(1)添加任何机器都能登录的用户
GRANT ALL PRIVILEGES ON dbName.* TO test@"%" identified by "1111";
(2)添加172.16.184.233机器登录的用户
GRANT ALL ON dbName.* TO test@172.16.184.233 IDENTIFIEDBY "1111";
(3)添加 一个用户 授 增 删 改 查 的权限。
GRANT SELECT,INSERT,DELETE,UPDATE ON dbName.* TO test@% IDENTIFIEDBY "1111";
但是一般使用这个
grant all privileges on *.* to 'test'@'localhost' identified by '123'
3 回收权限
revoke all privileges on *.* from 'test'@'localhost'
4 删除用户
use mysql;
DELETE FROM user WHERE User="test" and Host="localhost";
5 修改用户密码
use mysql;
update mysql.user set password=password('新密码') where User="test" and Host="localhost";
use mysql ;
select * from user;
2 添加用户并授权:
(1)添加任何机器都能登录的用户
GRANT ALL PRIVILEGES ON dbName.* TO test@"%" identified by "1111";
(2)添加172.16.184.233机器登录的用户
GRANT ALL ON dbName.* TO test@172.16.184.233 IDENTIFIEDBY "1111";
(3)添加 一个用户 授 增 删 改 查 的权限。
GRANT SELECT,INSERT,DELETE,UPDATE ON dbName.* TO test@% IDENTIFIEDBY "1111";
但是一般使用这个
grant all privileges on *.* to 'test'@'localhost' identified by '123'
3 回收权限
revoke all privileges on *.* from 'test'@'localhost'
4 删除用户
use mysql;
DELETE FROM user WHERE User="test" and Host="localhost";
5 修改用户密码
use mysql;
update mysql.user set password=password('新密码') where User="test" and Host="localhost";