LoginSignup
3
1

More than 5 years have passed since last update.

MySQL5.7を触ってみました①

Posted at

 今更遅いですけど、MySQL5.7を触って始めました。
 まずはインストールです。

古いバージョンをアンインストール

既存環境のmysqlバージョンを確認します。

# rpm -qa | grep mysql
mysql-libs-5.1.71-1.el6.x86_64

古いバージョンを全部アンインストールします。

# yum -y remove mysql*

インストール開始

rpmをインストールします。

# yum install http://dev.mysql.com/get/mysql-community-release-el6-5.noarch.rpm

mysql5.7をインストールできるようにします。

mysql5.6のリポジトリを無効にします
# yum-config-manager --disable mysql56-community

mysql5.7のリポジトリを有効にします
# yum-config-manager --enable mysql57-community-dmr

これから、mysql5.7をインストールします。

# yum -y install mysql mysql-devel mysql-server mysql-utilities

事後確認

# rpm -qa | grep mysql
mysql-community-libs-5.7.10-1.el6.x86_64
mysql-connector-python-2.1.3-1.el6.x86_64
mysql-community-server-5.7.10-1.el6.x86_64
mysql-community-devel-5.7.10-1.el6.x86_64
mysql-community-release-el6-5.noarch
mysql-community-common-5.7.10-1.el6.x86_64
mysql-community-client-5.7.10-1.el6.x86_64

# mysql --version
mysql  Ver 14.14 Distrib 5.7.10, for Linux (x86_64) using  EditLine wrapper

起動

mysqlを起動して、ログインしてみます。

# /etc/init.d/mysqld start
Initializing MySQL database:                               [  OK  ]
Starting mysqld:                                           [  OK  ]

# cat /root/.mysql_secret
cat: /root/.mysql_secret: No such file or directory

あれ!?rootの初期パスワードを記述されるファイルがありません。調べましたら、/var/log/mysql.logに記述されると分かりました。

# cat /var/log/mysqld.log | grep password
2015-12-11T01:07:23.389684Z 1 [Note] A temporary password is generated for root@localhost: tW&R&:(36Kv9

rootパスワード変更

mysqlへログインして、rootをパスワードを変更します。

# mysql -u root -p
Enter password:<初期パスワード> 
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 4
Server version: 5.7.10

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> ALTER USER 'root'@'localhost' IDENTIFIED BY '<パスワード>';
Query OK, 0 rows affected (0.00 sec)

mysql5.7のパスワードポリシーの初期値はMEDIUMとなっていますので、以下の条件を満たす必要があります。

  • 大文字/小文字/数字/記号の全てが入っている
  • 長さが8文字以上

まとめ

 インストールはとてもシンプルです。
 MySQL5.7には150を超える新機能がありますので、これからもちょっとずつ触ってみたいと思います。

3
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
3
1