欧美一区二区三区老妇人-欧美做爰猛烈大尺度电-99久久夜色精品国产亚洲a-亚洲福利视频一区二区

mysql怎么授權(quán),mysql怎么授權(quán)用戶

如何設(shè)置mysql用戶的權(quán)限

1、創(chuàng)建新用戶

10年積累的成都網(wǎng)站建設(shè)、做網(wǎng)站經(jīng)驗(yàn),可以快速應(yīng)對(duì)客戶對(duì)網(wǎng)站的新想法和需求。提供各種問(wèn)題對(duì)應(yīng)的解決方案。讓選擇我們的客戶得到更好、更有力的網(wǎng)絡(luò)服務(wù)。我雖然不認(rèn)識(shí)你,你也不認(rèn)識(shí)我。但先網(wǎng)站設(shè)計(jì)后付款的網(wǎng)站建設(shè)流程,更有泰寧免費(fèi)網(wǎng)站建設(shè)讓你可以放心的選擇與我們合作。

通過(guò)root用戶登錄之后創(chuàng)建

grant all privileges on *.* to testuser@localhost identified by "123456" ;//創(chuàng)建新用戶,用戶名為testuser,密碼為123456 ;

grant all privileges on *.* to testuser@localhost identified by "123456" ;//設(shè)置用戶testuser,可以在本地訪問(wèn)mysql

grant all privileges on *.* to testuser@"%" identified by "123456" ; //設(shè)置用戶testuser,可以在遠(yuǎn)程訪問(wèn)mysql

flush privileges ;//mysql 新設(shè)置用戶或更改密碼后需用flush privileges刷新MySQL的系統(tǒng)權(quán)限相關(guān)表,否則會(huì)出現(xiàn)拒絕訪問(wèn),還有一種方法,就是重新啟動(dòng)mysql服務(wù)器,來(lái)使新設(shè)置生效

2、設(shè)置用戶訪問(wèn)數(shù)據(jù)庫(kù)權(quán)限

grant all privileges on test_db.* to testuser@localhost identified by "123456" ;//設(shè)置用戶testuser,只能訪問(wèn)數(shù)據(jù)庫(kù)test_db,其他數(shù)據(jù)庫(kù)均不能訪問(wèn) ;

grant all privileges on *.* to testuser@localhost identified by "123456" ;//設(shè)置用戶testuser,可以訪問(wèn)mysql上的所有數(shù)據(jù)庫(kù) ;

grant all privileges on test_db.user_infor to testuser@localhost identified by "123456" ;//設(shè)置用戶testuser,只能訪問(wèn)數(shù)據(jù)庫(kù)test_db的表user_infor,數(shù)據(jù)庫(kù)中的其他表均不能訪問(wèn) ;

3、設(shè)置用戶操作權(quán)限

grant all privileges on *.* to testuser@localhost identified by "123456" WITH GRANT OPTION ;//設(shè)置用戶testuser,擁有所有的操作權(quán)限,也就是管理員 ;

grant select on *.* to testuser@localhost identified by "123456" WITH GRANT OPTION ;//設(shè)置用戶testuser,只擁有【查詢】操作權(quán)限 ;

grant select,insert on *.* to testuser@localhost identified by "123456" ;//設(shè)置用戶testuser,只擁有【查詢\插入】操作權(quán)限 ;

grant select,insert,update,delete on *.* to testuser@localhost identified by "123456" ;//設(shè)置用戶testuser,只擁有【查詢\插入】操作權(quán)限 ;

REVOKE select,insert ON what FROM testuser//取消用戶testuser的【查詢\插入】操作權(quán)限 ;

mysql怎么給予root權(quán)限

利用 GRANT 語(yǔ)句進(jìn)行授權(quán):

grant select on testdb.* to root@'%';

上述語(yǔ)句意思為只將對(duì)數(shù)據(jù)庫(kù)testdb的查詢權(quán)限授予root用戶

GRANT ALL PRIVILEGES ON *.* TO 'root'@'%';

上述語(yǔ)句意思為將對(duì)所有數(shù)據(jù)庫(kù)的所有權(quán)限都授權(quán)給root用戶!

mysql怎么授予創(chuàng)建數(shù)據(jù)庫(kù)的權(quán)限

MySQL命令行能否實(shí)現(xiàn)新建用戶呢?答案無(wú)疑是肯定的。而且在使用使用MySQL命令行新建用戶后,還可以為用戶授予權(quán)限。

首先要聲明一下:一般情況下,修改MySQL密碼,授權(quán),是需要有mysql里的root權(quán)限的。

注:本操作是在WIN命令提示符下,phpMyAdmin同樣適用。

用戶:phplamp

用戶數(shù)據(jù)庫(kù):phplampDB

1.MySQL命令行新建用戶

//登錄MYSQL

@mysql -u root -p

@密碼

//創(chuàng)建用戶

