動作確認ディストリビューション †MySQL 5.5.9のインストール †「Installing MySQL from Source」に 記載されているMySQLをインストールするために必要なツール。
MySQLのソースファイルを取得 # cd /usr/local/src # wget http://www.mysql.com/get/Downloads/MySQL-5.5/mysql-5.5.9.tar.gz/from/http://ftp.iij.ad.jp/pub/db/mysql/ MySQL用Linuxグループ作成 # groupadd mysql MySQL用Linuxアカウント作成 # useradd -g mysql mysql 展開 # tar zxvf mysql-5.5.9.tar.gz コンパイル準備 # cd mysql-5.5.9 # ./configure --prefix=/usr/local/mysql \ > --with-named-curses-libs=/usr/lib/libncurses.so.5 -bash: ./configure: そのようなファイルやディレクトリはありません と、いつものようにやると、「configure」が無いと怒られてしまう。
# cd /usr/local/src # wget http://download.fedora.redhat.com/pub/epel/5/i386/cmake-2.6.4-5.el5.2.i386.rpm # rpm -ivh cmake-2.6.4-5.el5.2.i386.rpm # cd mysql-5.5.9 # cmake . ・ ・ 省略 ・ ・ -- Could NOT find Curses (missing: CURSES_LIBRARY CURSES_INCLUDE_PATH) CMake Error at cmake/readline.cmake:82 (MESSAGE): Curses library not found. Please install appropriate package, remove CMakeCache.txt and rerun cmake.On Debian/Ubuntu, package name is libncurses5-dev, on Redhat and derivates it is ncurses-devel. Call Stack (most recent call first): cmake/readline.cmake:126 (FIND_CURSES) cmake/readline.cmake:216 (MYSQL_USE_BUNDLED_LIBEDIT) CMakeLists.txt:250 (MYSQL_CHECK_READLINE) -- Configuring incomplete, errors occurred! 今度は、「Curses library」が無いと怒られてしまいました。
# yum -y install ncurses-devel ゴミが残っているようで、エラー表示を繰り返してしまうので、一旦MySQLのディレクトリを削除し再実行します。 # rm -fr /usr/local/src/mysql-5.5.9 # cd /usr/local/src # tar zxvf mysql-5.5.9.tar.gz # cd mysql-5.5.9 # cmake . コンパイル # make インストール # make install 初期設定 # cd /usr/local/mysql # chown -R mysql . # chgrp -R mysql . # scripts/mysql_install_db --user=mysql Installing MySQL system tables... OK Filling help tables... OK 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: ./bin/mysqladmin -u root password 'new-password' ./bin/mysqladmin -u root -h chris password 'new-password' Alternatively you can run: ./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. You can start the MySQL daemon with: cd . ; ./bin/mysqld_safe & You can test the MySQL daemon with mysql-test-run.pl cd ./mysql-test ; perl mysql-test-run.pl Please report any problems with the ./bin/mysqlbug script! ↑のようにならずに、以下のエラーが発生した場合 110227 2:59:10 [ERROR] ./bin/mysqld: unknown option '--skip-locking' 以下のように対応する # cp /usr/local/src/mysql-5.5.9/support-files/my-medium.cnf /etc/my.cnf # vi /etc/my.cnf skip-external-locking ↓↓↓↓↓↓↓ #skip-external-locking そして、再実行 # scripts/mysql_install_db --user=mysql # chown -R root . # chown -R mysql data # cp support-files/my-medium.cnf /etc/my.cnf <=「mysql_install_db」でエラーが発生し、既にコピーしている場合はこの操作は不要。 # bin/mysqld_safe --user=mysql & MySQLの管理者パスワードの設定 # cd /usr/local/mysql # ./bin/mysqladmin -u root password '********' 自動起動用のスクリプトのコピー # cd /usr/local/mysql # cp support-files/mysql.server /etc/init.d/mysql.server # chmod 755 /etc/init.d/mysql.server # chkconfig --add mysql.server # chkconfig --list mysql.server mysql.server 0:off 1:off 2:on 3:on 4:on 5:on 6:off 起動スクリプトのテスト # service mysql.server status MySQL running (8734) [ OK ] # service mysql.server stop Shutting down MySQL. [ OK ] # service mysql.server start Starting MySQL.. [ OK ] 接続確認 # /usr/local/mysql/bin/mysql -u root -p Enter password: ←上記の「mysqladmin」にて設定したrootユーザーのパスワードを入力 Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 1 Server version: 5.5.9-log Source distribution Copyright (c) 2000, 2010, 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> 接続確認が完了後、切断処理 mysql> quit ←「quit」と入力し、エンター押下 Bye |