ホーム > Database > MySQL Community ServerのRPMを使用したCentOSへのインストール手順

MySQL Community ServerのRPMを使用したCentOSへのインストール手順


下記サイトでダウンロード。
MySQL :: Download MySQL Community Server

今回は下記を選択します。
Linux – Generic 2.6 (x86, 64-bit), TAR

既にMySQLがインストールされている場合は、全て削除してからインストールします。
インストールするのは下記3つ。
・MySQL-client-5.5.20-1.linux2.6.x86_64.rpm
・MySQL-server-5.5.20-1.linux2.6.x86_64.rpm
・MySQL-devel-5.5.20-1.linux2.6.x86_64.rpm

# rpm -ivh MySQL-client-5.5.20-1.linux2.6.x86_64.rpm MySQL-server-5.5.20-1.linux2.6.x86_64.rpm MySQL-devel-5.5.20-1.linux2.6.x86_64.rpm
準備中...                ########################################### [100%]
   1:MySQL-server           ########################################### [ 33%]

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 centos56 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 with the /usr/bin/mysqlbug script!

   2:MySQL-client           ########################################### [ 67%]
   3:MySQL-devel            ########################################### [100%]

設定ファイルのコピー

# cp /usr/share/mysql/my-medium.cnf /etc/my.cnf

MySQLの起動

# /etc/init.d/mysql start
Starting MySQL.........                                    [  OK  ]

パスワードの設定

# /usr/bin/mysqladmin -u root password 'root'

MySQLへアクセス

# mysql -u root -p
Enter password:
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 4
Server version: 5.5.20-log MySQL Community Server (GPL)

Copyright (c) 2000, 2011, 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が使用できるようになります。
RPMでのインストール後のレイアウトは下記に詳細があります。
MySQL :: MySQL 5.1 リファレンスマニュアル :: 2.1.5 インストールのレイアウト

デフォルトではlatin1という文字コードが使用されているので、文字化けを防ぐためにも、utf8で統一しておくといいでしょう。

デフォルトの文字コードをlatin1からutf8に変更

# vim /etc/my.cnf

[mysqld]に
character-set-server = utf8
skip-character-set-client-handshake
を追加

[client]に
default-character-set = utf8
を追加。

[mysqldump]に
default-character-set = utf8
を追加。

[mysql]に
default-character-set = utf8
を追加。

MySQLを再起動。
これにより、デフォルトでは下記なのが、

mysql> show variables like "char%";
+--------------------------+----------------------------+
| Variable_name            | Value                      |
+--------------------------+----------------------------+
| character_set_client     | utf8                       |
| character_set_connection | utf8                       |
| character_set_database   | latin1                     |
| character_set_filesystem | binary                     |
| character_set_results    | utf8                       |
| character_set_server     | latin1                     |
| character_set_system     | utf8                       |
| character_sets_dir       | /usr/share/mysql/charsets/ |
+--------------------------+----------------------------+
8 rows in set (0.00 sec)

下記のようにutf8に統一されます。

mysql> show variables like "char%";
+--------------------------+----------------------------+
| Variable_name            | Value                      |
+--------------------------+----------------------------+
| character_set_client     | utf8                       |
| character_set_connection | utf8                       |
| character_set_database   | utf8                       |
| character_set_filesystem | binary                     |
| character_set_results    | utf8                       |
| character_set_server     | utf8                       |
| character_set_system     | utf8                       |
| character_sets_dir       | /usr/share/mysql/charsets/ |
+--------------------------+----------------------------+
8 rows in set (0.00 sec)

参考サイト

shanbenxun: MySQL-5.5.9 インストールする
MySQLの文字コードをutf8で統一する方法 – yinkywebの日記
 

参考書籍

遠藤 俊裕 翔泳社 2011-08-26
売り上げランキング : 12545
by ヨメレバ

 

Related posts:

  1. MySQLのコミュニティ版(Community Edition)と有償版(Standard EditionやEnterprise Edition)の違い
  2. [Linux]RPMパッケージに含まれているファイルや、あるコマンドがどのパッケージからインストールされたのかを把握したい時
  3. PostgreSQLとOracleDatabaseのシャットダウンオプションの違いと対応表

コメント:0

コメントフォーム
入力した情報を記憶する

トラックバック:0

この記事のトラックバック URL
http://infra-engineer.com/database/mysql-community-server%e3%81%aerpm%e3%82%92%e4%bd%bf%e7%94%a8%e3%81%97%e3%81%9fcentos%e3%81%b8%e3%81%ae%e3%82%a4%e3%83%b3%e3%82%b9%e3%83%88%e3%83%bc%e3%83%ab%e6%89%8b%e9%a0%86/trackback/
トラックバックの送信元リスト
MySQL Community ServerのRPMを使用したCentOSへのインストール手順 - インフラエンジニアのつぶやき より

ホーム > Database > MySQL Community ServerのRPMを使用したCentOSへのインストール手順

ランキングサイト
Get Adobe Flash playerPlugin by wpburn.com wordpress themes

ページの上部に戻る