この章では、どのようにして MySQL を得、インストールするのかをのべます:
(訳注:もし RedHat 以外の Linux を使用しており、.rpm を、自分が使用している パッケージ管理システムの管理下におきたい場合、 alien : http://kitenet.net/programs/alien/ というツールを 使用します。これは RPM(Debian, Slackware) を自分が使用しているパッケージの形式に変換してくれます。)
RPM を使用して MySQL をインストールすることを推奨します。
MySQL RPMS は RedHat 6.2 で作成していますが、
他の rpm
と glibc
をサポートしている Linux でも動作するでしょう。
RPM file での問題, 例えば, ``Sorry, the host 'xxxx' could not be looked up
''
に遭遇した場合には → 「2.6.1.1 Linux Notes for Binary Distributions」節.
以下が使用するであろう RPM files です:
MySQL-VERSION.i386.rpm
MySQL サーバー。
ただ単に他のマシン上で走っている MySQL サーバーに接続するだけなら、
これは不要でしょう。
MySQL-client-VERSION.i386.rpm
MySQL クライアント標準プログラム。
このパッケージはほとんどの場合インストールすることになるでしょう。
MySQL-bench-VERSION.i386.rpm
ベンチマーク。perl msql-mysql-modules RPM が必要。
MySQL-devel-VERSION.i386.rpm
他の MySQL クライアント(perlモジュールのような)をコンパイルするのに必要な
ライブラリーとインクルードファイルを含みます。
MySQL-VERSION.src.rpm
上記全てのソース。これは他のアーキテクチャ用に RPM を作成する場合にのみ必要でしょう。
(例えば Alpha or SPARC).
RPM パッケージに含まれるファイルをみるには、以下を実行:
shell> rpm -qpl MySQL-VERSION.i386.rpm
インストールの最小の方法:
shell> rpm -i MySQL-VERSION.i386.rpm MySQL-client-VERSION.i386.rpm
クライアントパッケージだけをインストール:
shell> rpm -i MySQL-client-VERSION.i386.rpm
RPM はデータを `/var/lib/mysql' に保存します。 RPM は起動時にサーバーを立ちあげるように、`/etc/rc.d/' に登録します。 (以前にインストールがされていて、前にインストールされた MySQL 起 動ファイルを何か変更している場合、それをコピーしておいた方がいいでしょう。 そうすればその変更を失うことはありません。)
RPM ファイルのインストール後は、mysqld
デーモンが実行されていて、
MySQL の使用を開始することができます。 「2.4 インストール後の設定とテスト」節参照。
うまくいかない場合、バイナリインストールの章でさらに情報を探すことができま す。 「M.1 Installing a MySQL Binary Distribution」節参照。
The following instructions apply to precompiled binary distributions. If you download a source distribution, you will have to compile and install it yourself.
もし MySQL の配布物を持っていないなら、最初に http://www.mysql.com/downloads/mysql-3.23.html からダウンロードす べきです。
もし他のプログラムから MySQL に接続しようと考えているなら、 多分 MyODBC ドライバーも必要でしょう。 これは MyODBC download page にあります。(http://www.mysql.com/downloads/api-myodbc.html)
日本語版の MyODBC ドライバー は: MyODBC 日本語版
それぞれの配布物のインストールをするには、ダウンロードした物を
どこか からのディレクトリで unzip し、Setup.exe
プログラムを
実行します。
標準では、MySQL-Windows は `C:\mysql' にインストールされる
ようになっています。 もし違う場所に MySQL をインストールしたいな
ら、最初に `C:\mysql' にインストールした後に、そのフォルダを希望の場
所に移動します。MySQL を移動した場合は、サーバ起動時に
--basedir
オプションを指定して場所を指定する必要があります。たとえ
ば、MySQL ディストリビューションを `D:\programs\mysql' に移
動した場合は、mysqld
を次のように起動する必要があります:
C:\> D:\programs\mysql\bin\mysqld --basedir D:\programs\mysql
mysqld
が理解するすべてのオプションを表示するためには、
mysqld --help
を使用してください!
新しいバージョンの MySQL では、MySQL サーバの任意のデフォ ルトオプションを保持する `C:\my.cnf' ファイルを作成することもできま す。ファイル `\mysql\my-xxxxx.cnf' を `C:\my.cnf' にコピーし、 あなたの設定に合うように編集してください。注意: すべてのパスは `\' の代わりに `/' を指定すべきです。`\' を使用する場合は、2つ記述 する必要があります。`\' は MySQL ではエスケープ文字だからで す。 「4.1.2 my.cnf オプションファイル」節参照。
Starting with MySQL 3.23.38, the Windows distribution includes
both the normal and the MySQL-Max binaries. The main benefit
of using the normal mysqld.exe
binary is that it's a little
faster and uses less resources.
Here is a list of the different MySQL servers you can use:
mysqld | Compiled with full debugging and automatic memory allocation checking, symbolic links, BDB and InnoDB tables. |
mysqld-opt | Optimized binary with no support for transactional tables. |
mysqld-nt | Optimized binary for NT with support for named pipes. You can run this version on Win98, but in this case no named pipes are created and you must have TCP/IP installed. |
mysqld-max | Optimized binary with support for symbolic links, BDB and InnoDB tables. |
mysqld-max-nt |
Like mysqld-max , but compiled with support for named pipes.
|
All of the above binaries are optimized for the Pentium Pro processor but should work on any Intel processor >= i386.
NOTE: If you want to use InnoDB tables, there are certain startup options that must be specified in your `my.ini' file! 「7.6.2 InnoDB 起動オプション」節参照.
現在のバージョンとダウンロードの指示についての情報は MySQL ホームページ をチェックしてください。
主なダウンロードミラーはここにあります:
http://download.sourceforge.net/mirrors/mysql/
MySQL ミラーサイトになることに興味があれば、匿名 rsync ができます
: rsync://download.sourceforge.net/mysql/
。下記リストにあなたのミラー
を追加するため、webmaster@mysql.com に電子メールを送って、我々に
知らせてください。
我々のメインサイトからのダウンロードに問題があれば、下記に一覧されたミラー の一つを使用してみてください。
悪いまたは遅れているミラーは webmaster@mysql.com に報告してください。
ヨーロッパ:
北アメリカ:
南アメリカ:
アジア:
アフリカ:
我々は GNU Autoconf を使用していますので、MySQL は POSIX スレッ ドと C++ コンパイラが動作する全ての新しいシステムに移植可能です。(クライ アントコードのコンパイルだけは C++ を必要としますが、スレッドは必要ではありません。) 我々は自身のソフトウェアを、最初に Sun Solaris (現在は 2.5 ~ 2.7) 上と SuSE Linux Version 7.x で使用し開発します。
多くの OS では、ネイティブスレッドは最新バージョ ンだけで動作することに注意してください。 MySQL は次の OS/スレッドパッケージの組み合わせで、コンパイルの 成功が報告されています。
glibc
2.0.7+. 「2.6.1 Linux Notes (All Linux Versions)」節参照.
全てのプラットフォームがMySQLをちゃんと動作させるものではありません。 我々は以下のような評価基準に基づいて重要な要件を任せるに足るプラットフォームで あるかを判断しています。:
pthread_mutex_lock()
の実装に
不安がある場合です。この場合はMySQLの実行をはなはだしく阻害します。
このことを考慮せずにいるとCPUを増設するほどMySQLの実行が遅くなる
事象を生じるでしょう。
Based on the above criteria, the best platforms for running MySQL at this point are x86 with SuSE Linux 7.1, 2.4 kernel and ReiserFS (or any similar Linux distribution) and Sparc with Solaris 2.7 or 2.8. FreeBSD comes third, but we really hope it will join the top club once the thread library is improved. We also hope that at some point we will be able to include all other platforms on which MySQL compiles, runs ok, but not quite with the same level of stability and performance, into the top category. This will require some effort on our part in cooperation with the developers of the OS/library components MySQL depends upon. If you are interested in making one of those components better, are in a position to influence their development, and need more detailed instructions on what MySQL needs to run better, send an e-mail to internals@lists.mysql.com.
Please note that the comparison above is not to say that one OS is better or worse than the other in general. We are talking about choosing a particular OS for a dedicated purpose - running MySQL, and compare platforms in that regard only. With this in mind, the result of this comparison would be different if we included more issues into it. And in some cases, the reason one OS is better than the other could simply be that we have put forth more effort into testing on and optimizing for that particular platform. We are just stating our observations to help you make a decision on which platform to use MySQL on in your setup.
make を行う前に決める事は、あなたが最新の開発リリースを使用するのか、 または最新の安定リリースを使用するのかです:
crash-me
とベンチマークテストで簡単にテストできます。
「5.1.4 The MySQL Benchmark Suite」節参照.
注意: すべての MySQL リリースはそれぞれのリリー
スの前に MySQL ベンチマークと広範囲なテストスイートでチェックされ
ます。
make 前の2番目の決定事項は、ソースディストリビューションとバイナリディ ストリビューションのどちらを使用するかです。多くの場合、バイナリがプラッ トフォーム用に存在していれば、おそらくバイナリディストリビューションを使 用すべきです。通常、それはソースディストリビューションよりも簡単にインス トールできます。
次のケースでは、おそらくソースインストールの方が良いでしょう:
MySQL
クライアントは両方の MySQL バージョンに接続できます。
拡張 MySQL バイナリディストリビューションは -max
接尾語が
つけられていて、mysqld-max
と同じオプションで configure されていま
す。 「4.7.5 mysqld-max, An extended mysqld server」節参照.
MySQL-Max
RPM を使用したい場合は、最初に標準 MySQL
RPM をイ
ンストールすべきです。
mysqld
を、標準バイナリディストリビューションには無いいくつかの拡
張機能付きで configure したい場合。使用できる代表的な拡張オプションは次
の通りです:
--with-berkeley-db
--with-innodb
--with-raid
--with-libwrap
--with-named-z-lib (This is done for some of the binaries)
--with-debug[=full]
pgcc
のような)や、あなた
のプロセッサ用により最適化されたコンパイラオプションを使用できます。
MySQL の命名法では、リリース番号は3つの数値とサフィックスからな
ります。例えば、mysql-3.21.17-beta
のようなリリース名は次のように
解釈されます:
3
)はファイル形式を表します。全てのバージョン 3 リリー
スは同じファイルフォーマットを持ちます。バージョン 4 が現れた時、全ての
テーブルは新しい形式に変換する必要があります (このための良いツールはもち
ろん含まれます)。
21
)はリリースレベルです。通常は二つから選択します。一
つはリリース/安定ブランチで(現在は 23
)、もう一つは開発ブランチです(現在は 4.0
)。
通常は両方とも安定ですが、開発バージョンはきまぐれで、ドキュメントがなく、いくつかのシ
ステムではコンパイルに失敗します。
17
)はリリースレベル内のバージョン番号です。これは新し
い配布の度に増加します。普通はあなたの選択したリリースレベルの最新バージョ
ンを求めます。
beta
)はリリースの安定レベルを表します:
alpha
は、100% テストされていないいくつかの新しい大きなコードセク
ションが存在することを示し、知られているバグは News 節に記述されています
(通常はありません)。 「F MySQL change history」節参照。多くの alpha リリースには新しいコマ
ンドと拡張もあります。
大きなコード変更を含む開発中のものは、alpha リリース上に現れます。しかし
全てリリース前にテストされます。それぞれの MySQL リリースには既知
のバグはありません。
beta
は全ての新しいコードがテストされたことを意味します。大きな新
しいものは追加されません。知られているバグはありません。
alpha バージョンで、少なくとも一カ月間、致命的なバグが報告されなくて、古
いコマンドをより信頼できなくするような新しい機能を追加する計画がない時に、
alpha から beta にバージョンが変更されます。
gamma
は beta がしばらくして、正しく動くように見えるものです。
小さな修正だけが追加されます。
これは多くの他の会社がリリースと呼ぶものです。
MySQL の全てのバージョンは、比較的安全に使用できることを確かめ るため、我々は標準テストとベンチマークを通して確認しています。標準テス トは以前に見つかった全てのバグをチェックするように拡張されるため、テスト スイートはより良く保持されます。
全てのリリースは少なくても次のテストがされていることに注意してください:
crash-me
テスト
他のテストは我々の内部製品環境で最新の MySQL バージョンを我々が 少なくとも1つのマシンで使用することです。我々は動作のため 100ギガバイト 以上のデータを持ちます。
この節では、バイナリとソース配布のインストールで生成されるディレクトリの デフォルトのレイアウトを説明します。
バイナリ配布はアンパックすることによりインストールされ、インストール場所 はあなたが選択した場所(通常 `/usr/local/mysql')の中の次のディレクト リを選択し生成します:
ディレクトリ | ディレクトリの内容 |
`bin' | クライアントプログラム, mysqld サーバ
|
`data' | ログファイル, データベース |
`include' | インクルード(ヘッダ)ファイル |
`lib' | ライブラリ |
`scripts' | mysql_install_db
|
`share/mysql' | エラーメッセージファイル |
`sql-bench' | ベンチマーク |
ソース配布は configure しコンパイルした後にインストールされます。デフォ ルトではインストールステップは `/usr/local' 配下のファイルを次のサ ブディレクトリにインストールします:
ディレクトリ | ディレクトリの内容 |
`bin' | クライアントプログラムとスクリプト |
`include/mysql' | インクルードファイル |
`info' | Info 形式のドキュメント |
`lib/mysql' | ライブラリ |
`libexec' | mysqld サーバ
|
`share/mysql' | エラーメッセージファイル |
`sql-bench' | ベンチマークと crash-me テスト
|
`var' | データベースとログファイル |
ソースインストールのレイアウトはバイナリインストールと次の点が異なります:
mysqld
サーバは `/bin' ではなく
`libexec' ディレクトリにインストールされます。
mysql_install_db
は `/usr/local/mysql/scripts' ではなく
`/usr/local/bin' ディレクトリにインストールされます。
スクリプト `scripts/make_binary_distribution' を実行することにより、 コンパイルされたソースディストリビューションから、あなた自身のバイナリイン ストレーションを生成できます。
MySQL は MySQL AB でかなり速く進化していて、我々はこれを他の MySQL ユーザに共有してもらいたいです。我々は、他の人が必要とし ていると思われるとても便利な機能を持った時に、リリースの作成を試みます。
我々は、実装が簡単な機能を要求するユーザの手助けも試みます。我々は、我々 のライセンスユーザが求めるものにも注目し、特に我々の拡張 email サポート 顧客が求めるものに注目して、彼らの手助けを試みます。
新しいリリースをダウンロードする必要はありません。News 節は、新しいリリー スが、あなたが本当に求める何かを持っているかどうかをあなたに教えます。 「F MySQL change history」節参照.
我々は MySQL の更新時は次のポリシーにしたがって行います:
現在の安定リリースはバージョン 3.23 です; 我々はすでにバージョン 4.0 の開発に移行しています。 しかし、安定バージョンでもバグはまだ修正されます。 我々は、バグ修正と``行なわなければいけない''ことを無視するような、完全な 凍結を考えていません。``幾分かの凍結''とは、``ほとんど確実に既に動作して いるものに影響を与えない''小さなことを追加するかもしれないということを意 味します。
サービスとして、MySQL AB は MySQL のバイナリ配布を提供しています。 これらのコンパイルは TcX 内部でおこなったり、我々にマシンの アクセスを提供してもらっている顧客のマシン上で行っています。
これらの配布物は scripts/make_binary_distribution
で作成され、
以下のコンパイルオプションで調整されています。
gcc
2.7.2.1
CC=gcc CXX=gcc CXXFLAGS="-O3 -felide-constructors" ./configure --prefix=/usr/local/mysql --disable-shared --with-extra-charsets=complex --enable-assembler
egcs
1.0.3a or 2.90.27 or gcc 2.95.2 and newer
CC=gcc CFLAGS="-O3" CXX=gcc CXXFLAGS="-O3 -felide-constructors -fno-exceptions -fno-rtti" ./configure --prefix=/usr/local/mysql --with-low-memory --with-extra-charsets=complex --enable-assembler
gcc
2.8.1
CC=gcc CXX=gcc CXXFLAGS=-O3 ./configure --prefix=/usr/local/mysql --with-low-memory --with-extra-charsets=complex
pgcc
2.90.29 (egcs
1.0.3a)
CFLAGS="-O3 -mpentium -mstack-align-double" CXX=gcc CXXFLAGS="-O3 -mpentium -mstack-align-double -felide-constructors -fno-exceptions -fno-rtti" ./configure --prefix=/usr/local/mysql --enable-assembler --with-mysqld-ldflags=-all-static --with-extra-charsets=complex
gcc
2.95.2
CFLAGS="-O3 -mpentiumpro" CXX=gcc CXXFLAGS="-O3 -mpentiumpro -felide-constructors -fno-exceptions -fno-rtti" ./configure --prefix=/usr/local/mysql --enable-assembler --with-mysqld-ldflags=-all-static --disable-shared --with-extra-charset=complex
gcc
2.7-95q4
CC=gcc CXX=gcc CXXFLAGS=-O3 ./configure --prefix=/usr/local/mysql --with-extra-charsets=complex
gcc
2.7.2.2
CC=gcc CXX=gcc CXXFLAGS=-O3 ./configure --prefix=/usr/local/mysql --with-extra-charsets=complex
gcc
2.8.1
CC=gcc CFLAGS=-O CXX=gcc CXXFLAGS=-O3 ./configure --prefix=/usr/local/mysql --with-low-memory --with-extra-charsets=complex
gcc
2.8.0
CC=gcc CXX=gcc CXXFLAGS=-O3 ./configure --prefix=/usr/local/mysql --with-extra-charsets=complex
gcc
2.7.2.1
CC=gcc CXX=gcc CXXFLAGS=-O ./configure --prefix=/usr/local/mysql --with-extra-charsets=complex
gcc
2.7.2
CC=gcc CXX=gcc CXXFLAGS=-O3 ./configure --prefix=/usr/local/mysql --with-extra-charsets=complex
上で示したオプション以外で最適化を施した方はだれでも、開発者向けの メーリングリストにポストできます。 internals@lists.mysql.com.
RPM 配布では MySQL 3.22 を user-contributed としています。 3.22 をはじめ、いくつかの RPM パッケージは MySQL AB 製です。
MySQL のデバッグバージョンをコンパイルしたい場合は、
--with-debug
または --with-debug=full
を上記の configure 行
に追加して、すべての -fomit-frame-pointer
オプションを取り除いてく
ださい。
ソースインストールに取り掛かる前に、最初に我々のバイナリがあなたのプラット フォームに有効で、動作するかどうかをチェックしてください。我々は、我々のバ イナリが可能な限りのオプションで構築されていることを確認するために多くの努 力をしています。
ソースから MySQL を作成しインストールするためには次のツールが必 要です:
gunzip
。配布の伸張のため。
tar
。配布の展開のため。GNU tar
は動くことが知られて
います。Sun の tar
は問題があることが知られています。
gcc
>= 2.95.2, egcs
>= 1.0.2, egcs 2.91.66
,
SGI C++, SunPro C++ は働くことが知られているコンパイラのいくつかです。
libg++
は gcc
使用時には必要ではありません。gcc
2.7.x は、`sql/sql_base.cc' のような、完全に正当な C++ ファイルのい
くつかをコンパイルできないというバグがあります。gcc
2.7.x だけし
かなければ、MySQL をコンパイルできるように gcc
をアップ
グレードする必要があります。
gcc
2.8.1 is also known to have problems on some platforms so it should be
avoided if there exists a new compiler for the platform..
MySQL 3.23.x のコンパイル時は、gcc
>= 2.95.2 を推奨します。
make
プログラム。GNU make
は常に推奨され、時々は必要
とされます。問題があれば GNU make
3.75 以上を試すことをお勧めしま
す。
-fno-exceptions
オプションを解釈する gcc の最近のバージョ
ンを使用している場合は、それを使用することがとても重要です。そう
でなければ、ランダムにクラッシュするバイナリができあがるでしょう。また、
-fno-exceptions
に加え、-felide-contructors
と
-fno-rtti
を使用することをお奨めします。
疑いがある時は、次を行なってください:
CFLAGS="-O3" CXX=gcc CXXFLAGS="-O3 -felide-constructors -fno-exceptions -fno-rtti" ./configure --prefix=/usr/local/mysql --enable-assembler --with-mysqld-ldflags=-all-static
多くのシステムで、これは速くて安定したバイナリを与えます。
問題が起きたときは、mysql@lists.mysql.com に質問を投稿する時に
mysqlbug
を常に使用してください。問題がバグでないとして
も、mysqlbug
はあなたの問題を解決する助けになるであろうシステム情
報を収集します。mysqlbug
を使用しないと、あなたの問題の解決を得る
可能性が小さくなります! mysqlbug
は、配布のアンパック後に
`scripts' ディレクトリ内に見つけられます。 「1.2.22.3 バグや問題を報告する方法」節参照.
MySQL をソースからインストールするために行なわなければならない 基本的なコマンド:
shell> groupadd mysql shell> useradd -g mysql mysql shell> gunzip < mysql-VERSION.tar.gz | tar -xvf - shell> cd mysql-VERSION shell> ./configure --prefix=/usr/local/mysql shell> make shell> make install shell> scripts/mysql_install_db shell> chown -R root /usr/local/mysql shell> chown -R mysql /usr/local/mysql/var shell> chgrp -R mysql /usr/local/mysql shell> cp support-files/my-medium.cnf /etc/my.cnf shell> /usr/local/mysql/bin/safe_mysqld --user=mysql &
If you want have support for InnoDB tables, you should edit the
/etc/my.cnf
file and remove the #
character before the
parameters that starts with innodb_...
. 「4.1.2 my.cnf オプションファイル」節参照. 「7.6.2 InnoDB 起動オプション」節参照.
RPM ソースから開始する場合は:
shell> rpm --rebuild MySQL-VERSION.src.rpm
これはインストールできるRPMバイナリを作成します
もし DBI
と Msql-Mysql-modules
Perl モジュールをインストールするなら、
bin/mysql_setpermission
スクリプトが使用する新しいユーザーを
追加することができます。
次にさらに詳細な説明を行ないます:
ソース配布のインストールには、次のステップに従い、それから インストール 後の初期化とテストのために 「2.4 インストール後の設定とテスト」節参照 に進んでください。
tar
アーカイブとして提供さ
れ、`mysql-VERSION.tar.gz' のような名前を持ちます。ここで
VERSION
は 3.23.49 のような番号です。
mysqld
を実行するユーザーとグループを追加します:
shell> groupadd mysql shell> useradd -g mysql mysqlこれらのコマンドは
mysql
グループと mysql
ユーザを追加します。
useradd
と groupadd
構文は、別のバージョンの UNIX 上では少し異なるでしょ
う。adduser
と addgroup
と呼ばれることもあります。ユーザとグ
ループは mysql
の代わりに他の何かにすることもできます。
shell> gunzip < /path/to/mysql-VERSION.tar.gz | tar xvf -このコマンドは `mysql-VERSION' という名前のディレクトリを作成します。
shell> cd mysql-VERSION注意: 現在のこのトップレベルディレクトリで MySQL の configure と build を行なう必要があります。別のディレクトリでは build できません。
shell> ./configure --prefix=/usr/local/mysql shell> make
configure
の実行時、いくつかのオプションを指定できます。オプショ
ンの一覧は ./configure --help
を実行してください。 「2.3.3 典型的な configure
オプション」節, さらに有用なオプションのいくつかに
ついて議論しています。
configure
が失敗して、援助を得るために mysql@lists.mysql.com にメー
ルを送ろうとする場合、`config.log' から問題の解決の手助けにできると
考えられる行を含めてください。configure
が異常終了する場合、
configure
からの出力の最後の数行も含めてください。バグレポートは
mysqlbug
スクリプトを使用して投稿してください。 「1.2.22.3 バグや問題を報告する方法」節参照。
コンパイルが失敗する場合、いくらかのよくある問題での手助けのため、
「2.3.5 コンパイルの問題か?」節 を参照してください。
shell> make installこのコマンドは
root
として実行する必要があります。
shell> scripts/mysql_install_db注意: 3.22.10 より古い MySQL バージョンでは、
mysql_install_db
実行時に MySQL サーバが開始されましたが、
これはもはや真ではありません!
root
に、
データディレクトリの所有権を mysqld
を実行するユーザに変更し
てください:
shell> chown -R root /usr/local/mysql shell> chown -R mysql /usr/local/mysql/var shell> chgrp -R mysql /usr/local/mysql最初のコマンドはファイルの
owner
属性を root
ユーザーに変更し、
2番目のコマンドは owner
を mysql
ユーザに変更し、
3番目のコマンドは group
属性を mysql
グループに変更します。
DBI
/DBD
インタフェースのサポートをインストールしたい
場合、 「M.2 Perl Installation Comments」節 を見てください。
support-files/mysql.server
をシステムのスタートアップファイルがあ
る場所にコピーしてください。さらなる情報は
support-files/mysql.server
スクリプト自身の中と、
「2.4.3 MySQL の自動起動と自動停止」節 に見つけられます。
全てがインストールされた後、配布の初期化とテストを行なうべきです。
shell> /usr/local/mysql/bin/safe_mysqld --user=mysql &
コマンドがすぐに mysqld daemon ended
エラーで失敗する場合、
`mysql-data-directory/'hostname'.err' ファイルになんらかの情報を
見つけることができます。 よくあることとして、すでに他の mysqld
が
走っている場合などがあります。 「4.1.4 同一マシン上に複数の MySQL サーバーを走らせる」節参照.
「2.4 インストール後の設定とテスト」節参照.
時々、パッチは、メーリング・リストに流されたり、または MySQL Web サイトの パッチエリア に置かれます。
メーリング・リストからのパッチを適用するには、パッチが載っているメッセージを ファイルに保存して、あなたの MySQL ソース・ツリーの 一番上のディレクトリーに移動し、以下のようにコマンドを実行します:
shell> patch -p1 < patch-file-name shell> rm config.cache shell> make clean
FTPサイトに置かれるパッチは、プレーンテキストファイルとして、
あるいは gzip
で圧縮されたファイルとして頒布されます。
プレーンテキストのパッチの場合は、上に示したメーリングリストの
パッチと同様に適用します。 圧縮されたパッチを適用するには、
MySQL ソース・ツリーの
一番上のディレクトリーに移動し、以下のようにコマンドを実行します:
shell> gunzip < patch-file-name.gz | patch -p1 shell> rm config.cache shell> make clean
それから通常のソースインストールの指示を ./configure
ステップから
始めます。make install
ステップ実行後、あなたの MySQL サー
バを再起動します。
make install
を実行する前に、現在走っているサーバーを止める必要があるかもしれません。
( mysqladmin shutdown
で止めます )
いくつかのシステムでは、現在実行しているものを止めない限り、
新しいバージョンをインストールできないようになっています。
configure
オプション
configure
スクリプトは MySQL 配布をどのようにコンフィグ
するかを制御するための多くの処理を提供します。典型的には、
configure
コマンドラインにオプションを使用してこれを行ないます。
いくつかの環境変数を使用しても configure
に影響を与えることができ
ます。 「H Environment Variables」節参照.
configure
がサポートするオプションの一覧は、次のコマンドを
実行してください:
shell> ./configure --help
良く使われる configure
オプションのいくつか以下に説明します:
--without-server
オプションを使用してください:
shell> ./configure --without-serverC++ コンパイラがなければ、
mysql
はコンパイルできません(これは C++
を要求するクライアントプログラムの一つです)。この場合、configure
から C++ コンパイラをテストするコードを削除でます。それから
./configure
を --without-server
オプションつきで実行してく
ださい。コンパイルステップは mysql
の作成を試みますが、
`mysql.cc' についての警告は無視できます。(make
が止まる場合、
エラーが発生しても残りの作成を継続するように make -k
を試してくだ
さい。)
configure
コマンドのうちのどれかを使用してく
ださい:
shell> ./configure --prefix=/usr/local/mysql shell> ./configure --prefix=/usr/local \ --localstatedir=/usr/local/mysql/data最初のコマンドはインストールプレフィックスを変更し、デフォルトの `/usr/local' ではなく `/usr/local/mysql' 配下にインストールし ます。次のコマンドはデフォルトのインストールプレフィックスを保存しますが、 データベースディレクトリのデフォルト位置(通常は `/usr/local/var')を 上書きし、
/usr/local/mysql/data
に変更します。
configure
コマン
ドを次のように使用します:
shell> ./configure --with-unix-socket-path=/usr/local/mysql/tmp/mysql.sockファイル名は絶対パスでなければなりません! You can also later change the location `mysql.sock' by using the MySQL option files. 「A.4.5 MySQL ソケットファイル `/tmp/mysql.sock' を変更する方法、削除から守る方法」節参照.
configure
を実行します:
shell> ./configure --with-client-ldflags=-all-static \ --with-mysqld-ldflags=-all-static
gcc
を使用していて、libg++
や libstdc++
がインストー
ルされていない場合、configure
に gcc
を C++ コンパイラとし
て使用することを伝えてください:
shell> CC=gcc CXX=gcc ./configure
gcc
を C++ コンパイラとして使用する時、libg++
または
libstdc++
のリンクは試みません。
あなたが使用しているコンパイラによって、設定するいくつかの標準的な環境変数
があります:
gcc 2.7.2.1 | CC=gcc CXX=gcc CXXFLAGS="-O3 -felide-constructors" |
egcs 1.0.3a | CC=gcc CXX=gcc CXXFLAGS="-O3 -felide-constructors -fno-exceptions -fno-rtti" |
gcc 2.95.2 | CFLAGS="-O3 -mpentiumpro" CXX=gcc CXXFLAGS="-O3 -mpentiumpro -felide-constructors -fno-exceptions -fno-rtti" |
pgcc 2.90.29 or newer | CFLAGS="-O3 -mpentiumpro -mstack-align-double" CXX=gcc CXXFLAGS="-O3 -mpentiumpro -mstack-align-double -felide-constructors -fno-exceptions -fno-rtti" |
--prefix=/usr/local/mysql --enable-assembler --with-mysqld-ldflags=-all-static言い換えれば、すべての最近の gcc バージョン用には、完全な configure 行は次 のようなものになります:
CFLAGS="-O3 -mpentiumpro" CXX=gcc CXXFLAGS="-O3 -mpentiumpro -felide-constructors -fno-exceptions -fno-rtti" ./configure --prefix=/usr/local/mysql --enable-assembler --with-mysqld-ldflags=-all-static我々が MySQL Web サイト http://www.mysql.com 上で提供して いるバイナリは、完全に最適化されてコンパイルされ、多くのユーザに完全です。 「2.2.6 MySQL Binaries Compiled by MySQL AB」節参照。さらに速いバイナリを作成するために調整できることが いくつかありますが、これは上級ユーザ向けです。 「5.5.3 MySQL の速度に影響するコンパイルとリンク方法」節参照. コンパイラやリンカが共有ライブラリ `libmysqlclient.so.#' を生成でき ないというエラーになる場合、
--disable-shared
オプションを
configure
に与えることで、この問題を回避できます。この場合、
configure
は共有ライブラリ libmysqlclient.so.#
を作成しま
せん。
NULL
項目(すなわち、NULL
が許されていない項目)に
DEFAULT
項目値を使用しないように MySQL をコンフィグでき
ます。これは、非 NULL
値を要求する全ての項目に値を明示的に指定し
なければ、INSERT
ステートメントはエラーを生成します。デフォルト値
の使用を抑えるには、次のように configure
を実行します:
shell> CXXFLAGS=-DDONT_USE_DEFAULT_FIELDS ./configure
--with-charset
オプションを
使用します:
shell> ./configure --with-charset=CHARSET
CHARSET
may be one of big5
, cp1251
, cp1257
,
czech
, danish
, dec8
, dos
, euc_kr
,
gb2312
, gbk
, german1
, hebrew
, hp8
,
hungarian
, koi8_ru
, koi8_ukr
, latin1
,
latin2
, sjis
, swe7
, tis620
, ujis
,
usa7
, or win1251ukr
.
「4.6.1 データとソートに使用されるキャラクターセット」節参照.
サーバとクライアント間で文字を変換したい場合は、
SET OPTION CHARACTER SET
コマンドを調べるべきです。
「5.5.6 SET
構文」節参照.
警告: テーブルを生成した後に文字セットを変更する場合、
myisamchk -r -q
を全てのテーブルに実行する必要があります。そうでな
いと、インデックスは正しくソートされません。(これは、MySQL のイ
ンストール時、いくつかのテーブルの生成時、異なる文字セットを使用して
MySQL の再コンフィグ時、そして再インストール時に発生します。)
With the option --with-extra-charset=LIST
you can define
which additional character sets should be incompiled in the server.
Here LIST
is either a list of character set separated with space,
complex
to include all characters that can't be dynamically loaded
or all
to include all character sets into the binaries.
--with-debug
オプションを使用します:
shell> ./configure --with-debugこれにより、いくつかのエラーを見つけられる安全なメモリ割り当てが含まれ、 何が発生しているかについての出力を提供します。 「G.1 MySQL server のデバッグ」節参照.
--enable-thread-safe-client
configure オプションでスレッド安全用に
コンパイルする必要があります。これは、スレッドアプリケーションがリンクす
べき libmysqlclient_r
ライブラリを生成します。
「8.4.7 スレッドクライアントを作る方法」節参照.
警告: 我々の新しいテストコードについて我々を手助けすることに興味 がある場合にだけ、この節を読むべきです。MySQL を得て、あなたのシ ステム上で実行したいだけの場合は、標準リリースディストリビューションを使 用すべきです(ソースまたはバイナリディストリビューション)。
我々のもっとも新しい開発ソースツリーを得るには、次の手順に従ってください:
shell> bk clone bk://work.mysql.com:7000 mysqlTo clone the 4.0 branch, use this command instead:
shell> bk clone bk://work.mysql.com:7001 mysql-4.0The initial download of the source tree may take a while, depending on the speed of your connection; be patient.
autoconf
, automake
, libtool
, and
m4
to run the next set of commands.
If you get some strange error during this stage, check that you really
have libtool
installed!
shell> cd mysql shell> bk -r edit shell> aclocal; autoheader; autoconf; automake; shell> ./configure # Add your favorite options here shell> makeA collection of our standard configure scripts is located in the `BUILD/' subdirectory. If you are lazy, you can use `BUILD/compile-pentium-debug'. To compile on a different architecture, modify the script removing flags that are Pentium-specific.
make install
. Be careful with this
on a production machine; the command may overwrite your live release
installation. If you have another installation of MySQL, we
recommand that you run ./configure
with different values for the
prefix
, tcp-port
, and unix-socket-path
options than
those used for your production server.
make test
. 「9.3.2 MySQL Test Suite」節参照.
make
stage and the distribution does
not compile, please report it to bugs@lists.mysql.com. If you
have installed the latest versions of the required GNU tools, and they
crash trying to process our configuration files, please report that also.
However, if you execute aclocal
and get a command not found
error or a similar problem, do not report it. Instead, make sure all
the necessary tools are installed and that your PATH
variable is
set correctly so your shell can find them.
bk clone
operation to get the source tree, you
should run bk pull
periodically to get the updates.
bk sccstool
. If you see some funny diffs or code that you have a
question about, do not hesitate to send e-mail to
internals@lists.mysql.com. Also, if you think you have a better idea
on how to do something, send an email to the same address with a patch.
bk diffs
will produce a patch for you after you have made changes
to the source. If you do not have the time to code your idea, just send
a description.
bk helptool
.
Solaris 上で gcc
を使用した場合、一切警告無く
全ての MySQL プログラムがきれいに作れます。
他のシステムではインクルードファイルの違いから警告が出るかもしれません。
MIT-pthreads を使用した際の警告は 「2.3.6 MIT-pthreads に関して」節 を参照してください。
他の問題は、以下をチェックしてください。
多くの問題の解決のために、再 configure が必要です。 あなたが再構成する必要があるならば、以下に気をつけてください:
configure
を一度実行した後に実行するならば、 configure
は
前に作った情報を利用します。この情報は `config.cache' に保存されます。
configure
は起動時にこのファイルを探し、もし存在するならば、
その中の情報が正しい物として読み込みます。
これはあなたが再コンフィグするならば無効になります。
configure
を実行するごとに、 make
を実行してコンパイルしなければなりません。
しかし、最初に、前のビルドでできたオブジェクトを、消しておいてください。
なぜなら、違うコンフィグオプションにより生成されたからです。
古いコンフィグやオブジェクトファイルの使用を防ぐため、
configure
前に以下のコマンドを実行してください:
shell> rm config.cache shell> make clean
こうするかわりに、make distclean
としても構いません。
以下に、 MySQL をコンパイルする際に起こりやすい問題をあげておきます:
Internal compiler error: program cc1plus got fatal signal 11 or Out of virtual memory or Virtual memory exhaustedこの問題は、
gcc
がインライン展開で `sql_yacc.cc' をコンパイルするのに、
とても多くのメモリーを必要とするからです。
この場合、 configure
を --with-low-memory
オプション指定で実行します:
shell> ./configure --with-low-memoryこのオプションは、
gcc
を使用しているなら -fno-inline
オプションを
コマンドラインに加え、gcc
以外ならば -O0
を加えます。
多くのメモリーとスワップを持っていない限りは、--with-low-memory
オプションを使用すべきです。
この問題はけっこうなハードウェア構成でも起こることが知られています。
通常、 --with-low-memory
オプションでこの問題は解決できます。
configure
は c++
という名前でコンパイラーを使用し、
GNU c++
は -lg++
を使ってリンクします。
もし gcc
を使用しているならば、コンフィグ時に以下のような問題が出るかもしれません:
configure: error: installation or configuration problem: C++ compiler cannot create executables.この問題は、
g++
, libg++
あるいは libstdc++
に関連したものです。
原因の一つとして考えられることは、 g++
を持っていないか、あるいは、
g++
はあっても libg++
か libstdc++
がないという事です。
`config.log' ファイルは c++ コンパイラが動作しなかった理由を記録しています!
この問題を解決するに当たり、あなたが持っている C++ コンパイラーの代わりに
gcc
を使用しても構いません。CXX
環境変数に "gcc -O3"
としてみてください。
例えば:
shell> CXX="gcc -O3" ./configureこれは
gcc
が g++
と同様に C++ ソースをコンパイルするので動きますが、
libg++
か libstdc++
が標準ではリンクされません。
他の解決方法は、もちろん、g++
, libg++
, libstdc++
をインストールすることです。
make
のバージョンを上げてください:
making all in mit-pthreads make: Fatal error in reader: Makefile, line 18: Badly formed macro assignment or make: file `Makefile' line 18: Must be a separator (: or pthread.h: No such file or directorySolaris と FreeBSD の
make
プログラムには問題があることが知られています。
GNU make
Version 3.75 は動作確認されています。
CFLAGS
と CXXFLAGS
環境変数に
フラグを追加してください。同様に、 CC
と CXX
にコンパイラー名を
与えることもできます。
例えば:
shell> CC=gcc shell> CFLAGS=-O3 shell> CXX=gcc shell> CXXFLAGS=-O3 shell> export CC CFLAGS CXX CXXFLAGS「2.2.6 MySQL Binaries Compiled by MySQL AB」節 にはフラグの定義がリストされています。 色々なシステム上で役に立つと思います。
gcc
コンパイラーをアップグレードしてください:
client/libmysql.c:273: parse error before `__attribute__'
gcc
2.8.1 は動作することが確認されていますが、
gcc
2.95.2 以上をお勧めします。
mysqld
コンパイル時に以下のようなエラーが出た場合、
configure
が accept()
, getsockname()
, getpeername()
の最後の引数を正しく検出していません:
cxx: Error: mysqld.cc, line 645: In this statement, the referenced type of the pointer value "&length" is "unsigned long", which is not compatible with "int". new_sock = accept(sock, (struct sockaddr *)&cAddr, &length);これを修正するには、`config.h' ファイル(
configure
により作られる) を修正します。
いかのように:
/* Define as the base type of the last arg to accept */ #define SOCKET_SIZE_TYPE XXX
XXX
を size_t
か int
(あなたのオペレーティングシステムが依存している型)に変えます。
(configure
すると毎回 `config.h' は作り直されるので、
この修正は configure
する度に行わなければならないことに注意)
"sql_yacc.yy", line xxx fatal: default action causes potential...これはあなたの
yacc
のバージョンが不十分であることを示しています。
bison
(GNU 版 yacc
) を代わりにインストールして使用する必要があります。
mysqld
か MySQL クライアントをデバッグしたいなら、
configure
を --with-debug
オプション付きで実行します。
そしてコンパイルし、新しいクライアントライブラリーでクライアントをリンクします。
「G.2 Debugging a MySQL client」節参照.
このセクションではMIT-pthreadsを使っているさいに起こる問題についていくつか述べて います。
Linux では、MIT-pthreads を使用してはならず、 LinuxThreads をインストールするべきです! 「2.6.1 Linux Notes (All Linux Versions)」節参照.
もしあなたのシステムが本来のスレッドのサポートを提供しなければ、あなたは、 MIT-pthreadsパッケージを使って、MySQL を構築する必要があります。 これにはほとんどのFreeBSDシステム、SunOS4.x,Solaris 2.4とそれ以前、ほかいくつか が含まれます。 「2.2.2 MySQL がサポートする OS」節参照.
--with-mit-threads
オプションで
configure
実行することによって、
MIT-pthreadsが使われることを強制することができます。
shell> ./configure --with-mit-threadsMIT-pthreadsを使う時、非ソースディレクトリで構築することはサポートされていませ ん。なぜなら、私たちはこのコードへ私たちの変更を最小にしたいからです。
--without-server
を使ってクライアントコードのみを
ビルドすることを設定したならば、クライアントは MIT-othreads が使われているかいないか、
UNIXソケット接続がデフォルトで使われているのかわかりません。なぜなら UNIX ソケットは
MIT-pthreads 下では動作しないからです。また、あなたはそのようなインスタンスでは
-h
または --host
を使う必要があります。
--use-locking
オプション
を指定してサーバーに伝えることで、システムロックは使えるようになります。
bind()
コマンドは何のエラーメッセージ
なしにソケットへの bind に失敗することがあります。これは結果としてサーバーへの接続
失敗となります。たとえば、
shell> mysqladmin version mysqladmin: connect to server at '' failed; error: 'Can't connect to mysql server on localhost (146)'これを解決するために
mysqld
サーバーを終了して、再起動してください。こ
れは私たちがサーバーダウンを強制して、すぐにリスタートさせようとしたときだけ起こ
りました。
sleep()
システムコールは SIGINT
(break)
では割り込みできません。 これは mysqladmin --sleep
を走らせているときにだけ
起こることがわかっています。
割り込みが発生してプロセスが停止する前に、あなたは終了させるための sleep()
コールを待たなく
てはなりません。
ld: warning: symbol `_iob' has differing sizes: (file /my/local/pthreads/lib/libpthread.a(findfp.o) value=0x4; file /usr/lib/libc.so value=0x140); /my/local/pthreads/lib/libpthread.a(findfp.o) definition taken ld: warning: symbol `__iob' has differing sizes: (file /my/local/pthreads/lib/libpthread.a(findfp.o) value=0x4; file /usr/lib/libc.so value=0x140); /my/local/pthreads/lib/libpthread.a(findfp.o) definition taken
implicit declaration of function `int strtoll(...)' implicit declaration of function `int strtoul(...)'
readline
を手に入れていません(これは必要では
ないのですが、おそらく誰かには興味があるでしょう)。
初めて MySQLをインストールしたら(バイナリからでもソースからでもですが)、 サーバーを動作させるために、許可テーブルを初期化しなくてはなりません。 またマシンの起動時、停止時に、サーバーを自動で開始、停止することもできます。
通常、許可テーブルのインストールとサーバーの開始は、 ソースディストリビューションなら以下のようにします:
shell> ./scripts/mysql_install_db shell> cd mysql_installation_directory shell> ./bin/safe_mysqld --user=mysql &
バイナリディストリビューション(RPM または pkg パッケージではない)では次を 行ないます:
shell> cd mysql_installation_directory shell> ./bin/mysql_install_db shell> ./bin/safe_mysqld --user=mysql &
これは、いくつかのデータベースを生成します。mysql
データベースは全
てのデータベース権限を保持します。test
データベースは
MySQL をテストするために使用できます。そして、
mysql_install_db
を実行したユーザの権限エントリと root
ユー
ザも生成します(パスワードはありません)。これは mysqld
サーバの起動
も行ないます。
mysql_install_db
は古い権限テーブルを上書きしません。そのため、どの
ような環境でも安全に実行できます。test
データベースを持ちたくないな
ら、mysqladmin -u root drop test
で削除できます。
テストは、MySQL のトップディレクトリーから簡単に実行できます。 バイナリ配布を使用する場合、これ(トップディレクトリ)は インストール先のディレクトリーになるでしょう(`/usr/local/mysql')。 ソース配布の場合、これは MySQL のソースディレクトリです。
コマンドは本節といかに続く節で説明しますが、BINDIR
は
mysqladmin
や safe_mysqld
がインストールされたディレクトリを示します。
バイナリ配布を使用している場合、BINDIR
はバイナリ配布の `bin' ディレクトリになります。
ソースからインストールした場合、BINDIR
は、configure
で特別指定しない限り、
`/usr/local/bin' です。
EXECDIR
は mysqld
サーバーのインストール先です。
バイナリ配布を使用している場合、これは BINDIR
ディレクトリと同一になります。
ソースからインストールした場合、`/usr/local/libexec' です。
mysqld
サーバーを起動し MySQL の許可テーブルを初期化します。
(許可テーブルはユーザーがどのような権限をもってサーバーに接続を許すかを決定するものです。)
これは通常、mysql_install_db
スクリプトで初期化されます。
shell> scripts/mysql_install_db通常、
mysql_install_db
の実行は初めて MySQL をインストール
したあと一度だけ必要です。 すでにインストールされているものを
アップグレードする際にはこの手順は飛ばせます。
(しかし、mysql_install_db
は実に安全で、すでにテーブルが
存在している場合はいかなるテーブルも更新しません。したがって、
実行すべきかどうかわからない場合は、mysql_install_db
を常に
走らせることができます)
mysql_install_db
は 6個のテーブルを作ります (user
, db
,
host
, tables_priv
, columns_priv
, func
)
mysql
データベースに。 初期の権限状態についての説明は
「4.3.4 MySQL 権限許可の初期設定」節. これらの権限は MySQL root
ユーザーに
なんでもできるように許可し、そして、だれもが
'test'
という名前か 'test_'
ではじまる名前をもつ
データベースを作成、使用できるように許可されています。
もし許可テーブルを設定していない場合、サーバーを起動時に以下のエラーが出ます:
mysqld: Can't find file: 'host.frm'バイナリ配布の MySQL では、もし MySQL を
./bin/safe_mysqld
を実行しないで起動した場合に、このエラーがおきます!
「4.7.2 safe_mysqld, the wrapper around mysqld」節参照.
root
で mysql_install_db
を実行する必要があるとあなたは思うかもしれません。
しかし、 MySQL は root
以外のユーザーで起動できます。
データベースディレクトリがサーバーを起動したユーザに対して読み書きが許可されていれば良いのです。
MySQL を一般ユーザーで走らせる方法は
「A.3.2 一般ユーザで MySQL を動かす方法」節.
もし mysql_install_db
で問題が出たら、
「2.4.1 mysql_install_db
実行時の問題」節参照. を参照のこと。
mysql_install_db
スクリプトを走らせるにはいくつか選択があります:
mysql_install_db
を走らせる前に編集して、許可の初期状態を変更してもいいでしょう。
これは多くのマシンに同じ権限設定をして MySQL をインストールする際に
役立ちます。 この場合、いくつかの INSERT
構文を mysql.user
と
mysql.db
テーブルにたいして追加するようにするだけですみます!
mysql -u root mysql
で MySQL root
ユーザーで接続して直接許可テーブルを変更する SQL 文を実行します。
mysql_install_db
を編集した後にそう思うかもしれません。mysql_install_db
.
shell> cd mysql_installation_directory shell> bin/safe_mysqld &サーバの起動に問題があれば、 「2.4.2 MySQL サーバー起動時の問題」節 を見てください。
mysqladmin
でサーバーが走っているか確認します。
サーバーが立ち上がり接続を受け付けるか確認する簡単な方法を以下に示します:
shell> BINDIR/mysqladmin version shell> BINDIR/mysqladmin variables例えば、
mysqladmin version
の出力はあなたのプラットフォームと
MySQL のバージョンを出力します。
出力は以下の様にでます:
shell> BINDIR/mysqladmin version mysqladmin Ver 8.14 Distrib 3.23.32, for linux on i586 Copyright (C) 2000 MySQL AB & MySQL Finland AB & TCX DataKonsult AB This software comes with ABSOLUTELY NO WARRANTY. This is free software, and you are welcome to modify and redistribute it under the GPL license Server version 3.23.32-debug Protocol version 10 Connection Localhost via Unix socket TCP port 3306 UNIX socket /tmp/mysql.sock Uptime: 16 sec Threads: 1 Questions: 9 Slow queries: 0 Opens: 7 Flush tables: 2 Open tables: 0 Queries per second avg: 0.000 Memory in use: 132K Max memory used: 16773K
BINDIR/mysqladmin
の使用方法は、--help
オプションで起動することにより得られます。
shell> BINDIR/mysqladmin -u root shutdown
safe_mysqld
か mysqld
を直接実行します。
例えば:
shell> BINDIR/safe_mysqld --log &
safe_mysqld
が失敗するなら、 MySQL のインストールディレクトリーから実行してみてください。
もしそれでも起動しないなら、 「2.4.2 MySQL サーバー起動時の問題」節 を参照のこと。
shell> BINDIR/mysqlshow +-----------+ | Databases | +-----------+ | mysql | +-----------+ shell> BINDIR/mysqlshow mysql Database: mysql +--------------+ | Tables | +--------------+ | columns_priv | | db | | func | | host | | tables_priv | | user | +--------------+ shell> BINDIR/mysql -e "select host,db,user from db" mysql +------+--------+------+ | host | db | user | +------+--------+------+ | % | test | | | % | test_% | | +------+--------+------+他のプラットフォームで MySQL のパフォーマンスを比較するために `sql-bench' にベンチマークがあります。 `sql-bench/Results' ディレクトリには、他のデータベースやプラットフォームで ベンチを実行した結果があります。 全てのテストを実行するには、以下のようにします:
shell> cd sql-bench shell> run-all-testsRPM バイナリ配布には `sql-bench' ディレクトリがありません。 (RPM のソース配布には含まれます) この場合、ベンチマークをインストールしなくてはなりません。 MySQL バージョン 3.22 のバイナリ配布から、 `mysql-bench-VERSION-i386.rpm' という名前で RPM パッケージを作っており、 これにはベンチマークのデータとコードが含まれます。 `tests' サブディレクトリでテストすることも可能です。 例えば、`auto_increment.tst' の実行は以下のようにします:
shell> BINDIR/mysql -vvf test < ./tests/auto_increment.tstこれの結果は `./tests/auto_increment.res' ファイルに書き出されます。
mysql_install_db
実行時の問題
mysql_install_db
スクリプトの目的は、新しい MySQL 権限テー
ブルを生成することです。他のデータには何も影響しません! 既に MySQL 権限テー
ブルをインストールしている場合は、何も行ないません!
権限テーブルを再生成したい場合は、mysqld
サーバが動作していれば、それを落
としてから、次のように行なってください:
mv mysql-data-directory/mysql mysql-data-directory/mysql-old mysql_install_db
この節では mysql_install_db
を実行した際にでくわすかもしれない問題について述べます:
mysql_install_db
doesn't install the grant tables
mysql_install_db
が権限テーブルをインストールできなかった事のメッセージですが、
続いて以下のようにメッセージが出た場合:
starting mysqld daemon with databases from XXXXXX mysql daemon endedこの場合、注意深く log ファイルを調べてください! エラーメッセージに出ている `XXXXXX' ディレクトリにログファイルがあり、 これに
mysqld
がなぜスタートしなかったか記されているはずです。
もし何が起こったかわからない場合、このログファイルを含んで mysqlbug
を使用して
バグレポートを投稿してください!
「1.2.22.3 バグや問題を報告する方法」節参照.
mysqld
daemon running
mysql_install_db
を実行する必要はありません。
mysql_install_db
を実行するのは MySQL を初めてインストールした後、
たった一回だけです。
mysqld
daemon doesn't work when one daemon is running
Can't start server: Bind on TCP/IP port: Address already in use
エラーメッセージか
Can't start server : Bind on unix socket...
エラーメッセージが出ます。
「4.1.3 同じマシンに多くのサーバをインストールする」節参照.
mysql_install_db
の実行時、あるいは mysqld
の起動/使用時に
エラーとなるでしょう。
違うディレクトリーにソケットファイルや一時ファイルを指定するには:
shell> TMPDIR=/some_tmp_dir/ shell> MYSQL_UNIX_PORT=/some_tmp_dir/mysqld.sock shell> export TMPDIR MYSQL_UNIX_PORT「A.4.5 MySQL ソケットファイル `/tmp/mysql.sock' を変更する方法、削除から守る方法」節参照. `some_tmp_dir' は書き込みが可能なディレクトリーを指定しなくてはなりません。 「H Environment Variables」節参照. この後、
mysql_install_db
を走らせ、サーバーを起動する事ができます:
shell> scripts/mysql_install_db shell> BINDIR/safe_mysqld &
mysqld
crashes immediately
glibc
を使用している場合、
全ての glibc
パッチを当てなくてはなりません!
これに関しては MySQL メールのアーカイブに情報が多くあります。
http://www.mysql.com/documentation/.
Also, see 「2.6.1 Linux Notes (All Linux Versions)」節.
mysqld
を --skip-grant-tables
指定で起動することもできます。
そして以下のように mysql
を使用して自分自身の手により許可を加えます:
shell> BINDIR/safe_mysqld --skip-grant-tables & shell> BINDIR/mysql -u root mysql
mysql
から手動で mysql_install_db
に書かれている SQL コマンドを実行します。
許可テーブルをサーバーに読み込ますためには、
mysqladmin flush-privileges
か mysqladmin reload
を実行します。
トランザクションをサポートするテーブル(BDB, InnoDB)を使用しようとする場合、 最初に my.cnf ファイルを生成して、使用しようとするテーブル型の起動オプショ ンを設定すべきです。 「7 MySQL テーブル型」節参照.
通常 mysqld
サーバーの起動は、以下の三つの方法のうち一つで行います:
mysql.server
による起動。このスクリプトはシステムの起動時、停止時に使われます。
詳細は 「2.4.3 MySQL の自動起動と自動停止」節.
safe_mysqld
による起動。これは mysqld
への適切なオプションを決定し、
それらのオプションでサーバーの起動を試みます。 「4.7.2 safe_mysqld, the wrapper around mysqld」節参照.
mysqld
を次のようにサービスとしてインストールすべきです:
bin\mysqld-nt --install # Install MySQL as a serviceすると、次のように
mysqld
を起動/停止できます:
NET START mysql NET STOP mysql注意: この場合 mysqld に対して他のオプションは使用できません! 次のようにしてサービスを削除できます:
bin\mysqld-nt --remove # remove MySQL as a service
mysqld
を直接起動。
mysqld
デーモンの起動時に、デーモンはデータディレクトリにディレクトリを変えます。
ログファイルと pid (process ID) ファイルがこのディレクトリに書ける事、
そしてデータベースがこのディレクトリにある事を、デーモンは要求します。
データディレクトリの場所は配布物のコンパイル時に指定されています。
mysqld
があなたのシステム上にデータベースディレクトリを見つけれなかった場合、
サーバーは動きません。
mysqld
を --help
オプションで起動すれば mysqld
の
デフォルトのパスを知ることができますので、
サーバーが起動しない理由が違うパスを使用しているために起こっているかどうかがわかります。
パスが違う場合、mysqld
のコマンドラインの引数に正しいパスを指定して、デフォルト値を
上書きすることが可能です。(これらオプションは safe_mysqld
にも同様に使用できます)
通常、MySQL がインストールされたディレクトリのベースディレクトリだけを
mysqld
に教えればいいはずです。
これは --basedir
オプションを指定します。
--help
オプションを使用すればパスの変更が確認できます。
(--help
は必ず 最後に指定のこと)
例えば:
shell> EXECDIR/mysqld --basedir=/usr/local --help
パスの設定が思い通りに言ったことを確認したら、 --help
オプションを外してサーバーを起動します。
どの方法でサーバーを起動しても、もし起動に失敗すれば、ログファイルを確認してください。
なぜ失敗したか記録されています。ログファイルはデータベースディレクトリにあります。
(バイナリ配布の場合 `/usr/local/mysql/data' 、ソース配布の場合 `/usr/local/var'、
Windows では `\mysql\data\mysql.err' )
データベースディレクトリに `host_name.err' と `host_name.log' という
ファイル (host_name
はあなたのサーバー名) を探してください。
以下のようにしてそのファイルの最後の数行を確認します:
shell> tail host_name.err shell> tail host_name.log
ログファイル中に次のような何かを見つけた場合:
000729 14:50:10 bdb: Recovery function for LSN 1 27595 failed 000729 14:50:10 bdb: warning: ./test/t1.db: No such file or directory 000729 14:50:10 Can't init databases
これは --bdb-recover
付きで mysqld
が起動され、Berkeley DB がデータ
ベースを復元しようとした時にログファイルに悪い何かを見つけたということを意
味します。継続を可能にするためには、古い Berkeley DB ログファイルをデータ
ベースディレクトリから、あとで検査できる他の場所に移すべきです。ログファイ
ルは `log.0000000001' (番号は時間の経つと増加します)と名付けられてい
ます。
BDB テーブルサポートで mysqld
を実行していて、mysqld
が起動時にコア
ダンプする場合、BDB recover log にいくつかの問題の原因があり得ます。この場
合、mysqld
を --bdb-no-recover
で起動を試みることができます。
これで救える場合は、データディレクトリから全ての `log.*' ファイルを削
除し、そして mysqld
を再び起動してみてください。
以下のエラーの場合、他のプログラム(か他の mysqld
サーバー)が
mysqld
が使用しようとしている TCP/IP ソケットを使っています:
Can't start server: Bind on TCP/IP port: Address already in use or Can't start server : Bind on unix socket...
他の mysqld
サーバーが走っていないかを ps
で確認します。
もし他のサーバーが起動していないなら、 telnet your-host-name tcp-ip-port-number
コマンドを実行し、何回か RETURN
キーをたたいてみてください。
もし、 telnet: Unable to connect to remote host: Connection refused
のような
エラーが出た場合、なにかが mysqld
が使用しようとしているポートを既に使っています。
See 「2.4.1 mysql_install_db
実行時の問題」節 and 「4.1.4 同一マシン上に複数の MySQL サーバーを走らせる」節.
もし safe_mysqld
が MySQL インストールディレクトリから起動しても失敗するなら、
safe_mysqld
をあなたのシステム用に mysqld
のパスやパス名のオプションを
書き換えてもかまいません。
この場合、 MySQL をアップグレードした場合、あなたが変更した
safe_mysqld
は上書きされるので、変更したものはインストール前にコピーしておき、
再び戻さなくてはなりません。
もし mysqld
がすでに走っている場合、以下のコマンドにてパスの設定を知ることができます:
shell> mysqladmin variables
または
shell> mysqladmin -h 'your-host-name' variables
もし safe_mysqld
がサーバーを起動しても接続できないようなら、
`/etc/hosts' ファイルに以下のような記述を持たせてください:
127.0.0.1 localhost
この問題はスレッドライブラリーがなくて MySQL を MIT-pthreads を 使用するようにして作ったシステムにだけ起こります。
mysqld
を起動できない場合、問題を見つけるためにトレースファイルの作
成を試みることができます。 「G.1.2 Creating trace files」節参照.
InnoDB テーブルを使用している場合、InnoDB 固有の起動オプションを参照してく ださい。 「7.6.2 InnoDB 起動オプション」節参照.
BDB (Berkeley DB) テーブルを使用する場合は、BDB 固有の起動オプションに精通 すべきです。 「7.5.3 BDB startup options」節参照.
mysql.server
と safe_mysqld
スクリプトは、システム起動時に自
動的にサーバを起動するために使用できます。mysql.server
はサーバを停
止するためにも使用できます。
mysql.server
とスクリプトは start
, stop
引数を指定することにより
サーバーを起動、停止できます:
shell> mysql.server start shell> mysql.server stop
mysql.server
は MySQL インストールディレクトリの `share/mysql' ディレクトリ、
または MySQL ソースツリーの `support-files' ディレクトリにあります。
mysql.server
はサーバーを起動時する前に MySQL がインストールされた
ディレクトリにディレクトリを変え、safe_mysqld
を起動します。
もし標準以外にインストールしているバイナリ配布を使用しているなら、
mysql.server
を編集する必要があるかもしれません。
safe_mysqld
を起動する前に正しいディレクトリに cd
するように変更します。
safe_mysqld
に他のオプションを与えるように mysql.server
を変えても構いません。
他のユーザーで実行したい場合、add an appropriate user
line
to the `/etc/my.cnf' file, as shown later in this section.
mysql.server stop
はサーバーにシグナルを送ってサーバーを停止します。
mysqladmin shutdown
で手動でサーバーを落とすこともできます。
MySQL を使用している製品のために、これらスタート、ストップを
`/etc/rc*' に書きたいと思われるかもしれません。
ここでの注意点は、変更した mysql.server
は、
MySQL をアップグレードしたときに上書きされるということです。
よって、変更したものはインストール前にコピーを取っておくべきです。
もしあなたのシステムが `/etc/rc.local' を起動スクリプトとして使用しているなら、 以下のようにその中に記述します:
/bin/sh -c 'cd /usr/local/mysql ; ./bin/safe_mysqld --user=mysql &'
グローバル設定ファイルである `/etc/my.cnf' に、 mysql.server
の
オプションを記述することも可能です。`/etc/my.cnf' ファイルは以下のような
記述になっています:
[mysqld] datadir=/usr/local/mysql/var socket=/var/tmp/mysql.sock port=3306 user=mysql [mysql.server] basedir=/usr/local/mysql
mysql.server
スクリプトは次のオプションを理解します:
datadir
, basedir
そして pid-file
.
次の表は、各起動スクリプトがオプションファイルからどのオプショングループを読み込むかを示しています:
Script | Option groups |
mysqld | mysqld and server
|
mysql.server | mysql.server , mysqld , and server
|
safe_mysqld | mysql.server , mysqld , and server
|
「4.1.2 my.cnf オプションファイル」節参照.
MySQL 形式とデータファイルは、MySQL が同じベースバージョ
ンである限り、同じアーキテクチャ上の異なるバージョン間でいつでも移動でき
ます。現在のベースバージョンは 3 です。MySQL の実行時に
キャラクタ・セットが変更された場合(これはソート順も変更します)、全てのテーブル
に myisamchk -r -q
を行なう必要があります。そうしなければ、インデッ
クスが正しい順になりません。
もしあなたが神経質だったり新しいバージョンを恐れている場合、いつでもあな
たの古い mysqld
を mysqld
-'old-version-number' のような何
かにリネームできます。もし新しい mysqld
が予期せぬ何かを行った場
合、単純にそれをシャットダウンし、古い mysqld
を再起動することが
できます!
アップグレード時には、もちろん、古いデータベースをバックアップもしておく べきです。
アップグレード後、再コンパイルされたクライアントプログラムで、
Commands out sync
や予期せぬコアダンプのような問題が起きる場合、
おそらく、プログラムのコンパイル時に古いヘッダやライブラリファイルを使用
したのでしょう。この場合、`mysql.h' ファイルと `libmysql.a' ラ
イブラリが、新しい MySQL 配布からのものであるかどうかを確かめる
ために、日付をチェックすべきです。もし違っていれば、プログラムを再コンパ
イルしてください!
もし新しい mysqld
サーバーが起動できないとか、パスワード無しで
接続できないとか、いくつかの問題が発生した場合、以前のインストールでできた
古い `my.cnf' ファイルがあるかどうかを確認してください!
program-name --print-defaults
で確認できます. もしこの出力が
プログラムの名称以外の物を返した場合、有効になっている my.cnf
ファイルが
あります!
新しいリリースの MySQL をインストールした場合に常に
Msql-Mysql-modules
を再構築、再インストールすることは
いい考えです。すべての DBI
スクリプトが MySQL の
アップグレード後にコアダンプする兆候に気づいた場合は、特に
そうしてください。
MySQL バージョン 3.23 は新しい MyISAM
型のテーブルと、
古い ISAM
型のテーブルをサポートします。
バージョン 3.23 を使用する際、古いテーブル(ISAM) を変換する必要はありません。
デフォルトでは、新しく作られるテーブルが MyISAM
型になります。
(これは mysqld
を --default-table-type=isam
オプションで
起動することにより、変更できます)。
ISAM
テーブルを MyISAM
に変更するには、
ALTER TABLE table_name TYPE=MyISAM
を使用するか、mysql_convert_table_format
perl スクリプトを使用します。
バージョン 3.22 と バージョン 3.21 のクライアントは問題なく バージョン 3.23 サーバーで動作します。
以下に、バージョン 3.23 にアップグレードするときに、注目する必要があるものを列挙します:
tis620
文字セットを使用しているすべてのテーブルを myisamchk
-r
または REPAIR TABLE
で fix する必要があります。
DROP DATABASE
を行なう場
合は、リンクとオリジナルデータベースが削除されます。(3.22 では configure
が readlink
システムコールを検出しないため、これは起りません。)
OPTIMIZE TABLE
は現在、MyISAM テーブルだけに動作します。他
のテーブル型については、ALTER TABLE
を使用して、テーブルを最適化で
きます。OPTIMIZE TABLE
の間は、テーブルは他のスレッドからロックされ
ます。
mysql
は現在、デフォルトで
--no-named-commands (-g)
オプションで起動されます。このオプションは
--enable-named-commands (-G)
で無効にできます。これは、非互換問題を
引き起こす場合があります。たとえば、セミコロン無しの named command を使用
する SQL スクリプトです! 長い形式のコマンドは行頭でまだ動作します。
german
文字ソート順を使用する場合、ソート順についていくつか変更され
ているので、isamchk -r
ですべてのテーブルを修復する必要があります!
IF
のデフォルトの戻り値型は現在両方の引数に依存します。最初の引数だけではありません。
AUTO_INCREMENT
は負数では働きません。
この理由は、負数は -1 から 0 へのラッピング時に問題を引き起こすためです。
AUTO_INCREMENT
は現在 MyISAM テーブルでは低いテーブルで処理され、以
前よりとても速いです。MyISAM テーブルでは、テーブルからいくつかのレコード
を削除したとしても、古い数値は再利用されません。
CASE
, DELAYED
, ELSE
, END
,
FULLTEXT
, INNER
, DELAYED
,RIGHT
, WHEN
は
予約語になりました。
FLOAT(X)
は本当の浮動小数点型になりました。桁数固定の値ではありません。
DECIMAL(length,dec)
宣言時、length 引数はもはや符号や小数点の場所を含みません。
TIME
文字列は以下のフォーマットのいずれかでなければなりません:
[[[DAYS] [H]H:]MM:]SS[.fraction]
か
[[[[[H]H]H]H]MM]SS[.fraction]
LIKE
は、同一文字の比較 '='
ルールを使用して、
比較を行うようになりました。
もし古い比較方法にするならば、 MySQL を CXXFLAGS=-DLIKE_CMP_TOUPPER
フラグでコンパイルします。
REGEXP
は、通常の文字列(非 binary) では、ケース非依存になりました。
MyISAM
テーブル(.MYI
) の検査・修復には、CHECK TABLE
を使用するか、myisamchk
を使用します。
isamchk
は ISAM(.ISM
) テーブル用に使用します。.
mysqldump
を行いたいならば、
--opt
や --full
オプションを mysqldump
に指定してはいけません。
DATE_FORMAT()
をチェックしてください。
各フォーマット文字の前には `%' 文字が必要になりました。
(MySQL 3.22 バージョン以降ではこの文法が許されます。)
mysql_fetch_fields_direct
が関数になり (今まではマクロだったのが)、
MYSQL_FIELD
型ではなく MYSQL_FIELD
ポインター型を返します。
mysql_num_fields()
は、 MYSQL*
object をもはや使うことができません。
(これは今、 MYSQL_RES*
を引数に取る関数になりました)。
代わりに、 mysql_field_count()
を使用すべきです。
MySQL
バージョン 3.22 では, SELECT DISTINCT ...
の出力は
ほとんどいつもソートされました。 3.23 では, ソートを行った結果を得るには
GROUP BY
か ORDER BY
を使用しなくてはなりません。
SUM()
は 0 の代わりに NULL
を返すようになりました。
これは ANSI SQL 準拠です。
NULL
値での AND
や OR
は現在 0 ではなく
NULL
を返します。
これは主に、NOT NULL
= NULL
として、AND/OR
式上で
NOT
を使用するクエリに影響します。LPAD()
と RPAD()
は
長さ引数よりも長い場合、結果文字列は短くなります。
バージョン 3.21 と バージョン 3.22 の間には互換性に影響する変更はありません。
DATE
型のフィールドを持たせて作成した新しいテーブルは、
日付の格納に新しい方法を使用することだけが、唯一の落とし穴です。
これらの新しいフィールドに古いバージョンの
mysqld
からアクセスすることはできません。
MySQL
バージョン 3.22 インストール後、新しいサーバを開始して、
mysql_fix_privilege_tables
スクリプトを実行すべきです。これは
GRANT
コマンドを使用するために必要な権限を追加します。これを忘れ
ると、ALTER TABLE
、CREATE INDEX
、DROP INDEX
を
使用しようとした時に Access denied
になります。
MySQL root ユーザがパスワードを要求する場合、
mysql_fix_privilege_tables
への引数としてそれを与えてください。
C API インタフェース mysql_real_connect()
は変更されました。この
関数を呼び出す古いクライアントプログラムを持っている場合は、新しい
db
引数に 0
を置く(またはより速い接続のために db
要
素を送るようにクライアントをコーディングしなおす)必要があります。
mysql_real_connect()
を呼び出す前に
mysql_init()
を呼ばなくてはなりません!
この変更は、MYSQL
の構造体にオプションを保存するための
新しい mysql_options()
関数を有効にします。
mysqld
変数 key_buffer
は key_buffer_size
に名前が
変わりました。しかし、まだ前の名前もスターとアップファイル中で使用できま
す。
既に バージョン 3.20.28 より前のバージョンが稼働していて、バージョン 3.21.x に変更したい場合は、 次を行なう必要があります:
safe_mysqld --old-protocol
で mysqld
3.21 サーバを起動すれ
ば、バージョン 3.20 配布からのクライアントでそれを使用できます。この場合、新しいク
ライアント関数 mysql_errno()
はサーバのエラーは何も返さず、
CR_UNKNOWN_ERROR
だけを返します (ただしクライアントのエラーについ
ては働きます)。そして サーバは古い password()
チェックを新しいものの代わ
りに使用します。
mysqld
に --old-protocol
オプションを使わない場合、
次の変更をする必要があります:
mysql.user
テーブル内の password
フィールドを
CHAR(16)
に変換するために、スクリプト
scripts/add_long_password
を実行する必要があります。
mysql.user
テーブル内に再配置する必要がありま
す(31ビットパスワードの代わりに、62ビットを得るために)。
MySQL バージョン 3.20.28 とそれ以降は、クライアントに影響を及ぼさずに、新
しい user
テーブル形式を処理することができます。バージョン 3.20.28 より前の
MySQL バージョンを持っている場合は、user
テーブルを変換
すると、パスワードはその上ではもう働きません。安全のため、最初に少なくと
も バージョン 3.20.28 にアップグレードし、それから バージョン 3.21.x に
アップグレードすべきです。
新しいクライアントコードは バージョン 3.20.x mysqld
サーバで動作するので、
もし バージョン 3.21.x で問題があった場合は、クライアントをもう一度再コンパイルする必
要はなく、古い バージョン 3.20.x サーバを使用することができます。
mysqld
に --old-protocol
オプションを使用しない場合、古い
クライアントはエラーメッセージを発します:
ERROR: Protocol mismatch. Server Version = 10 Client Version = 9
新しい Perl インタフェース DBI
/DBD
は古い mysqlperl
インタフェースもサポートします。mysqlperl
を使用する場合に行う必
要のある変更は、connect()
関数の引数の変更だけです。新しい引数は:
host
, database
, user
, password
(user
と password
引数の順番が変更されました)。
「8.2.2 The DBI
Interface」節参照.
次の変更は古いアプリケーションでのクエリに影響します:
HAVING
は現在 ORDER BY
節より前になければいけません。
LOCATE()
へのパラメータは交換されました。
DATE
,
TIME
そして TIMESTAMP
です。
もし、MySQL バージョン 3.23 を使用しているならば、
違うアーキテクチャのマシンに、.frm
, .MYI
,.MYD
ファイルを
コピーすることが出来ます。
ただし、両者間で、同じ浮動小数点のフォーマットをサポートしている場合に限ります。
(MySQL takes care of any byte swapping issues).
現在 MySQL ISAM
データファイルとインデックスファイル
( `*.ISD' と `*.ISM' ファイル) はアーキテクチャ依存で、
いくつかのケースでは OS 依存です。
アプリケーションを、現在のマシンとは異なるアーキテクチャ/OS を
持つ他のマシンに移したい場合は、単純にファイルを他のマシンにコピーするこ
とでデータベースを移行しようとすべきではありません。mysqldump
を
使用すべきです。
デフォルトでは mysqldump
は、完全な SQL ステートメントファイルを
生成します。それからそのファイルを他のマシンへ転送し、mysql
クラ
イアントへの入力として与えることができます。
有効なオプションが何かを見るためには、mysqldump --help
を試してく
ださい。データを MySQL のより新しいバージョンに移す場合、速くコ
ンパクトなダンプを得るために、より新しいバージョンで mysqldump --opt
を使用すべきです。
2つのマシン間でデータベースを移動する最も簡単な (しかし最も速くはない) 方法は、データベースが置かれているマシン上で次のコマンドを実行することで す:
shell> mysqladmin -h 'other hostname' create db_name shell> mysqldump --opt db_name \ | mysql -h 'other hostname' db_name
遅いネットワーク上でリモートマシンからデータベースをコピーしたい場合は、 次を使用できます:
shell> mysqladmin create db_name shell> mysqldump -h 'other hostname' --opt --compress db_name \ | mysql db_name
ファイル内の結果を格納することもできます (この例では圧縮されています):
shell> mysqldump --quick db_name | gzip > db_name.contents.gz
データベースの中身を含んでいるファイルを、目的のマシンに転送して、次のコ マンドを実行してください:
shell> mysqladmin create db_name shell> gunzip < db_name.contents.gz | mysql db_name
データベース転送を実行するために、mysqldump
と mysqlimport
も使用できます。大きなテーブルでは、これは単純な mysqldump
の使用
よりもとても速いです。次に示すコマンドでは、DUMPDIR
は
mysqldump
からの出力を格納するために使用するディレクトリの完全な
パス名を表わしています。
まず、出力ファイルのためのディレクトリを作成して、データベースをダンプし ます:
shell> mkdir DUMPDIR shell> mysqldump --tab=DUMPDIR db_name
それから、DUMPDIR
ディレクトリ内のファイルを目的のマシン上の対応
するディレクトリに転送し、MySQL にファイルをロードします:
shell> mysqladmin create db_name # create database shell> cat DUMPDIR/*.sql | mysql db_name # create tables in database shell> mysqlimport db_name DUMPDIR/*.txt # load data into tables
mysql
データベースのコピーも忘れないでください。それは承認テーブ
ル (user
, db
, host
) が格納されるためです。
mysql
データベースをその場所に置くまで、新しいマシン上では
MySQL root
ユーザとしてコマンドを実行する必要があります。
新しいマシン上へ mysql
データベースを導入した後、サーバが承認テー
ブル情報を再ロードするために、mysqladmin flush-privileges
を実行してください。
以下の注意は、glibc に関して、MySQL をあなた自身で作成す るシチュエーションだけに適用されます。Linux を x86 マシンで実行する場合、 多くの場合は我々のバイナリを使用した方が良いです。我々は glibc の 最良パッチバージョンと我々のバイナリをリンクします。我々は最良のコンパイラ オプションでそれを作成し、高負荷サーバについて適切になるように試みています。 以下のテキストを読んで、何をあなたがやるべきかについて迷った時は、あなたの 必要にかなうかどうかをみるために、我々のバイナリをまず試してください。そし て、我々のバイナリが十分でないとわかった後にだけ、あなた自身の作成について 考えてください。この場合、それについての評価します。そのため、次回にはより 良いバイナリを作成できます。典型的なユーザについて、そして、多くの同時接続 と 2GB 制限を超えるテーブルを設定する場合でも、多くの場合、我々のバイナリ は最良の選択です。
Linux では MySQL は LinuxThreads を使用します。
もし glibc2
を持たない古い Linux を使用している場合、
MySQL のコンパイルの前に、
LinuxThreads をインストールしなければなりません。
LinuxThreads は http://www.mysql.com/Downloads/Linux から得ることが
できます。
NOTE: We have seen some strange problems with Linux 2.2.14 and MySQL on SMP systems; If you have a SMP system, we recommend you to upgrade to Linux 2.4 ASAP! Your system will be faster and more stable by doing this!
注意: 2.1.1 以前の glibc
バージョンは
pthread_mutex_timedwait
処理に致命的なバグがあります。これは
INSERT DELAYED
を行なう時に使用されます。glibc をアップグレードする
前に INSERT DELAYED
は使用しないようにお奨めします。
1000以上の同時接続を使用する予定であれば、LinuxThreads にいくつかの変更
をして、再コンパイルし、MySQL を新しい `libpthread.a' を使用するように再リ
ンクする必要があります。`sysdeps/unix/sysv/linux/bits/local_lim.h' 内の
PTHREAD_THREADS_MAX
を 4096 に増加し、
`linuxthreads/internals.h' 中の STACK_SIZE
を
256 KB に減少させてください。注意: STACK_SIZE
がデフォルトの 2MB である
場合、MySQL は 600-1000 程度の接続で安定でなくなります。
MySQL が十分なファイルをオープンまたは接続できないという問題を 得た場合、十分なファイルを操作するように構築された Linux を持っていない ということです。
Linux 2.2 以降では、割り当てられたファイル記述子の数を次のようにしてチェッ クできます:
cat /proc/sys/fs/file-max cat /proc/sys/fs/dquot-max cat /proc/sys/fs/super-max
16M 以上のメモリがある場合は、次のような何かを起動スクリプト(SuSE では `/etc/rc/boot.local')に追加すべきです:
echo 65536 > /proc/sys/fs/file-max echo 8192 > /proc/sys/fs/dquot-max echo 1024 > /proc/sys/fs/super-max
上記は、root でコマンドラインからも実行できますが、この場合、コンピュータ をリブートすると古い制限が使われます。
/etc/my.cnf にも追加すべきです:
[safe_mysqld] open_files_limit=8192
上記は MySQL に、最大 8192 接続/ファイルを生成することを許可しま す。
The STACK_SIZE
constant in LinuxThreads controls the spacing of thread
stacks in the address space. It needs to be large enough so that there will
be plenty of room for the stack of each individual thread, but small enough
to keep the stack of some thread from running into the global mysqld
data. Unfortunately, the Linux implementation of mmap()
, as we have
experimentally discovered, will successfully unmap an already mapped region
if you ask it to map out an address already in use, zeroing out the data
on the entire page, instead of returning an error. So, the safety of
mysqld
or any other threaded application depends on the "gentleman"
behavior of the code that creates threads. The user must take measures to
make sure the number of running threads at any time is sufficiently low for
thread stacks to stay away from the global heap. With mysqld
, you
should enforce this "gentleman" behavior by setting a reasonable value for
the max_connections
variable.
If you build MySQL yourself and do not want to mess with patching
LinuxThreads, you should set max_connections
to a value no higher
than 500. It should be even less if you have a large key buffer, large
heap tables, or some other things that make mysqld
allocate a lot
of memory or if you are running a 2.2 kernel with a 2GB patch. If you are
using our binary or RPM version 3.23.25 or later, you can safely set
max_connections
at 1500, assuming no large key buffer or heap tables
with lots of data. The more you reduce STACK_SIZE
in LinuxThreads
the more threads you can safely create. We recommend the values between
128K and 256K.
多くの同時接続を使用したい場合は、fork 爆弾攻撃を避けようとして、子供の
fork や複製について、プロセスにペナルティを課すという、バージョン 2.2 カー
ネルの "機能" に悩まされるでしょう。これにより、あなたが並行クライアントの
数を増加するようには、MySQL がスケールしません。シングル CPU システムでは、
とても遅いスレッド生成で明らかにこれが見られます。これは、MySQL への接続に
長い時間(1分程度)が掛かり、それを切断するのにも長い時間掛かるということを
意味します。複数 CPU システムでは、クライアント数の増加に従って、クエリ速
度が徐々に落ちていくのが観測されました。問題の解決を見つけようとする処理の
中で、我々のユーザからカーネルパッチを受け取りました。我々はいくつかの限定
されたテストで、このパッチが MySQL のスケーラビリティを非常に改善した結果
を得ました。このパッチはここにあります
(http://www.mysql.com/Downloads/Patches/linux-fork.patch). We have
now done rather extensive testing of this patch on both development and
production systems. It has significantly
improved MySQL
performance without causing any problems and we now
recommend it to our users who are still running high-load servers on
2.2 kernels. This issue has been fixed in the 2.4 kernel, so if you are not
satisfied with
the current performance of your system, rather than patching your 2.2 kernel,
it might be easier to just upgrade to 2.4, which will also give you a nice
SMP boost in addition to fixing this fairness bug.
我々は 2 CPU マシン上の Linux カーネルバージョン 2.4 で MySQL をテストし
ました。そしてこの上では MySQL はとても良くスケールします!
- there was virtually no slowdown
on query throughput all the way up
to 1000 clients, and MySQL scaling factor ( computed as the ratio of
maximum throughput to the throughput with one client) was 180%.
We have observed similar results on a 4-CPU system - virtually no
slowdown as the number of
clients was increased up to 1000, and 300% scaling factor. So for a high-load
SMP server we would definitely recommend the 2.4 kernel at this point. We
have discovered that it is essential to run mysqld
process with the
highest possible priority on the 2.4 kernel to achieve maximum performance.
This can be done by adding
renice -20 $$
command to safe_mysqld
. In our testing on a
4-CPU machine, increasing the priority gave 60% increase in throughput with
400 clients.
We are currently also trying to collect
more info on how well MySQL
performs on 2.4 kernel on 4-way and 8-way
systems. If you have access such a system and have done some benchmarks,
please send a mail to docs@mysql.com with the results - we will
include them in the manual.
There is another issue that greatly hurts MySQL performance, especially on SMP systems. The implementation of mutex in LinuxThreads in glibc-2.1 is very bad for programs with many threads that only hold the mutex for a short time. On an SMP system, ironic as it is, if you link MySQL against unmodified LinuxThreads, removing processors from the machine improves MySQL performance in many cases. We have made a patch available for glibc 2.1.3, linuxthreads-2.1-patch to correct this behavior.
With glibc-2.2.2
MySQL version 3.23.36 will use the adaptive mutex, which is much
better than even the patched one in glibc-2.1.3. Be warned, however,
that under some conditions, the current mutex code in glibc-2.2.2
overspins, which hurts MySQL performance. The chance of this
condition can be reduced by renicing mysqld
process to the highest
priority. We have also been able to correct the overspin behavior with
a patch, available here. It combines the correction of overspin, maximum number of
threads, and stack spacing all in one. You will need to apply it in the
linuxthreads
directory with
patch -p0 </tmp/linuxthreads-2.2.2.patch
.
We hope it will be included in
some form in to the future releases of glibc-2.2
. In any case, if
you link against glibc-2.2.2
you still need to correct
STACK_SIZE
and PTHREAD_THREADS_MAX
. We hope that the defaults
will be corrected to some more acceptable values for high-load
MySQL setup in the future, so that your own build can be reduced
to ./configure; make; make install
.
We recommend that you use the above patches to build a special static
version of libpthread.a
and use it only for statically linking
against MySQL
. We know that the patches are safe for MySQL
and significantly improve its performance, but we cannot say anything
about other applications. If you link other applications against the
patched version of the library, or build a patched shared version and
install it on your system, you are doing it at your own risk with regard
to other applications that depend on LinuxThreads
.
If you experience any strange problems during the installation of MySQL, or with some common utilties hanging, it is very likely that they are either library or compiler related. If this is the case, using our binary will resolve them.
一つ知られている問題として、バイナリ配布を libc5
の古い Linux システム
(RedHat 4.x , Slackware 3.6 以下, Debian 1.3 bo 以下など)
で使用すると、ホスト名解決の致命的なエラーが出ます.
「2.6.1.1 Linux Notes for Binary Distributions」節参照.
LinuxThreads を使用している場合、最低3つのプロセスが走ります。 これらは実スレッドで、一つは LinuxThreads マネージャーのために、 一つは接続のハンドルに、もうひとつはアラームとシグナルのハンドルです。
注意: linux カーネルと linuxthread ライブラリはデフォルトでは 1024 スレッ ドだけ持つことができます。これはパッチを適用していないシステム上では MySQL への接続は最大 1021 だけであるということを意味します。ページ http://www.volano.com/linuxnotes.html はこの制限をどのように回避 するかの情報が含まれています。
もし mysqld
デーモンプロセスが ps
などでみると死んでいるようであれば,
通常これは MySQL バグか、壊れたテーブルを持っています。
「A.4.1 What To Do If MySQL Keeps Crashing」節参照.
Linux 上で、mysqld
が SIGSEGV シグナルで死んだ時にコアダンプを得たい場合、
--core-file
オプションを付けて mysqld
を起動できます。注意:
ulimit -c 1000000
を safe_mysqld
に追加するか
--core-file-sizes=1000000
をつけて safe_mysqld
を起動して、
core file size
を増加する必要があります。
「4.7.2 safe_mysqld, the wrapper around mysqld」節参照.
もし MySQL クライアントをリンクしようとして以下のエラーになった場合:
ld.so.1: ./my: fatal: libmysqlclient.so.4: open failed: No such file or directory
実行時には、以下のうちの一つの方法で問題を解決できます:
-Lpath
のかわりに)リンクします:
-Wl,r/path-libmysqlclient.so
.
libmysqclient.so
を `/usr/lib' にコピーします
LD_RUN_PATH
環境変数を `libmysqlclient.so' が存在する場所に設定します。
(クライアントを実行する前に設定します)
富士通コンパイラ (fcc / FCC)
を使用している場合、MySQL
のコンパイルにいくつかの問題があります。Linux ヘッダファイルはとても
gcc
指向であるためです。
次の configure
行は fcc/FCC
で動作します:
CC=fcc CFLAGS="-O -K fast -K lib -K omitfp -Kpreex -D_GNU_SOURCE -DCONST=const -DNO_STRTOLL_PROTO" CXX=FCC CXXFLAGS="-O -K fast -K lib -K omitfp -K preex --no_exceptions --no_rtti -D_GNU_SOURCE -DCONST=const -Dalloca=__builtin_alloca -DNO_STRTOLL_PROTO '-D_EXTERN_INLINE=static __inline'" ./configure --prefix=/usr/local/mysql --enable-assembler --with-mysqld-ldflags=-all-static --disable-shared --with-low-memory
MySQL は少なくとも Linux バージョン 2.0 を必要とします。
TcX のバイナリリリースは -static
でリンクされており、これはあなたのシステムが
どのバージョンのライブラリーを使用しているか気にする必要がありません。
よって、LinuxThreads もこの場合必要ありません。
-static
でリンクされたプログラムのサイズは
ダイナミックリンクされたプログラムより大きくなりますが、少し(3-5%)速くなります。
しかし一つの問題として、このスタティックリンクされたプログラムでは、
ユーザー定義関数(UDF)が使用できないことです。
もし UDF を使用する(書く)場合(C, C++とかで)、自分自身で MySQL を
ダイナミックリンクを使用してコンパイルしなくてはなりません。
もし glibc2
ではなく libc ベースのシステムを使用しているなら、
このバイナリリリースではホスト名解決と getpwnam()
にいくつか問題が出ます。
(これは glibc
がホスト名解決と getpwent()
にいくつかの外部ライブラリに
依存しているためで、たとえ -static
リンクしても解決しません).
この場合、mysql_install_db
実行時に以下のエラーが出るでしょう:
Sorry, the host 'xxxx' could not be looked up
あるいは、--user
オプションで mysqld
を起動しようとしたとき、
以下のエラーが出る場合:
getpwnam: No such file or directory
この問題は、以下のうちのどれかの方法で解決できます:
tar.gz
)、代わりに
インストールします。
mysql_install_db --force
を実行します; これは mysql_install_db
に
かかれている resolveip
テストを実行しません。
また許可テーブル内でホスト名が使えなくなっています;
ホスト名でなく IP アドレスで登録します (localhost
は除).
もし --force
を持っていないような古い MySQL を使用しているなら、
エディターで、resolveip
テストを mysql_install
から削除します。
mysqld
を --user
の代わりに su
で起動。
Linux-Intel binary と MySQL RPM リリースは、もっとも速くなるように 調整されています。我々はもっとも早く安定したコンパイラーを常に使用しています。
MySQL Perl サポートは Perl 5.004_03 以上のバージョンを必要としま す。
Linux 2.2 バージョンのいくつかでは、TCP/IP 上で mysqld
サーバに多く
の新しい接続を行なう時に、エラー Resource temporarily unavailable
を得ることがあります。
この問題は、Linux では TCP/IP ソケットをクローズする時と、それがシステムに よって実際に解放される間に遅延があるためです。TCP/IP スロットの数は有限な ので、TCP/IP 上で MySQL `test-connect' ベンチマークを実行し た時のように、短い時間にとても多くの新しい TCP/IP 接続が行なわれた場合に上 記エラーが得られます。
我々はこの問題について、異なる Linux メーリングリストで何回かメールを受け ました。しかし、当然、我々はこれを解決することはできません。
この問題の知られている'解決策'は、あなたのクライアント内で永続的な接続を使
用するか、データベースサーバとクライアントが同じマシン上で実行されている場
合にソケットを使用することだけです。我々は、将来、Linux 2.4
カーネ
ルでこの問題が解決されることを希望します。
MySQL は libc
5.4.12 以上が必要です。libc
5.4.46 で動作します。
glibc
2.0.6 以上でも動作します。
glibc
の RPM にはいくつか問題があり、アップデートをチェックしてください。
glibc
2.0.7-19 と 2.0.7-29 RPM で動作します。
古い Linux 配布物では、configure
時に以下のようなエラーが出るかもしれません:
Syntax error in sched.h. Change _P to __P in the /usr/include/sched.h file. See the Installation chapter in the Reference Manual.
これは _P
マクロが一つのアンダースコアしか持っていないためで、
このエラーメッセージに示されたように対処してください。
以下のようなワーニングは無視して構いません:
mysqld.cc -o objs-thread/mysqld.o mysqld.cc: In function `void init_signals()': mysqld.cc:315: warning: assignment of negative value `-1' to `long unsigned int' mysqld.cc: In function `void * signal_hand(void *)': mysqld.cc:346: warning: assignment of negative value `-1' to `long unsigned int'
Debian GNU/Linux では、MySQL をマシンの起動時に立ちあげるためには、 以下のようにします:
shell> cp support-files/mysql.server /etc/init.d/mysql.server shell> /usr/sbin/update-rc.d mysql.server defaults 99
mysql.server
スクリプトは MySQL をインストールした先の
`share/mysql' directory にあります。
あるいは、 MySQL のソースの中の `support-files' ディレクトリにあります。
mysqld
がつねにスタート時にコアをはく場合、
古い `/lib/libc.a' を使用しているかもしれません。
`sql/mysqld' を消去して、新しく make install
してみてください。
これはいくつかの Slackware で報告された現象です。
もし mysqld
をリンクする場合に以下のようなエラーが出た場合、
`libg++.a' が正しくインストールされていません:
/usr/lib/libc.a(putc.o): In function `_IO_putc': putc.o(.text+0x0): multiple definition of `_IO_putc'
`libg++.a' の使用を避けるには、 configure
を以下のようにします:
shell> CXX=gcc ./configure
いくつかの埋め込み関数, readdir_r()
が壊れます。
この顕れとして、SHOW DATABASES
が常に空を返します。
これは configure 後、コンパイルする前に、
`config.h' から HAVE_READDIR_R
を取り除くことで解決します。
その他いくつかの問題は、あなたの Linux にパッチを当てる必要があります。
パッチは http://www.mysql.com/Downloads/patches/Linux-sparc-2.0.30.diff. にあります。
このパッチは、vger.rutgers.edu
にある `sparclinux-2.0.30.tar.gz' 用です。
(これは正式の 2.0.30 とは違います。パッチを正式2.0.30に当てないように)
そして LinuxThreads Version 0.6 かそれ以上にしなくてはなりません。
MySQL Version 3.23.12 が、Linux-Alpha 上で最初にテストされたバージョンです。 もし MySQL を Linux-Alpha 上で使用したいと考えたなら、 このバージョンより新しいものを使用します。
We have tested MySQL on Alpha with our benchmarks and test suite, and it appears to work nicely. The main thing we haven't yet had time to test is how things works with many concurrent users.
When we compiled the standard MySQL binary we are using SuSE 6.4, kernel 2.2.13-SMP, Compaq C compiler (V6.2-504) and Compaq C++ compiler (V6.3-005) on a Comaq DS20 machine with an Alpha EV6 processor.
You can find the above compilers at http://www.support.compaq.com/alpha-tools). By using these compilers, instead of gcc, we get about 9-14 % better performance with MySQL.
Note that the configure line optimized the binary for the current CPU; This means you can only use our binary if you have an Alpha EV6 processor. We also compile statically to avoid library problems.
CC=ccc CFLAGS="-fast" CXX=cxx CXXFLAGS="-fast -noexceptions -nortti" ./configure --prefix=/usr/local/mysql --disable-shared --with-extra-charsets=complex --enable-thread-safe-client --with-mysqld-ldflags=-non_shared --with-client-ldflags=-non_shared
If you want to use egcs the following configure line worked for us:
CFLAGS="-O3 -fomit-frame-pointer" CXX=gcc CXXFLAGS="-O3 -fomit-frame-pointer -felide-constructors -fno-exceptions -fno-rtti" ./configure --prefix=/usr/local/mysql --disable-shared
Some known problems when running MySQL on Linux-Alpha:
gdb 4.18
. You should download and use gdb 5.0 instead!
mysqld
statically when using gcc
, the
resulting image will core dump at start. In other words, DON'T
use --with-mysqld-ldflags=-all-static
with gcc
.
MySQL は最新の glibc
を使用した MkLinux で動作します。
(glibc
2.0.7 でテストしました).
Qube2 (Linux Mips) 上で MySQL を動作させるには、
最新の glibc
ライブラリでなくてはなりません
(glibc-2.0.7-29C2
は動作することが分かっています)。
そして、 egcs
C++ compiler (egcs-1.0.2-9
, gcc 2.95.2
以上) を
使用しなくてはなりません。
To get MySQL to compile on Linux Ia64, we use the following compile line:
Using gcc-2.96
:
CC=gcc CFLAGS="-O3 -fno-omit-frame-pointer" CXX=gcc CXXFLAGS="-O3 -fno-omit-frame-pointer -felide-constructors -fno-exceptions -fno-rtti" ./configure --prefix=/usr/local/mysql "--with-comment=Official MySQL binary" --with-extra-charsets=complex
On Ia64 the MySQL client binaries are using shared libraries. This means
that if you install our binary distribution in some other place than
`/usr/local/mysql' you need to either modify `/etc/ld.so.conf'
or add the path to the directory where you have `libmysqlclient.so'
to the LD_LIBRARY_PATH
environment variable.
「A.3.1 Problems When Linking with the MySQL Client Library」節参照.
This section describes installation and use of MySQL on Windows. This information is also provided in the `README' file that comes with the MySQL Windows distribution.
MySQL は TCP/IP をクライアントからサーバーへの接続に使用します。 こうすればネットワーク上のどのマシンからでも MySQL サーバーに 接続できるようになります。 このため、MySQL を起動する前に、 あなたは TCP/IP をインストールしなくてはなりません。 これは Windows CD-ROM にあります。
もし古い Win95 (for example OSR2) を使用しているなら、 これは古い Winsock パッケージを使用しているかもしれません! MySQL は Winsock 2 を要求します! 最新の Winsock は http://www.microsoft.com/ にあります。 Win98 はデフォルトで新しい Winsock 2 ライブラリですので、 これは Win98 には当てはまりません。
mysqld
サーバーを起動するには, MS-DOS を起動し、以下のように入力します:
C:\> C:\mysql\bin\mysqld
これは mysqld
をバックグラウンドで動かします。
MySQL サーバーの kill には:
C:\> C:\mysql\bin\mysqladmin -u root shutdown
注意: Win95 と Win98 は名前付パイプをサポートしていません。Win95 と
Win98 では、Windows NT サーバホスト上で動いているリモートの
MySQL への接続だけに、名前付パイプを使用できます。
(The MySQL server must also support named pipes, of
course. For example, using mysqld-opt
under NT will not allow
named pipe connections. You should use either mysqld-nt
or
mysqld-max-nt
.)
mysqld
が起動しない場合、`\mysql\data\mysql.err' ファイルがそ
の問題の原因を示す何らかのメッセージをサーバが書き出していないかチェック
してください。mysqld --standalone
でサーバの起動を試みることもでき
ます; この場合、問題の解決の助けになるであろう、いくつかの有用な情報が画
面上で得られます。
最後の選択肢は mysqld
を --standalone --debug
付きで起動す
ることです。この場合、mysqld
はログをファイル
`C:\mysqld.trace' に書き出します。これには、mysqld
が何故起動
しないかの理由が含まれます。 「G.1.2 Creating trace files」節参照。
Win95/Win98 セクションは NT/Win2000 上の MySQL にもあてはまり ますが、次の違いがあります:
NT 上で TCP/IP を用いて MySQL を動作させるには、service pack 3(以上) が必須です!
注意: 次の NT にあてはまる全ては、Win2000 にもあてはまります!
NT/Win2000 では、サーバ名は mysqld-nt
です。通常
MySQL は NT/Win2000 のサービスとしてインストールすべきです:
C:\> C:\mysql\bin\mysqld-nt --install
または
C:\> C:\mysql\bin\mysqld-max-nt --install
(Windows NT では、サーババイナリを実際にはサービスとしてインストールする
ことができます。しかし、-nt.exe
で終わる名前を持つものだけが名前つ
きパイプのサポートを提供しています)
MySQL サービスの起動と停止は次のコマンドで行なうことができます:
C:\> NET START mysql C:\> NET STOP mysql
この場合、mysqld
に、いかなるオプションも使用できないことに注意!
もし mysqld-nt
をオプション無しで起動する必要があるならば、
mysqld-nt
をスタンドアローンのプログラムとして NT 上で走らせることも
出来ます! もし mysqld-nt
をオプション無しで NT 上で起動すると、
mysqld-nt
は自分自身をサービスとして立ち上げようとします。
デフォルトのサービスオプションを使用して。
もし既に mysqld-nt
を止めていたなら、 NET START mysql
で
起動しなくてはなりません。
サービスは MySQL
という名前で登録されます。 一度インストールしたら、
これは Services Control Manager (SCM) Utility (コントロールパネルにある)
を使用するか、NET START MySQL
コマンドを使用するかして、
起動されなくてはなりません。
もし、オプションがなにも指定されていないなら、MySQL
サービス開始前に、
SCM Utility の ``Startup parameters'' に記述しなくてはなりません。
一度走れば、 mysqld-nt
は mysqladmin
や SCM utility 、
NET STOP MySQL
コマンドで停止できます。
もし SCM を使用して mysqld-nt
停止するなら、
mysqld shutdown normally
についての変なメッセージがでます。
サービスとして実行すると、mysql-nt
はコンソールへのアクセスを持た
ないので、メッセージは何も見られません。
NT では以下のエラーメッセージが出るかもしれません:
Permission Denied | mysqld-nt.exe が見つからないことを意味します。
|
Cannot Register | path が正しくないことを意味します。 |
Failed to install service. | サービスがすでにインストールされているか、Service Control Manager が間違った状態にあります。 |
もし mysqld-nt
をサービスとしてインストールする場合に
問題が発生した場合、フルパスで実行してみてください:
C:\> C:\mysql\bin\mysqld-nt --install
もしこれで動作しないようなら、レジストリ内のパスを修正すれば mysqld-nt
を
起動できるでしょう。
サービスとして mysqld-nt
を起動したくないなら以下のようにします:
C:\> C:\mysql\bin\mysqld-nt --standalone
or
C:\> C:\mysql\bin\mysqld --standalone --debug
最新のバージョンでは、デバッグのトレースを `C:\mysqld.trace' に出します。 「G.1.2 Creating trace files」節参照.
MySQLは全ての Windows プラットフォーム上で TCP/IP をサポートし、 NT 上で 名前つきパイプ(named pipe) をサポートします。 デフォルトは、NT 上でローカルに接続するときに名前つきパイプが使用され、 そのほかの全ての場合で TCP/IP が使用されます。 ホスト名はどのプロトコルを使用するかを決めます:
Host name | Protocol |
NULL (none) | NT では最初に名前つきパイプ(named pipe)を試み、動かなければ TCP/IP を使用します。 Win95/Win98 では TCP/IP を使用します。 |
. | 名前つきパイプ(named pipe) |
localhost | 現在のホストへ TCP/IP で接続 |
hostname | TCP/IP |
MySQL クライアントに named pipes を強制的に使用させるには、
--pipe
オプションか、ホストに .
を指定します。
そして、--socket
オプションでパイプの名前を指定します。
MySQL が動いているかどうかは、以下のようにして確認できます:
C:\> C:\mysql\bin\mysqlshow C:\> C:\mysql\bin\mysqlshow -u root mysql C:\> C:\mysql\bin\mysqladmin version status proc C:\> C:\mysql\bin\mysql test
もし Win95/Win98 上で mysqld
への接続が遅いようなら、DNS の問題かもしれません。
この場合、 mysqld
を --skip-name-resolve
オプションで
起動し、MySQL 許可テーブルには、localhost
と IP アドレスだけ
使用します。
NT上で走る mysqld-nt
MySQL サーバーに対しての接続時に
DNS を避けるために、 --pipe
引数を指定して名前つきパイプ(named pipe)を
使用できます。 これはほとんどの MySQL クライアントで動きます。
2つの MySQL コマンドラインツールがあります:
mysql | ネイティブな Windows 用にコンパイルされている。非常に限られたコマンドライン編集機能しか持たない |
mysqlc | Cygnus GNU コンパイラとライブラリを用いてコンパイルされている。GNU readline によるコマンドライン編集機能を持つ。 |
もし mysqlc.exe
を使用したいなら,
`C:\mysql\lib\cygwinb19.dll' をあなたの Windows システムディレクトリ
(`\windows\system' もしくは同様のパス)にコピーしなくてはなりません。
Windows の MySQL の初期の権限は、ローカルの全てのユーザーに
対して、全てのデータベースで全ての権限がパスワードなしに与えられています。
MySQL を安全にするために、全てのユーザーにパスワードを
設定すべきです。また、mysql.user
テーブルから
Host='localhost'
で User=''
となっているレコードを
削除すべきです。
root
ユーザーにもパスワードを設定すべきです。次の例は、匿名ユーザ
を削除してから開始します。匿名ユーザは誰からでも test
データベース
へのアクセスでき、root
ユーザパスワードを設定できます:
C:\> C:\mysql\bin\mysql mysql mysql> DELETE FROM user WHERE Host='localhost' AND User=''; mysql> QUIT C:\> C:\mysql\bin\mysqladmin reload C:\> C:\mysql\bin\mysqladmin -u root password your_password
パスワードを設定した後、もし mysqld
サーバーを停止させるなら、
以下のようにします:
C:\> mysqladmin --user=root --password=your_password shutdown
もしあなたが Windows 下で、古い MySQL バージョン 3.21 のシェアウェ
アバージョンを使用しているなら、上記のコマンドは次のエラーで失敗します:
parse error near 'SET OPTION password'
。回避策は、現在の
MySQL バージョンにアップグレードすることです。これもフリーです。
現在の MySQL バージョンでは、GRANT
と REVOKE
コ
マンドで、簡単に新しいユーザを追加でき、権限を変更することができます。
「4.3.1 GRANT
と REVOKE
構文」節参照.
以下は SSH を用いてリモートの MySQL サーバに安全に接続するための 方法について述べたものです。 (by David Carlson dcarlson@mplcomm.com):
SecureCRT
from http://www.vandyke.com/.
Another option is f-secure
from http://www.f-secure.com/. You
can also find some free ones on Google at
http://directory.google.com/Top/Computers/Security/Products_and_Tools/Cryptography/SSH/Clients/Windows/.
Host_Name = yourmysqlserver_URL_or_IP
.
Set userid=your_userid
to log in to your server (probably not the same
as your MySQL login/password.
local_port: 3306
, remote_host: yourmysqlservername_or_ip
, remote_port: 3306
)
or a local forward (Set port: 3306
, host: localhost
, remote port: 3306
).
localhost
for the MySQL host server -- not yourmysqlservername
.
You should now have an ODBC connection to MySQL, encrypted using SSH.
Windows 上では、3.23.16 以上のバージョンの MySQL ディストリビュー
ション中の mysqld-max
と mysql-max-nt
サーバは、
-DUSE_SYMDIR
オプション付きでコンパイルされています。これはデータ
ベースに対するシンボリックリンクを追加することで異なるディスクにデータベー
スを置くことを可能にします(Unix におけるシンボリック・リンクと同様の方法
で)。
Windows 上では、宛先ディレクトリへのパスを持つファイルを作成し、
そのファイルを database.sym
というファイル名で mysql_data
ディレクトリ
の中に保存することで、データベースへのシンボリックリンクを作成します。
Note that the symbolic link will only be used if the directory
mysql_data_dir\database
doesn't exist.
例えば、MySQL データディレクトリが `C:\mysql\data' で、
`D:\data\foo' に置かれているデータベース foo
を持ちたければ、
テキスト D:\data\foo\
を含む `C:\mysql\data\foo.sym' を作成す
べきです。その後、データベース foo
に作成されるすべてのテーブルは
`D:\data\foo' に作成されるでしょう。
Note that because of the speed penalty you get when opening every table,
we have not enabled this by default even if you have compiled
MySQL with support for this. To enable symlinks you should put
in your my.cnf
or my.ini
file the following entry:
[mysqld] use-symbolic-links
In MySQL 4.0 we will enable symlinks by default. Then you
should instead use the skip-symlink
option if you want to
disable this.
ソースファイル中で `mysql.h' をインクルードする前に `windows.h' を インクルードするべきです:
#if defined(_WIN32) || defined(_WIN64) #include <windows.h> #endif #include <mysql.h>
あなたのコードを、必要に応じて `libmysql.dll' 中でロードするための ラッパーである `libmysql.lib' ライブラリに動的にリンクすることも できますし、また `mysqlclient.lib' ライブラリを静的にリンクすることも できます。
mysqlclient ライブラリはスレッド対応ライブラリとしてコンパイル されていますので、あなたのコードもマルチスレッド対応になるように コンパイルするべきことに注意してください。
MySQL-Windows バージョンは現在それ自体とても安定した(stableな)状態で供給されています。 MySQL-win32 バージョンは すべての機能が UNIX バージョンの MySQL と対応しています。 ただし、下記のような例外があります。
mysqld
を実行させるべきではあり
ません!
WindowsNT と Windows98 はこのバグを持ちません。
INSERT
と SELECT
を混ぜることを可能にするために pread()
及び pwrite()
関数コールに依存します。現時点では pread()
/pwrite()
をエミュレートするために Mutex を用いています。長期的な計画では、
ファイルレベルのインターフェースを仮想インターフェースで置き換えて
いくつもりなので、さらに速度を上げるために WindowsNT 上で
readfile()
/writefile()
インターフェースを使うことができます。
現在の実装は、しかし MySQL が利用可能なファイル数の上限が 1024 に
なっています。これは Unix では可能な数の並行スレッドを NT 上では
動作させることができないことを意味しています。
mysqladmin kill
は、スリープしている接続上では働かないはずです。
mysqladmin shutdown
は中断することができません。
DROP DATABASE
mysqladmin shutdown
で終了しなければなりません。
LOAD DATA INFILE
または
SELECT ... INTO OUTFILE
を使う場合には、`\' を二重に使わなくてはなりません。
mysql> LOAD DATA INFILE "C:\\tmp\\skr.txt" INTO TABLE skr; mysql> SELECT * INTO OUTFILE 'C:\\tmp\\skr.txt' FROM skr;あるいは、UNIX でのファイルネーム形式 `/' で書く必要があります。
mysql> LOAD DATA INFILE "C:/tmp/skr.txt" INTO TABLE skr; mysql> SELECT * INTO OUTFILE 'C:/tmp/skr.txt' FROM skr;
Can't open named pipe
エラー
error 2017: can't open named pipe to host: . pipe...これは、 MySQL のリリースバージョンがデフォルトで NT の 名前つきパイプを 使っているために起こっています。 新しい MySQL クライアントで
--host=localhost
オプションを用いるか、
以下の情報を含むオプションファイル `C:\my.cnf' を作成することで、このエラーを
回避することができます。
[client] host = localhost
Access denied for user
error
Access denied for user: 'some-user@unknown' to database 'mysql'
エラーを得るなら、これはあなたの MySQL があなた
のマシンのホスト名を正しく解決できてないことを意味します。
これを修正するには、
以下の情報を持つファイル `\windows\hosts' を作成するべきです。
(注:Windows95,98には\Windowsフォルダ上にサンプルとして「lmhosts.sam」ファイルが
既にあるはずです)
127.0.0.1 localhost
ALTER TABLE
ALTER TABLE
ステートメントの実行中、テーブルは他のスレッドが使用できないようロック
されます。これは Windows が他のスレッドによって使用中のファイルを削除
できないという事実のためにしなければならないことです(私たちはこの
問題を回避するための方法を将来見出すかもしれません)。
MERGE
テーブルで使用中のテーブルに対する DROP TABLE
は機能しません。
MERGE
ハンドラは MySQL からテーブルの対応関係を隠すことを行います。
Windows ではオープン中のファイルを削除することを許さないために、
すべての MERGE
テーブルを (FLUSH TABLES
を用いて) 最初にフラッシュ
するか、テーブルをドロップする前に MERGE
テーブルをドロップする
必要があります。この問題は VIEW
を導入するのと同時に解消するつもりです。
Windowsリリースを手伝いたいと思っている人のために、いくつかオープンになっている
未解決の問題を以下に示します:
mysqld.cc
の
中にコード化されていますが、よりパラメータ指向で記録するべきです。
このツールは、ユーザーがレジストリより `C:\my.cnf' オプションファイルを用いることを
好んだ場合に、`C:\my.cnf' を更新することも可能であるべきです。
mysqld
をサービスとして --install
フラグで登録するとき、
コマンドラインにデフォルトオプションも一緒に追加できると素敵です。
差し当たって、 回避策は代わりに `C:\my.cnf' ファイル内のパラメータをリストすることです。
mysqld
を終了させることができればほんとうに親切でしょう。
今のところ、あなたは mysqladmin shutdown
を使わなければなりません。
mysql
のコマンドライン・ツールで使うために readline
をWindowsに移植しませんか?
mysql
、mysqlshow
、mysqladmin
、および、mysqldump
)のGUI
バージョンがあればいいでしょうねぇ。
mysqladmin kill
を用いて、オープンなスレッドを
kill することができるでしょう。
mysqld
はデフォルトロケールではなく、常に「C」ロケールで起動します。私たちは、
ソート順に関して mysqld
が現在のロケールを使用するようにしたいです。
.DLL
での実装
他の Windows 特有の事柄は MySQL-Windows ディストリビューションに同梱されている `README' ファイルで説明されています。
Solaris では MySQL ソースを展開するときトラブルが出るでしょう!
Solaris の tar
は長い名前を扱えず、 MySQL を展開する場合、
以下のようなエラーになります:
x mysql-3.22.12-beta/bench/Results/ATIS-mysql_odbc-NT_4.0-cmp-db2,informix,ms-sql,mysql,oracle,solid,sybase, 0 bytes, 0 tape blocks tar: directory checksum error
この場合、GNU tar
(gtar
) を展開に使用してください。
コンパイルずみのものが以下にあります:
http://www.mysql.com/Downloads/.
Sun ネイティブスレッドは Solaris 2.5 以上で動きます。 バージョン 2.4 以下の場合、MySQL は時動的に MIT-pthreads を使用します 「2.3.6 MIT-pthreads に関して」節参照.
もし、configure 時に、以下のエラーが出たなら:
checking for restartable system calls... configure: error can not run test programs while cross compiling
これはコンパイラーのインストールでなにかを間違っています!
この場合、あなたは、より新しいバージョンへコンパイラーをアップグレードすべきです。
以下の行を config.cache
ファイルに追加することによって、
この問題を解決してもかまいません:
ac_cv_sys_restartable_syscalls=${ac_cv_sys_restartable_syscalls='no'}
もしあなたが SPARC の Solaris を使用しているなら、
gcc
2.95.2 を推奨します。
これは ttp://gcc.gnu.org/. で見つけれます。
egcs
1.1.1 と gcc
2.8.1 は SPARC 上では完全に動作しないことに注意!
gcc
2.95.2 を使用した、推奨する configure
は:
CC=gcc CFLAGS="-O3" \ CXX=gcc CXXFLAGS="-O3 -felide-constructors -fno-exceptions -fno-rtti" \ ./configure --prefix=/usr/local/mysql --with-low-memory --enable-assembler
Ultra SPARC を使用する場合、"-mcpu=v8 -Wa,-xarch=v8plusa" を CFLAGS と CXXFLAGS に追加することで、さらに 4% の性能を得られます。
もし Sun Workshop (SunPro) 4.2 (以上)のコンパイラを使用するなら、
configure
を以下のようにします:
CC=cc CFLAGS="-Xa -fast -xO4 -native -xstrconst -mt" \ CXX=CC CXXFLAGS="-noex -xO4 -mt" \ ./configure --prefix=/usr/local/mysql --enable-assembler
In the MySQL benchmarks, we got a 6 % speedup on an Ultrasparc when using Sun Workshop 5.3 compared to using gcc with -mcpu flags.
If you get a problem with fdatasync
or sched_yield
,
you can fix this by adding LIBS=-lrt
to the configure line
The following paragraph is only relevant for older compilers than WorkShop 5.3:
You may also have to edit the configure
script to change this line:
#if !defined(__STDC__) || __STDC__ != 1
to this:
#if !defined(__STDC__)
もし -Xc
オプションで __STDC__
を有効にした場合、
Sun compiler は Solaris の `pthread.h' ヘッダーファイルを使用して
コンパイルすることができません。
これはサンのバグです(インクルードファイルかコンパイラーのバグ)
もし mysqld
を起動時に以下のエラーが出た場合、
マルチスレッドを外して(オプション -mt
を指定) Sun compiler を使って
MySQL をコンパイルし直してください:
libc internal error: _rmutex_unlock: rmutex not held
-mt
を CFLAGS
と CXXFLAGS
に加えます。
gcc
で MySQL をコンパイルするときに以下のエラーが出た場合、
これは gcc
があなたの Solaris のバージョン用に調整されていません!
shell> gcc -O3 -g -O2 -DDBUG_OFF -o thr_alarm ... ./thr_alarm.c: In function `signal_hand': ./thr_alarm.c:556: too many arguments to function `sigwait'
この場合、新しい gcc
でコンパイルします!
少なくとも Solaris 2.5 では、ほとんどの gcc
のバイナリのバージョンが古く、
スレッドを使用するプログラムにはこのインクルードファイルは使えません!
Solaris は スタテックリンクのシステムライブラリーを用意していません
(libpthreads
and libdl
)。
そのため、--static
オプションで MySQL をコンパイルできません。
もしこれを試みた場合、以下のエラーになります:
ld: fatal: library -ldl: not found or undefined reference to `dlopen' or cannot find -lrt
もし多くのプロセスが速く mysqld
に接続を試みた場合、
MySQL ログに以下のようにエラーが出ます:
Error in accept: Protocol error
サーバーを --set-variable back_log=50
オプションで起動すれば、この問題に対処できるでしょう。
「4.1.1 mysqld コマンド行オプション」節参照.
もし自分の MySQL クライアントプログラムをリンクして 実行時に以下のようにエラーが出た場合:
ld.so.1: ./my: fatal: libmysqlclient.so.#: open failed: No such file or directory
これは以下のどれかで回避できます:
-Lpath
の代わりに):
-Wl,r/full-path-to-libmysqlclient.so
.
LD_RUN_PATH
environment variable before running your client.
--with-libwrap
configure オプション使用時、libwrap.a
が必
要とするライブラリも含める必要があります:
--with-libwrap="/opt/NUtcpwrapper-7.6/lib/libwrap.a -lnsl -lsocket
configure や MySQL が -lz
のリンクを試み、あなたがそれを
インストールしていないという問題がある場合は、2つの選択肢があります:
--with-named-z-libs=no
をつけて configure を行ないます。
If you are using gcc and have problems with loading UDF
functions
into MySQL, try adding -lgcc
to the link line for the
UDF
function.
MySQL を自動的に開始させたい場合、
`support-files/mysql.server' を `/etc/init.d' にコピーし、
/etc/rc3.d/S99mysql.server
という名前でシンボリックリンクを生成し
てください。
通常、Solaris 2.6 のバイナリは Solaris 7 , 8 で使用できます。 ほとんどの Solaris 2.6 の問題も Solaris 7 , 8 に適用できます。
注意: MySQL Version 3.23.4 以上では、新しいバージョンの Solaris を自動 検出し、以下の問題についての回避策を有効にします!
Solaris 7 , 8 は、インクルードファイルにいくつかバグがあります。
gcc
で以下のようなエラーが出た場合:
/usr/include/widec.h:42: warning: `getwc' redefined /usr/include/wchar.h:326: warning: this is the location of the previous definition
以下のようにして回避します:
/usr/include/widec.h
を .../lib/gcc-lib/os/gcc-version/include
にコピー
41 行目を変更:
変更前: #if !defined(lint) && !defined(__lint) 変更後: #if !defined(lint) && !defined(__lint) && !defined(getwc)
代わりに、`/usr/include/widec.h' を直接変更してもかまいません。
どちらの方法にしても、ファイルを修正後は、`config.cache' を
消して configure
を再実行しなくてはなりません!
make
実行時に以下のようなエラーになった場合、configure
が
`curses.h' ファイルを検出できていません (これは /usr/include/widec.h
の
エラーのためにおきます):
In file included from mysql.cc:50: /usr/include/term.h:1060: syntax error before `,' /usr/include/term.h:1081: syntax error before `;'
これを解決するには、以下のうち一つを行います:
CFLAGS=-DHAVE_CURSES_H CXXFLAGS=-DHAVE_CURSES_H ./configure
.
#define HAVE_TERM
行を `config.h' ファイルから消し、
make
を再実行します。
クライアントプログラムのリンク時に、リンカが -lz
を見つけられない
という問題が発生した場合、問題はおそらく `libz.so' ファイルが
`/usr/local/lib' にインストールされたことです。次の方法の一つでこれ
を修正できます:
LD_LIBRARY_PATH
に `/usr/local/lib' を追加
/lib
から libz.so
へのリンクを追加
--with-named-z-libs=no
オプション付きで MySQL を
configure する。
On Solaris 2.8 on x86, mysqld
will core dump if you run
'strip' in.
(訳注: GNU binutils を Sun 上で使用すると、CPU, version にかかわらず、
この現象に遭遇します。その場合は、/usr/ccs/bin/ の方を使います。)
gcc
か egcs
を Solaris x86 で使用した場合、load 時にコアダンプする場合、
以下のように configure
します:
CC=gcc CFLAGS="-O3 -fomit-frame-pointer -DHAVE_CURSES_H" \ CXX=gcc \ CXXFLAGS="-O3 -fomit-frame-pointer -felide-constructors -fno-exceptions -fno-rtti -DHAVE_CURSES_H" \ ./configure --prefix=/usr/local/mysql
これは libstdc++
ライブラリーと C++ の問題を回避します。
もしこれが該当しない場合、デバッグモードでコンパイルして
デバッグのトレースファイルを書き出すようにして起動するか、
gdb
を使用して起動してください。 「G.1.3 Debugging mysqld under gdb」節参照.
FreeBSD 3.x is recommended for running MySQL since the thread package is much more integrated.
The easiest and therefor the preferred way to install is to use the mysql-server and mysql-client ports available on http://www.freebsd.org.
Using these gives you:
It is recommended you use MIT-pthreads on FreeBSD 2.x and native threads on
Versions 3 and up. It is possible to run with native threads on some late
2.2.x versions but you may encounter problems shutting down mysqld
.
The MySQL `Makefile's require GNU make (gmake
) to work. If
you want to compile MySQL you need to install GNU make
first.
Be sure to have your name resolver setup correct. Otherwise you may
experience resolver delays or failures when connecting to mysqld
.
Make sure that the localhost
entry in the `/etc/hosts' file is
correct (otherwise you will have problems connecting to the database). The
`/etc/hosts' file should start with a line:
127.0.0.1 localhost localhost.your.domain
If you notice that configure
will use MIT-pthreads, you should read
the MIT-pthreads notes. 「2.3.6 MIT-pthreads に関して」節参照.
If you get an error from make install
that it can't find
`/usr/include/pthreads', configure
didn't detect that you need
MIT-pthreads. This is fixed by executing these commands:
shell> rm config.cache shell> ./configure --with-mit-threads
FreeBSD is also known to have a very low default file handle limit.
「A.2.16 File Not Found」節参照. Uncomment the ulimit -n section in
safe_mysqld or raise the limits for the mysqld
user in /etc/login.conf
(and rebuild it with cap_mkdb /etc/login.conf). Also be sure you set the
appropriate class for this user in the password file if you are not
using the default (use: chpass mysqld-user-name). 「4.7.2 safe_mysqld, the wrapper around mysqld」節参照.
If you get problems with the current date in MySQL, setting the
TZ
variable will probably help. 「H Environment Variables」節参照.
To get a secure and stable system you should only use FreeBSD kernels
that are marked -STABLE
.
To compile on NetBSD you need GNU make
. Otherwise the compile will
crash when make
tries to run lint
on C++ files.
On OpenBSD Version 2.5, you can compile MySQL with native threads with the following options:
CFLAGS=-pthread CXXFLAGS=-pthread ./configure --with-mit-threads=no
Our users have reported that OpenBSD 2.8 has a threading bug which causes problems with MySQL. The OpenBSD Developers have fixed the problem, but as of January 25th, 2001, it's only available in the ``-current'' branch. The symptoms of this threading bug are: slow response, high load, high CPU usage, and crashes.
If you get the following error when compiling MySQL, your
ulimit
value for virtual memory is too low:
item_func.h: In method `Item_func_ge::Item_func_ge(const Item_func_ge &)': item_func.h:28: virtual memory exhausted make[2]: *** [item_func.o] Error 1
Try using ulimit -v 80000
and run make
again. If this
doesn't work and you are using bash
, try switching to csh
or sh
; some BSDI users have reported problems with bash
and ulimit
.
If you are using gcc
, you may also use have to use the
--with-low-memory
flag for configure
to be able to compile
`sql_yacc.cc'.
If you get problems with the current date in MySQL, setting the
TZ
variable will probably help. 「H Environment Variables」節参照.
Upgrade to BSD/OS Version 3.1. If that is not possible, install BSDIpatch M300-038.
Use the following command when configuring MySQL:
shell> env CXX=shlicc++ CC=shlicc2 \ ./configure \ --prefix=/usr/local/mysql \ --localstatedir=/var/mysql \ --without-perl \ --with-unix-socket-path=/var/mysql/mysql.sock
The following is also known to work:
shell> env CC=gcc CXX=gcc CXXFLAGS=-O3 \ ./configure \ --prefix=/usr/local/mysql \ --with-unix-socket-path=/var/mysql/mysql.sock
You can change the directory locations if you wish, or just use the defaults by not specifying any locations.
If you have problems with performance under heavy load, try using the
--skip-thread-priority
option to mysqld
! This will run
all threads with the same priority; on BSDI Version 3.1, this gives better
performance (at least until BSDI fixes their thread scheduler).
If you get the error virtual memory exhausted
while compiling,
you should try using ulimit -v 80000
and run make
again.
If this doesn't work and you are using bash
, try switching to
csh
or sh
; some BSDI users have reported problems with
bash
and ulimit
.
BSDI Version 4.x has some thread-related bugs. If you want to use MySQL on this, you should install all thread-related patches. At least M400-023 should be installed.
On some BSDI Version 4.x systems, you may get problems with shared libraries.
The symptom is that you can't execute any client programs, for example,
mysqladmin
. In this case you need to reconfigure not to use
shared libraries with the --disable-shared
option to configure.
Some customers have had problems on BSDI 4.0.1 that the mysqld
binary after a while can't open tables. This is because some
library/system related bug causes mysqld
to change current
directory without asking for this!
The fix is to either upgrade to 3.23.34 or after running configure
remove the line #define HAVE_REALPATH
from config.h
before running make.
Note that the above means that you can't symbolic link a database directories to another database directory or symbolic link a table to another database on BSDI! (Making a symbolic link to another disk is ok).
MySQL should work without any problems on Mac OS X Public Beta (Darwin). You don't need the pthread patches for this OS!
Before trying to configure MySQL on Mac OS X server you must first install the pthread package from http://www.prnet.de/RegEx/mysql.html.
Our binary for Mac OS X is compiled on Rhapsody 5.5 with the following configure line:
CC=gcc CFLAGS="-O2 -fomit-frame-pointer" CXX=gcc CXXFLAGS="-O2 -fomit-frame-pointer" ./configure --prefix=/usr/local/mysql "--with-comment=Official MySQL binary" --with-extra-charsets=complex --disable-shared
You might want to also add aliases to your shell's resource file to
access mysql
and mysqladmin
from the command line:
alias mysql '/usr/local/mysql/bin/mysql' alias mysqladmin '/usr/local/mysql/bin/mysqladmin'
Some of the binary distributions of MySQL for HP-UX is distributed as an HP depot file and as a tar file. To use the depot file you must be running at least HP-UX 10.x to have access to HP's software depot tools.
The HP version of MySQL was compiled on an HP 9000/8xx server under HP-UX 10.20, and uses MIT-pthreads. It is known to work well under this configuration. MySQL Version 3.22.26 and newer can also be built with HP's native thread package.
Other configurations that may work:
The following configurations almost definitely won't work:
To install the distribution, use one of the commands below, where
/path/to/depot
is the full pathname of the depot file:
shell> /usr/sbin/swinstall -s /path/to/depot mysql.full
shell> /usr/sbin/swinstall -s /path/to/depot mysql.server
shell> /usr/sbin/swinstall -s /path/to/depot mysql.client
shell> /usr/sbin/swinstall -s /path/to/depot mysql.developer
The depot places binaries and libraries in `/opt/mysql' and data in
`/var/opt/mysql'. The depot also creates the appropriate entries in
`/etc/init.d' and `/etc/rc2.d' to start the server automatically
at boot time. Obviously, this entails being root
to install.
To install the HP-UX tar.gz distribution, you must have a copy of GNU
tar
.
There are a couple of small problems when compiling MySQL on
HP-UX. We recommend that you use gcc
instead of the HP-UX native
compiler, because gcc
produces better code!
We recommend using gcc 2.95 on HP-UX. Don't use high optimization flags (like -O6) as this may not be safe on HP-UX.
Note that MIT-pthreads can't be compiled with the HP-UX compiler
because it can't compile .S
(assembler) files.
The following configure line should work:
CFLAGS="-DHPUX -I/opt/dce/include" CXXFLAGS="-DHPUX -I/opt/dce/include -felide-constructors -fno-exceptions -fno-rtti" CXX=gcc ./configure --with-pthread --with-named-thread-libs='-ldce' --prefix=/usr/local/mysql --disable-shared
If you are compiling gcc
2.95 yourself, you should NOT link it with
the DCE libraries (libdce.a
or libcma.a
) if you want to compile
MySQL with MIT-pthreads. If you mix the DCE and MIT-pthreads
packages you will get a mysqld
to which you cannot connect. Remove
the DCE libraries while you compile gcc
2.95!
For HP-UX Version 11.x we recommend MySQL Version 3.23.15 or later.
Because of some critical bugs in the standard HP-UX libraries, you should install the following patches before trying to run MySQL on HP-UX 11.0:
PHKL_22840 Streams cumulative PHNE_22397 ARPA cumulative
This will solve a problem that one gets EWOULDBLOCK
from recv()
and EBADF
from accept()
in threaded applications.
If you are using gcc
2.95.1 on an unpatched HP-UX 11.x system,
you will get the error:
In file included from /usr/include/unistd.h:11, from ../include/global.h:125, from mysql_priv.h:15, from item.cc:19: /usr/include/sys/unistd.h:184: declaration of C function ... /usr/include/sys/pthread.h:440: previous declaration ... In file included from item.h:306, from mysql_priv.h:158, from item.cc:19:
The problem is that HP-UX doesn't define pthreads_atfork()
consistently.
It has conflicting prototypes in
`/usr/include/sys/unistd.h':184 and
`/usr/include/sys/pthread.h':440 (details below).
One solution is to copy `/usr/include/sys/unistd.h' into `mysql/include' and edit `unistd.h' and change it to match the definition in `pthread.h'. Here's the diff:
183,184c183,184 < extern int pthread_atfork(void (*prepare)(), void (*parent)(), < void (*child)()); --- > extern int pthread_atfork(void (*prepare)(void), void (*parent)(void), > void (*child)(void));
After this, the following configure line should work:
CFLAGS="-fomit-frame-pointer -O3 -fpic" CXX=gcc CXXFLAGS="-felide-constructors -fno-exceptions -fno-rtti -O3" ./configure --prefix=/usr/local/mysql --disable-shared
Here is some information that a HP-UX Version 11.x user sent us about compiling MySQL with HP-UX:x compiler:
Environment: proper compilers. setenv CC cc setenv CXX aCC flags setenv CFLAGS -D_REENTRANT setenv CXXFLAGS -D_REENTRANT setenv CPPFLAGS -D_REENTRANT % aCC -V aCC: HP ANSI C++ B3910B X.03.14.06 % cc -V /tmp/empty.c cpp.ansi: HP92453-01 A.11.02.00 HP C Preprocessor (ANSI) ccom: HP92453-01 A.11.01.00 HP C Compiler cc: "/tmp/empty.c", line 1: warning 501: Empty source file. configuration: ./configure --with-pthread \ --prefix=/source-control/mysql \ --with-named-thread-libs=-lpthread \ --with-low-memory added '#define _CTYPE_INCLUDED' to include/m_ctype.h. This symbol is the one defined in HP's /usr/include/ctype.h: /* Don't include std ctype.h when this is included */ #define _CTYPE_H #define __CTYPE_INCLUDED #define _CTYPE_INCLUDED #define _CTYPE_USING /* Don't put names in global namespace. */
-D_REENTRANT
to get the compiler
to recognize the prototype for localtime_r
. Alternatively I could have
supplied the prototype for localtime_r
. But I wanted to catch other
bugs without needing to run into them. I wasn't sure where I needed it, so I
added it to all flags.
If you get the following error from configure
checking for cc option to accept ANSI C... no configure: error: MySQL requires a ANSI C compiler (and a C++ compiler). Try gcc. See the Installation chapter in the Reference Manual.
Check that you don't have the path to the K&R compiler before the path to the HP-UX C and C++ compiler.
Automatic detection of xlC
is missing from Autoconf, so a
configure
command something like this is needed when compiling
MySQL (This example uses the IBM compiler):
export CC="xlc_r -ma -O3 -qstrict -qoptimize=3 -qmaxmem=8192 " export CXX="xlC_r -ma -O3 -qstrict -qoptimize=3 -qmaxmem=8192" export CFLAGS="-I /usr/local/include" export LDLFAGS="-L /usr/local/lib" export CPPFLAGS=$CFLAGS export CXXFLAGS=$CFLAGS ./configure --prefix=/usr/local \ --localstatedir=/var/mysql \ --sysconfdir=/etc/mysql \ --sbindir='/usr/local/bin' \ --libexecdir='/usr/local/bin' \ --enable-thread-safe-client \ --enable-large-files
Above are the options used to compile the MySQL distribution that can be found at http://www-frec.bull.com/.
If you change the -O3
to -O2
in the above configure line,
you must also remove the -qstrict
option (this is a limitation in
the IBM C compiler).
If you are using gcc
or egcs
to compile MySQL, you
MUST use the -fno-exceptions
flag, as the exception
handling in gcc
/egcs
is not thread safe! (This is tested with
egcs
1.1.). There are also some known problems with IBM's assembler,
which may cause it to generate bad code when used with gcc.
We recommend the following configure
line with egcs
and
gcc 2.95
on AIX:
CC="gcc -pipe -mcpu=power -Wa,-many" \ CXX="gcc -pipe -mcpu=power -Wa,-many" \ CXXFLAGS="-felide-constructors -fno-exceptions -fno-rtti" \ ./configure --prefix=/usr/local/mysql --with-low-memory
The -Wa,-many
is necessary for the compile to be successful. IBM is
aware of this problem but is in to hurry to fix it because of the workaround
available. We don't know if the -fno-exceptions
is required with
gcc 2.95
, but as MySQL doesn't use exceptions and the above
option generates faster code, we recommend that you should always use this
option with egcs / gcc
.
If you get a problem with assembler code try changing the -mcpu=xxx to match your cpu. Typically power2, power, or powerpc may need to be used, alternatively you might need to use 604 or 604e. I'm not positive but I would think using "power" would likely be safe most of the time, even on a power2 machine.
If you don't know what your cpu is then do a "uname -m", this will give you back a string that looks like "000514676700", with a format of xxyyyyyymmss where xx and ss are always 0's, yyyyyy is a unique system id and mm is the id of the CPU Planar. A chart of these values can be found at http://www.rs6000.ibm.com/doc_link/en_US/a_doc_lib/cmds/aixcmds5/uname.htm. This will give you a machine type and a machine model you can use to determine what type of cpu you have.
If you have problems with signals (MySQL dies unexpectedly under high load) you may have found an OS bug with threads and signals. In this case you can tell MySQL not to use signals by configuring with:
shell> CFLAGS=-DDONT_USE_THR_ALARM CXX=gcc \ CXXFLAGS="-felide-constructors -fno-exceptions -fno-rtti -DDONT_USE_THR_ALARM" \ ./configure --prefix=/usr/local/mysql --with-debug --with-low-memory
This doesn't affect the performance of MySQL, but has the side
effect that you can't kill clients that are ``sleeping'' on a connection with
mysqladmin kill
or mysqladmin shutdown
. Instead, the client
will die when it issues its next command.
On some versions of AIX, linking with libbind.a
makes
getservbyname
core dump. This is an AIX bug and should be reported
to IBM.
For AIX 4.2.1 and gcc you have to do the following changes.
After configuring, edit `config.h' and `include/my_config.h' and change the line that says
#define HAVE_SNPRINTF 1
to
#undef HAVE_SNPRINTF
And finally, in `mysqld.cc' you need to add a prototype for initgoups.
#ifdef _AIX41 extern "C" int initgroups(const char *,int); #endif
On SunOS 4, MIT-pthreads is needed to compile MySQL, which in turn
means you will need GNU make
.
Some SunOS 4 systems have problems with dynamic libraries and libtool
.
You can use the following configure
line to avoid this problem:
shell> ./configure --disable-shared --with-mysqld-ldflags=-all-static
When compiling readline
, you may get warnings about duplicate defines.
These may be ignored.
When compiling mysqld
, there will be some implicit declaration
of function
warnings. These may be ignored.
If you are using egcs 1.1.2 on Digital Unix, you should upgrade to gcc 2.95.2, as egcs on DEC has some serious bugs!
When compiling threaded programs under Digital Unix, the documentation
recommends using the -pthread
option for cc
and cxx
and
the libraries -lmach -lexc
(in addition to -lpthread
). You
should run configure
something like this:
CC="cc -pthread" CXX="cxx -pthread -O" \ ./configure --with-named-thread-libs="-lpthread -lmach -lexc -lc"
When compiling mysqld
, you may see a couple of warnings like this:
mysqld.cc: In function void handle_connections()': mysqld.cc:626: passing long unsigned int *' as argument 3 of accept(int,sockadddr *, int *)'
You can safely ignore these warnings. They occur because configure
can detect only errors, not warnings.
If you start the server directly from the command line, you may have problems
with it dying when you log out. (When you log out, your outstanding processes
receive a SIGHUP
signal.) If so, try starting the server like this:
shell> nohup mysqld [options] &
nohup
causes the command following it to ignore any SIGHUP
signal sent from the terminal. Alternatively, start the server by running
safe_mysqld
, which invokes mysqld
using nohup
for you.
「4.7.2 safe_mysqld, the wrapper around mysqld」節参照.
If you get a problem when compiling mysys/get_opt.c, just remove the line #define _NO_PROTO from the start of that file!
If you are using Compac's CC compiler, the following configure line should work:
CC="cc -pthread" CFLAGS="-O4 -ansi_alias -ansi_args -fast -inline speed all -arch host" CXX="cxx -pthread" CXXFLAGS="-O4 -ansi_alias -ansi_args -fast -inline speed all -arch host" export CC CFLAGS CXX CXXFLAGS ./configure \ --prefix=/usr/local/mysql \ --with-low-memory \ --enable-large-files \ --enable-shared=yes \ --with-named-thread-libs="-lpthread -lmach -lexc -lc" gnumake
If you get a problem with libtool, when compiling with shared libraries
as above, when linking mysql
, you should be able to get around
this by issuing:
cd mysql /bin/sh ../libtool --mode=link cxx -pthread -O3 -DDBUG_OFF \ -O4 -ansi_alias -ansi_args -fast -inline speed \ -speculate all \ -arch host -DUNDEF_HAVE_GETHOSTBYNAME_R \ -o mysql mysql.o readline.o sql_string.o completion_hash.o \ ../readline/libreadline.a -lcurses \ ../libmysql/.libs/libmysqlclient.so -lm cd .. gnumake gnumake install scripts/mysql_install_db
If you have problems compiling and have DEC CC
and gcc
installed, try running configure
like this:
CC=cc CFLAGS=-O CXX=gcc CXXFLAGS=-O3 \ ./configure --prefix=/usr/local/mysql
If you get problems with the `c_asm.h' file, you can create and use a 'dummy' `c_asm.h' file with:
touch include/c_asm.h CC=gcc CFLAGS=-I./include \ CXX=gcc CXXFLAGS=-O3 \ ./configure --prefix=/usr/local/mysql
Note that the following problems with the ld
program can be fixed
by downloading the latest DEC (Compaq) patch kit from:
http://ftp.support.compaq.com/public/unix/.
On OSF1 V4.0D and compiler "DEC C V5.6-071 on Digital Unix V4.0 (Rev. 878)"
the compiler had some strange behavior (undefined asm
symbols).
/bin/ld
also appears to be broken (problems with _exit
undefined
errors occuring while linking mysqld
). On this system, we
have managed to compile MySQL with the following configure
line, after replacing /bin/ld
with the version from OSF 4.0C:
CC=gcc CXX=gcc CXXFLAGS=-O3 ./configure --prefix=/usr/local/mysql
With the Digital compiler "C++ V6.1-029", the following should work:
CC=cc -pthread CFLAGS=-O4 -ansi_alias -ansi_args -fast -inline speed -speculate all -arch host CXX=cxx -pthread CXXFLAGS=-O4 -ansi_alias -ansi_args -fast -inline speed -speculate all -arch host -noexceptions -nortti export CC CFLAGS CXX CXXFLAGS ./configure --prefix=/usr/mysql/mysql --with-mysqld-ldflags=-all-static --disable-shared --with-named-thread-libs="-lmach -lexc -lc"
In some versions of OSF1, the alloca()
function is broken. Fix
this by removing the line in `config.h' that defines 'HAVE_ALLOCA'
.
The alloca()
function also may have an incorrect prototype in
/usr/include/alloca.h
. This warning resulting from this can be ignored.
configure
will use the following thread libraries automatically:
--with-named-thread-libs="-lpthread -lmach -lexc -lc"
.
When using gcc
, you can also try running configure
like this:
shell> CFLAGS=-D_PTHREAD_USE_D4 CXX=gcc CXXFLAGS=-O3 ./configure ....
If you have problems with signals (MySQL dies unexpectedly under high load), you may have found an OS bug with threads and signals. In this case you can tell MySQL not to use signals by configuring with:
shell> CFLAGS=-DDONT_USE_THR_ALARM \ CXXFLAGS=-DDONT_USE_THR_ALARM \ ./configure ...
This doesn't affect the performance of MySQL, but has the side
effect that you can't kill clients that are ``sleeping'' on a connection with
mysqladmin kill
or mysqladmin shutdown
. Instead, the client
will die when it issues its next command.
With gcc
2.95.2, you will probably run into the following compile error:
sql_acl.cc:1456: Internal compiler error in `scan_region', at except.c:2566 Please submit a full bug report.
To fix this you should change to the sql
directory and do a ``cut
and paste'' of the last gcc
line, but change -O3
to
-O0
(or add -O0
immediately after gcc
if you don't
have any -O
option on your compile line.) After this is done you
can just change back to the top-level directly and run make
again.
If you are using Irix Version 6.5.3 or newer mysqld
will only be able to
create threads if you run it as a user with CAP_SCHED_MGT
privileges (like root
) or give the mysqld
server this privilege
with the following shell command:
shell> chcap "CAP_SCHED_MGT+epi" /opt/mysql/libexec/mysqld
You may have to undefine some things in `config.h' after running
configure
and before compiling.
In some Irix implementations, the alloca()
function is broken. If the
mysqld
server dies on some SELECT
statements, remove the lines
from `config.h' that define HAVE_ALLOC
and HAVE_ALLOCA_H
.
If mysqladmin create
doesn't work, remove the line from `config.h'
that defines HAVE_READDIR_R
. You may have to remove the
HAVE_TERM_H
line as well.
SGI recommends that you install all of the patches on this page as a set: http://support.sgi.com/surfzone/patches/patchset/6.2_indigo.rps.html
At the very minimum, you should install the latest kernel rollup, the
latest rld
rollup, and the latest libc
rollup.
You definitely need all the POSIX patches on this page, for pthreads support:
http://support.sgi.com/surfzone/patches/patchset/6.2_posix.rps.html
If you get the something like the following error when compiling `mysql.cc':
"/usr/include/curses.h", line 82: error(1084): invalid combination of type
Type the following in the top-level directory of your MySQL source tree:
shell> extra/replace bool curses_bool < /usr/include/curses.h > include/curses.h shell> make
There have also been reports of scheduling problems. If only one thread is running, things go slow. Avoid this by starting another client. This may lead to a 2-to-10-fold increase in execution speed thereafter for the other thread. This is a poorly understood problem with Irix threads; you may have to improvise to find solutions until this can be fixed.
If you are compiling with gcc
, you can use the following
configure
command:
CC=gcc CXX=gcc CXXFLAGS=-O3 \ ./configure --prefix=/usr/local/mysql --enable-thread-safe-client --with-named-thread-libs=-lpthread
On Irix 6.5.11 with native Irix C and C++ compilers ver. 7.3.1.2, the following is reported to work
CC=cc CXX=CC CFLAGS='-O3 -n32 -TARG:platform=IP22 -I/usr/local/include \ -L/usr/local/lib' CXXFLAGS='-O3 -n32 -TARG:platform=IP22 \ -I/usr/local/include -L/usr/local/lib' ./configure --prefix=/usr/local/mysql \ --with-berkeley-db --with-innodb \ --with-libwrap=/usr/local --with-named-curses-libs=/usr/local/lib/libncurses.a
The current port is tested only on a ``sco3.2v5.0.4'' and ``sco3.2v5.0.5'' system. There has also been a lot of progress on a port to ``sco 3.2v4.2''.
For the moment the recommended compiler on OpenServer is gcc 2.95.2. With this you should be able to compile MySQL with just:
CC=gcc CXX=gcc ./configure ... (options)
gcc
2.7.2 in Skunkware 97 does not have
GNU as
. You can also use egcs
1.1.2 or newer
http://www.egcs.com/. If you are using egcs
1.1.2 you have
to execute the following command:
shell> cp -p /usr/include/pthread/stdtypes.h /usr/local/lib/gcc-lib/i386-pc-sco3.2v5.0.5/egcs-2.91.66/include/pthread/
./configure
in the `threads/src' directory and select
the SCO OpenServer option. This command copies `Makefile.SCO5' to
`Makefile'.
make
.
cd
to the `thread/src' directory, and run make
install
.
make
when making MySQL.
safe_mysqld
as root, you probably will get only the
default 110 open files per process. mysqld
will write a note about this
in the log file.
configure
command should work:
shell> ./configure --prefix=/usr/local/mysql --disable-shared
configure
command should work:
shell> CFLAGS="-D_XOPEN_XPG4" CXX=gcc CXXFLAGS="-D_XOPEN_XPG4" \ ./configure \ --prefix=/usr/local/mysql \ --with-named-thread-libs="-lgthreads -lsocket -lgen -lgthreads" \ --with-named-curses-libs="-lcurses"You may get some problems with some include files. In this case, you can find new SCO-specific include files at http://www.mysql.com/Downloads/SCO/SCO-3.2v4.2-includes.tar.gz. You should unpack this file in the `include' directory of your MySQL source tree.
SCO development notes:
mysqld
with -lgthreads -lsocket -lgthreads
.
malloc
. If you encounter problems with memory usage,
make sure that `gmalloc.o' is included in `libgthreads.a' and
`libgthreads.so'.
read()
,
write()
, getmsg()
, connect()
, accept()
,
select()
, and wait()
.
If you want to install DBI on SCO, you have to edit the `Makefile' in DBI-xxx and each subdirectory.
Note that the following assumes gcc 2.95.2 or newer:
OLD: NEW: CC = cc CC = gcc CCCDLFLAGS = -KPIC -W1,-Bexport CCCDLFLAGS = -fpic CCDLFLAGS = -wl,-Bexport CCDLFLAGS = LD = ld LD = gcc -G -fpic LDDLFLAGS = -G -L/usr/local/lib LDDLFLAGS = -L/usr/local/lib LDFLAGS = -belf -L/usr/local/lib LDFLAGS = -L/usr/local/lib LD = ld LD = gcc -G -fpic OPTIMISE = -Od OPTIMISE = -O1 OLD: CCCFLAGS = -belf -dy -w0 -U M_XENIX -DPERL_SCO5 -I/usr/local/include NEW: CCFLAGS = -U M_XENIX -DPERL_SCO5 -I/usr/local/include
This is because the Perl dynaloader will not load the DBI
modules
if they were compiled with icc
or cc
.
Perl works best when compiled with cc
.
You must use a version of MySQL at least as recent as Version 3.22.13 because that version fixes some portability problems under Unixware.
We have been able to compile MySQL with the following configure
command on Unixware Version 7.0.1:
CC=cc CXX=CC ./configure --prefix=/usr/local/mysql
If you want to use gcc
, you must use gcc
2.95.2 or newer.
MySQL uses quite a few open files. Because of this, you should add something like the following to your `CONFIG.SYS' file:
SET EMXOPT=-c -n -h1024
If you don't do this, you will probably run into the following error:
File 'xxxx' not found (Errcode: 24)
When using MySQL with OS/2 Warp 3, FixPack 29 or above is required. With OS/2 Warp 4, FixPack 4 or above is required. This is a requirement of the Pthreads library. MySQL must be installed in a partition that supports long filenames such as HPFS, FAT32, etc.
The `INSTALL.CMD' script must be run from OS/2's own `CMD.EXE' and may not work with replacement shells such as `4OS2.EXE'.
The `scripts/mysql-install-db' script has been renamed. It is now called `install.cmd' and is a REXX script, which will set up the default MySQL security settings and create the WorkPlace Shell icons for MySQL.
Dynamic module support is compiled in but not fully tested. Dynamic modules should be compiled using the Pthreads run-time library.
gcc -Zdll -Zmt -Zcrtdll=pthrdrtl -I../include -I../regex -I.. \ -o example udf_example.cc -L../lib -lmysqlclient udf_example.def mv example.dll example.udf
Note: Due to limitations in OS/2, UDF module name stems must not
exceed 8 characters. Modules are stored in the `/mysql2/udf'
directory; the safe-mysqld.cmd
script will put this directory in
the BEGINLIBPATH
environment variable. When using UDF modules,
specified extensions are ignored -- it is assumed to be `.udf'.
For example, in Unix, the shared module might be named `example.so'
and you would load a function from it like this:
mysql> CREATE FUNCTION metaphon RETURNS STRING SONAME "example.so";
Is OS/2, the module would be named `example.udf', but you would not specify the module extension:
mysql> CREATE FUNCTION metaphon RETURNS STRING SONAME "example";
We are really interested in getting MySQL to work on BeOS, but unfortunately we don't have any person who knows BeOS or has time to do a port.
We are interested in finding someone to do a port, and we will help them with any technical questions they may have while doing the port.
We have previously talked with some BeOS developers that have said that MySQL is 80% ported to BeOS, but we haven't heard from them in a while.
We are really interested in getting MySQL to work on Netware, but unfortunately we don't have any person who knows Netware or has time to do a port.
We are interested in finding someone to do a port, and we will help them with any technical questions they may have while doing the port.
Go to the first, previous, next, last section, table of contents.