CentOS6.5にMySQL5.5をインストールしたのだが。

さらに話は悲惨で、CentOS6.5にMySQL5をインストールしなくちゃならなくなった。
いままでブログに書いたやり方だと、MySQL5.6がインストールされてしまう事態に悩まされる。
同じことを2度繰り返したら成功したという顛末。

先人の教えに頼りつつ、こんな形で実現した。
まず最初に、MySQLのサイトから次の3ファイルをダウンロードしてくる。

MySQL-client-5.5.38-1.linux2.6.x86_64.rpm
MySQL-server-5.5.38-1.linux2.6.x86_64.rpm
MySQL-shared-compat-5.5.38-1.linux2.6.x86_64.rpm

で、まず既存のmysql関連のファイルを削除する。

# rpm -qa | grep mysql
mysql-devel-5.1.71-1.el6.x86_64
mysql-5.1.71-1.el6.x86_64

# yum remove mysql*
Loaded plugins: fastestmirror, refresh-packagekit, security
Setting up Remove Process
Resolving Dependencies
--> Running transaction check
---> Package mysql.x86_64 0:5.1.71-1.el6 will be erased
---> Package mysql-devel.x86_64 0:5.1.71-1.el6 will be erased
--> Finished Dependency Resolution

Dependencies Resolved

================================================================================
 Package     Arch   Version      Repository                                Size
================================================================================
Removing:
 mysql       x86_64 5.1.71-1.el6 @anaconda-CentOS-201311272149.x86_64/6.5 2.4 M
 mysql-devel x86_64 5.1.71-1.el6 @anaconda-CentOS-201311272149.x86_64/6.5 388 k

Transaction Summary
================================================================================
Remove        2 Package(s)

Installed size: 2.8 M
Is this ok [y/N]: y
Downloading Packages:
Running rpm_check_debug
Running Transaction Test
Transaction Test Succeeded
Running Transaction
  Erasing    : mysql-devel-5.1.71-1.el6.x86_64                              1/2
  Erasing    : mysql-5.1.71-1.el6.x86_64                                    2/2
  Verifying  : mysql-5.1.71-1.el6.x86_64                                    1/2
  Verifying  : mysql-devel-5.1.71-1.el6.x86_64                              2/2

Removed:
  mysql.x86_64 0:5.1.71-1.el6         mysql-devel.x86_64 0:5.1.71-1.el6       

Complete!

で、あらためてインストール開始。
ライブラリーから。

# yum localinstall MySQL-shared-compat-5.5.38-1.linux2.6.x86_64
Loaded plugins: fastestmirror, refresh-packagekit, security
Setting up Local Package Process
Skipping: MySQL-shared-compat-5.5.38-1.linux2.6.x86_64, filename does not end in .rpm.
Nothing to do

次にMySQL serverをインストール。

# yum localinstall MySQL-server-5.5.38-1.linux2.6.x86_64.rpm
Loaded plugins: fastestmirror, refresh-packagekit, security
Setting up Local Package Process
Examining MySQL-server-5.5.38-1.linux2.6.x86_64.rpm: MySQL-server-5.5.38-1.linux2.6.x86_64
Marking MySQL-server-5.5.38-1.linux2.6.x86_64.rpm to be installed
Loading mirror speeds from cached hostfile
 * base: www.ftp.ne.jp
 * extras: www.ftp.ne.jp
 * updates: www.ftp.ne.jp
Resolving Dependencies
--> Running transaction check
---> Package MySQL-server.x86_64 0:5.5.38-1.linux2.6 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

================================================================================
 Package  Arch   Version           Repository                              Size
================================================================================
Installing:
 MySQL-server
          x86_64 5.5.38-1.linux2.6 /MySQL-server-5.5.38-1.linux2.6.x86_64 151 M

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

Total size: 151 M
Installed size: 151 M
Is this ok [y/N]: y
Downloading Packages:
Running rpm_check_debug
Running Transaction Test
Transaction Test Succeeded
Running Transaction
  Installing : MySQL-server-5.5.38-1.linux2.6.x86_64                        1/1

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 CentOS6.5 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/

  Verifying  : MySQL-server-5.5.38-1.linux2.6.x86_64                        1/1

Installed:
  MySQL-server.x86_64 0:5.5.38-1.linux2.6                                      

Complete!

そして最後にclientをインストール。

# yum localinstall MySQL-client-5.5.38-1.linux2.6.x86_64.rpm
Loaded plugins: fastestmirror, refresh-packagekit, security
Setting up Local Package Process
Examining MySQL-client-5.5.38-1.linux2.6.x86_64.rpm: MySQL-client-5.5.38-1.linux2.6.x86_64
Marking MySQL-client-5.5.38-1.linux2.6.x86_64.rpm to be installed
Loading mirror speeds from cached hostfile
 * base: www.ftp.ne.jp
 * extras: www.ftp.ne.jp
 * updates: www.ftp.ne.jp
Resolving Dependencies
--> Running transaction check
---> Package MySQL-client.x86_64 0:5.5.38-1.linux2.6 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

================================================================================
 Package  Arch   Version           Repository                              Size
================================================================================
Installing:
 MySQL-client
          x86_64 5.5.38-1.linux2.6 /MySQL-client-5.5.38-1.linux2.6.x86_64  58 M

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

Total size: 58 M
Installed size: 58 M
Is this ok [y/N]: y
Downloading Packages:
Running rpm_check_debug
Running Transaction Test
Transaction Test Succeeded
Running Transaction
  Installing : MySQL-client-5.5.38-1.linux2.6.x86_64                        1/1
  Verifying  : MySQL-client-5.5.38-1.linux2.6.x86_64                        1/1

Installed:
  MySQL-client.x86_64 0:5.5.38-1.linux2.6                                      

Complete!

一連のインストール作業は終了。
バージョンを確認してみる。

# mysql --version
mysql  Ver 14.14 Distrib 5.5.38, for Linux (x86_64) using readline 5.1

ちゃんとMySQL 5.5.38がインストールされているようだ。
じゃ、MySQLを起動してみる。

$ sudo service mysql start
Starting MySQL..                                           [  OK  ]

ちゃんと動いたので、CentOSが起動したときに、MySQLも自動起動するためのおまじない。

$ sudo chkconfig mysql on

じゃ、MySQLにアクセスしてみる。

$ mysql -u root
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 1
Server version: 5.5.38 MySQL Community Server (GPL)

Copyright (c) 2000, 2014, 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> SET PASSWORD for root@localhost=PASSWORD('hogehoge');
Query OK, 0 rows affected (0.00 sec)

以上、終了。

0 件のコメント:

コメントを投稿