* MySQL 5.0インストール手順 [#vb748b65]
#contents
**インストール元 [#kbef417b]
インストール元のtarボールは下記URLより取得する。

 http://dev.mysql.com/downloads/mysql/5.0.html

各種バイナリとソースが公開されており、ページの一番下にある「Source downloads」の「Tarball (in 5.1 both Unix & Windows, tar.gz)」を取得する。


**インストール手順 [#ne621af2]
インストールの際にはMySQL専用のユーザを作成し、全ての作業を専用ユーザにて行う。~
root権限でログイン後、ユーザを作成する。

 groupadd mysql
 useradd -g mysql -d /usr/local/mysql mysql
 passwd mysql 

インストール先ディレクトリの親ディレクトリに対して専用ユーザの書き込み権限がない場合は事前にディレクトリを作成して所有者を変更する。

 mkdir /usr/local/mysql
 chown mysql.mysql /usr/local/mysql/

ソースファイルを展開して、ソースディレクトリを専用ユーザが書き込み可能にするように所有者を変更する。

 wget http://dev.mysql.com/get/Downloads/MySQL-5.0/mysql-5.0.51a.tar.gz/from/http://mirror.mysql-partners-jp.biz/ 
 tar xfvz mysql-5.0.51a.tar.gz
 chown -fR mysql.mysql ./mysql-5.0.51a

専用ユーザ権限に切り替える

 su mysql

設定とコンパイルを行う

 ./configure --with-charset=utf8 --with-extra-charsets=all --with-mysqld-user=mysql --prefix=/usr/local/mysql
 ./configure --with-charset=utf8 --with-extra-charsets=all --with-mysqld-user=mysql --with-plugins=max --prefix=/usr/local/mysql
 make
 make install

データベースの初期化を行う

 ./scripts/mysql_install_db

**環境変数 PATH設定 [#o236b2d7]
MySQL実行ファイルのパスを設定する。~
アカウント個別に設定を行なう場合は~/.bash_profile、アカウント全てに設定を行なう場合は/etc/profileに下記を追記する。

 export PATH=$PATH:/usr/local/mysql/bin
 export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/mysql/lib/mysql

一度ログアウトすることで設定が反映される。

**自動起動設定 [#v9d3c8d1]
MySQLのソースパッケージには起動・停止制御用のスクリプトが同梱されている。~
下記手順にて所定位置にスクリプトをコピーすることで自動起動が可能である。(要root権限)~

 cd [MySQLソースパス]
 cd ./support-files
 chmod 755 mysql.server
 cp ./mysql.server /etc/init.d/mysql

MySQLをOSのサービスとして登録する

 chkconfig mysql on

サービスの登録状況を確認する

 chkconfig --list | grep mysql
 mysql           0:off   1:off   2:on    3:on    4:on    5:on    6:off

MySQLを起動する。

 /etc/init.d/mysql start

**rootアカウントの設定 [#w8648bfc]
MySQLの管理者ユーザの設定をする

 mysqladmin -u root password 'PASSWORD'
 mysqladmin -u root -h [HOST NAME] password 'PASSWORD'

接続を試験する

 mysql -u root -p
 Enter password: 

 Welcome to the MySQL monitor.  Commands end with ; or \g.
 Your MySQL connection id is 3 to server version: 5.0.26
 
 Type 'help;' or '\h' for help. Type '\c' to clear the buffer.
 
 mysql> 

疎通を確認する

 /usr/local/mysql/bin/mysqladmin -u root@localhost ping
 mysqld is alive

**configureオプション [#x4c53af9]

-デフォルト文字コード
 --with-charset=[CHARSET]

|binary||
|armscii8||
|ascii||
|big5||
|cp1250||
|cp1251||
|cp1256||
|cp1257||
|cp850||
|cp852||
|cp866||
|cp932||
|dec8||
|eucjpms||
|euckr||
|gb2312||
|gbk||
|geostd8||
|greek||
|hebrew||
|hp8||
|keybcs2||
|koi8r||
|koi8u||
|latin1||
|latin2||
|latin5||
|latin7||
|macce||
|macroman||
|sjis|Shift JIS|
|swe7||
|tis620||
|ucs2||
|ujis|EUC-JP|
|utf8|UTF-8|

-追加言語
 --with-extra-charsets=[CHARSET]

|none|含めない|
|complex|動的にロードできないすべての文字を含める|
|all|すべてのキャラクタセットをバイナリに含める|

-実行ユーザ
 --with-mysqld-user=[USER]

-インストールディレクトリ
 --prefix=[DIR]

トップ   編集 差分 バックアップ 添付 複製 名前変更 リロード   新規 一覧 検索 最終更新   ヘルプ   最終更新のRSS