豚吐露@wiki

install

最終更新:

Bot(ページ名リンク)

- view
管理者のみ編集可

MySQL install

CentOS 6.4 64bit
MySQL 5.6.13


  • download
bundleはなrpmがtarで固められているfile。個別downloadでもokなので必要なrpmを揃える。
必要なrpmは、普通に使いたいだけの人なら client,devel,server,shared,shared-compat。

for 32bit OS
http://dev.mysql.com/get/Downloads/MySQL-5.6/MySQL-5.6.13-1.el6.i686.rpm-bundle.tar/from/http://cdn.mysql.com/
or
http://dev.mysql.com/get/Downloads/MySQL-5.6/MySQL-client-5.6.13-1.el6.i686.rpm/from/http://cdn.mysql.com/
http://dev.mysql.com/get/Downloads/MySQL-5.6/MySQL-devel-5.6.13-1.el6.i686.rpm/from/http://cdn.mysql.com/
http://dev.mysql.com/get/Downloads/MySQL-5.6/MySQL-server-5.6.13-1.el6.i686.rpm/from/http://cdn.mysql.com/
http://dev.mysql.com/get/Downloads/MySQL-5.6/MySQL-shared-5.6.13-1.el6.i686.rpm/from/http://cdn.mysql.com/
http://dev.mysql.com/get/Downloads/MySQL-5.6/MySQL-shared-compat-5.6.13-1.el6.i686.rpm/from/http://cdn.mysql.com/

for 64bit OS
http://dev.mysql.com/get/Downloads/MySQL-5.6/MySQL-5.6.13-1.el6.x86_64.rpm-bundle.tar/from/http://cdn.mysql.com/
or
http://dev.mysql.com/get/Downloads/MySQL-5.6/MySQL-client-5.6.13-1.el6.x86_64.rpm/from/http://cdn.mysql.com/
http://dev.mysql.com/get/Downloads/MySQL-5.6/MySQL-devel-5.6.13-1.el6.x86_64.rpm/from/http://cdn.mysql.com/
http://dev.mysql.com/get/Downloads/MySQL-5.6/MySQL-server-5.6.13-1.el6.x86_64.rpm/from/http://cdn.mysql.com/
http://dev.mysql.com/get/Downloads/MySQL-5.6/MySQL-shared-5.6.13-1.el6.x86_64.rpm/from/http://cdn.mysql.com/
http://dev.mysql.com/get/Downloads/MySQL-5.6/MySQL-shared-compat-5.6.13-1.el6.x86_64.rpm/from/http://cdn.mysql.com/


