はじめに
公式レポジトリを使ってCentOS6にMySQL8.0をインストール
親記事:MySQL, MariaDBの各種インストール方法とEOLまとめ - Qiita
参考:MySQL :: MySQL 8.0 Reference Manual :: 2.5.1 Installing MySQL on Linux Using the MySQL Yum Repository
LOG
レポジトリ登録
# yum install -y yum-utils
# yum install -y https://dev.mysql.com/get/mysql80-community-release-el6-3.noarch.rpm
# yum repolist all | grep mysql
mysql-cluster-7.5-community MySQL Cluster 7.5 Community disabled
mysql-cluster-7.5-community-source MySQL Cluster 7.5 Community - S disabled
mysql-cluster-7.6-community MySQL Cluster 7.6 Community disabled
mysql-cluster-7.6-community-source MySQL Cluster 7.6 Community - S disabled
mysql-cluster-8.0-community MySQL Cluster 8.0 Community disabled
mysql-cluster-8.0-community-source MySQL Cluster 8.0 Community - S disabled
mysql-connectors-community MySQL Connectors Community enabled: 113
mysql-connectors-community-source MySQL Connectors Community - So disabled
mysql-tools-community MySQL Tools Community enabled: 84
mysql-tools-community-source MySQL Tools Community - Source disabled
mysql-tools-preview MySQL Tools Preview disabled
mysql-tools-preview-source MySQL Tools Preview - Source disabled
mysql55-community MySQL 5.5 Community Server disabled
mysql55-community-source MySQL 5.5 Community Server - So disabled
mysql56-community MySQL 5.6 Community Server disabled
mysql56-community-source MySQL 5.6 Community Server - So disabled
mysql57-community MySQL 5.7 Community Server disabled
mysql57-community-source MySQL 5.7 Community Server - So disabled
mysql80-community MySQL 8.0 Community Server enabled: 127
mysql80-community-source MySQL 8.0 Community Server - So disabled
mysql80以降が標準になったら下記コマンドで有効レポジトリを切り替える
# yum-config-manager --disable mysql80-community
# yum-config-manager --enable mysql80-community
インストール
# cat /etc/redhat-release
CentOS release 6.10 (Final)
# yum install -y mysql-server
... 略
mysql起動/停止
# service mysqld start
Initializing MySQL database: [ OK ]
Starting mysqld: [ OK ]
# service mysqld status
mysqld (pid 383) is running...
# service mysqld stop
Stopping mysqld: [ OK ]
# service mysqld status
mysqld is stopped
mysql自動起動設定/設定解除
# chkconfig mysqld on
# chkconfig --list mysqld
mysqld 0:off 1:off 2:on 3:on 4:on 5:on 6:off
# chkconfig mysqld off
# chkconfig --list mysqld
mysqld 0:off 1:off 2:off 3:off 4:off 5:off 6:off
各種確認
# service mysqld start
Starting mysqld: [ OK ]
# grep 'temporary password' /var/log/mysqld.log
2019-11-16T10:49:21.139772Z 5 [Note] [MY-010454] [Server] A temporary password is generated for root@localhost: d;0-t6xT,,fx
# mysql -uroot -p
mysql> ALTER USER 'root'@'localhost' IDENTIFIED BY 'MyNewPass4!';
Query OK, 0 rows affected (0.01 sec)
mysql> select version();
+-----------+
| version() |
+-----------+
| 8.0.18 |
+-----------+