标签:
一, 创建用户:
命令:CREATE USER ‘username’@’host’ IDENTIFIED BY ‘password‘;(host – 指定该用户在哪个主机上可以登陆,如果是本地用户可用localhost, 如果想让该用户可以从任意远程主机登陆,可以使用通配符%;password可以为空)
SELECT DISTINCT CONCAT(‘User: ”’,user,”’@”’,host,”‘;’) AS query FROM mysql.user;(查看用户)
二,授权:
命令:GRANT privileges ON databasename.tablename TO ‘username’@’host’ ;
GRANT ALL ON *.* TO ‘user’@’%‘;
三.设置与更改用户密码:
命令:SET PASSWORD FOR ‘username’@’host’ = PASSWORD(‘newpassword’);
如果是当前登陆用户用SET PASSWORD = PASSWORD(“newpassword”);
四.撤销用户权限:
命令: REVOKE privilege ON databasename.tablename FROM ‘username’@’host‘;
标签:
原文地址:http://www.cnblogs.com/evi10032/p/5426426.html