如何mysql使用者只有查詢許可權,如何設定mysql使用者的許可權

時間 2022-08-17 16:32:31

1樓:折柳成萌

mysql中所有使用者的許可權是記錄在mysql這個資料庫的users資料表中

所以你只要先use mysql

再select * from users 你可以看到所有的使用者許可權有關db的資料是記錄在db(大小寫要注意)這個資料表中所以只要呼叫出db的資料 select * from db 就可以看到你要的答案

或者你可以用 select * from db where db='phplampdb'找出你要的答案

2樓:匿名使用者

grant select privileges on databasename.tablename to 'username'@'localhost';

mysql使用者許可權管理

3樓:淡淡的雷人生活

賬戶許可權管理

首先進入mysql控制台:

mysql -uroot -p

建立乙個新使用者(user)並為此使用者分配許可權(這裡先分配對所有資料庫的表增刪改查的許可權),identified by 後面填入你新使用者的密碼

grant select,insert,update,delete on *.* to 'user'@'%' identified by 'your password';

如果是僅給予查詢許可權那麼就這樣

grant select on *.* to 'user'@'%' identified by 'your password';

原文

如何設定mysql使用者的許可權 200

4樓:匿名使用者

1、建立新使用者

通過root使用者登入之後建立

>> grant all privileges on *.* to testuser@localhost identified by "123456" ;  //  建立新使用者,使用者名為testuser,密碼為123456 ;

>> grant all privileges on *.* to testuser@localhost identified by "123456" ;  //  設定使用者testuser,可以在本地訪問mysql

>> grant all privileges on *.* to testuser@"%" identified by "123456" ;   //  設定使用者testuser,可以在遠端訪問mysql

>> flush privileges ;  //  mysql 新設定使用者或更改密碼後需用flush privileges重新整理mysql的系統許可權相關表,否則會出現拒絕訪問,還有一種方法,就是重新啟動mysql伺服器,來使新設定生效

2、設定使用者訪問資料庫許可權

>> grant all privileges on test_db.* to testuser@localhost identified by "123456" ;  //  設定使用者testuser,只能訪問資料庫test_db,其他資料庫均不能訪問 ;

>> grant all privileges on *.* to testuser@localhost identified by "123456" ;  //  設定使用者testuser,可以訪問mysql上的所有資料庫 ;

>> grant all privileges on test_db.user_infor to testuser@localhost identified by "123456" ;  //  設定使用者testuser,只能訪問資料庫test_db的表user_infor,資料庫中的其他表均不能訪問 ;

3、設定使用者操作許可權

>> grant all privileges on *.* to testuser@localhost identified by "123456" with grant option ;  //設定使用者testuser,擁有所有的操作許可權,也就是管理員 ;

>> grant select on *.* to testuser@localhost identified by "123456" with grant option ;  //設定使用者testuser,只擁有【查詢】操作許可權 ;

>> grant select,insert on *.* to testuser@localhost identified by "123456" ;  //設定使用者testuser,只擁有【查詢\插入】操作許可權 ;

>> grant select,insert,update,delete on *.* to testuser@localhost identified by "123456" ;  //設定使用者testuser,只擁有【查詢\插入】操作許可權 ;

>> revoke select,insert on what from testuser  //取消使用者testuser的【查詢\插入】操作許可權 ;

5樓:雁子

給使用者授權

語法:grant 許可權1, … , 許可權n on 資料庫.* to 使用者名稱

grant create,alter,drop,insert,update,delete,select on mydb1.* to user1@localhost;

grant all on mydb1.* to user2@localhost;

撤銷許可權:

語法:revoke許可權1, … , 許可權n on 資料庫.* form 使用者名稱

revoke create,alter,drop on mydb1.* from user1@localhost;

mysql 如何檢視該資料庫使用者具有哪些許可權?

6樓:大野瘦子

1、use mysql

2、select * from users

就可以看到所有的使用者許可權

有關db的資料是記錄在db(大小寫要注意)這個資料表中,所以只要呼叫出db的資料 select * from db 就可以看到你要的答案。

或者可以用:

select * from db where db='phplampdb'找出你要的答案

授予mysql使用者許可權的語句

show grants for 你的使用者

比如:show grants for root@'localhost';

grant 用法:

grant usage on *.* to 'discuz'@'localhost' identified by password

'*c242ddd213be9c6f8da28d49245bf69fc79a86eb';

grant all privileges on `discuz`.* to 'discuz'@'localhost';

