0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

CentOS 6にMySQL 5.6をインストール(公式レポジトリ)

Last updated at Posted at 2019-11-16

はじめに

公式レポジトリを使ってCentOS6にMySQL5.6をインストール
親記事:MySQL, MariaDBの各種インストール方法とEOLまとめ - Qiita
参考:MySQL :: MySQL 5.6 リファレンスマニュアル :: 2.5.1 MySQL Yum リポジトリを使用して MySQL を Linux にインストールする

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 mysql56-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      enabled:  549
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      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:
... 略

PLEASE REMEMBER TO SET A PASSWORD FOR THE MySQL root USER !
To do so, start the server, then issue the following commands:

  /usr/bin/mysqladmin -u root password 'new-password'
  /usr/bin/mysqladmin -u root -h 95bca3a9c511 password 'new-password'

Alternatively you can run:

  /usr/bin/mysql_secure_installation

which will also give you the option of removing the test
databases and anonymous user created by default.  This is
strongly recommended for production servers.

See the manual for more instructions.

Please report any problems at http://bugs.mysql.com/

The latest information about MySQL is available on the web at

  http://www.mysql.com

Support MySQL by buying support/licenses at http://shop.mysql.com

Note: new default config file not created.
Please make sure your config file is current

WARNING: Default config file /etc/my.cnf exists on the system
This file will be read by default by the MySQL server
If you do not want to use this, either remove it, or use the
--defaults-file argument to mysqld_safe when starting the server

                                                           [  OK  ]
Starting mysqld:                                           [  OK  ]

# service mysqld status
mysqld (pid  404) 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  ]

# mysql -u root -e'select version();'
+-----------+
| version() |
+-----------+
| 5.6.46    |
+-----------+
0
0
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
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?