RDBMS は普段 MariaDB しか使わないので備忘録。
レポジトリ設定
yum localinstall http://dev.mysql.com/get/mysql80-community-release-el7-1.noarch.rpm
以下の2つのレポジトリが設定されます。
/etc/yum.repos.d
-rw-r--r--. 1 root root 1864 Feb 22 08:49 mysql-community.repo
-rw-r--r--. 1 root root 1885 Feb 22 08:49 mysql-community-source.repo
yumでインストール
yum -y install mysql-community-server
systemctl start mysqld
初期passwordは /var/log/mysqld.log に記載されています。
/var/log/mysqld.log
2018-05-22T16:47:07.339688Z 5 [Note] [MY-010454] [Server] A temporary password is generated for root@localhost: jo;Fa5g&14DT
grep "temporary password" /var/log/mysqld.log
するといいと思います。
mysql -uroot -p
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 11
Server version: 8.0.11 MySQL Community Server - GPL
Copyright (c) 2000, 2018, 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>
mysql_secure_installation
お約束の mysql_secure_installation を実行してrootユーザのパスワード変更等を行います。
ユーザ作成
リモートのクライアントから接続できるようにユーザを作成してみます。
mysql> create user remoteuser@'%' identified by 'p@ssW0rd';
mysql> grant all on *.* to remoteuser@'%';
mysql> flush privileges;
authentication plugin 'caching_sha2_password' cannot be loaded
デフォルトの認証プラグインが caching_sha2_password に変更されていて、MySQL Workbench をもってしても接続できなくなっているようです。
my.cnf の mysqld セクションに以下の設定を追加して mysql_native_password を選択されるようにしたら、MySQL Workbench でも HeidiSQL でも接続できることを確認しました。
/etc/my.cnf
[mysqld]
default_authentication_plugin=mysql_native_password