這篇文章給大家分享的是有關(guān)MySQL權(quán)限操作的示例分析的內(nèi)容。小編覺(jué)得挺實(shí)用的,因此分享給大家做個(gè)參考,一起跟隨小編過(guò)來(lái)看看吧。
創(chuàng)新互聯(lián)建站專(zhuān)業(yè)為企業(yè)提供南宮網(wǎng)站建設(shè)、南宮做網(wǎng)站、南宮網(wǎng)站設(shè)計(jì)、南宮網(wǎng)站制作等企業(yè)網(wǎng)站建設(shè)、網(wǎng)頁(yè)設(shè)計(jì)與制作、南宮企業(yè)網(wǎng)站模板建站服務(wù),十余年南宮做網(wǎng)站經(jīng)驗(yàn),不只是建網(wǎng)站,更提供有價(jià)值的思路和整體網(wǎng)絡(luò)服務(wù)。
1、創(chuàng)建新用戶(hù):
create user mark@localhost identified by '123456';
2、刪除用戶(hù):
drop user mark@localhost;
3、修改用戶(hù)名:
rename user mark@localhost to mark1@localhost;
4、修改用戶(hù)密碼:
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)授予用戶(hù)權(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語(yǔ)句最后加with grant option,表示該用戶(hù)有把自己的權(quán)限授予其它用戶(hù)的權(quán)利,而不管其它用戶(hù)是否有該權(quán)限。
grant select on mysql.user to mark@localhost with grant option;
重新用mark登錄數(shù)據(jù)庫(kù)后,mark可以授予別的用戶(hù)相同的權(quán)限。
(2)with子句也可以對(duì)一個(gè)用戶(hù)授予實(shí)用限制。
max_queries_per_hour 1 每小時(shí)查詢(xún)數(shù)據(jù)庫(kù)次數(shù)為1。
max_connections_per_hour 1 每小時(shí)可以連接數(shù)據(jù)庫(kù)次數(shù)。
max_updates_per_hour 1 每小時(shí)可以修改數(shù)據(jù)庫(kù)次數(shù)
max_user_connections 1 同時(shí)連接mysql的最大用戶(hù)數(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)容可以對(duì)大家有一定的幫助,讓大家可以學(xué)到更多知識(shí),如果覺(jué)得文章不錯(cuò),可以把它分享出去讓更多的人看到吧!
名稱(chēng)欄目:mysql權(quán)限操作的示例分析
標(biāo)題來(lái)源:http://bm7419.com/article14/igccde.html
成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供Google、網(wǎng)站設(shè)計(jì)公司、營(yíng)銷(xiāo)型網(wǎng)站建設(shè)、虛擬主機(jī)、定制網(wǎng)站、品牌網(wǎng)站設(shè)計(jì)
聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶(hù)投稿、用戶(hù)轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請(qǐng)盡快告知,我們將會(huì)在第一時(shí)間刪除。文章觀(guān)點(diǎn)不代表本網(wǎng)站立場(chǎng),如需處理請(qǐng)聯(lián)系客服。電話(huà):028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時(shí)需注明來(lái)源: 創(chuàng)新互聯(lián)