ServersMan@VPS mysql-server5.5 のインストール

スポンサーリンク

今回は、remiのレポジトリを用いて、MySQL-Server5.5をインストールする。

インストールに先立ちremiのレポジトリが必要になるので、以下リンク先を参考に用意してくれ。

yumレポジトリの「remi」を追加する@CentOS5.5

 

1. MySQL-Serverのインストール。

同時に依存関係で複数のパッケージがインストールされます。

[root@mail ~]# yum install mysql-server --enablerepo=remi
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
 * base: ftp.iij.ad.jp
 * epel: ftp.iij.ad.jp
 * extras: ftp.iij.ad.jp
 * remi: remirpm.mirror.gymkl.ch
 * updates: ftp.iij.ad.jp
base                                                                                  | 1.1 kB     00:00
epel                                                                                  | 3.7 kB     00:00
extras                                                                                | 2.1 kB     00:00
remi                                                                                  | 2.5 kB     00:00
updates                                                                               | 1.9 kB     00:00
vz-base                                                                               |  951 B     00:00
vz-updates                                                                            |  951 B     00:00
Setting up Install Process
Resolving Dependencies
--> Running transaction check
---> Package mysql-server.i386 0:5.5.12-1.el5.remi set to be updated
--> Processing Dependency: mysql = 5.5.12-1.el5.remi for package: mysql-server
--> Processing Dependency: mysql-libs = 5.5.12-1.el5.remi for package: mysql-server
--> Processing Dependency: libaio.so.1(LIBAIO_0.4) for package: mysql-server
--> Processing Dependency: libaio.so.1 for package: mysql-server
--> Processing Dependency: perl-DBD-MySQL for package: mysql-server
--> Processing Dependency: libaio.so.1(LIBAIO_0.1) for package: mysql-server
--> Running transaction check
---> Package libaio.i386 0:0.3.106-5 set to be updated
--> Processing Dependency: libmysqlclient.so.15 for package: dovecot
--> Processing Dependency: libmysqlclient.so.15 for package: perl-DBD-MySQL
--> Processing Dependency: libmysqlclient.so.15(libmysqlclient_15) for package: dovecot
--> Processing Dependency: libmysqlclient.so.15(libmysqlclient_15) for package: perl-DBD-MySQL
---> Package mysql.i386 0:5.5.12-1.el5.remi set to be updated
---> Package mysql-libs.i386 0:5.5.12-1.el5.remi set to be updated
---> Package perl-DBD-MySQL.i386 0:3.0007-2.el5 set to be updated
--> Running transaction check
---> Package mysqlclient15.i386 0:5.0.67-1.el5.remi set to be updated
--> Finished Dependency Resolution

Dependencies Resolved

=============================================================================================================
 Package                      Arch               Version                            Repository          Size
=============================================================================================================
Installing:
 mysql-server                 i386               5.5.12-1.el5.remi                  remi                12 M
Installing for dependencies:
 libaio                       i386               0.3.106-5                          base                19 k
 mysql-libs                   i386               5.5.12-1.el5.remi                  remi               1.1 M
 mysqlclient15                i386               5.0.67-1.el5.remi                  remi               1.3 M
 perl-DBD-MySQL               i386               3.0007-2.el5                       base               148 k
Updating for dependencies:
 mysql                        i386               5.5.12-1.el5.remi                  remi               7.5 M

Transaction Summary
=============================================================================================================
Install       5 Package(s)
Upgrade       1 Package(s)

Total download size: 22 M
Is this ok [y/N]: y
Downloading Packages:
(1/6): libaio-0.3.106-5.i386.rpm                                                      |  19 kB     00:00
(2/6): perl-DBD-MySQL-3.0007-2.el5.i386.rpm                                           | 148 kB     00:00
(3/6): mysql-libs-5.5.12-1.el5.remi.i386.rpm                                          | 1.1 MB     00:03
(4/6): mysqlclient15-5.0.67-1.el5.remi.i386.rpm                                       | 1.3 MB     00:00
(5/6): mysql-5.5.12-1.el5.remi.i386.rpm                                               | 7.5 MB     00:06
(6/6): mysql-server-5.5.12-1.el5.remi.i386.rpm                                        |  12 MB     00:09
-------------------------------------------------------------------------------------------------------------
Total                                                                        1.0 MB/s |  22 MB     00:22
Running rpm_check_debug
Running Transaction Test
Finished Transaction Test
Transaction Test Succeeded
Running Transaction

