标签:
1.登录MySQL语句
mysql -h hostname|hostIP -P port -u username -p databasename -e "SQL语句";
2.新建普通用户
CREATE USER username@Host IDENTIFIED BY ‘password‘;
INSERT INTO mysql.user(Host,User,Password)values(‘hostname‘,‘username‘,PASSWORD(‘password‘));
GRANT priv_type ON database.table TO username@Host IDENTIFIED BY ‘password‘;
建完后执行 fulsh privileges,否则不能生效;
3.删除普通用户
DROP USER username@Host;
4.root用户修改自己的密码
>mysqladmin -u username -p password new_password
>Enter password:******
UPDATE mysql.user SET Password=PASSWORD(‘new_password‘) WHERE User=‘username‘ AND Host=‘Host‘;
SET PASSWORD=PASSWORD(‘new_password‘);
5.root用户修改普通用户的密码
UPDATE mysql.user SET Password=PASSWORD(‘new_password‘) WHERE User=‘username‘ AND Host=‘Host‘;
SET PASSWORD FOR username@hostname=PASSWORD(‘new_password‘);
6.普通用户修改自己的密码
SET PASSWORD=PASSWORD(‘new_password‘);
7.MySQL权限表
标签:
原文地址:http://www.cnblogs.com/xiaozong/p/5696964.html