MySQL 8.0で憶えておいてほしいこ
と
Please remember them when you use MySQL 8.0
2017/10/23
yoku0825
MyNA(日本MySQLユーザ会)会 2017年10月
約2年前
About 2 years ago.
1/36
default_password_lifetime
= 360 ( < 5.7.11 )
2/36
パスワード変更から 360
日 でアカウントがロック
される
MySQL account will lock after
360 days during last
password changed
3/36
アップグレード
から
After upgrade to
5.7,
4/36
360日後に襲
ってくる
After 360 days,
5/36
_人人人人人人_
> 突然の死 <
 ̄Y^Y^Y^Y^ ̄
We dies suddenly!
6/36
default_password_lifetime = 360 ( < 5.7.11 )
もう直ってる(?)から気にしなくても大丈夫ですよ
This had been changed to 0, no problem‐
MySQL Bugs: #77277: default_password_lifetime
should be set 0 as implicit default value
Thank you Morgan and MySQL Server Team!‐
7/36
MySQL 8.0で憶え
ておいてほしいこと
Please remember them
when you use MySQL 8.0
(For Japanese)
8/36
\こんばんわ/
yoku0825@とある企業のDBA
オラクれない‐
ポスグれない‐
マイエスキューエる‐
生息域
Twitter: @yoku0825‐
Blog: 日々の覚書‐
MyNA ML: 日本MySQLユーザ会‐
MySQL Casual: Slack‐
9/36
「kamipoのハハ=パ
パ問題」を知ってい
ますか?
Do you know “kamipo’s
Mother-Father Issue” ?
10/36
kamipoのハハ=パパ問題
kamipo’s Mother-Father Issue
mysql> SELECT * FROM families;
+----+-----------+--------------+
| id | name | relationship |
+----+-----------+--------------+
| 1 | ユイ | 本人 |
| 2 | キリト | パパ |
| 3 | アスナ | ハハ |
+----+-----------+--------------+
11/36
kamipoのハハ=パパ問題
kamipo’s Mother-Father Issue
SELECT * FROM families WHERE relationship = 'パパ';
+----+-----------+--------------+
| id | name | relationship |
+----+-----------+--------------+
| 2 | キリト | パパ |
| 3 | アスナ | ハハ |
+----+-----------+--------------+
12/36
kamipoのハハ=パパ問題
kamipo’s Mother-Father Issue
元々はActiveRecordでは明示的に照合順序を指定しない場
合にcharset utf8で照合順序 utf8_unicode_ci にしてしまっ
てハハ=パパになる
Originally, this issue causes the default collation in
ActiveRecord when using charset utf8 was utf8_unicode_ci.
‐
UNICODEの仕様による 問題の派生
This is caused by UCA 4.0.0, same as Sushi-Beer Issue‐
ActiveRecordでデフォルトの照合順序を変更する
13/36
MySQL 8.0.1
The default value of the character_set_server and
character_set_database system variables has changed
from latin1 to utf8mb4.
The default value of the collation_server and
collation_database system variables has changed from
latin1_swedish_ci to utf8mb4_0900_ai_ci .
MySQL :: MySQL 8.0 Release Notes :: Changes in
MySQL 8.0.1 (2017-04-10, Development Milestone)
14/36
utf8mb4_0900_ai_ci
0900 .. Unicode Collation Algorithm 9.0.0ベース
Based on UCA 9.0.0‐
ai .. アクセントインセンシティブ
Accent insensitive‐
ci .. 大文字小文字を区別しない
Case insensitive‐
15/36
utf8mb4_0900_ai_ci
ハ と パ .. アクセントの違い(らしい)
よ と ょ .. ケースの違い(らしい)
と .. 食べたい
M と M .. 何の違いだか二重の意味でよくわからない
16/36
utf8mb4_0900_ai_ci
デフォルトではハハ=パパになる
Mother = Father is TRUE by default.‐
病院も美容院になる
Hospital = Beauty parior is TRUE, too.‐
= ではなくなった
= is FALSE, this is correct.‐
MySQL = MySQL(某WEBメディアにやさしい)
MySQL = MySQL is TRUE‐
17/36
!= のために失
ったものは大きい
(藁)
We lost too much for !
= (lol)
18/36
そんな我々を救うために(?)日本語用の照合順序が新設
された
Collation for Japanese language has been impremented.
utf8mb4_ja_0900_as_cs is the first Japanese language-
specific collation available for Unicode in MySQL.
MySQL :: MySQL 8.0 Release Notes :: Changes in MySQL
8.0.1 (2017-04-10, Development Milestone)
19/36
utf8mb4_ja_0900_as_cs
ja .. 日本語用
For Japanese language‐
0900 .. Unicode Collation Algorithm 9.0.0ベース
Based on UCA 9.0.0‐
as .. アクセントセンシティブ
Accent sensitive‐
cs .. 大文字小文字を区別する
Case sensitive‐
20/36
utf8mb4_ja_0900_as_cs_ks
ja .. 日本語用
For Japanese language‐
0900 .. Unicode Collation Algorithm 9.0.0ベース
Based on UCA 9.0.0‐
as .. アクセントセンシティブ
Accent sensitive‐
cs .. 大文字小文字を区別する
Case sensitive‐
ks .. ひらがなとカタカナを区別する
Kana sensitive‐
21/36
絶対噛む
I can’t pronounce
utf8mb4_ja_0900_as_cs
smoothly.
22/36
Collations
collation ハハ != パパ びょういん != び
よういん
!= MySQL = MyS
QL
utf8mb4_gen
eral_ci
o o x x
utf8mb4_090
0_ai_ci
x x o o
utf8mb4_ja_
0900_as_cs
o o o o
utf8mb4_bin o o o x
23/36
デフォルト “だけ” が
日本語にやさしくない
Only default setting isn’t
kind for Japanese language
24/36
というわけで秘伝のタレに追加しておいてくだしあ
Please put following lines into your my.cnf.
### デフォルトといっしょ
character_set_server = utf8mb4
### ハ = は をしたい場合は as_cs, そうでなければbin
collation_server = utf8mb4_ja_0900_as_cs
#collation_server = utf8mb4_bin
25/36
これはデバッグビルドでの比較なので数値自体はアテにし
ない
”=” Benchmark
https://gist.github.com/
yoku0825/5cf3917322d27134c56ca017baaf6321
‐
“ORDER BY” Benchmark
https://gist.github.com/
yoku0825/63cd4ff7f240131b41d34c820a455858
‐
必要に応じて各自でベンチを!
Evaluate for your production by yourself‐
26/36
デフォルトでONになったパラメーター
ON by default
log_bin まあこれは知ってりゃ問題ないか
log_slave_updates スレーブの容量に注意
explicit_defaults_for_timestamp TIMESTAMP型のON UPDATE TIMESTAMP
の動作が変わる
event_scheduler 変なバックグラウンドスレッドが浮くけど
気にしないで
innodb_undo_log_truncate これのトリムで重くなる…可能性もある(ど
れくらいでへたれるのか未検証)
27/36
なくなったパラメーター
Removed parameters
my.cnfに残ってると Unknown variable って言われるので消
しておきましょう
innodb_file_format Barracuda固定
innodb_large_prefix ON固定
ignore_db_dir データディクショナリーがファイルベース
からInnoDBに変更
query_cache_* ついになくなったんじゃよ
28/36
変更されたパラメーター
Changed parameters
innodb_dedicated_server InnoDBのパラメーターいくつかが自動サイ
ジング
expire_logs_days=30 今までは0、binlog_expire_logs_seconds
とは 足し算
innodb_undo_tablespaces=2 ただし再起動だけでサクッと再作成してく
れる
innodb_autoinc_lock_mode=2 binlog_format=STATEMENTだとレプリケ
ーション壊れる
local_infile=FALSE LOAD DATA LOCAL INFILEできない
master_info_repository=TABLE master.infoファイルができなくなる
relay_log_info_repository=TABLE relay_log.infoファイルができなくなる
symbolic_links シンボリックリンク使えない
29/36
その他思うところ
The others which I had seen
“ROLE” が予約語になった
“ROLE” becomes reserved word‐
前、SonarQubeさんがこれで死んだ
My SonarQube raised error(1 years ago)
‐
TempTable Storage Engineって紹介されてる?
What is TempTable Storage Engine?‐
internal_tmp_mem_storage_engine = TempTable(Default) or
MEMORYってなってるけど
temptable_max_ram = 1Gって大きくない?
‐
password_history は(今のところ)デフォルト0
password_history is set to 0 (at least now)‐
30/36
(ここには当日だ
けのお楽しみペー
ジがありました)
31/36
おまけ
An addition
32/36
おまけ
An addition
??「今まで言ってなかったけどMySQL 8.0.4はRC2!」
We didn’t talk officialy yet, 8.0.4 becomes as RC2‐
ぼく「うん、知ってた」
I knew it‐
33/36
 
MySQL :: MySQL 8.0 Release Notes
34/36
おまけ
An addition
ちなみに次はMySQL 9.0.0?
Will the next MySQL be 9.0.0?‐
MySQL Bugs: #79269: Failure of auth_socket
authentication with sha256_password as default
35/36
Stay
tuned!!
36/36

MySQL 8.0で憶えておいてほしいこと