mysql 修改密码和授权

修改密码

格式:

mysql> set password for 用户名@HOST = password('新密码')
例子:
mysql> set password for root@localhost = password('123456')

用户授权

必须以最高权力用户来授权 比如root等

grant all on stumysql.* to test@localhost identified by 'song123'grant select, insert, update, delete  on  *.*  to test@"%"  identified by 'song123';
grant all on stumysql. * to test@ '192.168.0.0'  identified by 'song123'

以上三条grant语句的授权参数详解:
1、授权 localhost主机通过test用户和song123密码访问本地的stumysql库的所有权限;
2、授权所有主机通过test用户和song123s密码访间本地的 stumysql库的查询、插入、更新、删除权限;
3、授权192.168.0.0主机通过test用户和song123密码访问本地的 stumysql库的所有权限。

发布了74 篇原创文章 · 获赞 29 · 访问量 2万+

猜你喜欢

转载自blog.csdn.net/ClonH/article/details/103714004