MySQL5.7の導入手順

最近、MySQLに触れる機会が増えてきたので、勉強がてらテスト環境を構築しました。
気が向いたらPostgreSQLとの比較をするかもしれません。

今回は、Download MySQL Yum Repositoryページからrpmパッケージをダウンロードして導入します。
「mysql57-community-release-el7-9.noarch.rpm」がダウンロードできました。
(ダウンロードにはアカウントの取得が必要です)

レポジトリ登録

$ rpm -Uvh /tmp/mysql57-community-release-el7-9.noarch.rpm

yumパッケージで導入

$ yum install mysql-server

一度起動する

$ systemctl start mysqld

初期パスワードを確認

最近のMySQLサーバでは初期パスワードが設定されるので確認

$ cat /var/log/mysqld.log | grep password
2017-01-24T07:16:45.992736Z 1 [Note] A temporary password is generated for root@localhost: &Y83********

初期設定ツールを起動して設定する

$ mysql_secure_installation

現在のパスワード・新パスワードを設定すると、登録されてパスワード強度などが表示される

Enter password for user root:
New password:
Re-enter new password:

Estimated strength of the password: 100
Do you wish to continue with the password provided?(Press y|Y for Yes, any other key for No) : y

匿名ユーザは不要なので「y」

Remove anonymous users? (Press y|Y for Yes, any other key for No) : y
Success.

リモートからのrootログインは不要なので「y」

Disallow root login remotely? (Press y|Y for Yes, any other key for No) : y
Success.

testデータベースは不要なので「y」

Remove test database and access to it? (Press y|Y for Yes, any other key for No) : y

特権テーブルをリロードしない理由がないので「y」

Reload privilege tables now? (Press y|Y for Yes, any other key for No) : y

設定完了

All done!

コメントする