mysql建立各種許可權使用者的命令

來源:互聯網
上載者:User

用命令建立各種許可權的mysql帳號的方法如下(一定要先進入mysql,在mysql命令下執行以下的語句):

1. 建立一個使用者,並擁有建立資料庫,修改欄位,刪除表,對錶增刪改查的許可權,和支援遠程甚至任何地方登陸的許可權(差不多相當於root帳號的許可權):

grant select,insert,update,delete,create,drop,alter on *.* to reson1@"%" identified by "123456";
grant select,insert,update,delete,create,drop,alter on *.* to reson1@localhost identified by


"123456"; (一定要添加一條"%"和一條localhost,這樣才能既支援本地訪問,又支援遠程任一ip訪問。其中reson1為使用者名稱,123456為密碼)

2. 建立一個使用者,並擁有對錶增刪改查的許可權,只能在本地登陸:

grant select,insert,update,delete on *.* to reson2@localhost identified by "123456";

3. 建立一個使用者,並擁有對錶增刪改查的許可權,只能在192.168.1.100登陸,且只能操作dat1資料庫的許可權:

grant select,insert,update,delete on dat1.* to reson3@192.168.1.100 identified by "123456";

掌握以上3個案例,就能建立各種想要的許可權的mysql帳號了。
 

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.