MySQL8.0 RCのDockerイメージがリリースされていたので、今後の検証やデモ用に設定しました。
手軽に検証出来るので、軽く検証するにはお勧めです。

Docker Image: https://github.com/mysql/mysql-docker


[root@DockerHost oracle]# docker pull mysql/mysql-server:8.0
8.0: Pulling from mysql/mysql-server
323fb8f65502: Pull complete 
b2a15600aac3: Pull complete 
a1116f4203e9: Pull complete 
8be6f234356c: Pull complete 
a09590e34bdc: Pull complete 
554cdb588e9e: Pull complete 
851fce189663: Pull complete 
ca60670c6cb3: Pull complete 
98a8195f4fc5: Pull complete 
ec8c0ade6c51: Pull complete 
73919c529833: Pull complete 
285b77036a3a: Pull complete 
270395aafb1e: Pull complete 
Digest: sha256:183772d6f5a1decd1eb0252e542d338a5ef8c02fe4cc2cc909b58788f8728c58
Status: Downloaded newer image for mysql/mysql-server:8.0
[root@DockerHost oracle]#

[root@DockerHost oracle]# docker run --name mysql83 -v /docker/docker83:/var/lib/mysql -v /docker/option83:/etc/mysql/conf.d -v /docker/init_script:/docker-entrypoint-initdb.d -e MYSQL_ROOT_PASSWORD=mysql -d mysql/mysql-server:8.0
ecd2156cdd36d735b5d01f6d7b89ea24cc7d499cbc59e1014bc42ba92c764365
[root@DockerHost oracle]# 

