mysqlインストール


参考:公式文書http://dev.mysql.com/doc/refman/5.1/en/installing.html
ここでは主に以下の設置方法を紹介します。Installing MySQL from Generanic Binaries on Unix/Linux
オペレーティングシステムバージョンLinux version 2.6.3-31.0.15 el 6.i 686
mysqlのディレクトリ構造紹介
ディレクトリー
 
Conttets of DirectorybinClient programs and the mysqld serverdataLog files,databasesdocsManual in Info formatmanUnix manaual pagesincludeInclude(header)fileslibLibriesscriptsmysqlinstall_dbshareMiscellane ous support files、including error messages、sample configration files、SQL for database installationsql-benchBenchmarks
インストール手順
1、ダウンロード(32位)インストールパッケージmysql-51.60-linux-686-glibc 23.tar.gz
2、ユーザーとユーザグループを作成する

shell> groupadd mysql
shell> useradd -r -g mysql mysql
3、ストレス解消インストールパッケージmysql-51.60-linux-686-glibc 23.gz

shell> cd /usr/local
shell> tar zxvf /path/to/mysql-VERSION-OS.tar.gz
4、ソフト接続をする
ln -s full-path-to-mysql-VERSION-OS mysql
5、インストールディレクトリの権限を変更する

shell> chown -R mysql:mysql .
6、脚本creates the MySQL Server system tablesを実行します。
scripts/mysql_install_db --user=mysql
シナリオは/usr/local/mysql/share/mysqlsystem_tables.sqlはシステムテーブルを作成して、実行しないとhostテーブルがなく、mysqlサービスに登録できません。
7、ディレクトリのパーミッションを変更する

shell> chown -R root .
shell> chown -R mysql data
8、プロファイルの変更(オプション)

# Next command is optional
shell> cp support-files/my-medium.cnf /etc/my.cnf
9、運行開始mysql

shell> bin/mysqld_safe --user=mysql &
 
10、システムサービスに追加する(service ServiceName start/stop/retartでサービスを開始することができます)

# Next command is optional
shell> cp support-files/mysql.server /etc/init.d/mysqld
 
11、ブートを追加してから起動する

# Next command is optional
shell> chkconfig mysqld on
 
mysql.serverスクリプトは主にスクリプトbin/mysqldを呼び出します。safeがmysqlデータベースを起動します。