MySQL5.7.6DMRが今月リリースされて、色々な機能追加や改善が施されているので、
DMRのうちに少しずつ検証してRCとGAに備えたいと思います。
とりあえず、本日は初期設定まで。
MySQL 5.7 Release Notes
http://dev.mysql.com/doc/relnotes/mysql/5.7/en/index.html
ダウンロードサイトからDMRをダウンロードしてきてあります。
mysql-5.7.6-m16-linux-glibc2.5-x86_64.tar.gz
[root@misc01 admin]# cd /usr/local/ [root@misc01 local]# ls -l 合計 545048 drwxr-xr-x. 2 root root 6 6月 10 2014 bin drwxr-xr-x. 2 root root 6 6月 10 2014 etc drwxr-xr-x. 2 root root 6 6月 10 2014 games drwxr-xr-x. 2 root root 6 6月 10 2014 include drwxr-xr-x. 2 root root 6 6月 10 2014 lib drwxr-xr-x. 2 root root 6 6月 10 2014 lib64 drwxr-xr-x. 2 root root 6 6月 10 2014 libexec -rw-rw-r--. 1 admin admin 558127440 3月 28 06:49 mysql-5.7.6-m16-linux-glibc2.5-x86_64.tar.gz drwxr-xr-x. 2 root root 6 6月 10 2014 sbin drwxr-xr-x. 5 root root 46 3月 28 07:02 share drwxr-xr-x. 2 root root 6 6月 10 2014 src [root@misc01 local]# [root@misc01 local]# tar xzvf mysql-5.7.6-m16-linux-glibc2.5-x86_64.tar.gz [root@misc01 local]# groupadd mysql [root@misc01 local]# useradd -r -g mysql mysql [root@misc01 local]# ls -l 合計 545052 drwxr-xr-x. 2 root root 6 6月 10 2014 bin drwxr-xr-x. 2 root root 6 6月 10 2014 etc drwxr-xr-x. 2 root root 6 6月 10 2014 games drwxr-xr-x. 2 root root 6 6月 10 2014 include drwxr-xr-x. 2 root root 6 6月 10 2014 lib drwxr-xr-x. 2 root root 6 6月 10 2014 lib64 drwxr-xr-x. 2 root root 6 6月 10 2014 libexec drwxr-xr-x. 11 root root 4096 3月 28 08:30 mysql-5.7.6-m16-linux-glibc2.5-x86_64 -rw-rw-r--. 1 admin admin 558127440 3月 28 06:49 mysql-5.7.6-m16-linux-glibc2.5-x86_64.tar.gz drwxr-xr-x. 2 root root 6 6月 10 2014 sbin drwxr-xr-x. 5 root root 46 3月 28 07:02 share drwxr-xr-x. 2 root root 6 6月 10 2014 src [root@misc01 local]# ln -s mysql-5.7.6-m16-linux-glibc2.5-x86_64 mysql [root@misc01 local]# ls -l 合計 545052 drwxr-xr-x. 2 root root 6 6月 10 2014 bin drwxr-xr-x. 2 root root 6 6月 10 2014 etc drwxr-xr-x. 2 root root 6 6月 10 2014 games drwxr-xr-x. 2 root root 6 6月 10 2014 include drwxr-xr-x. 2 root root 6 6月 10 2014 lib drwxr-xr-x. 2 root root 6 6月 10 2014 lib64 drwxr-xr-x. 2 root root 6 6月 10 2014 libexec lrwxrwxrwx. 1 root root 37 3月 28 08:32 mysql -> mysql-5.7.6-m16-linux-glibc2.5-x86_64 drwxr-xr-x. 11 root root 4096 3月 28 08:30 mysql-5.7.6-m16-linux-glibc2.5-x86_64 -rw-rw-r--. 1 admin admin 558127440 3月 28 06:49 mysql-5.7.6-m16-linux-glibc2.5-x86_64.tar.gz drwxr-xr-x. 2 root root 6 6月 10 2014 sbin drwxr-xr-x. 5 root root 46 3月 28 07:02 share drwxr-xr-x. 2 root root 6 6月 10 2014 src [root@misc01 local]#
展開して初期DBを設定します
5.7以降で設定方法が変わっていたのを忘れていました… 詳細は此方をご確認ください。
2.9.1.1 Initializing the Data Directory Using mysqld
http://dev.mysql.com/doc/refman/5.7/en/data-directory-initialization-mysqld.html
4.4.2 mysql_install_db — Initialize MySQL Data Directory
http://dev.mysql.com/doc/refman/5.7/en/mysql-install-db.html
初期root用のpasswordもこちらでランダムに作成されています。
初回ログイン時に変更してしまいましょう。
[root@misc01 local]# cd mysql [root@misc01 mysql]# chown -R mysql . [root@misc01 mysql]# chgrp -R mysql . [root@misc01 mysql]# scripts/mysql_install_db --user=mysql bash: scripts/mysql_install_db: そのようなファイルやディレクトリはありません [root@misc01 mysql]# bin/mysqld --initialize --user=mysql 2015-03-27T23:40:52.379590Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details). 2015-03-27T23:40:53.301410Z 0 [Warning] InnoDB: New log files created, LSN=45790 2015-03-27T23:40:53.421318Z 0 [Warning] InnoDB: Creating foreign key constraint system tables. 2015-03-27T23:40:53.487611Z 0 [Warning] Failed to setup SSL 2015-03-27T23:40:53.487667Z 0 [Warning] SSL error: SSL context is not usable without certificate and private key 2015-03-27T23:40:53.490120Z 1 [Warning] A temporary password is generated for root@localhost: Bfd,psIvR4*e [root@misc01 mysql]# chown -R root . [root@misc01 mysql]# chown -R mysql data
初期設定が終わったので、起動してログインしてみます。
[root@misc01 mysql]# bin/mysqld_safe --user=mysql & [1] 4910 [root@misc01 mysql]# 150328 08:51:25 mysqld_safe Logging to '/usr/local/mysql/data/misc01.err'. 150328 08:51:25 mysqld_safe Starting mysqld daemon with databases from /usr/local/mysql/data [root@misc01 mysql]# [root@misc01 mysql]# ./bin/mysql -u root -p Enter password: Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 2 Server version: 5.7.6-m16 Copyright (c) 2000, 2015, 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 | +-----------+ | 5.7.6-m16 | +-----------+ 1 row in set (0.01 sec) mysql> mysql> ALTER USER 'root'@'localhost' IDENTIFIED BY 'password'; Query OK, 0 rows affected (0.00 sec) mysql> exit Bye [root@misc01 mysql]# [root@misc01 mysql]# ps -ef | grep mysql root 4910 1883 0 08:51 pts/0 00:00:00 /bin/sh bin/mysqld_safe --user=mysql mysql 4992 4910 0 08:51 pts/0 00:00:00 /usr/local/mysql/bin/mysqld --basedir=/usr/local/mysql --datadir=/usr/local/mysql/data --plugin-dir=/usr/local/mysql/lib/plugin --user=mysql --log-error=/usr/local/mysql/data/misc01.err --pid-file=/usr/local/mysql/data/misc01.pid root 5024 1883 0 08:56 pts/0 00:00:00 grep --color=auto mysql [root@misc01 mysql]# kill 4992 [root@misc01 mysql]# 150328 08:56:32 mysqld_safe mysqld from pid file /usr/local/mysql/data/misc01.pid ended [1]+ 終了 bin/mysqld_safe --user=mysql [root@misc01 mysql]# ps -ef | grep mysql root 5030 1883 0 08:56 pts/0 00:00:00 grep --color=auto mysql [root@misc01 mysql]#
起動ファイルのBASE, DATAディレクトリーを記入してファイルをコピー
[root@misc01 support-files]# pwd /usr/local/mysql/support-files [root@misc01 support-files]# vi mysql.server [root@misc01 support-files]# cp -p mysql.server /etc/init.d/ [root@misc01 support-files]# /etc/init.d/mysql.server start Starting MySQL. SUCCESS! [root@misc01 support-files]#
MySQLにroot以外の追加の管理者アカウントを追加してみます。
GRANTでアカウントを作成するのはやめて、CREATE USERで作成した方が良いですね。
[root@misc01 support-files]# /usr/local/mysql/bin/mysql -u root -p Enter password: Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 2 Server version: 5.7.6-m16 MySQL Community Server (GPL) Copyright (c) 2000, 2015, 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> GRANT ALL PRIVILEGES ON *.* TO admin@'%' IDENTIFIED BY 'password' WITH GRANT OPTION; Query OK, 0 rows affected, 1 warning (0.00 sec) mysql> show warnings; +---------+------+------------------------------------------------------------------------------------------------------------------------------------+ | Level | Code | Message | +---------+------+------------------------------------------------------------------------------------------------------------------------------------+ | Warning | 1287 | Using GRANT for creating new user is deprecated and will be removed in future release. Create new user with CREATE USER statement. | +---------+------+------------------------------------------------------------------------------------------------------------------------------------+ 1 row in set (0.00 sec)
5.7からは、mysql.userテーブルからpasswordという列が無くなってますね。
mysql> select user,host,password from mysql.user; ERROR 1054 (42S22): Unknown column 'password' in 'field list' mysql> select user,host,authentication_string from mysql.user; +-------+-----------+-------------------------------------------+ | user | host | authentication_string | +-------+-----------+-------------------------------------------+ | root | localhost | *A41ECFBE1191DDE4713F2B6F5A6CD5D0D0D5DC35 | | admin | % | *A41ECFBE1191DDE4713F2B6F5A6CD5D0D0D5DC35 | +-------+-----------+-------------------------------------------+ 2 rows in set (0.00 sec) mysql>
その他、アカウントのパスワード期限など、コンプライアンス対応に使えそうなフィールドが増えています。
※ CentOSなどでは,MariaDBさんの/etc/my.cnfがあるので初期設定時にエラーになったりするので初期設定時に削除しています。
ここら辺、名前が被らない方がユーザー的には有難いです。