[root@DockerHost oracle]# docker exec -it mysql83 mysql --default-character-set=utf8mb4 -uroot -pmysql
mysql: [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: 8.0.3-rc-log MySQL Community Server (GPL)

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> select @@version;
+--------------+
| @@version    |
+--------------+
| 8.0.3-rc-log |
+--------------+
1 row in set (0.00 sec)

mysql> show variables like '%char%';
+--------------------------+----------------------------+
| Variable_name            | Value                      |
+--------------------------+----------------------------+
| character_set_client     | utf8mb4                    |
| character_set_connection | utf8mb4                    |
| character_set_database   | utf8mb4                    |
| character_set_filesystem | binary                     |
| character_set_results    | utf8mb4                    |
| character_set_server     | utf8mb4                    |
| character_set_system     | utf8                       |
| character_sets_dir       | /usr/share/mysql/charsets/ |
+--------------------------+----------------------------+
8 rows in set (0.03 sec)

mysql> show databases;
+--------------------+
| Database           |
+--------------------+
| information_schema |
| mysql              |
| performance_schema |
| sakila             |
| sys                |
| world              |
+--------------------+
7 rows in set (0.00 sec)


メモ:CTEの確認

mysql> WITH RECURSIVE  
    -> emp_ext (id, name, path) AS ( 
    ->    SELECT id, name, CAST(id AS CHAR(200)) 
    ->    FROM employees WHERE manager_id IS NULL 
    ->  UNION ALL 
    ->    SELECT s.id, s.name,CONCAT(m.path, ",", s.id) 
    ->    FROM emp_ext m JOIN  employees s ON m.id=s.manager_id )
    -> SELECT * FROM emp_ext ORDER BY path; 
+------+---------+-----------------+
| id   | name    | path            |
+------+---------+-----------------+
|  333 | Yasmina | 333             |
|  198 | John    | 333,198         |
|   29 | Pedro   | 333,198,29      |
| 4610 | Sarah   | 333,198,29,4610 |
|   72 | Pierre  | 333,198,29,72   |
|  692 | Tarek   | 333,692         |
|  123 | Adil    | 333,692,123     |
+------+---------+-----------------+
7 rows in set (0.00 sec)

mysql> 

メモ:Windows Functionの確認


mysql> select employee,date,sale,SUM(sale)
    -> OVER (PARTITION BY employee) AS sum FROM sales;
+----------+------------+------+------+
| employee | date       | sale | sum  |
+----------+------------+------+------+
| A        | 2017-03-01 |  200 |  900 |
| A        | 2017-04-01 |  300 |  900 |
| A        | 2017-05-01 |  400 |  900 |
| B        | 2017-03-01 |  400 | 1200 |
| B        | 2017-04-01 |  300 | 1200 |
| B        | 2017-05-01 |  500 | 1200 |
| C        | 2017-03-01 |  100 | 1000 |
| C        | 2017-04-01 |  600 | 1000 |
| C        | 2017-05-01 |  300 | 1000 |
+----------+------------+------+------+
9 rows in set (0.00 sec)

mysql> 

MySQL8.0には管理者と開発者にとって使い易い機能や関数も増えているので、
色々な場面で活用する事が出来るかと思います。

詳細情報:
http://mysqlserverteam.com/

バグ報告:
https://bugs.mysql.com/

ブログにはRC1と書いてあったけど、RC2とかもリリース予定なのかな?
Please enjoy it.


MySQL8.0がリリース候補版になりました。

Changes in MySQL 8.0.3 (2017-09-21, Release Candidate)
リリースノート:https://dev.mysql.com/doc/relnotes/mysql/8.0/en/news-8-0-3.html

【主な変更点】
Histograms, Force Index, Hints, Invisible Indexes
Common Table Expressions, Windows Functions, Character Sets,
JSON, GIS, Resource Groups, Performance Schema, Security,
Protocol, Service Infrastructure, X Protocol / X Plugin,
Performance, Tablespaces, DDL, Replication, Group Replication,
Data Dictionary, MTR Tests, Library Upgrade, Changes to Defaults

詳細:http://mysqlserverteam.com/the-mysql-8-0-3-release-candidate-is-available/

全てをカバーしてませんが、先日のセミナー資料で概要を紹介しています。


MySQL5.7で約20程のJSON関数が追加されていましたが、MySQL8.0においても更に追加でJSON関数が加えられているので、基本的な動作のみを確認しています。JSON_ARRAYAGG(), JSON_OBJECTAGG(),JSON_PRETTY()

MySQL5.7 JSON関数マニュアル
https://dev.mysql.com/doc/refman/5.7/en/json-functions.html

MySQL5.7のJSONの概要に関しては、こちらにて資料がダウンロード可能です。https://www.mysql.com/jp/why-mysql/presentations/mysql-json-201701-ja/

まだ、MySQL8.0はDMRなので、これからまだ仕様が変わる部分がある事はご了承ください。

確認バージョン


mysql> select now(),@@version;     
+---------------------+-----------+
| now()               | @@version |
+---------------------+-----------+
| 2017-05-31 19:50:46 | 8.0.1-dmr |
+---------------------+-----------+
1 row in set (0.00 sec)

mysql> 

WL#7987 : JSON aggregation functions
https://dev.mysql.com/worklog/task/?id=7987

Add aggregation functions to generate JSON arrays and objects. This makes it possible to combine JSON documents in multiple rows into a JSON array or a JSON object.

mysql> select body from T_JSON_DOC where id in (1,2);              
+---------------------------------------------------------------------------------+
| body                                                                            |
+---------------------------------------------------------------------------------+
| {"id": 1, "name": "", "price": 10000, "Conditions": ["NEW", 2015, "Excellent"]} |
| {"id": 2, "name": "", "price": 30000, "Conditions": ["USED", 2013, ""]}         |
+---------------------------------------------------------------------------------+
2 rows in set (0.01 sec)

mysql> select JSON_ARRAYAGG(body) from T_JSON_DOC where id in(1,2);
+------------------------------------------------------------------------------------------------------------------------------------------------------------+
| JSON_ARRAYAGG(body)                                                                                                                                        |
+------------------------------------------------------------------------------------------------------------------------------------------------------------+
| [{"id": 1, "name": "", "price": 10000, "Conditions": ["NEW", 2015, "Excellent"]}, {"id": 2, "name": "", "price": 30000, "Conditions": ["USED", 2013, ""]}] |
+------------------------------------------------------------------------------------------------------------------------------------------------------------+
1 row in set (0.00 sec)


mysql> select id,body from T_JSON_DOC where id in(1,2);            
+----+---------------------------------------------------------------------------------+
| id | body                                                                            |
+----+---------------------------------------------------------------------------------+
|  1 | {"id": 1, "name": "", "price": 10000, "Conditions": ["NEW", 2015, "Excellent"]} |
|  2 | {"id": 2, "name": "", "price": 30000, "Conditions": ["USED", 2013, ""]}         |
+----+---------------------------------------------------------------------------------+
2 rows in set (0.00 sec)

mysql> select JSON_OBJECTAGG(id,body) from T_JSON_DOC where id in(1,2);
+----------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| JSON_OBJECTAGG(id,body)                                                                                                                                              |
+----------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| {"1": {"id": 1, "name": "", "price": 10000, "Conditions": ["NEW", 2015, "Excellent"]}, "2": {"id": 2, "name": "", "price": 30000, "Conditions": ["USED", 2013, ""]}} |
+----------------------------------------------------------------------------------------------------------------------------------------------------------------------+
1 row in set (0.00 sec)

mysql> select id,body from T_JSON_DOC;                                                
+----+---------------------------------------------------------------------------------+
| id | body                                                                            |
+----+---------------------------------------------------------------------------------+
|  1 | {"id": 1, "name": "", "price": 10000, "Conditions": ["NEW", 2015, "Excellent"]} |
|  2 | {"id": 2, "name": "", "price": 30000, "Conditions": ["USED", 2013, ""]}         |
|  3 | {"id": 3, "name": "", "price": 18198, "Conditions": ["NEW", 2015]}              |
|  4 | {"id": 4, "name": "", "price": 500000, "Conditions": ["NEW", 2015]}             |
|  5 | {"id": 5, "name": "", "price": 25000, "Conditions": ["NEW", 2015, "January"]}   |
+----+---------------------------------------------------------------------------------+
5 rows in set (0.01 sec)

mysql> select JSON_OBJECTAGG(id,body) from T_JSON_DOC group by body->"$.Conditions[0]"\G
*************************** 1. row ***************************
JSON_OBJECTAGG(id,body): {"1": {"id": 1, "name": "", "price": 10000, "Conditions": ["NEW", 2015, "Excellent"]}, "3": {"id": 3, "name": "", "price
": 18198, "Conditions": ["NEW", 2015]}, "4": {"id": 4, "name": "", "price": 500000, "Conditions": ["NEW", 2015]}, "5": {"id": 5, "name": "", "pri
ce": 25000, "Conditions": ["NEW", 2015, "January"]}}
*************************** 2. row ***************************
JSON_OBJECTAGG(id,body): {"2": {"id": 2, "name": "", "price": 30000, "Conditions": ["USED", 2013, ""]}}
2 rows in set (0.01 sec)

mysql> mysql> select JSON_OBJECTAGG(id,body) from T_JSON_DOC group by body->"$.Conditions[1]"\G
*************************** 1. row ***************************
JSON_OBJECTAGG(id,body): {"2": {"id": 2, "name": "", "price": 30000, "Conditions": ["USED", 2013, ""]}}
*************************** 2. row ***************************
JSON_OBJECTAGG(id,body): {"1": {"id": 1, "name": "", "price": 10000, "Conditions": ["NEW", 2015, "Excellent"]}, "3": {"id": 3, "name": "", "price": 18198, "Conditions": ["NEW", 2015]}, "4": {"id": 4, "name": "", "price": 500000, "Conditions": ["NEW", 2015]}, "5": {"id": 5, "name": "", "price": 25000, "Conditions": ["NEW", 2015, "January"]}}
2 rows in set (0.00 sec)

mysql>
 

WL#9191: JSON_PRETTY function
https://dev.mysql.com/worklog/task/?id=9191

User Feedback from presenting JSON features has suggested that we are missing a function to format JSON in a human-readable way (with new lines and indentation).

This functionality is available in both PHP and PostgreSQL under the name “pretty”:


mysql> select body from T_JSON_DOC where id = 1\G             
*************************** 1. row ***************************
body: {"id": 1, "name": "", "price": 10000, "Conditions": ["NEW", 2015, "Excellent"]}
1 row in set (0.00 sec)

mysql> select json_pretty(body) from T_JSON_DOC where id = 1\G
*************************** 1. row ***************************
json_pretty(body): {
  "id": 1,
  "name": "",
  "price": 10000,
  "Conditions": [
    "NEW",
    2015,
    "Excellent"
  ]
}
1 row in set (0.00 sec)

mysql> 

その他のJSON関数(運用向け)

JSON_STORAGE_FREE(json_val)
For a JSON column value, this function shows how much storage space was freed in its binary representation after it was updated in place using JSON_SET() or JSON_REPLACE(). The argument can also be a valid JSON document or a string which can be parsed as one—either as a literal value or as the value of a user variable—in which case the function returns 0.

※Updating the column without using JSON_SET() (or JSON_REPLACE()) means that the optimizer cannot perform the update in place; in this case, JSON_STORAGE_FREE() returns 0.

JSON_STORAGE_SIZE(json_val)
This function returns the number of bytes used to store the binary representation of a JSON document.


mysql> SELECT 
    ->     jcol, 
    ->     JSON_STORAGE_SIZE(jcol) AS Size, 
    ->     JSON_STORAGE_FREE(jcol) AS Free 
    -> FROM jtable;

JSON_STORAGE_SIZE(): Return value (bytes)
JSON_STORAGE_FREE(): If no updates have yet been performed, this is 0, as expected.


SELECT
    ->     JSON_STORAGE_SIZE('[100, "sakila", [1, 3, 5], 425.05]') AS A,
    ->     JSON_STORAGE_SIZE('{"a": 1000, "b": "a", "c": "[1, 3, 5, 7]"}') AS B,
    ->     JSON_STORAGE_SIZE('{"a": 1000, "b": "wxyz", "c": "[1, 3, 5, 7]"}') AS C, 
    ->     JSON_STORAGE_SIZE('[100, "json", [[10, 20, 30], 3, 5], 425.05]') AS D;


MySQL8.0から、Descending Indexがサポートされる。
これによりMySQL5.7と比較して、大きなテーブルでの降順(DESC)のデータ参照処理を、高速に実行する事が出来るようになる。小さいテーブルに関しては、既存のMySQL5.7でもインデックスが利用出来るので、それ程差は出ないかと思います。

MySQL8.0.1で、Sakila Sampleデータベースのrentalテーブルを参照した場合 (INDEXはASCで作成されている)


mysql> select @@version;                                              
+-----------+
| @@version |
+-----------+
| 8.0.1-dmr |
+-----------+
1 row in set (0.00 sec)

mysql> show create table rental\G                                     
*************************** 1. row ***************************
       Table: rental
Create Table: CREATE TABLE `rental` (
  `rental_id` int(11) NOT NULL AUTO_INCREMENT,
  `rental_date` datetime NOT NULL,
  `inventory_id` mediumint(8) unsigned NOT NULL,
  `customer_id` smallint(5) unsigned NOT NULL,
  `return_date` datetime DEFAULT NULL,
  `staff_id` tinyint(3) unsigned NOT NULL,
  `last_update` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  PRIMARY KEY (`rental_id`),
  UNIQUE KEY `rental_date` (`rental_date`,`inventory_id`,`customer_id`),
  KEY `idx_fk_inventory_id` (`inventory_id`),
  KEY `idx_fk_customer_id` (`customer_id`),
  KEY `idx_fk_staff_id` (`staff_id`),
  CONSTRAINT `fk_rental_customer` FOREIGN KEY (`customer_id`) REFERENCES `customer` (`customer_id`) ON UPDATE CASCADE,
  CONSTRAINT `fk_rental_inventory` FOREIGN KEY (`inventory_id`) REFERENCES `inventory` (`inventory_id`) ON UPDATE CASCADE,
  CONSTRAINT `fk_rental_staff` FOREIGN KEY (`staff_id`) REFERENCES `staff` (`staff_id`) ON UPDATE CASCADE
) ENGINE=InnoDB AUTO_INCREMENT=16050 DEFAULT CHARSET=utf8
1 row in set (0.00 sec)

mysql> select * from rental order by rental_date asc limit 3; 
+-----------+---------------------+--------------+-------------+---------------------+----------+---------------------+
| rental_id | rental_date         | inventory_id | customer_id | return_date         | staff_id | last_update         |
+-----------+---------------------+--------------+-------------+---------------------+----------+---------------------+
|         1 | 2005-05-24 22:53:30 |          367 |         130 | 2005-05-26 22:04:30 |        1 | 2006-02-15 21:30:53 |
|         2 | 2005-05-24 22:54:33 |         1525 |         459 | 2005-05-28 19:40:33 |        1 | 2006-02-15 21:30:53 |
|         3 | 2005-05-24 23:03:39 |         1711 |         408 | 2005-06-01 22:12:39 |        1 | 2006-02-15 21:30:53 |
+-----------+---------------------+--------------+-------------+---------------------+----------+---------------------+
3 rows in set (0.00 sec)

mysql> explain select * from rental order by rental_date asc limit 3; 
+----+-------------+--------+------------+-------+---------------+-------------+---------+------+------+----------+-------+
| id | select_type | table  | partitions | type  | possible_keys | key         | key_len | ref  | rows | filtered | Extra |
+----+-------------+--------+------------+-------+---------------+-------------+---------+------+------+----------+-------+
|  1 | SIMPLE      | rental | NULL       | index | NULL          | rental_date | 10      | NULL |    3 |   100.00 | NULL  |
+----+-------------+--------+------------+-------+---------------+-------------+---------+------+------+----------+-------+
1 row in set, 1 warning (0.00 sec)

mysql> select * from rental order by rental_date desc limit 3;
+-----------+---------------------+--------------+-------------+-------------+----------+---------------------+
| rental_id | rental_date         | inventory_id | customer_id | return_date | staff_id | last_update         |
+-----------+---------------------+--------------+-------------+-------------+----------+---------------------+
|     11739 | 2006-02-14 15:16:03 |         4568 |         373 | NULL        |        2 | 2006-02-15 21:30:53 |
|     14616 | 2006-02-14 15:16:03 |         4537 |         532 | NULL        |        1 | 2006-02-15 21:30:53 |
|     11676 | 2006-02-14 15:16:03 |         4496 |         216 | NULL        |        2 | 2006-02-15 21:30:53 |
+-----------+---------------------+--------------+-------------+-------------+----------+---------------------+
3 rows in set (0.00 sec)

mysql> explain select * from rental order by rental_date desc limit 3;
+----+-------------+--------+------------+-------+---------------+-------------+---------+------+------+----------+---------------------+
| id | select_type | table  | partitions | type  | possible_keys | key         | key_len | ref  | rows | filtered | Extra               |
+----+-------------+--------+------------+-------+---------------+-------------+---------+------+------+----------+---------------------+
|  1 | SIMPLE      | rental | NULL       | index | NULL          | rental_date | 10      | NULL |    3 |   100.00 | Backward index scan |
+----+-------------+--------+------------+-------+---------------+-------------+---------+------+------+----------+---------------------+
1 row in set, 1 warning (0.00 sec)

mysql> 

MySQL8.0.1で、Sakila Sampleデータベースのrentalテーブルを参照した場合 (INDEXをDESCで作成し直した場合)
インデックスを降順に作成したので、先程とはEXTRAが反対になっている事が確認出来る。

mysql> alter table rental add unique key rental_date_desc (`rental_date` desc,`inventory_id` desc,`customer_id` desc);
Query OK, 0 rows affected (0.30 sec)
Records: 0  Duplicates: 0  Warnings: 0

mysql> select * from rental order by rental_date asc limit 3; 
+-----------+---------------------+--------------+-------------+---------------------+----------+---------------------+
| rental_id | rental_date         | inventory_id | customer_id | return_date         | staff_id | last_update         |
+-----------+---------------------+--------------+-------------+---------------------+----------+---------------------+
|         1 | 2005-05-24 22:53:30 |          367 |         130 | 2005-05-26 22:04:30 |        1 | 2006-02-15 21:30:53 |
|         2 | 2005-05-24 22:54:33 |         1525 |         459 | 2005-05-28 19:40:33 |        1 | 2006-02-15 21:30:53 |
|         3 | 2005-05-24 23:03:39 |         1711 |         408 | 2005-06-01 22:12:39 |        1 | 2006-02-15 21:30:53 |
+-----------+---------------------+--------------+-------------+---------------------+----------+---------------------+
3 rows in set (0.00 sec)

mysql> explain select * from rental order by rental_date asc limit 3;                                                
+----+-------------+--------+------------+-------+---------------+------------------+---------+------+------+----------+---------------------+
| id | select_type | table  | partitions | type  | possible_keys | key              | key_len | ref  | rows | filtered | Extra               |
+----+-------------+--------+------------+-------+---------------+------------------+---------+------+------+----------+---------------------+
|  1 | SIMPLE      | rental | NULL       | index | NULL          | rental_date_desc | 10      | NULL |    3 |   100.00 | Backward index scan |
+----+-------------+--------+------------+-------+---------------+------------------+---------+------+------+----------+---------------------+
1 row in set, 1 warning (0.01 sec)

mysql> select * from rental order by rental_date desc limit 3;
+-----------+---------------------+--------------+-------------+-------------+----------+---------------------+
| rental_id | rental_date         | inventory_id | customer_id | return_date | staff_id | last_update         |
+-----------+---------------------+--------------+-------------+-------------+----------+---------------------+
|     11739 | 2006-02-14 15:16:03 |         4568 |         373 | NULL        |        2 | 2006-02-15 21:30:53 |
|     14616 | 2006-02-14 15:16:03 |         4537 |         532 | NULL        |        1 | 2006-02-15 21:30:53 |
|     11676 | 2006-02-14 15:16:03 |         4496 |         216 | NULL        |        2 | 2006-02-15 21:30:53 |
+-----------+---------------------+--------------+-------------+-------------+----------+---------------------+
3 rows in set (0.00 sec)

mysql> explain select * from rental order by rental_date desc limit 3;                                               
+----+-------------+--------+------------+-------+---------------+------------------+---------+------+------+----------+-------+
| id | select_type | table  | partitions | type  | possible_keys | key              | key_len | ref  | rows | filtered | Extra |
+----+-------------+--------+------------+-------+---------------+------------------+---------+------+------+----------+-------+
|  1 | SIMPLE      | rental | NULL       | index | NULL          | rental_date_desc | 10      | NULL |    3 |   100.00 | NULL  |
+----+-------------+--------+------------+-------+---------------+------------------+---------+------+------+----------+-------+
1 row in set, 1 warning (0.01 sec)

mysql> 

詳細は、以下のMySQL Server Teamのブログを確認下さい。
MySQL 8.0 Labs – Descending Indexes in MySQL
http://mysqlserverteam.com/mysql-8-0-labs-descending-indexes-in-mysql/

MySQL5.5 ~ MySQL5.7までは昇順(ASC)で格納されたインデックスデータを利用してASC, DESC共に参照処理を行う
MySQL 5.7までは、インデックスのデータはASCで格納されています。こちらは、DESCで格納したインデックスと比べて、降順のデータの参照パフォーマンスは遅いが、
クエリーにDESCオプションを付けて、直近のデータを参照するとASCで作成したINDEXを利用してデータを参照する為、インデックスを利用した後方参照処理になる為、
インデックスが無い場合と比べても高速なレスポンスで後方参照処理を行う事が出来る。以下のマニュアルは、若干分かり難いがASC、DESCを付けてインデックスを作成しても、
MySQL5.5以降のMySQLであれば昇順(ASC)で作成されたINDEXでASCもDESCも処理出来る為、高速に参照する事が可能です。MySQL8.0で処理がより高速になる。

5.7 英語マニュアル
https://dev.mysql.com/doc/refman/5.7/en/create-index.html
An index_col_name specification can end with ASC or DESC. These keywords are permitted for future extensions for specifying ascending or descending index value storage. Currently, they are parsed but ignored; index values are always stored in ascending order.

5.6 日本語マニュアル
https://dev.mysql.com/doc/refman/5.6/ja/create-index.html
index_col_name の指定を ASC または DESC で終了させることができます。これらのキーワードは、インデックス値の昇順または降順での格納を指定する将来の拡張のために許可されています。現在、これらは解析されますが、無視されます。インデックス値は、常に昇順で格納されます。

MySQL5.7.18の実行プランは以下のような感じです。インデックスを利用して降順(DESC)参照が行われている事が確認出来る。
MySQL8.0RCがリリースされた頃に、大きなテーブルでレスポンスの差を確認して見たいと思います。


mysql> select @@version;
+-------------------------------------------+
| @@version                                 |
+-------------------------------------------+
| 5.7.18-enterprise-commercial-advanced-log |
+-------------------------------------------+
1 row in set (0.00 sec)

mysql> show create table rental\G
*************************** 1. row ***************************
       Table: rental
Create Table: CREATE TABLE `rental` (
  `rental_id` int(11) NOT NULL AUTO_INCREMENT,
  `rental_date` datetime NOT NULL,
  `inventory_id` mediumint(8) unsigned NOT NULL,
  `customer_id` smallint(5) unsigned NOT NULL,
  `return_date` datetime DEFAULT NULL,
  `staff_id` tinyint(3) unsigned NOT NULL,
  `last_update` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  PRIMARY KEY (`rental_id`),
  UNIQUE KEY `rental_date` (`rental_date`,`inventory_id`,`customer_id`),
  KEY `idx_fk_inventory_id` (`inventory_id`),
  KEY `idx_fk_customer_id` (`customer_id`),
  KEY `idx_fk_staff_id` (`staff_id`),
  CONSTRAINT `fk_rental_customer` FOREIGN KEY (`customer_id`) REFERENCES `customer` (`customer_id`) ON UPDATE CASCADE,
  CONSTRAINT `fk_rental_inventory` FOREIGN KEY (`inventory_id`) REFERENCES `inventory` (`inventory_id`) ON UPDATE CASCADE,
  CONSTRAINT `fk_rental_staff` FOREIGN KEY (`staff_id`) REFERENCES `staff` (`staff_id`) ON UPDATE CASCADE
) ENGINE=InnoDB AUTO_INCREMENT=16050 DEFAULT CHARSET=utf8
1 row in set (0.02 sec)

mysql> select * from rental limit 3;
+-----------+---------------------+--------------+-------------+---------------------+----------+---------------------+
| rental_id | rental_date         | inventory_id | customer_id | return_date         | staff_id | last_update         |
+-----------+---------------------+--------------+-------------+---------------------+----------+---------------------+
|         1 | 2005-05-24 22:53:30 |          367 |         130 | 2005-05-26 22:04:30 |        1 | 2006-02-15 21:30:53 |
|         2 | 2005-05-24 22:54:33 |         1525 |         459 | 2005-05-28 19:40:33 |        1 | 2006-02-15 21:30:53 |
|         3 | 2005-05-24 23:03:39 |         1711 |         408 | 2005-06-01 22:12:39 |        1 | 2006-02-15 21:30:53 |
+-----------+---------------------+--------------+-------------+---------------------+----------+---------------------+
3 rows in set (0.00 sec)

mysql> explain select * from rental limit 3;
+----+-------------+--------+------------+------+---------------+------+---------+------+-------+----------+-------+
| id | select_type | table  | partitions | type | possible_keys | key  | key_len | ref  | rows  | filtered | Extra |
+----+-------------+--------+------------+------+---------------+------+---------+------+-------+----------+-------+
|  1 | SIMPLE      | rental | NULL       | ALL  | NULL          | NULL | NULL    | NULL | 16005 |   100.00 | NULL  |
+----+-------------+--------+------------+------+---------------+------+---------+------+-------+----------+-------+
1 row in set, 1 warning (0.02 sec)

Note (Code 1003): /* select#1 */ select `sakila`.`rental`.`rental_id` AS `rental_id`,`sakila`.`rental`.`rental_date` AS `rental_date`,`sakila`.`rental`.`inventory_id` AS `inventory_id`,`sakila`.`rental`.`customer_id` AS `customer_id`,`sakila`.`rental`.`return_date` AS `return_date`,`sakila`.`rental`.`staff_id` AS `staff_id`,`sakila`.`rental`.`last_update` AS `last_update` from `sakila`.`rental` limit 3

mysql> select * from rental order by rental_date asc limit 3;
+-----------+---------------------+--------------+-------------+---------------------+----------+---------------------+
| rental_id | rental_date         | inventory_id | customer_id | return_date         | staff_id | last_update         |
+-----------+---------------------+--------------+-------------+---------------------+----------+---------------------+
|         1 | 2005-05-24 22:53:30 |          367 |         130 | 2005-05-26 22:04:30 |        1 | 2006-02-15 21:30:53 |
|         2 | 2005-05-24 22:54:33 |         1525 |         459 | 2005-05-28 19:40:33 |        1 | 2006-02-15 21:30:53 |
|         3 | 2005-05-24 23:03:39 |         1711 |         408 | 2005-06-01 22:12:39 |        1 | 2006-02-15 21:30:53 |
+-----------+---------------------+--------------+-------------+---------------------+----------+---------------------+
3 rows in set (0.00 sec)

mysql> explain select * from rental order by rental_date asc limit 3;
+----+-------------+--------+------------+-------+---------------+-------------+---------+------+------+----------+-------+
| id | select_type | table  | partitions | type  | possible_keys | key         | key_len | ref  | rows | filtered | Extra |
+----+-------------+--------+------------+-------+---------------+-------------+---------+------+------+----------+-------+
|  1 | SIMPLE      | rental | NULL       | index | NULL          | rental_date | 10      | NULL |    3 |   100.00 | NULL  |
+----+-------------+--------+------------+-------+---------------+-------------+---------+------+------+----------+-------+
1 row in set, 1 warning (0.02 sec)

Note (Code 1003): /* select#1 */ select `sakila`.`rental`.`rental_id` AS `rental_id`,`sakila`.`rental`.`rental_date` AS `rental_date`,`sakila`.`rental`.`inventory_id` AS `inventory_id`,`sakila`.`rental`.`customer_id` AS `customer_id`,`sakila`.`rental`.`return_date` AS `return_date`,`sakila`.`rental`.`staff_id` AS `staff_id`,`sakila`.`rental`.`last_update` AS `last_update` from `sakila`.`rental` order by `sakila`.`rental`.`rental_date` limit 3

mysql> select * from rental order by rental_date desc limit 3;
+-----------+---------------------+--------------+-------------+-------------+----------+---------------------+
| rental_id | rental_date         | inventory_id | customer_id | return_date | staff_id | last_update         |
+-----------+---------------------+--------------+-------------+-------------+----------+---------------------+
|     11739 | 2006-02-14 15:16:03 |         4568 |         373 | NULL        |        2 | 2006-02-15 21:30:53 |
|     14616 | 2006-02-14 15:16:03 |         4537 |         532 | NULL        |        1 | 2006-02-15 21:30:53 |
|     11676 | 2006-02-14 15:16:03 |         4496 |         216 | NULL        |        2 | 2006-02-15 21:30:53 |
+-----------+---------------------+--------------+-------------+-------------+----------+---------------------+
3 rows in set (0.00 sec)

mysql> explain select * from rental order by rental_date desc limit 3;
+----+-------------+--------+------------+-------+---------------+-------------+---------+------+------+----------+-------+
| id | select_type | table  | partitions | type  | possible_keys | key         | key_len | ref  | rows | filtered | Extra |
+----+-------------+--------+------------+-------+---------------+-------------+---------+------+------+----------+-------+
|  1 | SIMPLE      | rental | NULL       | index | NULL          | rental_date | 10      | NULL |    3 |   100.00 | NULL  |
+----+-------------+--------+------------+-------+---------------+-------------+---------+------+------+----------+-------+
1 row in set, 1 warning (0.01 sec)

Note (Code 1003): /* select#1 */ select `sakila`.`rental`.`rental_id` AS `rental_id`,`sakila`.`rental`.`rental_date` AS `rental_date`,`sakila`.`rental`.`inventory_id` AS `inventory_id`,`sakila`.`rental`.`customer_id` AS `customer_id`,`sakila`.`rental`.`return_date` AS `return_date`,`sakila`.`rental`.`staff_id` AS `staff_id`,`sakila`.`rental`.`last_update` AS `last_update` from `sakila`.`rental` order by `sakila`.`rental`.`rental_date` desc limit 3
mysql>  


MySQL8.0におけるROLEによるユーザー権限管理についての確認。
MySQL5.7からProxy Userを利用する事で、ROLEと同じように権限をまとめて管理する事が出来るようになりましたが、MySQL8.0からは正式にROLEが追加されて、複数ROLEの切り替えやROLEのネストが出来るようになります。これにより、多くのユーザーを管理するような環境では、権限管理工数やミスが削減出来る事になるかと思います。

7.3.4 Using Roles
https://dev.mysql.com/doc/refman/8.0/en/roles.html

ROLEの作成とROLEへの権限付与

mysql> CREATE ROLE role80;
Query OK, 0 rows affected (0.01 sec)

mysql> GRANT ALL on DEMO.* TO role80;
Query OK, 0 rows affected (0.05 sec)

mysql> create user user01 identified by 'password';
Query OK, 0 rows affected (0.01 sec)

mysql> select host, user, authentication_string from mysql.user;
+-----------+-----------+-------------------------------------------+
| host      | user      | authentication_string                     |
+-----------+-----------+-------------------------------------------+
| %         | role80    |                                           |
| %         | root      | *E74858DB86EBA20BC33D0AECAE8A8108C56B17FA |
| %         | user01    | *2470C0C06DEE42FD1618BB99005ADCA2EC9D1E19 |
| localhost | mysql.sys | *THISISNOTAVALIDPASSWORDTHATCANBEUSEDHERE |
+-----------+-----------+-------------------------------------------+
4 rows in set (0.02 sec)

USER01にrole80の権限を付与
ROLE権限を付与する前は、何も権限を付与していない為、information_schemaのみ確認可能。

[root@DockerHost oracle]# docker exec -it mysql8 mysql -uuser01 -p
Enter password: 
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 6
Server version: 8.0.0-dmr MySQL Community Server (GPL)

Copyright (c) 2000, 2016, 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> show databases;
+--------------------+
| Database           |
+--------------------+
| information_schema |
+--------------------+
1 row in set (0.00 sec)

mysql> grant role80 to user01;
Query OK, 0 rows affected (0.02 sec)

mysql> select * from mysql.role_edges;
+-----------+-----------+---------+---------+-------------------+
| FROM_HOST | FROM_USER | TO_HOST | TO_USER | WITH_ADMIN_OPTION |
+-----------+-----------+---------+---------+-------------------+
| %         | role80    | %       | user01  | N                 |
+-----------+-----------+---------+---------+-------------------+
1 row in set (0.06 sec)

mysql> select * from mysql.default_roles;
Empty set (0.00 sec)

mysql> 

ユーザーのDEFAULT ROLEを設定しログイン時に反映させる


mysql> alter user user01 default role role80;
Query OK, 0 rows affected (0.01 sec)

mysql> select * from mysql.default_roles;    
+------+--------+-------------------+-------------------+
| HOST | USER   | DEFAULT_ROLE_HOST | DEFAULT_ROLE_USER |
+------+--------+-------------------+-------------------+
| %    | user01 | %                 | role80            |
+------+--------+-------------------+-------------------+
1 row in set (0.00 sec)

mysql> 

権限が継承されているかログインして確認してみる


[root@DockerHost oracle]# docker exec -it mysql8 mysql -uuser01 -p
Enter password: 
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 10
Server version: 8.0.0-dmr MySQL Community Server (GPL)

Copyright (c) 2000, 2016, 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> show databases;
+--------------------+
| Database           |
+--------------------+
| DEMO               |
| information_schema |
+--------------------+
2 rows in set (0.00 sec)

mysql> select user(),current_user(),current_role(); 
+------------------+----------------+----------------+
| user()           | current_user() | current_role() |
+------------------+----------------+----------------+
| user01@localhost | user01@%       | `role80`@`%`   |
+------------------+----------------+----------------+
1 row in set (0.00 sec)

mysql> show grants;
+--------------------------------------------------+
| Grants for user01@%                              |
+--------------------------------------------------+
| GRANT USAGE ON *.* TO `user01`@`%`               |
| GRANT ALL PRIVILEGES ON `DEMO`.* TO `user01`@`%` |
| GRANT `role80`@`%` TO `user01`@`%`               |
+--------------------------------------------------+
3 rows in set (0.00 sec)

mysql> show grants for user01; 
+------------------------------------+
| Grants for user01@%                |
+------------------------------------+
| GRANT USAGE ON *.* TO `user01`@`%` |
| GRANT `role80`@`%` TO `user01`@`%` |
+------------------------------------+
2 rows in set (0.01 sec)

mysql> show grants for user01 using role80;
+--------------------------------------------------+
| Grants for user01@%                              |
+--------------------------------------------------+
| GRANT USAGE ON *.* TO `user01`@`%`               |
| GRANT ALL PRIVILEGES ON `DEMO`.* TO `user01`@`%` |
| GRANT `role80`@`%` TO `user01`@`%`               |
+--------------------------------------------------+
3 rows in set (0.00 sec)

mysql>  

補足:Default Roleを設定しない場合
確認用アカウントuser02を作成


mysql> create user user02 identified by 'password';                                                              
Query OK, 0 rows affected (0.07 sec)

mysql> grant role80 to user02;
Query OK, 0 rows affected (0.01 sec)

mysql> 

Deault Roleが無い場合は、ログイン後にSETコマンドでROLEを選択する


[root@DockerHost oracle]# docker exec -it mysql8 mysql -uuser02 -p
Enter password: 
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 11
Server version: 8.0.0-dmr MySQL Community Server (GPL)

Copyright (c) 2000, 2016, 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> show databases;
+--------------------+
| Database           |
+--------------------+
| information_schema |
+--------------------+
1 row in set (0.01 sec)

mysql> select user(),current_user(),current_role();
+------------------+----------------+----------------+
| user()           | current_user() | current_role() |
+------------------+----------------+----------------+
| user02@localhost | user02@%       | NONE           |
+------------------+----------------+----------------+
1 row in set (0.00 sec)

mysql> set role role80;
Query OK, 0 rows affected (0.00 sec)

mysql> select user(),current_user(),current_role();
+------------------+----------------+----------------+
| user()           | current_user() | current_role() |
+------------------+----------------+----------------+
| user02@localhost | user02@%       | `role80`@`%`   |
+------------------+----------------+----------------+
1 row in set (0.00 sec)

mysql> show databases;                             
+--------------------+
| Database           |
+--------------------+
| DEMO               |
| information_schema |
+--------------------+
2 rows in set (0.00 sec)

mysql> 

再起動するとSETコマンドで設定した値は消えるので、必要に応じて”set default role”コマンドでDefault Roleを設定する

mysql> set default role role80 to user02;
Query OK, 0 rows affected (0.01 sec)

mysql> select user(),current_user(),current_role();
+------------------+----------------+----------------+
| user()           | current_user() | current_role() |
+------------------+----------------+----------------+
| user02@localhost | user02@%       | NONE           |
+------------------+----------------+----------------+
1 row in set (0.00 sec)

mysql> exit
Bye
[root@DockerHost oracle]# docker exec -it mysql8 mysql -uuser02 -p
Enter password: 
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 13
Server version: 8.0.0-dmr MySQL Community Server (GPL)

Copyright (c) 2000, 2016, 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> select user(),current_user(),current_role();
+------------------+----------------+----------------+
| user()           | current_user() | current_role() |
+------------------+----------------+----------------+
| user02@localhost | user02@%       | `role80`@`%`   |
+------------------+----------------+----------------+
1 row in set (0.00 sec)

mysql> show databases;
+--------------------+
| Database           |
+--------------------+
| DEMO               |
| information_schema |
+--------------------+
2 rows in set (0.00 sec)

mysql> 

その他参考:roleはpassword_expireとaccount_lockedで設定されている
通常のアカウント同様に利用したい場合、必要であればexpiredとlockedを解除してあげる。

mysql> select host, user, authentication_string,password_expired,account_locked  from mysql.user;
+-----------+-----------+-------------------------------------------+------------------+----------------+
| host      | user      | authentication_string                     | password_expired | account_locked |
+-----------+-----------+-------------------------------------------+------------------+----------------+
| %         | role80    |                                           | Y                | Y              |
| %         | root      | *E74858DB86EBA20BC33D0AECAE8A8108C56B17FA | N                | N              |
| %         | user01    | *2470C0C06DEE42FD1618BB99005ADCA2EC9D1E19 | N                | N              |
| %         | user02    | *2470C0C06DEE42FD1618BB99005ADCA2EC9D1E19 | N                | N              |
| localhost | mysql.sys | *THISISNOTAVALIDPASSWORDTHATCANBEUSEDHERE | N                | Y              |
+-----------+-----------+-------------------------------------------+------------------+----------------+
5 rows in set (0.01 sec)

mysql> 

ユーザーに複数のROLEの権限を付与してみる
先ずは、ROLEを追加作成してsakilaデータベースに権限付与してみる


mysql> CREATE ROLE role81;    
Query OK, 0 rows affected (0.01 sec)

mysql> GRANT ALL on sakila.* TO role81;
Query OK, 0 rows affected (0.01 sec)

mysql> grant role81 to user01;
Query OK, 0 rows affected (0.01 sec)

mysql> select * from mysql.role_edges;
+-----------+-----------+---------+---------+-------------------+
| FROM_HOST | FROM_USER | TO_HOST | TO_USER | WITH_ADMIN_OPTION |
+-----------+-----------+---------+---------+-------------------+
| %         | role80    | %       | user01  | N                 |
| %         | role80    | %       | user02  | N                 |
| %         | role81    | %       | user01  | N                 |
+-----------+-----------+---------+---------+-------------------+
3 rows in set (0.00 sec)

mysql> 

Default Roleはrole80になっているので、DEMOデータベースのみにアクセス出来るが、SETコマンドでroleを切り替える事が出来る。

[root@DockerHost oracle]# docker exec -it mysql8 mysql -uuser01 -p
Enter password: 
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 14
Server version: 8.0.0-dmr MySQL Community Server (GPL)

Copyright (c) 2000, 2016, 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> show databases;
+--------------------+
| Database           |
+--------------------+
| DEMO               |
| information_schema |
+--------------------+
2 rows in set (0.01 sec)

mysql> select user(),current_user(),current_role();
+------------------+----------------+----------------+
| user()           | current_user() | current_role() |
+------------------+----------------+----------------+
| user01@localhost | user01@%       | `role80`@`%`   |
+------------------+----------------+----------------+
1 row in set (0.00 sec)

mysql> set role role81;          
Query OK, 0 rows affected (0.00 sec)

mysql> show databases;                             
+--------------------+
| Database           |
+--------------------+
| information_schema |
| sakila             |
+--------------------+
2 rows in set (0.00 sec)

mysql> select user(),current_user(),current_role();
+------------------+----------------+----------------+
| user()           | current_user() | current_role() |
+------------------+----------------+----------------+
| user01@localhost | user01@%       | `role81`@`%`   |
+------------------+----------------+----------------+
1 row in set (0.00 sec)

mysql> 

ROLEにROLE権限をネストして付与してみる


mysql> grant role81 to role80;
Query OK, 0 rows affected (0.01 sec)

mysql> select * from mysql.role_edges;
+-----------+-----------+---------+---------+-------------------+
| FROM_HOST | FROM_USER | TO_HOST | TO_USER | WITH_ADMIN_OPTION |
+-----------+-----------+---------+---------+-------------------+
| %         | role80    | %       | user01  | N                 |
| %         | role80    | %       | user02  | N                 |
| %         | role81    | %       | role80  | N                 |
| %         | role81    | %       | user01  | N                 |
+-----------+-----------+---------+---------+-------------------+
4 rows in set (0.01 sec)

mysql> show grants for role80@'%';
+--------------------------------------------------+
| Grants for role80@%                              |
+--------------------------------------------------+
| GRANT USAGE ON *.* TO `role80`@`%`               |
| GRANT ALL PRIVILEGES ON `DEMO`.* TO `role80`@`%` |
| GRANT `role81`@`%` TO `role80`@`%`               |
+--------------------------------------------------+
3 rows in set (0.00 sec)

mysql> show grants for role81@'%';
+----------------------------------------------------+
| Grants for role81@%                                |
+----------------------------------------------------+
| GRANT USAGE ON *.* TO `role81`@`%`                 |
| GRANT ALL PRIVILEGES ON `sakila`.* TO `role81`@`%` |
+----------------------------------------------------+
2 rows in set (0.00 sec)

role80のメンバーのuser01でログインして、付与された権限を確認してみる。
role80には、role81の権限が付与されているのでDEMOとsakilaデータベース共にアクセス可能になっている。


mysql> select user(),current_role(); 
+------------------+----------------+
| user()           | current_role() |
+------------------+----------------+
| user01@localhost | `role80`@`%`   |
+------------------+----------------+
1 row in set (0.00 sec)

mysql> show grants;
+----------------------------------------------------+
| Grants for user01@%                                |
+----------------------------------------------------+
| GRANT USAGE ON *.* TO `user01`@`%`                 |
| GRANT ALL PRIVILEGES ON `DEMO`.* TO `user01`@`%`   |
| GRANT ALL PRIVILEGES ON `sakila`.* TO `user01`@`%` |
| GRANT `role80`@`%`,`role81`@`%` TO `user01`@`%`    |
+----------------------------------------------------+
4 rows in set (0.01 sec)

mysql> show databases;
+--------------------+
| Database           |
+--------------------+
| DEMO               |
| information_schema |
| sakila             |
+--------------------+
3 rows in set (0.00 sec)

mysql>


MySQL8.0がDockerリポジトリーで提供されているので、Dockerに8.0のイメージをダウンロードしてインストールしてみました。
同時にMySQL8.0の新機能確認として、動的にGlobal Variablesを変更して永続化出来るか?また、データディクショナリの状況も確認してみました。

■ DockerレポジトリーとイメージTag
https://hub.docker.com/r/mysql/mysql-server/
https://hub.docker.com/r/mysql/mysql-server/tags/

MySQL8.0 Dockerイメージダウンロード~起動まで


[root@DockerHost oracle]# docker pull mysql/mysql-server:8.0
8.0: Pulling from mysql/mysql-server
7f369f1cac0b: Pull complete 
897fddccf3d8: Pull complete 
865c22dab1e4: Pull complete 
3e61c960af44: Pull complete 
fcd95ea99f45: Pull complete 
e9cae96efb21: Pull complete 
671450fab9a5: Pull complete 
1b8291aef5a7: Pull complete 
99ef814fb233: Pull complete 
c1add8e582f0: Pull complete 
Digest: sha256:c65b1da17c01749a28fc0b0865f94bf02053f290f23a28bf4fe9d8447dccadd6
Status: Downloaded newer image for mysql/mysql-server:8.0
[root@DockerHost oracle]# docker images
REPOSITORY           TAG                 IMAGE ID            CREATED             VIRTUAL SIZE
mysql/mysql-server   8.0                 c1add8e582f0        5 days ago          393.4 MB
mysql/mysql-server   5.7.12              4e1d42e32c43        5 months ago        296.7 MB
mysql                5.7.10              ea0aca21950d        9 months ago        360.3 MB
mysql/mysql-server   5.7.10              e472f1765697        9 months ago        294.6 MB
[root@DockerHost oracle]# 

[root@DockerHost oracle]# docker run --name mysql8 -v /docker/docker8:/var/lib/mysql -e MYSQL_ROOT_PASSWORD=mysql -d mysql/mysql-server:8.0
f0d7a1a715633b76aaadbba8b8fa6a63b293a9a88d193d28cd44cebd33d08955
[root@DockerHost oracle]# 

[root@DockerHost oracle]# docker ps -a
CONTAINER ID        IMAGE                       COMMAND                  CREATED              STATUS                    PORTS                 NAMES
f0d7a1a71563        mysql/mysql-server:8.0      "/entrypoint.sh mysql"   About a minute ago   Up About a minute         3306/tcp, 33060/tcp   mysql8
88da7fe02e00        mysql:5.7.10                "/entrypoint.sh mysql"   3 months ago         Exited (0) 3 months ago                         my_docker03
4fde03dc4cb5        mysql/mysql-server:5.7.10   "/entrypoint.sh mysql"   8 months ago         Exited (0) 3 months ago                         my_docker02
5152a22b2aa0        mysql:5.7.10                "/entrypoint.sh mysql"   8 months ago         Exited (0) 8 months ago                         my_docker01
[root@DockerHost oracle]# 

[root@DockerHost oracle]# docker inspect -f "{{.Config.Hostname}}, {{.NetworkSettings.IPAddress}}" $(docker ps | grep -v "^CONTAINER" | awk '{print $1}')
f0d7a1a71563, 172.17.0.2
[root@DockerHost oracle]# 

ログインしてバージョン確認

[root@DockerHost oracle]# docker exec -it mysql8 mysql -uroot -p
Enter password: 
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 4
Server version: 8.0.0-dmr MySQL Community Server (GPL)

Copyright (c) 2000, 2016, 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> select @@version;
+-----------+
| @@version |
+-----------+
| 8.0.0-dmr |
+-----------+
1 row in set (0.00 sec)

mysql> 

■ SET PERSIST Statementの確認
http://mysqlserverteam.com/mysql-8-0-persisting-configuration-variables/


mysql> SELECT * FROM performance_schema.variables_info WHERE variable_source != 'COMPILED';
+--------------------+-----------------+---------------+-----------+-----------+
| VARIABLE_NAME      | VARIABLE_SOURCE | VARIABLE_PATH | MIN_VALUE | MAX_VALUE |
+--------------------+-----------------+---------------+-----------+-----------+
| datadir            | GLOBAL          | /etc/my.cnf   | 0         | 0         |
| foreign_key_checks | DYNAMIC         |               | 0         | 0         |
| log_error          | GLOBAL          | /etc/my.cnf   | 0         | 0         |
| pid_file           | GLOBAL          | /etc/my.cnf   | 0         | 0         |
| secure_file_priv   | GLOBAL          | /etc/my.cnf   | 0         | 0         |
| skip_name_resolve  | GLOBAL          | /etc/my.cnf   | 0         | 0         |
| socket             | GLOBAL          | /etc/my.cnf   | 0         | 0         |
+--------------------+-----------------+---------------+-----------+-----------+
7 rows in set (0.00 sec)

mysql> show variables like 'log_timestamps';                                               
+----------------+-------+
| Variable_name  | Value |
+----------------+-------+
| log_timestamps | UTC   |
+----------------+-------+
1 row in set (0.01 sec)

mysql> SET PERSIST log_timestamps='SYSTEM';
Query OK, 0 rows affected (0.00 sec)

mysql> show variables like 'log_timestamps';                                               
+----------------+--------+
| Variable_name  | Value  |
+----------------+--------+
| log_timestamps | SYSTEM |
+----------------+--------+
1 row in set (0.00 sec)

mysql> SELECT * FROM performance_schema.variables_info WHERE variable_source != 'COMPILED';
+--------------------+-----------------+---------------+-----------+-----------+
| VARIABLE_NAME      | VARIABLE_SOURCE | VARIABLE_PATH | MIN_VALUE | MAX_VALUE |
+--------------------+-----------------+---------------+-----------+-----------+
| datadir            | GLOBAL          | /etc/my.cnf   | 0         | 0         |
| foreign_key_checks | DYNAMIC         |               | 0         | 0         |
| log_error          | GLOBAL          | /etc/my.cnf   | 0         | 0         |
| log_timestamps     | DYNAMIC         |               | 0         | 0         |
| pid_file           | GLOBAL          | /etc/my.cnf   | 0         | 0         |
| secure_file_priv   | GLOBAL          | /etc/my.cnf   | 0         | 0         |
| skip_name_resolve  | GLOBAL          | /etc/my.cnf   | 0         | 0         |
| socket             | GLOBAL          | /etc/my.cnf   | 0         | 0         |
+--------------------+-----------------+---------------+-----------+-----------+
8 rows in set (0.00 sec)

mysql> 

再起動後も値が反映されている事を確認


[root@DockerHost oracle]# docker stop f0d7a1a71563
f0d7a1a71563
[root@DockerHost oracle]# docker ps -a
CONTAINER ID        IMAGE                       COMMAND                  CREATED             STATUS                     PORTS               NAMES
f0d7a1a71563        mysql/mysql-server:8.0      "/entrypoint.sh mysql"   11 minutes ago      Exited (0) 2 seconds ago                       mysql8
88da7fe02e00        mysql:5.7.10                "/entrypoint.sh mysql"   3 months ago        Exited (0) 3 months ago                        my_docker03
4fde03dc4cb5        mysql/mysql-server:5.7.10   "/entrypoint.sh mysql"   8 months ago        Exited (0) 3 months ago                        my_docker02
5152a22b2aa0        mysql:5.7.10                "/entrypoint.sh mysql"   8 months ago        Exited (0) 8 months ago                        my_docker01
[root@DockerHost oracle]# docker start f0d7a1a71563
f0d7a1a71563
[root@DockerHost oracle]# docker ps -a
CONTAINER ID        IMAGE                       COMMAND                  CREATED             STATUS                    PORTS                 NAMES
f0d7a1a71563        mysql/mysql-server:8.0      "/entrypoint.sh mysql"   11 minutes ago      Up 2 seconds              3306/tcp, 33060/tcp   mysql8
88da7fe02e00        mysql:5.7.10                "/entrypoint.sh mysql"   3 months ago        Exited (0) 3 months ago                         my_docker03
4fde03dc4cb5        mysql/mysql-server:5.7.10   "/entrypoint.sh mysql"   8 months ago        Exited (0) 3 months ago                         my_docker02
5152a22b2aa0        mysql:5.7.10                "/entrypoint.sh mysql"   8 months ago        Exited (0) 8 months ago                         my_docker01
[root@DockerHost oracle]# 

[root@DockerHost oracle]# docker exec -it mysql8 mysql -uroot -p
Enter password: 
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 4
Server version: 8.0.0-dmr MySQL Community Server (GPL)

Copyright (c) 2000, 2016, 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> show variables like 'log_timestamps';
+----------------+--------+
| Variable_name  | Value  |
+----------------+--------+
| log_timestamps | SYSTEM |
+----------------+--------+
1 row in set (0.02 sec)

mysql> 

(補足) SET PERSISTで設定変更した、GLOBAL変数は以下のようにmysqld-auto.cnfから読み込まれています。

Under the hood the settings will be persisted to a file named mysqld-auto.cnf which will be created in the data directory.
This file will be read during server startup just like any other configuration file, and all variables present in this file will be applied as the highest priority.
That means the file mysqld-auto.cnf will be the last file to be applied on server startup (even after command-line options) and takes precedence if a specific setting has been specified in more than one location.


mysql>  select VARIABLE_NAME,VARIABLE_SOURCE,VARIABLE_PATH from performance_schema.variables_info where VARIABLE_PATH <> '';
+-------------------+-----------------+--------------------------------+
| VARIABLE_NAME     | VARIABLE_SOURCE | VARIABLE_PATH                  |
+-------------------+-----------------+--------------------------------+
| datadir           | GLOBAL          | /etc/my.cnf                    |
| log_error         | GLOBAL          | /etc/my.cnf                    |
| log_timestamps    | PERSISTED       | /var/lib/mysql/mysqld-auto.cnf |
| pid_file          | GLOBAL          | /etc/my.cnf                    |
| secure_file_priv  | GLOBAL          | /etc/my.cnf                    |
| skip_name_resolve | GLOBAL          | /etc/my.cnf                    |
| socket            | GLOBAL          | /etc/my.cnf                    |
+-------------------+-----------------+--------------------------------+
7 rows in set (0.00 sec)

mysql> 

■MySQL8.0データディクショナリの確認


[root@DockerHost var]# docker exec -it mysql8 mysql -uroot -p
Enter password: 
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 11
Server version: 8.0.0-dmr MySQL Community Server (GPL)

Copyright (c) 2000, 2016, 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> source /var/lib/mysql/init-docker-sakila.sql

Query OK, 200 rows affected (0.01 sec)
Records: 200  Duplicates: 0  Warnings: 0

Query OK, 603 rows affected (0.04 sec)
Records: 603  Duplicates: 0  Warnings: 0

Query OK, 600 rows affected (0.01 sec)
Records: 600  Duplicates: 0  Warnings: 0

<SNIP>

Query OK, 109 rows affected (0.01 sec)
Records: 109  Duplicates: 0  Warnings: 0

Query OK, 599 rows affected (0.04 sec)
Records: 599  Duplicates: 0  Warnings: 0

Query OK, 1000 rows affected (0.17 sec)
Records: 1000  Duplicates: 0  Warnings: 0

Query OK, 5462 rows affected (0.18 sec)
Records: 5462  Duplicates: 0  Warnings: 0

Query OK, 0 rows affected (0.00 sec)

mysql> show databases;
+--------------------+
| Database           |
+--------------------+
| information_schema |
| mysql              |
| performance_schema |
| sakila             |
| sys                |
+--------------------+
5 rows in set (0.01 sec)

mysql> 

■ MySQL8.0で作成したSakilaサンプルデータベースのデータディクショナリー確認

[root@DockerHost sakila]# ls -l /docker/docker8/sakila
total 25104
-rw-r----- 1 27 27   147456 Sep 20 13:55 actor.ibd
-rw-r----- 1 27 27   278528 Sep 20 13:55 address.ibd
-rw-r----- 1 27 27   131072 Sep 20 13:55 category.ibd
-rw-r----- 1 27 27   147456 Sep 20 13:55 city.ibd
-rw-r----- 1 27 27   131072 Sep 20 13:55 country.ibd
-rw-r----- 1 27 27   229376 Sep 20 13:55 customer.ibd
-rw-r----- 1 27 27   376832 Sep 20 13:55 film_actor.ibd
-rw-r----- 1 27 27   180224 Sep 20 13:55 film_category.ibd
-rw-r----- 1 27 27   376832 Sep 20 13:55 film.ibd
-rw-r----- 1 27 27   294912 Sep 20 13:55 film_text.ibd
-rw-r----- 1 27 27   131072 Sep 20 13:55 FTS_000000000000005b_00000000000000ae_INDEX_1.ibd
-rw-r----- 1 27 27   131072 Sep 20 13:55 FTS_000000000000005b_00000000000000ae_INDEX_2.ibd
-rw-r----- 1 27 27   131072 Sep 20 13:55 FTS_000000000000005b_00000000000000ae_INDEX_3.ibd
-rw-r----- 1 27 27   131072 Sep 20 13:55 FTS_000000000000005b_00000000000000ae_INDEX_4.ibd
-rw-r----- 1 27 27   131072 Sep 20 13:55 FTS_000000000000005b_00000000000000ae_INDEX_5.ibd
-rw-r----- 1 27 27   131072 Sep 20 13:55 FTS_000000000000005b_00000000000000ae_INDEX_6.ibd
-rw-r----- 1 27 27   131072 Sep 20 13:55 FTS_000000000000005b_BEING_DELETED_CACHE.ibd
-rw-r----- 1 27 27   131072 Sep 20 13:55 FTS_000000000000005b_BEING_DELETED.ibd
-rw-r----- 1 27 27   131072 Sep 20 13:55 FTS_000000000000005b_CONFIG.ibd
-rw-r----- 1 27 27   131072 Sep 20 13:55 FTS_000000000000005b_DELETED_CACHE.ibd
-rw-r----- 1 27 27   131072 Sep 20 13:55 FTS_000000000000005b_DELETED.ibd
-rw-r----- 1 27 27   475136 Sep 20 13:56 inventory.ibd
-rw-r----- 1 27 27   131072 Sep 20 13:55 language.ibd
-rw-r----- 1 27 27 10485760 Sep 20 13:56 payment.ibd
-rw-r----- 1 27 27 10485760 Sep 20 13:56 rental.ibd
-rw-r----- 1 27 27   180224 Sep 20 13:55 staff.ibd
-rw-r----- 1 27 27   163840 Sep 20 13:55 store.ibd
[root@DockerHost sakila]# 

■ MySQL5.7で作成したSakilaサンプルデータベースのデータディクショナリー確認
frmやTRGファイルが存在しています。


[root@DockerHost sakila]# ls -l /docker/docker03/sakila/
total 24620
-rw-r----- 1 999 999     8694 Jun  7 07:17 actor.frm
-rw-r----- 1 999 999   114688 Jun  7 07:17 actor.ibd
-rw-r----- 1 999 999     2863 Jun  7 07:17 actor_info.frm
-rw-r----- 1 999 999     8878 Jun  7 07:17 address.frm
-rw-r----- 1 999 999   245760 Jun  7 07:17 address.ibd
-rw-r----- 1 999 999     8648 Jun  7 07:17 category.frm
-rw-r----- 1 999 999    98304 Jun  7 07:17 category.ibd
-rw-r----- 1 999 999     8682 Jun  7 07:17 city.frm
-rw-r----- 1 999 999   114688 Jun  7 07:17 city.ibd
-rw-r----- 1 999 999     8652 Jun  7 07:17 country.frm
-rw-r----- 1 999 999    98304 Jun  7 07:17 country.ibd
-rw-r----- 1 999 999       40 Jun  7 07:17 customer_create_date.TRN
-rw-r----- 1 999 999     8890 Jun  7 07:17 customer.frm
-rw-r----- 1 999 999   196608 Jun  7 07:17 customer.ibd
-rw-r----- 1 999 999     1892 Jun  7 07:17 customer_list.frm
-rw-r----- 1 999 999      300 Jun  7 07:17 customer.TRG
-rw-r----- 1 999 999       61 Jun  7 07:17 db.opt
-rw-r----- 1 999 999       36 Jun  7 07:17 del_film.TRN
-rw-r----- 1 999 999     8648 Jun  7 07:17 film_actor.frm
-rw-r----- 1 999 999   344064 Jun  7 07:17 film_actor.ibd
-rw-r----- 1 999 999     8654 Jun  7 07:17 film_category.frm
-rw-r----- 1 999 999   147456 Jun  7 07:17 film_category.ibd
-rw-r----- 1 999 999     9188 Jun  7 07:17 film.frm
-rw-r----- 1 999 999   344064 Jun  7 07:17 film.ibd
-rw-r----- 1 999 999     2616 Jun  7 07:17 film_list.frm
-rw-r----- 1 999 999     8642 Jun  7 07:17 film_text.frm
-rw-r----- 1 999 999   262144 Jun  7 07:17 film_text.ibd
-rw-r----- 1 999 999     1093 Jun  7 07:17 film.TRG
-rw-r----- 1 999 999    98304 Jun  7 07:17 FTS_0000000000000035_0000000000000045_INDEX_1.ibd
-rw-r----- 1 999 999   131072 Jun  7 07:17 FTS_0000000000000035_0000000000000045_INDEX_2.ibd
-rw-r----- 1 999 999    98304 Jun  7 07:17 FTS_0000000000000035_0000000000000045_INDEX_3.ibd
-rw-r----- 1 999 999    98304 Jun  7 07:17 FTS_0000000000000035_0000000000000045_INDEX_4.ibd
-rw-r----- 1 999 999   131072 Jun  7 07:17 FTS_0000000000000035_0000000000000045_INDEX_5.ibd
-rw-r----- 1 999 999    98304 Jun  7 07:17 FTS_0000000000000035_0000000000000045_INDEX_6.ibd
-rw-r----- 1 999 999    98304 Jun  7 07:17 FTS_0000000000000035_BEING_DELETED_CACHE.ibd
-rw-r----- 1 999 999    98304 Jun  7 07:17 FTS_0000000000000035_BEING_DELETED.ibd
-rw-r----- 1 999 999    98304 Jun  7 07:17 FTS_0000000000000035_CONFIG.ibd
-rw-r----- 1 999 999    98304 Jun  7 07:17 FTS_0000000000000035_DELETED_CACHE.ibd
-rw-r----- 1 999 999    98304 Jun  7 07:17 FTS_0000000000000035_DELETED.ibd
-rw-r----- 1 999 999       36 Jun  7 07:17 ins_film.TRN
-rw-r----- 1 999 999     8694 Jun  7 07:17 inventory.frm
-rw-r----- 1 999 999   442368 Jun  7 07:17 inventory.ibd
-rw-r----- 1 999 999     8648 Jun  7 07:17 language.frm
-rw-r----- 1 999 999    98304 Jun  7 07:17 language.ibd
-rw-r----- 1 999 999     3234 Jun  7 07:17 nicer_but_slower_film_list.frm
-rw-r----- 1 999 999       39 Jun  7 07:17 payment_date.TRN
-rw-r----- 1 999 999     8818 Jun  7 07:17 payment.frm
-rw-r----- 1 999 999 10485760 Jun  7 07:17 payment.ibd
-rw-r----- 1 999 999      292 Jun  7 07:17 payment.TRG
-rw-r----- 1 999 999       38 Jun  7 07:17 rental_date.TRN
-rw-r----- 1 999 999     8830 Jun  7 07:17 rental.frm
-rw-r----- 1 999 999 10485760 Jun  7 07:17 rental.ibd
-rw-r----- 1 999 999      289 Jun  7 07:17 rental.TRG
-rw-r----- 1 999 999     1669 Jun  7 07:17 sales_by_film_category.frm
-rw-r----- 1 999 999     2344 Jun  7 07:17 sales_by_store.frm
-rw-r----- 1 999 999     8952 Jun  7 07:17 staff.frm
-rw-r----- 1 999 999   147456 Jun  7 07:17 staff.ibd
-rw-r----- 1 999 999     1705 Jun  7 07:17 staff_list.frm
-rw-r----- 1 999 999     8708 Jun  7 07:17 store.frm
-rw-r----- 1 999 999   131072 Jun  7 07:17 store.ibd
-rw-r----- 1 999 999       36 Jun  7 07:17 upd_film.TRN

メモ:MySQL8.0 DATA DICTIONARY

Data dictionary tables are invisible. They cannot be read with SELECT, do not appear in the output of SHOW TABLES,
are not listed in the INFORMATION_SCHEMA.TABLES table, and so forth. However, in most cases there are corresponding INFORMATION_SCHEMA tables
that can be queried. Conceptually, the INFORMATION_SCHEMA provides a view through which MySQL exposes data dictionary metadata.
For example, you cannot select from the mysql.schemata table directly:
http://dev.mysql.com/doc/refman/8.0/en/system-database.html#system-database-data-dictionary-tables


mysql> SELECT * FROM mysql.schemata;                                                                         
ERROR 3554 (HY000): Access to system table 'mysql.schemata' is rejected.
mysql> 

mysql> SELECT * FROM INFORMATION_SCHEMA.SCHEMATA limit 10; 
+--------------+--------------------+----------------------------+------------------------+----------+
| CATALOG_NAME | SCHEMA_NAME        | DEFAULT_CHARACTER_SET_NAME | DEFAULT_COLLATION_NAME | SQL_PATH |
+--------------+--------------------+----------------------------+------------------------+----------+
| def          | mysql              | latin1                     | latin1_swedish_ci      |     NULL |
| def          | information_schema | utf8                       | utf8_general_ci        |     NULL |
| def          | performance_schema | utf8                       | utf8_general_ci        |     NULL |
| def          | sys                | utf8                       | utf8_general_ci        |     NULL |
| def          | sakila             | latin1                     | latin1_swedish_ci      |     NULL |
+--------------+--------------------+----------------------------+------------------------+----------+
5 rows in set (0.00 sec)

mysql> select * from INNODB_SYS_TABLES where NAME LIKE 'sakila%';
+----------+------------------------------------------------------+------+--------+-------+------------+---------------+------------+
| TABLE_ID | NAME                                                 | FLAG | N_COLS | SPACE | ROW_FORMAT | ZIP_PAGE_SIZE | SPACE_TYPE |
+----------+------------------------------------------------------+------+--------+-------+------------+---------------+------------+
|       97 | sakila/FTS_000000000000005b_00000000000000ae_INDEX_1 |   33 |      8 |    85 | Dynamic    |             0 | Single     |
|       98 | sakila/FTS_000000000000005b_00000000000000ae_INDEX_2 |   33 |      8 |    86 | Dynamic    |             0 | Single     |
|       99 | sakila/FTS_000000000000005b_00000000000000ae_INDEX_3 |   33 |      8 |    87 | Dynamic    |             0 | Single     |
|      100 | sakila/FTS_000000000000005b_00000000000000ae_INDEX_4 |   33 |      8 |    88 | Dynamic    |             0 | Single     |
|      101 | sakila/FTS_000000000000005b_00000000000000ae_INDEX_5 |   33 |      8 |    89 | Dynamic    |             0 | Single     |
|      102 | sakila/FTS_000000000000005b_00000000000000ae_INDEX_6 |   33 |      8 |    90 | Dynamic    |             0 | Single     |
|       92 | sakila/FTS_000000000000005b_BEING_DELETED            |   33 |      4 |    80 | Dynamic    |             0 | Single     |
|       93 | sakila/FTS_000000000000005b_BEING_DELETED_CACHE      |   33 |      4 |    81 | Dynamic    |             0 | Single     |
|       94 | sakila/FTS_000000000000005b_CONFIG                   |   33 |      5 |    82 | Dynamic    |             0 | Single     |
|       95 | sakila/FTS_000000000000005b_DELETED                  |   33 |      4 |    83 | Dynamic    |             0 | Single     |
|       96 | sakila/FTS_000000000000005b_DELETED_CACHE            |   33 |      4 |    84 | Dynamic    |             0 | Single     |
|      109 | sakila/OPC                                           |   33 |      4 |   100 | Dynamic    |             0 | Single     |
|       82 | sakila/actor                                         |   33 |      7 |    70 | Dynamic    |             0 | Single     |
|       83 | sakila/address                                       |   33 |     12 |    71 | Dynamic    |             0 | Single     |
|       84 | sakila/category                                      |   33 |      6 |    72 | Dynamic    |             0 | Single     |
|       85 | sakila/city                                          |   33 |      7 |    73 | Dynamic    |             0 | Single     |
|       86 | sakila/country                                       |   33 |      6 |    74 | Dynamic    |             0 | Single     |
|       87 | sakila/customer                                      |   33 |     12 |    75 | Dynamic    |             0 | Single     |
|       88 | sakila/film                                          |   33 |     16 |    76 | Dynamic    |             0 | Single     |
|       89 | sakila/film_actor                                    |   33 |      6 |    77 | Dynamic    |             0 | Single     |
|       90 | sakila/film_category                                 |   33 |      6 |    78 | Dynamic    |             0 | Single     |
|       91 | sakila/film_text                                     |   33 |      7 |    79 | Dynamic    |             0 | Single     |
|      103 | sakila/inventory                                     |   33 |      7 |    91 | Dynamic    |             0 | Single     |
|      104 | sakila/language                                      |   33 |      6 |    92 | Dynamic    |             0 | Single     |
|      105 | sakila/payment                                       |   33 |     10 |    93 | Dynamic    |             0 | Single     |
|      106 | sakila/rental                                        |   33 |     10 |    94 | Dynamic    |             0 | Single     |
|      107 | sakila/staff                                         |   33 |     14 |    95 | Dynamic    |             0 | Single     |
|      108 | sakila/store                                         |   33 |      7 |    96 | Dynamic    |             0 | Single     |
+----------+------------------------------------------------------+------+--------+-------+------------+---------------+------------+
28 rows in set (0.00 sec)

mysql> select * from INNODB_SYS_DATAFILES limit 5;
+-------+------------------------------+
| SPACE | PATH                         |
+-------+------------------------------+
|     2 | ./mysql/version.ibd          |
|     3 | ./mysql/character_sets.ibd   |
|     4 | ./mysql/collations.ibd       |
|     5 | ./mysql/tablespaces.ibd      |
|     6 | ./mysql/tablespace_files.ibd |
+-------+------------------------------+
5 rows in set (0.01 sec)

mysql> 

■ 参照
15.6 Data Dictionary Usage Differences
The MySQL 8.0.0 Milestone Release is available