建立乙個只可以在本地登陸的 不能操作的用使用者名稱 discuz 密碼為 ***** 已經加密了的

然後第二句的意思是 ,給這個discuz使用者操作discuz資料庫的所有許可權

使用grant

grant命令用來建立新使用者,指定使用者口令並增加使用者許可權。其格式如下:

mysql> grant on

-> to [identified by ""]

-> [with grant option];

7樓:匿名使用者

mysql中所有使用者的許可權是記錄在mysql這個資料庫的users資料表中

所以你只要先use mysql

再select * from users 你可以看到所有的使用者許可權有關db的資料是記錄在db(大小寫要注意)這個資料表中所以只要呼叫出db的資料 select * from db 就可以看到你要的答案

或者你可以用 select * from db where db='phplampdb'找出你要的答案

8樓:匿名使用者

grant all privileges on 資料庫.

sql 怎麼建立乙個只有查詢資料庫使用者許可權呢?

9樓:海天盛

1.在資料庫本機用使用cmd指令調出命令列視窗,再用sqlplus/assysdba登入到資料庫中。並且用對要賦許可權的表所有者連線資料庫,否則後續賦許可權會失敗。

2.建立由test123標識的使用者測試;建立密碼設定為test123的測試使用者。

3.授權測試使用者的連線和資源許可權。授予連線,資源到測試。

4.指定表授權查詢許可權。授予使用者選擇。表測試。

5.用新的登入資料庫進行驗證,我們會先嘗試刪除刪除資料的功能,結果錯誤無法執行,說明我們新增的使用者沒有刪除許可權。

6.然後驗證select查詢函式,成功找到指定的資料。建立乙個新使用者並指定查詢許可權函式的實現。對於沒有許可權的表的查詢也會被拒絕。

10樓:匿名使用者

首先執行:

exec sp_addrole 'username' --建立使用者角色,其中username替換成要建立的使用者

然後:exec sp_addrolemember 'db_datareader','username' --給這個使用者讀資料庫的許可權

如果單錶等賦予其他使用者許可權的話,可用如下語句:

grant select on 表名 to username

11樓:匿名使用者

exec sp_addrole 'username'

--新增乙個使用者'username'

exec sp_addrolemember 'db_datareader','username'

--賦予使用者唯讀的角色的屬性

12樓:愛桔子人

屬性-資料庫角色成員身份。選個reader

13樓:

用sa登陸在資料庫右鍵屬性點許可權 點新增

受限使用者如何提公升許可權,如何讓受限使用者獲得管理員許可權

用管理員賬戶登陸系統才能給其他使用者更改許可權,如果你沒有管理員帳號,可以嘗試下面的方法 建乙個批處理檔案 net user admin1 1234 add net localgroup administrators admin1 add 另存為admin1.bat在桌面上.然後執行輸入gpedit...

如何限制windows xp使用者的許可權

進入選單,控制面板到使用者帳戶裡面設定 不可能的事!即使可能也絕對不簡單!以上內容來自 中華隱士聯盟 下面的是我在網上找到的,不知是否對你有用 具體做法是用超級使用者登入電腦 計算機管理員使用者 建立乙個受限使用者名稱 給管理員使用者設定好密碼,受限使用者不用設定 然後進入系統後在需要設定許可權的碟...

linux如何建立最低許可權使用者,linux如何新增乙個 最低使用者許可權的使用者

假設你想要建立最低許可權使用者名為looklooksudo mkdir home looklooksudo chown nobody nobody home looklook sudo useradd d home looklook s bin false 這個使用者沒有家目錄許可權,沒有shell...

如何修改mysql使用者名稱和密碼,如何修改mysql資料庫中的使用者名稱和密碼

方法一使用phpmyadmin,這是最簡單的了,修改mysql庫的user表,方法二使用mysqladmin,這是前面宣告的乙個特例。mysqladmin u root p password mypasswd 輸入這個命令後,需要輸入root的原密碼,然後root的密碼將改為mypasswd。把命令...

如何檢視mysql的使用者名稱和密碼

如果你在安裝過程中沒有設定使用者名稱密碼的話,你可以用root使用者名稱與密碼登入資料庫 使用者名稱 root 密碼為空。如果設定過密碼忘記了,那不好意思,不能檢視密碼,只能檢視使用者名稱,因為mysql密碼是動態md5加密,是不可逆向查詢的。關於查詢使用者名稱 select from mysql....