はじめに
公式レポジトリを使ってCentOS6にMySQL5.7をインストール
親記事:MySQL, MariaDBの各種インストール方法とEOLまとめ - Qiita
参考:MySQL :: MySQL 5.7 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
# yum-config-manager --disable mysql80-community
# yum-config-manager --enable mysql57-community
# 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 enabled: 360
mysql57-community-source MySQL 5.7 Community Server - So disabled
mysql80-community MySQL 8.0 Community Server disabled
mysql80-community-source MySQL 8.0 Community Server - So disabled
インストール
# 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 379) 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:21:12.143646Z 1 [Note] A temporary password is generated for root@localhost: I.D)a-,CI1kg
# mysql -uroot -p
mysql> ALTER USER 'root'@'localhost' IDENTIFIED BY 'MyNewPass4!';
Query OK, 0 rows affected (0.01 sec)
mysql> select version();
+-----------+
| version() |
+-----------+
| 5.7.28 |
+-----------+