WARNING : This MySQL RPM is not an official Fedora/Redhat build and it
overrides the official one. Don't file bugs on Fedora Project nor Redhat.
Use dedicated forums http://forums.famillecollet.com/

 Installing     : mysql-libs                                                                            1/7
 Installing     : mysqlclient15                                                                         2/7
 Installing     : perl-DBD-MySQL                                                                        3/7
 Updating       : mysql                                                                                 4/7
 Installing     : libaio                                                                                5/7
 Installing     : mysql-server                                                                          6/7
 Cleanup        : mysql                                                                                 7/7

Installed:
 mysql-server.i386 0:5.5.12-1.el5.remi

Dependency Installed:
 libaio.i386 0:0.3.106-5                                mysql-libs.i386 0:5.5.12-1.el5.remi
 mysqlclient15.i386 0:5.0.67-1.el5.remi                 perl-DBD-MySQL.i386 0:3.0007-2.el5

Dependency Updated:
 mysql.i386 0:5.5.12-1.el5.remi

Complete!
[root@mail ~]#

2. MySQLサーバを起動します。

初回のみずらーっとメッセージが表示されますが気にしないで下さい。

[root@mail ~]# service mysqld start

3. MySQLサーバの初期設定を行うために「/usr/bin/mysql_secure_installation」を実行します。

対話的にrootパスワードの設定や、アノニマスユーザの削除、初期テストDBの削除が出来ます。

[root@mail ~]# /usr/bin/mysql_secure_installation

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): Enter
OK, successfully used password, moving on...

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

Set root password? [Y/n] y ← rootパスワードを設定します宣言。
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 ←rootユーザのリモートアクセス制限
 ... 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 ←テストDB削除します宣言
 - 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!

Cleaning up...

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

Thanks for using MySQL!

[root@mail ~]#

4. 設定ファイル/etc/my.cnfのバックアップを取り、編集します。

[root@mail ~]# cp -p /etc/my.cnf  /etc/my.cnf.ORG
[root@mail ~]# vi /etc/my.cnf
[mysqld]
datadir=/var/lib/mysql
socket=/var/lib/mysql/mysql.sock
user=mysql
# Disabling symbolic-links is recommended to prevent assorted security risks
symbolic-links=0
character-set-server = utf8 ←追加
bind-address=127.0.0.1 ←追加

# Semisynchronous Replication
# http://dev.mysql.com/doc/refman/5.5/en/replication-semisync.html
# uncomment next line on MASTER
;plugin-load=rpl_semi_sync_master=semisync_master.so
# uncomment next line on SLAVE
;plugin-load=rpl_semi_sync_slave=semisync_slave.so

# Others options for Semisynchronous Replication
;rpl_semi_sync_master_enabled=1
;rpl_semi_sync_master_timeout=10
;rpl_semi_sync_slave_enabled=1

# http://dev.mysql.com/doc/refman/5.5/en/performance-schema.html
;performance_schema

[mysql] ←追加
default-character-set = utf8 ←追加

[mysqld_safe]
log-error=/var/log/mysqld.log
pid-file=/var/run/mysqld/mysqld.pid

設定を反映させるには、MySQLサーバを再起動します。

[root@mail ~]# service mysqld restart

5. サーバにログインできるか確認しましょう。

[root@mail ~]# mysql -u root -p
Enter password: パスワード(不可視)
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 2
Server version: 5.5.12 MySQL Community Server (GPL) by Remi

Copyright (c) 2000, 2010, 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> exit
Bye
[root@mail ~]#

6. サーバ起動時に自動で起動するように設定します。

[現在の設定確認]

[root@mail ~]# chkconfig --list mysqld
mysqld          0:off   1:off   2:off   3:off   4:off   5:off   6:off
[root@mail ~]#

[設定変更]

[root@mail ~]# chkconfig mysqld on

[変更後確認]

[root@mail ~]# chkconfig --list mysqld
mysqld          0:off   1:off   2:on    3:on    4:on    5:on    6:off
[root@mail ~]#

以上で完了です。

注意点

MySQL5.5からは、/etc/my.cnfの [mysqld] にて、「default-character-set」を使用すると
以下のエラーでMySQLサーバの起動が出来ません。

 [ERROR] /usr/libexec/mysqld: unknown variable 'default-character-set=utf8'

MySQLサーバ5.5からは、「character-set-server」を使用します。

 

不明点などあればコメント or コンタクトme.

 

コメント

  1. […] ServersMan@VPS PHP5.3.6 + MySQL5.5.13 のインストール ServersMan@VPS契約ServersMan@VPS mysql-server5.5 のインストール […]

タイトルとURLをコピーしました