TOP / データベース / MySQL

MySQL

とりあえず、現在のユーザでMySQL4.1をソースコードからインストールして、起動確認まで行うメモ

mysql4.1.18をダウンロードして現在のユーザでutf-8の文字コードでコンパイルして/opt/app/mysqlにインストールする。#!/sw/bin/bashは、OSXの設定なので、Linuxの場合などはbashの場所を指定すればよい. シェルスクリプト内のsudoコマンドがLinuxに入っていない場合はsuコマンドに書き直せば動くはず。

#!/sw/bin/bash
#
# mysql 4.1 install shell script.
# 木  3 30 12:10:14 JST 2006
# [MySQL AB::MySQL4.1 Downloads]
# http://dev.mysql.com/downloads/mysql/4.1.html

DOWNLOAD_SITE="http://dev.mysql.com/get/Downloads/MySQL-4.1"
DOWNLOAD_SITE="${DOWNLOAD_SITE}/mysql-4.1.18.tar.gz/from/http://ftp.iij.ad.jp/pub/db/mysql/"
ARCHIVE="mysql-4.1.18.tar.gz"
ARCHIVE_NAME=`echo "${ARCHIVE}" | sed 's/.tar.gz//g'`
TARGET_DIR="/opt/app/mysql"

# download
if [ ! -f ${ARCHIVE} ]; then
  wget "${DOWNLOAD_SITE}"
fi

# expact
if [ ! -d ${ARCHIVE_NAME} ]; then
  tar -zxvf ${ARCHIVE}
fi

# mkdir
if [ ! -d ${TARGET_DIR} ]; then
  echo "mkdir ${TARGET_DIR}"
  mkdir ${TARGET_DIR}
fi

# compile
cd ${ARCHIVE_NAME}
./configure --prefix=${TARGET_DIR} --with-charset=utf8 --with-mysqld-user=${USER}
make
sudo make install
bash-3.00$ ./mysql/bin/mysql_install_db
Installing all prepared tables
060330 14:56:08 [Warning] Setting lower_case_table_names=2 because file system 
for /opt/app/mysql/var/ is case insensitive
Fill help tables
060330 14:56:09 [Warning] Setting lower_case_table_names=2 because file system 
for /opt/app/mysql/var/ is case insensitive

To start mysqld at boot time you have to copy support-files/mysql.server
to the right place for your system

PLEASE REMEMBER TO SET A PASSWORD FOR THE MySQL root USER !
To do so, start the server, then issue the following commands:
/opt/app/mysql/bin/mysqladmin -u root password 'new-password'
/opt/app/mysql/bin/mysqladmin -u root -h es.local password 'new-password'
See the manual for more instructions.

You can start the MySQL daemon with:
cd /opt/app/mysql ; /opt/app/mysql/bin/mysqld_safe &

You can test the MySQL daemon with the benchmarks in the 'sql-bench' directory:
cd sql-bench ; perl run-all-tests

Please report any problems with the /opt/app/mysql/bin/mysqlbug script!

The latest information about MySQL is available on the web at
http://www.mysql.com
Support MySQL by buying support/licenses at https://order.mysql.com
-bash-3.00$ pwd
/opt/app

mysqlをバックエンドで起動してpsコマンドで確認.


bash-3.00$ cd /opt/app/mysql ; /opt/app/mysql/bin/mysqld_safe &
[1] 12608
-bash-3.00$ Starting mysqld daemon with databases from /opt/app/mysql/var

-bash-3.00$ ps -awx | grep mysql
12608 std  S      0:00.06 sh /opt/app/mysql/bin/mysqld_safe
12621 std  S      0:00.37 /opt/app/mysql/libexec/mysqld 
--basedir=/opt/app/mysql --datadir=/opt/app/mysql/var --user=okitasatoshi -
12623 std  S+     0:00.00 grep mysql
12597  p2  S+     0:00.30 vi mysql.xhtml

mysqladminコマンドで起動確認.


-bash-3.00$ /opt/app/mysql/bin/mysqladmin -u root ping
mysqld is alive


イバラキングへのリンク Get Firefox Valid XHTML 1.1 Apple Darwinへのリンク