MySQL使用權限設定

來源:互聯網
上載者:User

標籤:mysql




本機存取權限:

mysql> GRANT ALL PRIVILEGES ON *.* TO ‘username‘@‘localhost‘ IDENTIFIED BY ‘password‘;


遠端存取許可權:

mysql> GRANT ALL PRIVILEGES ON *.* TO ‘username‘@‘%‘ IDENTIFIED BY ‘password‘;



FLUSH PRIVILEGES;



增加使用者 test1 密碼 abc,讓它可以在任何主機上登入,並對所有資料庫有查詢,插入,修改,刪除的許可權:

 格式: grant select on 資料庫.* to 使用者名稱@登入主機 identified by "密碼"


 grant select,insert,update,delete on *.* to [email protected]"%" Identified by "abc";



刪除使用者

drop user [email protected];(@不加預設為“%”)


許可權回收

revoke delete on test.* from [email protected]‘localhost‘;



授權精確到列

grant select (cur_url,pre_url) on dataname.table_name to [email protected];




限制使用者資源

mysql> GRANT ALL ON customer.* TO ‘francis‘@‘localhost‘

-> IDENTIFIED BY ‘frank‘

-> WITH MAX_QUERIES_PER_HOUR 20

-> MAX_UPDATES_PER_HOUR 10

-> MAX_CONNECTIONS_PER_HOUR 5

-> MAX_USER_CONNECTIONS 2;


本文出自 “比爾營運筆記” 部落格,請務必保留此出處http://chenshoubiao.blog.51cto.com/6159058/1842667

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.