Ubuntu8.10 で mysql5.1 をインストール

ソースからインストールした覚え書き。

ソースの tar.gz を mysql のサイトから持ってくる。
事前に /usr/local/mysql がホームディレクトリで、mysql グループの
mysql ユーザを作成しておいた。

http://dev.mysql.com/doc/refman/5.1/ja/quick-install.html
に書いてある手順を参考にして、、、

以下 root にて作業。

$ gunzip < mysql-5.1.30.tar.gz | tar -xvf -
$ cd mysql-5.1.30
$  ./configure --prefix=/usr/local/mysql
...
checking for termcap functions library... configure: error: No curses/termcap library found

おや?

$ apt-get install libncurses5-dev

してから、再度、

$  ./configure --prefix=/usr/local/mysql
...
Thank you for choosing MySQL!

おけおけ。*1

$ make
$ make install
$ cp support-files/my-medium.cnf /etc/my.cnf
$ cd /usr/local/mysql
$ bin/mysql_install_db --user=mysql
..
FATAL ERROR: Could not find /fill_help_tables.sql

あら。*2--no-defaults をつけてやりなおし。

$ bin/mysql_install_db --user=mysql --no-defaults
...
$ chown -R root  .
$ chown -R mysql var
$ chgrp -R mysql .
$ bin/mysqld_safe --user=mysql &


・・・・とここまでやって気づいたが、charsetの指定するの忘れてる・・・。
まあいいや、検証用だし、ということで。

# /usr/local/mysql/bin/mysqld_safe 
...
Can't find messagefile '/usr/share/mysql/english/errmsg.sys'

おやー?(こればっかり)

ln -s /usr/local/mysql/share/mysql /usr/share/

これで再度試すと、

081229 13:17:44 mysqld_safe Starting mysqld daemon with databases from /var/lib/mysql
/usr/local/mysql/libexec/mysqld: Table 'mysql.plugin' doesn't exist
081229 13:17:44 [ERROR] Can't open the mysql.plugin table. Please run mysql_upgrade to create it.
081229 13:17:44 [ERROR] /usr/local/mysql/libexec/mysqld: unknown option '--skip-federated'
081229 13:17:44 [ERROR] Aborting

まだだめ。

# vi /etc/my.cnf

# Disable Federated by default
#skip-federated	# ここをコメントアウト

これで、再度、

# /usr/local/mysql/bin/mysqld_safe &

で無事起動した。

自動起動設定↓

# cp /usr/local/mysql/share/mysql/mysql.server /etc/init.d/mysql 

・・・とここまで書いといてアレなんだけど、基本的にはバイナリ配布されてるものを使った方がよさそう。

Linuxx86 マシンで使用している場合、弊社のバイナリが多くのケースで最適です。弊社では弊社のバイナリを弊社が知り得る限りベスト パッチの glibc バージョンにリンクし最高のコンパイラ オプションを使用して、高負荷のサーバに最適なソリューションを目指しています。一般的なユーザーにとって、多数の同時接続あるいは 2 GB の制限を越えるテーブルでの設定においてさえ、弊社のバイナリはその殆どのケースで最適な選択といます。

http://dev.mysql.com/doc/refman/5.1/ja/source-notes-linux.html

バイナリ配布版のコンパイルオプションはこちら。
http://dev.mysql.com/doc/refman/5.1/ja/mysql-binaries.html

■ 参考URL
http://www.dondari.net/index.php?MySQL%E3%82%92%E3%82%BD%E3%83%BC%E3%82%B9%E3%81%8B%E3%82%89%E3%82%A4%E3%83%B3%E3%82%B9%E3%83%88%E3%83%BC%E3%83%AB
コマンドによるMySQL管理テクニック (2/2):快速MySQLでデータベースアプリ!(3) - @IT

*1:会社の debian マシンにインストールしようとしたところ、gcc と g++ も無くて、aptitude install gcc, aptitude install g++ も必要であった。g++ をインストールした後、再 make しても「error: redeclaration of C++ built-in type 'bool'」とかっていうエラーが出るので、make clean;make destclean した後、configure からやり直している。

*2:エラーメッセージは"FATAL ERROR: Could not find "かもしれない