カテゴリーSQL文
- DDL(データ定義言語)の文:データ定義言語。これらのステートメントは、異なるデータセグメント、定義
データベースオブジェクト、テーブル、列、インデックスのデータベースで定義されています。作成、ドロップ、変更などの一般的な文のキーワード
ようにと。 - データ操作文、追加、削除、更新及び検索する:DML(データ操作言語)ステートメントは
、クエリのデータベース・レコードとチェックデータの整合性、共通キーワードのステートメントは、インサートを含んで、削除、UDPATEおよび
ように選択します。 - DCL(データ制御言語)文:制御文データのライセンスを直接制御し、異なるデータセグメントのための
アクセスレベルの声明。これらのステートメントは、データベース、テーブル、フィールド、ユーザーのアクセス権およびセキュリティレベルを定義します。メイン
の文のキーワードは、許可ように取り消しています。
DCL声明
DCL文は主にDBAが権限管理システムをobjectにするときに使用され、一般の開発者は、ほとんど使用されません。以下の
この点を説明するために単純な例を。
データベース・ユーザー・PLFを作成し、すべてのテーブルPLFデータベースSELECT / INSERT権限を持っています:
mysql> grant select,insert on plf.* to 'plf'@'%' identified by '123456';
Query OK, 0 rows affected (0.00 sec)
mysql> flush privileges;
Query OK, 0 rows affected (0.00 sec)
mysql> quit
Bye
[root@mysql ~]# mysql -uplf -p123456 -h 192.168.3.100
Warning: Using a password on the command line interface can be insecure.
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 7
Server version: 5.6.37 Source distribution
Copyright (c) 2000, 2017, Oracle and/or its affiliates. All rights reserved.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
mysql> use mysql;
ERROR 1044 (42000): Access denied for user 'plf'@'%' to database 'mysql'
mysql> use plf
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A
Database changed
変更する必要がPLFの権限を変更する権限は、INSERTを撤回するので、SELECTデータは、その後、我々は可能なrootアカウントを使用する必要があり、操作することができます。
mysql> revoke insert on plf.* from 'plf'@'%';
Query OK, 0 rows affected (0.00 sec)
mysql> quit
Bye
[root@mysql ~]# mysql -uplf -p123456 -h 192.168.3.100
Warning: Using a password on the command line interface can be insecure.
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 9
Server version: 5.6.37 Source distribution
Copyright (c) 2000, 2017, Oracle and/or its affiliates. All rights reserved.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
mysql> use plf
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A
Database changed
mysql> show tables;
+---------------+
| Tables_in_plf |
+---------------+
| dept |
| emp |
| hk_info |
| log_info |
| user_info |
+---------------+
5 rows in set (0.00 sec)
mysql> insert into dept values(7,'plf');
ERROR 1142 (42000): INSERT command denied to user 'plf'@'192.168.3.100' for table 'dept'
mysql> select*from dept;
+--------+----------+
| deptno | deptname |
+--------+----------+
| 1 | tech |
| 2 | sale |
| 3 | hr |
| 5 | fin |
+--------+----------+
4 rows in set (0.00 sec)
助成金の上記の例と取り消し付与され、ユーザーPLFは、私たちの目的を達成権限の一部を回復するために、権限の詳細は、パートIVで詳しく説明します。