在mysql庫里添加一個用戶,設置用戶的許可權 grant select on dbname.table to user@'%' ;
㈡ mysql能限制特定賬號對某個資料庫的訪問嗎
可以通過grant為用戶授權來控制用戶許可權。
授權格式:grant 許可權 on 資料庫.* to 用戶名@登錄主機 identified by "密碼";
1 登錄MYSQL(有ROOT許可權),這里以ROOT身份登錄:
@>mysql -u root -p
@>密碼
2 首先為用戶創建一個資料庫(testDB):
mysql>create database testDB;
3 授權test用戶擁有testDB資料庫的所有許可權(某個資料庫的所有許可權):
mysql>grant all privileges on testDB.* to test@localhost identified by '1234';
mysql>flush privileges;//刷新系統許可權表
格式:grant 許可權 on 資料庫.* to 用戶名@登錄主機 identified by "密碼";
4 如果想指定部分許可權給一用戶,可以這樣來寫:
mysql>grant select,update on testDB.* to test@localhost identified by '1234';
mysql>flush privileges; //刷新系統許可權表
5 授權test用戶擁有所有資料庫的某些許可權:
mysql>grant select,delete,update,create,drop on *.* to test@"%" identified by "1234";
//test用戶對所有資料庫都有select,delete,update,create,drop 許可權。
//@"%" 表示對所有非本地主機授權,不包括localhost。(localhost地址設為127.0.0.1,如果設為真實的本地地址,不知道是否可以,沒有驗證。)
//對localhost授權:加上一句grant all privileges on testDB.* to test@localhost identified by '1234';即可。
㈢ 如何讓mysql的某個用戶只能訪問mysql伺服器中某個特定的資料庫
mysql 中用戶默認有usage許可權,revoke all後都還會有的,所以別人還是能連上資料庫,但也僅僅能連上資料庫,什麼都幹不了
㈣ 如何讓mysql新建的用戶只對自己創建的資料庫擁有許可權
用戶對哪一個資料庫有操作許可權,是要用root用戶進行授權的。
創建用戶:
CREATE USER'username'@'host' IDENTIFIED BY 'password';
其中username 是用戶名,host是可以進行遠程訪問資料庫的伺服器地址。
給用戶授權:
GRANT privileges ONdatabasename.tablename TO 'username'@'host';
給'username'@'host'用戶進行授權,其中privileges是要授予的許可權,可以是all privileges、select、update等。databasename.tablename是要訪問的某個資料庫中的某張表,如果是所有的,則可以用*。
㈤ MSSQL如何讓用戶只能訪問特定的資料庫
先創建庫,然後創建用戶,使用grant賦權就可以了。。grant all privileges on db_name.* to 'username'@'host'
注意:MySQL數據用戶管理是以指定訪問源ip和用戶為單位來控制的,比如roy@locahost和[email protected]是不一樣的,需要單獨進行grant賦權
㈥ mysql中如何實現一個用戶只能對一個資料庫進行操作的功能
在庫mysql的db表裡面指定用戶對指定資料庫的訪問許可權即可舉例如下mysql use mysql
Database changed
mysql select host,db,user from db;
+------+------+------+
| host | db | user |
+------+------+------+
| % | kmyy | cx |
| % | kmyy | llf |
| % | kmyy | wq |
| % | llf | cx |
| % | llf | llf |
| % | llf | wq |
| % | wq | cx |
| % | wq | llf |
+------+------+------+
8 rows in set (0.00 sec)
上面內容省略了許可權相關
㈦ 如何讓MYSQL新建的用戶只能看到自己的資料庫信息
1. grant, revoke 用戶許可權後,該用戶只有重新連接 MySQL 資料庫,許可權才能生效。
2. 如果想讓授權的用戶,也可以將這些許可權 grant 給其他用戶,需要選項 「grant option「
grant select on testdb.* to dba@localhost with grant option;
這個特性一般用不到。實際中,資料庫許可權最好由 DBA 來統一管理。
Category: Post
You can follow any responses to this entry via RSS.
Comments are currently closed, but you can trackback from your own site.
㈧ 使用navicat for mysql 新建一個用戶 讓這個用戶登錄navicat for mysql後只能看見指定的那一個資料庫
人家本來設計的就是能看到所有庫,
你用指定連接, 然後給他查看某個庫的許可權,試試
㈨ mysql建立新用戶後如何指定只管理自己的資料庫
在用戶許可權里有設置的。你想該用戶管理哪個資料庫就給哪個的許可權。其它的不要打勾就行了。很簡單啊。 補充: 創建完新用戶後不要給全局許可權。然後在下面找到「按資料庫指定許可權」,然後點擊「在下列數 據庫添加許可權」後面的下拉列表,選擇資料庫,選擇數據下面的全部,然後選擇結構除了最下面三個以外的復選框,其他一律不選,然後點擊「執行」按鈕,這樣就 配置好了這個用戶完全管理這個資料庫的許可權了。[這是我的做法,當然,你也可以根據你的實際需要去給許可權。]
㈩ mysql 設置mysql用戶只能訪問某個表
grant select,update on app.user to app@『%』 identified by '123456'; --允許通過遠程訪問
grant select,update on app.user to app@『localhost' identified by '123456'; ---這樣本地伺服器授權。MySQL不像Oracle,它授權的時候要區分是通過遠程訪問還是本地訪問的。