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庫的所有權限。

發佈了65 篇原創文章 · 獲贊 27 · 訪問量 2萬+
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章