動作確認ディストリビューション †MySQL 5.1.39のインストール †「ソースのディストリビューションを使用した MySQL のインストール」に 記載されているMySQLをインストールするために必要なツール。
MySQLのソースファイルを取得 # cd /usr/local/src # wget http://dev.mysql.com/get/Downloads/MySQL-5.1/mysql-5.1.39.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.1.39.tar.gz コンパイル準備 # cd mysql-5.1.39 # ./configure --prefix=/usr/local/mysql configure中に以下のエラーが発生したため、ググってみると【「yum install -y libtermcap-devel ncurses-devel」で解決】みたいな記事が多々見つかる。 # ./configure --prefix=/usr/local/mysql ・ ・ 省略 ・ ・ checking for termcap functions library... configure: error: No curses/termcap library found が、納得がいかない。
# ./configure --prefix=/usr/local/mysql \ > --with-named-curses-libs=/usr/lib/libncurses.so.5 コンパイル # make インストール # make install # cp /usr/local/src/mysql-5.1.39/support-files/my-medium.cnf /etc/my.cnf DB初期化 # cd /usr/local/mysql # bin/mysql_install_db --user=mysql 所有権の変更 # cd /usr/local/mysql # chown -R root . # chown -R mysql var # chgrp -R mysql . 手動起動については、「mysql_install_db」実行後、以下のように表示されるため、参考にしてMySQLを起動します。 ・・・省略・・・ See the manual for more instructions. You can start the MySQL daemon with: cd /usr/local/mysql ; /usr/local/mysql/bin/mysqld_safe & ・・・省略・・・ # cd /usr/local/mysql # bin/mysqld_safe --user=mysql & MySQLの管理者パスワードについて、「mysql_install_db」実行後、以下のように表示されるため、
「mysqladmin」または「mysql_secure_installation」のいずれかにてパスワードを設定します。
・・・省略・・・ PLEASE REMEMBER TO SET A PASSWORD FOR THE MySQL root USER ! To do so, start the server, then issue the following commands: /usr/local/mysql/bin/mysqladmin -u root password 'new-password' /usr/local/mysql/bin/mysqladmin -u root -h tony password 'new-password' Alternatively you can run: /usr/local/mysql/bin/mysql_secure_installation ・・・省略・・・ # /usr/local/mysql/bin/mysqladmin -u root password '********' 自動起動については、「mysql_install_db」実行後、以下のように表示されるため、 自動起動用のスクリプトをコピーしておきます。 ・・・省略・・・ To start mysqld at boot time you have to copy support-files/mysql.server to the right place for your system ・・・省略・・・ # cp /usr/local/src/mysql-5.1.39/support-files/mysql.server /etc/init.d/mysqld # chmod 755 /etc/init.d/mysqld # chkconfig --add mysqld # chkconfig --list mysqld mysqld 0:off 1:off 2:on 3:on 4:on 5:on 6:off 起動スクリプトのテスト # service mysqld status MySQL running (17674) [ OK ] # service mysqld stop Shutting down MySQL. [ OK ] # service mysqld 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.1.39-log Source distribution Type 'help;' or '\h' for help. Type '\c' to clear the current input statement. mysql> 接続確認が完了後、切断処理 mysql> quit ←「quit」と入力し、エンター押下 Bye |