Linux环境 Mysql新建用户并授权


新建用户

1
2
3
4
create user 'username'@'localhost' identified by '******';
grant all privileges on databasename.* to username@ip identified by '******';
# grant all privileges on databasename.* to username@'%' identified by '******';
flush privileges;

删除用户

1
2
3
4
delect from user where user='username' and Host='localhost';

drop user username@'%';
drop user username@localhost;

改指定用户password

1
2
update mysql.user set password=password('新密码') where User='username' and Host="localhost";
flush privileges;

文章作者: Xiaowan
版权声明: 本博客所有文章除特別声明外,均采用 CC BY 4.0 许可协议。转载请注明来源 Xiaowan !
  目录