mysql insert into mysql.user(Host,User,Password) values('localhost','phplamp',password('1234'));

//刷新系統(tǒng)權(quán)限表

mysqlflush privileges;

這樣就創(chuàng)建了一個(gè)名為:phplamp 密碼為:1234 的用戶。

//退出后登錄一下

mysqlexit;

@mysql -u phplamp -p

@輸入密碼

mysql登錄成功

2.MySQL命令行為用戶授權(quán)

//登錄MYSQL(有ROOT權(quán)限)。我里我以ROOT身份登錄.

@mysql -u root -p

@密碼

//首先為用戶創(chuàng)建一個(gè)數(shù)據(jù)庫(kù)(phplampDB)

mysqlcreate database phplampDB;

//授權(quán)phplamp用戶擁有phplamp數(shù)據(jù)庫(kù)的所有權(quán)限

@grant all privileges on phplampDB.* to phplamp@localhost identified by '1234'; //這里需要注意,如果發(fā)現(xiàn)找不到用戶,需要執(zhí)行命令 flush privilieges;

//刷新系統(tǒng)權(quán)限表

mysqlflush privileges;

mysql其它操作

//如果想指定部分權(quán)限給一用戶,可以這樣來(lái)寫(xiě):

mysqlgrant select,update on phplampDB.* to phplamp@localhost identified by '1234';

//刷新系統(tǒng)權(quán)限表。

mysqlflush privileges;

mysql grant 權(quán)限1,權(quán)限2,…權(quán)限n on 數(shù)據(jù)庫(kù)名稱.表名稱 to 用戶名@用戶地址 identified by ‘連接口令’;

權(quán)限1,權(quán)限2,…權(quán)限n代表select,insert,update,delete,create,drop,index,alter,grant,references,reload,shutdown,process,file等14個(gè)權(quán)限。

當(dāng)權(quán)限1,權(quán)限2,…權(quán)限n被all privileges或者all代替,表示賦予用戶全部權(quán)限。

當(dāng)數(shù)據(jù)庫(kù)名稱.表名稱被*.*代替,表示賦予用戶操作服務(wù)器上所有數(shù)據(jù)庫(kù)所有表的權(quán)限。

用戶地址可以是localhost,也可以是ip地址、機(jī)器名字、域名。也可以用’%'表示從任何地址連接。

‘連接口令’不能為空,否則創(chuàng)建失敗。

例如:

mysqlgrant select,insert,update,delete,create,drop on vtdc.employee to joe@10.163.225.87 identified by ‘123′;

給來(lái)自10.163.225.87的用戶joe分配可對(duì)數(shù)據(jù)庫(kù)vtdc的employee表進(jìn)行select,insert,update,delete,create,drop等操作的權(quán)限,并設(shè)定口令為123。

mysqlgrant all privileges on vtdc.* to joe@10.163.225.87 identified by ‘123′;

給來(lái)自10.163.225.87的用戶joe分配可對(duì)數(shù)據(jù)庫(kù)vtdc所有表進(jìn)行所有操作的權(quán)限,并設(shè)定口令為123。

mysqlgrant all privileges on *.* to joe@10.163.225.87 identified by ‘123′;

給來(lái)自10.163.225.87的用戶joe分配可對(duì)所有數(shù)據(jù)庫(kù)的所有表進(jìn)行所有操作的權(quán)限,并設(shè)定口令為123。

mysqlgrant all privileges on *.* to joe@localhost identified by ‘123′;

給本機(jī)用戶joe分配可對(duì)所有數(shù)據(jù)庫(kù)的所有表進(jìn)行所有操作的權(quán)限,并設(shè)定口令為123。

Mysql--基本配置、授權(quán)及刪除權(quán)限

Mac下安裝與配置MySQL

啟動(dòng)Mysql服務(wù)端

啟動(dòng)Mysql客戶端

mac偏好設(shè)置啟動(dòng)or關(guān)閉

復(fù)制cnf文件

配置文件路徑 /etc/my.cnf

配置完成后,需要重啟服務(wù)端才能生效

在您相應(yīng)的配置文件里添加,.profile or .zshrc

網(wǎng)站標(biāo)題:mysql怎么授權(quán),mysql怎么授權(quán)用戶
鏈接地址:http://chinadenli.net/article16/hecsdg.html

成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供關(guān)鍵詞優(yōu)化網(wǎng)站營(yíng)銷(xiāo)全網(wǎng)營(yíng)銷(xiāo)推廣軟件開(kāi)發(fā)網(wǎng)站改版網(wǎng)站建設(shè)

廣告

聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請(qǐng)盡快告知,我們將會(huì)在第一時(shí)間刪除。文章觀點(diǎn)不代表本網(wǎng)站立場(chǎng),如需處理請(qǐng)聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時(shí)需注明來(lái)源: 創(chuàng)新互聯(lián)

網(wǎng)站托管運(yùn)營(yíng)