修改密碼
格式:
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庫的所有權限。