client MySQL Client。
devel 開発用。コンパイルに必要なライブラリなどが含まれる。
embedded 組み込みMySQLサーバー用ライブラリ。
server MySQL Server本体
shared MySQL5に必要なライブラリが含まれたパッケージ。
shared-compat 旧環境のMySQL(3とか4とか)のライブラリを含んだパッケージ。
test MySQLのテストスイート
※officialにはsharedとshared-compatは排他利用だって書いてあるけど、これはMySQL5.5.5より前の話。MySQL5.5.5からはsharedとshared-compatは独立したパッケージになってるので、両方installしてok。と言うか、CentOSでは両方installしないとダメだったり...(´д`;)

c.f.)
# rpm -qip MySQL-shared-compat-5.6.13-1.el6.x86_64.rpm
Description :
This package includes the shared client libraries for previous MySQL versions.
Install this package, if you have applications that are dynamically linked
against older versions of the MySQL client library and you want to upgrade
to MySQL 5.6.13 without breaking the library dependencies.
Up to MySQL 5.5.5, this package also contains the current version of the
shared client library, so it should be installed instead of "MySQL-shared",
Starting from MySQL 5.5.6, this package contains only the older versions of the
library, so it can be installed together with and independent of "MySQL-shared".

  • install
必要なライブラリは環境によって異なるが...
とりあえず、client,devel,server,shared,shared-compatがあればok。
# ls -l
total 83304
-rw-r--r-- 1 root root 18533672 Jul 12 21:04 MySQL-client-5.6.13-1.el6.x86_64.rpm
-rw-r--r-- 1 root root 3329616 Jul 12 21:04 MySQL-devel-5.6.13-1.el6.x86_64.rpm
-rw-r--r-- 1 root root 57528120 Jul 12 21:05 MySQL-server-5.6.13-1.el6.x86_64.rpm
-rw-r--r-- 1 root root 1936780 Jul 12 21:06 MySQL-shared-5.6.13-1.el6.x86_64.rpm
-rw-r--r-- 1 root root 3969908 Jul 12 21:06 MySQL-shared-compat-5.6.13-1.el6.x86_64.rpm
# yum install *.rpm

CentOS 6.4には既にMySQL5系用のlibが入ってるんだけど、5.6では不要なので勝手に削除されてる。
# cat /var/log/yum.log
Sep 09 18:36:21 Installed: libaio-0.3.107-10.el6.x86_64
Sep 09 18:36:49 Installed: MySQL-server-5.6.13-1.el6.x86_64
Sep 09 18:36:49 Installed: MySQL-shared-5.6.13-1.el6.x86_64
Sep 09 18:36:50 Installed: MySQL-shared-compat-5.6.13-1.el6.x86_64
Sep 09 18:36:55 Installed: MySQL-client-5.6.13-1.el6.x86_64
Sep 09 18:36:58 Installed: MySQL-devel-5.6.13-1.el6.x86_64
Sep 09 18:36:58 Erased: mysql-libs

version確認。
# mysql --version
mysql Ver 14.14 Distrib 5.6.13, for Linux (x86_64) using EditLine wrapper

  • first settings
まずはmysqlを起動。
# service mysql start
Starting MySQL.. SUCCESS!

root userのpasswordを確認。root userのpasswordは、『/root/.mysql_secret』ってfileが作られてて、その中に書いてある。
# cat .mysql_secret
# The random password set for the root user at Mon Sep 9 18:36:44 2013 (local time): ********

確認したら、以下のコマンドを実行。
# mysql_secure_installation
service起動してなかったら動かないから注意。
NOTE: RUNNING ALL PARTS OF THIS SCRIPT IS RECOMMENDED FOR ALL MySQL
      SERVERS IN PRODUCTION USE! PLEASE READ EACH STEP CAREFULLY!

In order to log into MySQL to secure it, we'll need the current
password for the root user. If you've just installed MySQL, and
you haven't set the root password yet, the password will be blank,
so you should just press enter here.

Enter current password for root (enter for none):
OK, successfully used password, moving on...

Setting the root password ensures that nobody can log into the MySQL
root user without the proper authorisation.

You already have a root password set, so you can safely answer 'n'.

Change the root password? [Y/n] Y
New password:
Re-enter new password:
Password updated successfully!
Reloading privilege tables..
 ... Success!


By default, a MySQL installation has an anonymous user, allowing anyone
to log into MySQL without having to have a user account created for
them. This is intended only for testing, and to make the installation
go a bit smoother. You should remove them before moving into a
production environment.

Remove anonymous users? [Y/n] Y
 ... Success!

Normally, root should only be allowed to connect from 'localhost'. This
ensures that someone cannot guess at the root password from the network.

Disallow root login remotely? [Y/n] Y
 ... Success!

By default, MySQL comes with a database named 'test' that anyone can
access. This is also intended only for testing, and should be removed
before moving into a production environment.

Remove test database and access to it? [Y/n] Y
 - Dropping test database...
 ... Success!
 - Removing privileges on test database...
 ... Success!

Reloading the privilege tables will ensure that all changes made so far
will take effect immediately.

Reload privilege tables now? [Y/n] Y
 ... Success!




All done! If you've completed all of the above steps, your MySQL
installation should now be secure.

Thanks for using MySQL!


Cleaning up...

いっぱい出てくるけど、やってることは...
■ ルートのパスワード変えますか?(y/n)
  →yだと新しいパスワードを2回入力させられる。
■ アノニマスユーザを削除しますか?(y/n)
■ リモートからのrootユーザログインを禁止しますか?(y/n)
■ テスト用データベース及びアクセスを削除しますか?(y/n)
■ 権限テーブルを再読み込みしますか?(y/n)
全部Yで良い感じの質問。(*´ω`)

serviceの自動起動設定。
これは多分勝手に設定されてる。
# chkconfig --list | grep mysql
mysql           0:off 1:off 2:on 3:on 4:on 5:on 6:off
設定されてなかったら以下を実行。
# chkconfig mysql on



更新日: 2013年09月10日 (火) 19時22分09秒

名前:
コメント:

すべてのコメントを見る
記事メニュー
ウィキ募集バナー