這篇文章給大家分享的是有關(guān)MySQL權(quán)限操作的示例分析的內(nèi)容。小編覺得挺實用的,因此分享給大家做個參考,一起跟隨小編過來看看吧。
創(chuàng)新互聯(lián)建站專業(yè)為企業(yè)提供南宮網(wǎng)站建設(shè)、南宮做網(wǎng)站、南宮網(wǎng)站設(shè)計、南宮網(wǎng)站制作等企業(yè)網(wǎng)站建設(shè)、網(wǎng)頁設(shè)計與制作、南宮企業(yè)網(wǎng)站模板建站服務(wù),十余年南宮做網(wǎng)站經(jīng)驗,不只是建網(wǎng)站,更提供有價值的思路和整體網(wǎng)絡(luò)服務(wù)。
1、創(chuàng)建新用戶:
create user mark@localhost identified by '123456';
2、刪除用戶:
drop user mark@localhost;
3、修改用戶名:
rename user mark@localhost to mark1@localhost;
4、修改用戶密碼:
set password for mark@localhost = password('111111');
5、授予權(quán)限:
(1)授予表權(quán)限:select,insert,delete,update,references,create,alter,index,drop,all或者all privileges.
use mysql;
grant select on user to mark@localhost;
(2)授予權(quán) 限:select,insert,delete,update,references,create,alter,index,drop,create temporary tables,create view,show view,create routine,alter routine,execute routine,lock tables,all或者all privileges.
grant select on .* to mark@localhost;
(3)授予用戶權(quán)限:create user,show databases
grant create user on *.* to mark@localhost;
grant create,alter,drop on *.* to mark@localhost;
6、權(quán)限的轉(zhuǎn)移和限制
(1)grant語句最后加with grant option,表示該用戶有把自己的權(quán)限授予其它用戶的權(quán)利,而不管其它用戶是否有該權(quán)限。
grant select on mysql.user to mark@localhost with grant option;
重新用mark登錄數(shù)據(jù)庫后,mark可以授予別的用戶相同的權(quán)限。
(2)with子句也可以對一個用戶授予實用限制。
max_queries_per_hour 1 每小時查詢數(shù)據(jù)庫次數(shù)為1。
max_connections_per_hour 1 每小時可以連接數(shù)據(jù)庫次數(shù)。
max_updates_per_hour 1 每小時可以修改數(shù)據(jù)庫次數(shù)
max_user_connections 1 同時連接mysql的最大用戶數(shù)。
如:
grant select on mysql.user to mark@localhost with max_queries_per_hour 1;
7、回收權(quán)限。
revoke select on mysql.user from mark@localhost;
感謝各位的閱讀!關(guān)于“mysql權(quán)限操作的示例分析”這篇文章就分享到這里了,希望以上內(nèi)容可以對大家有一定的幫助,讓大家可以學(xué)到更多知識,如果覺得文章不錯,可以把它分享出去讓更多的人看到吧!
名稱欄目:mysql權(quán)限操作的示例分析
標題來源:http://aaarwkj.com/article14/igccde.html
成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供Google、網(wǎng)站設(shè)計公司、營銷型網(wǎng)站建設(shè)、虛擬主機、定制網(wǎng)站、品牌網(wǎng)站設(shè)計
聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請盡快告知,我們將會在第一時間刪除。文章觀點不代表本網(wǎng)站立場,如需處理請聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時需注明來源: 創(chuàng)新互聯(lián)