mysql 授權
最簡單,最直接的mysql授權方式,以前那種查網頁,看別人寫語句的方法真是弱爆了
就兩步,先 show privileges; 顯示出來所有的許可權,然後想怎麼授就怎麼授
舉例如下:
root@localhost : test > show privileges;
+-------------------------+---------------------------------------+-------------------------------------------------------+
| Privilege | Context | Comment |
+-------------------------+---------------------------------------+-------------------------------------------------------+
| Alter | Tables | To alter the table |
| Alter routine | Functions,Procedures | To alter or drop stored functions/procedures |
| Create | Databases,Tables,Indexes | To create new databases and tables |
| Create routine | Databases | To use CREATE FUNCTION/PROCEDURE |
| Create temporary tables | Databases | To use CREATE TEMPORARY TABLE |
| Create view | Tables | To create new views |
| Create user | Server Admin | To create new users |
| Delete | Tables | To delete existing rows |
| Drop | Databases,Tables | To drop databases, tables, and views |
| Event | Server Admin | To create, alter, drop and execute events |
| Execute | Functions,Procedures | To execute stored routines |
| File | File access on server | To read and write files on the server |
| Grant option | Databases,Tables,Functions,Procedures | To give to other users those privileges you possess |
| Index | Tables | To create or drop indexes |
| Insert | Tables | To insert data into tables |
| Lock tables | Databases | To use LOCK TABLES (together with SELECT privilege) |
| Process | Server Admin | To view the plain text of currently executing queries |
| Proxy | Server Admin | To make proxy user possible |
| References | Databases,Tables | To have references on tables |
| Reload | Server Admin | To reload or refresh tables, logs and privileges |
| Replication client | Server Admin | To ask where the slave or master servers are |
| Replication slave | Server Admin | To read binary log events from the master |
| Select | Tables | To retrieve rows from table |
| Show databases | Server Admin | To see all databases with SHOW DATABASES |
| Show view | Tables | To see views with SHOW CREATE VIEW |
| Shutdown | Server Admin | To shut down the server |
| Super | Server Admin | To use KILL thread, SET GLOBAL, CHANGE MASTER, etc. |
| Trigger | Tables | To use triggers |
| Create tablespace | Server Admin | To create/alter/drop tablespaces |
| Update | Tables | To update existing rows |
| Usage | Server Admin | No privileges - allow connect only |
+-------------------------+---------------------------------------+-------------------------------------------------------+
31 rows in set (0.00 sec)
grant create,alter,drop,delete,update,insert,select on `test.test` to 'admin'@'192.168.8.212' ;
grant Create routine,Alter routine,Event,Execute on eccoredb.* to 'admin'@'192.168.8.212';
grant select on eccoredb.* to 'admin'@'192.168.8.212';
flush privileges;
show grants for 'admin'@'192.168.8.212';
+-------------------------------------------------------------------------------------------------------------------------------------------+
| Grants for admin@192.168.8.212 |
+-------------------------------------------------------------------------------------------------------------------------------------------+
| GRANT USAGE ON *.* TO 'admin'@'192.168.8.212' |
| GRANT EXECUTE, CREATE ROUTINE, EVENT ON `eccoredb`.* TO 'admin'@'192.168.8.212' |
| GRANT SELECT, INSERT, UPDATE, DELETE, CREATE, DROP, INDEX, ALTER ON `test`.`test.test` TO 'admin'@'192.168.8.212' |
+-------------------------------------------------------------------------------------------------------------------------------------------+
3 rows in set (0.00 sec)
就兩步,先 show privileges; 顯示出來所有的許可權,然後想怎麼授就怎麼授
舉例如下:
root@localhost : test > show privileges;
+-------------------------+---------------------------------------+-------------------------------------------------------+
| Privilege | Context | Comment |
+-------------------------+---------------------------------------+-------------------------------------------------------+
| Alter | Tables | To alter the table |
| Alter routine | Functions,Procedures | To alter or drop stored functions/procedures |
| Create | Databases,Tables,Indexes | To create new databases and tables |
| Create routine | Databases | To use CREATE FUNCTION/PROCEDURE |
| Create temporary tables | Databases | To use CREATE TEMPORARY TABLE |
| Create view | Tables | To create new views |
| Create user | Server Admin | To create new users |
| Delete | Tables | To delete existing rows |
| Drop | Databases,Tables | To drop databases, tables, and views |
| Event | Server Admin | To create, alter, drop and execute events |
| Execute | Functions,Procedures | To execute stored routines |
| File | File access on server | To read and write files on the server |
| Grant option | Databases,Tables,Functions,Procedures | To give to other users those privileges you possess |
| Index | Tables | To create or drop indexes |
| Insert | Tables | To insert data into tables |
| Lock tables | Databases | To use LOCK TABLES (together with SELECT privilege) |
| Process | Server Admin | To view the plain text of currently executing queries |
| Proxy | Server Admin | To make proxy user possible |
| References | Databases,Tables | To have references on tables |
| Reload | Server Admin | To reload or refresh tables, logs and privileges |
| Replication client | Server Admin | To ask where the slave or master servers are |
| Replication slave | Server Admin | To read binary log events from the master |
| Select | Tables | To retrieve rows from table |
| Show databases | Server Admin | To see all databases with SHOW DATABASES |
| Show view | Tables | To see views with SHOW CREATE VIEW |
| Shutdown | Server Admin | To shut down the server |
| Super | Server Admin | To use KILL thread, SET GLOBAL, CHANGE MASTER, etc. |
| Trigger | Tables | To use triggers |
| Create tablespace | Server Admin | To create/alter/drop tablespaces |
| Update | Tables | To update existing rows |
| Usage | Server Admin | No privileges - allow connect only |
+-------------------------+---------------------------------------+-------------------------------------------------------+
31 rows in set (0.00 sec)
grant create,alter,drop,delete,update,insert,select on `test.test` to 'admin'@'192.168.8.212' ;
grant Create routine,Alter routine,Event,Execute on eccoredb.* to 'admin'@'192.168.8.212';
grant select on eccoredb.* to 'admin'@'192.168.8.212';
flush privileges;
show grants for 'admin'@'192.168.8.212';
+-------------------------------------------------------------------------------------------------------------------------------------------+
| Grants for admin@192.168.8.212 |
+-------------------------------------------------------------------------------------------------------------------------------------------+
| GRANT USAGE ON *.* TO 'admin'@'192.168.8.212' |
| GRANT EXECUTE, CREATE ROUTINE, EVENT ON `eccoredb`.* TO 'admin'@'192.168.8.212' |
| GRANT SELECT, INSERT, UPDATE, DELETE, CREATE, DROP, INDEX, ALTER ON `test`.`test.test` TO 'admin'@'192.168.8.212' |
+-------------------------------------------------------------------------------------------------------------------------------------------+
3 rows in set (0.00 sec)
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/29291882/viewspace-1135268/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- MySQL回收某一授權MySql
- 深入學習MySQL授權表MySql
- MySQL掃盲 -- 授權方式 (轉)MySql
- 淺談MySQL中授權(grant)和撤銷授權(revoke)用法詳解MySql
- mysql使用者建立與授權MySql
- MySQL建立使用者和授權MySql
- MySQL建立使用者與授權MySql
- MySql建立使用者及授權MySql
- 遠端連線mysql 授權方法教程MySql
- MySQL 授權時報錯 ERROR 1819MySqlError
- MySQL建立使用者授權訪問MySql
- MySQL 5.7 建立使用者並授權MySql
- 授權機制與授權模型研究模型
- mysql各個級別授權的總結MySql
- mysql8.0授權root遠端訪問MySql
- 認證授權方案之授權初識
- oracle顯式授權和隱式授權Oracle
- mysql操作命令梳理(4)-grant授權和revoke回收許可權MySql
- oracle授權Oracle
- 表列授權
- 認證授權方案之授權揭祕 (上篇)
- ASP.NET Core策略授權和 ABP 授權ASP.NET
- MySQL新增使用者使用者與授權MySql
- MySQL 5.6授權表的內容用途介紹MySql
- MySQL-授權使用者管理資料庫MySql資料庫
- MySQL 語句大全:建立、授權、查詢、修改等MySql
- 授權物件許可權後的授權者顯示問題物件
- 【認證與授權】Spring Security的授權流程Spring
- 前端微信授權前端
- Laravel授權策略Laravel
- 授權指令碼指令碼
- 對列授權
- 動態授權
- abp授權原理
- 認證授權
- OneinStack如何配置MySQL遠端連線並授權MySql
- springcloud Oauth2授權,四種授權型別SpringGCCloudOAuth型別
- 使用java操作ranger,hdfs ranger授權操作,hive ranger授權操作JavaRangerHive