mysql 修改密码和授权

核能气质少年 提交于 2019-12-26 16:47:44

修改密码

格式:

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库的所有权限。

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!