Go to the first, previous, next, last section, table of contents.


2 MySQL のインストール

この章では、どのようにして MySQL を得、インストールするのかをのべます:

2.1 Quick Standard Installation of MySQL

2.1.1 Installing MySQL on Linux

(訳注:もし RedHat 以外の Linux を使用しており、.rpm を、自分が使用している パッケージ管理システムの管理下におきたい場合、 alien : http://kitenet.net/programs/alien/ というツールを 使用します。これは RPM(Debian, Slackware) を自分が使用しているパッケージの形式に変換してくれます。)

RPM を使用して MySQL をインストールすることを推奨します。 MySQL RPM は SuSE Linux 7.3 で作成していますが、 他の rpmglibc をサポートしている Linux でも動作するでしょう。

RPM file での問題, 例えば, ``Sorry, the host 'xxxx' could not be looked up'' に遭遇した場合には → 「2.6.1.1 Linux Notes for Binary Distributions」節.

以下が使用するであろう RPM files です:

To see all files in an RPM package, run:

shell> rpm -qpl MySQL-VERSION.i386.rpm

インストールの最小の方法:

shell> rpm -i MySQL-server-VERSION.i386.rpm MySQL-client-VERSION.i386.rpm

クライアントパッケージだけをインストール:

shell> rpm -i MySQL-client-VERSION.i386.rpm

RPM はデータを `/var/lib/mysql' に保存します。 RPM は起動時にサーバーを立ちあげるように、`/etc/init.d/' に登録します。 (以前にインストールがされていて、前にインストールされた MySQL 起 動ファイルを何か変更している場合、それをコピーしておいた方がいいでしょう。 そうすればその変更を失うことはありません。)

If you want to install the MySQL RPM on older Linux distributions that do not support init scripts in `/etc/init.d' (directly or via a symlink), you should create a symbolic link pointing to the old location before installing the RPM:

shell> cd /etc ; ln -s rc.d/init.d .

However, all current major Linux distributions should already support this new directory layout as it is required for LSB (Linux Standard Base) compliance.

RPM ファイルのインストール後は、mysqld デーモンが実行されていて、 MySQL の使用を開始することができます。 「2.4 インストール後の設定とテスト」節参照.

うまくいかない場合、バイナリインストールの章でさらに情報を探すことができま す。 「2.2.10 Installing a MySQL Binary Distribution」節参照.

2.1.2 Windows への MySQL のインストール

Windows用の MySQLサーバ には,2つの配布形態があります。:

  1. バイナリ配布は,セットアッププログラムが含まれ,必要な全てのインストール作業を行い, あなたは直ぐにサーバをスタートさせることができます。
  2. The source distribution contains all the code and support files for building the executables using the VC++ 6.0 compiler. 「2.3.7 Windows Source Distribution」節参照.

大雑把な言い方をすると,バイナリ配布を使用する方がいいでしょう。

You will need the following:

2.1.2.1 Installing the Binaries

  1. If you are working on an NT/2000/XP server, logon as a user with administrator privileges.
  2. If you are doing an upgrade of an earlier MySQL installation, it is necessary to stop the server. If you are running the server as a service, use:
    C:\> NET STOP MySQL
    
    Otherwise, use:
    C:\mysql\bin> mysqladmin -u root shutdown
    
  3. On NT/2000/XP machines, if you want to change the server executable (e.g., -max or -nt), it is also necessary to remove the service:
    C:\mysql\bin> mysqld-max-nt --remove
    
  4. Unzip the distribution file to a temporary directory.
  5. Run the `setup.exe' file to begin the installation process. If you want to install into another directory than the default `c:\mysql', use the Browse button to specify your preferred directory.
  6. Finish the install process.

2.1.2.2 Preparing the Windows MySQL Environment

Starting with MySQL 3.23.38, the Windows distribution includes both the normal and the MySQL-Max server binaries. Here is a list of the different MySQL servers you can use:

Binary Description
mysqld Compiled with full debugging and automatic memory allocation checking, symbolic links, InnoDB, and BDB tables.
mysqld-opt Optimised binary with no support for transactional tables.
mysqld-nt Optimised binary for NT/2000/XP with support for named pipes. You can run this version on Windows 9x/Me, but in this case no named pipes are created and you must have TCP/IP installed.
mysqld-max Optimised binary with support for symbolic links, InnoDB and BDB tables.
mysqld-max-nt Like mysqld-max, but compiled with support for named pipes.

Starting from 3.23.50, named pipes are only enabled if one starts mysqld with --enable-named-pipe.

All of the preceding binaries are optimised for the Pentium Pro processor but should work on any Intel processor >= i386.

You will need to use an option file to specify your MySQL configuration under the following circumstances:

Normally you can use the WinMySQLAdmin tool to edit the option file my.ini. In this case you don't have to worry about the following section.

There are two option files with the same function: `my.cnf' and `my.ini'. However, to avoid confusion, it's best if you use only of one them. Both files are plain text. The `my.cnf' file, if used, should be created in the root directory of the C drive. The `my.ini' file, if used, should be created in the Windows system directory. (This directory is typically something like `C:\WINDOWS' or `C:\WINNT'. You can determine its exact location from the value of the windir environment variable.) MySQL looks first for the my.ini file, then for the `my.cnf' file.

If your PC uses a boot loader where the C drive isn't the boot drive, your only option is to use the `my.ini' file. Also note that if you use the WinMySQLAdmin tool, it uses only the `my.ini' file. The `\mysql\bin' directory contains a help file with instructions for using this tool.

Using notepad.exe, create the option file and edit the [mysqld] section to specify values for the basedir and datadir parameters:

[mysqld]
# set basedir to installation path, e.g., c:/mysql
basedir=the_install_path
# set datadir to location of data directory,
# e.g., c:/mysql/data or d:/mydata/data
datadir=the_data_path

Note that Windows pathnames should be specified in option files using forward slashes rather than backslashes. If you do use backslashes, you must double them.

If you would like to use a data directory different from the default of `c:\mysql\data', you must copy the entire contents of the `c:\mysql\data' directory to the new location.

If you want to use the InnoDB transactional tables, you need to manually create two new directories to hold the InnoDB data and log files@-e.g., `c:\ibdata' and `c:\iblogs'. You will also need to add some extra lines to the option file. 「7.5.2 InnoDB 起動オプション」節参照.

If you don't want to use InnoDB tables, add the skip-innodb option to the option file.

Now you are ready to test starting the server.

2.1.2.3 Starting the Server for the First Time

Testing from a DOS command prompt is the best thing to do because the server displays status messages that appear in the DOS window. If something is wrong with your configuration, these messages will make it easier for you to identify and fix any problems.

Make sure you are in the directory where the server is located, then enter this command:

C:\mysql\bin> mysqld-max --standalone

You should see the following messages as the server starts up:

InnoDB: The first specified datafile c:\ibdata\ibdata1 did not exist:
InnoDB: a new database to be created!
InnoDB: Setting file c:\ibdata\ibdata1 size to 209715200
InnoDB: Database physically writes the file full: wait...
InnoDB: Log file c:\iblogs\ib_logfile0 did not exist: new to be created
InnoDB: Setting log file c:\iblogs\ib_logfile0 size to 31457280
InnoDB: Log file c:\iblogs\ib_logfile1 did not exist: new to be created
InnoDB: Setting log file c:\iblogs\ib_logfile1 size to 31457280
InnoDB: Log file c:\iblogs\ib_logfile2 did not exist: new to be created
InnoDB: Setting log file c:\iblogs\ib_logfile2 size to 31457280
InnoDB: Doublewrite buffer not found: creating new
InnoDB: Doublewrite buffer created
InnoDB: creating foreign key constraint system tables
InnoDB: foreign key constraint system tables created
011024 10:58:25  InnoDB: Started

For further information about running MySQL on Windows, see 「2.6.2 Windows Notes」節.

2.1.3 Installing MySQL on Mac OS X

Beginning with MySQL 4.0.11, you can install MySQL on Mac OS X 10.2 ("Jaguar") using a Mac OS X PKG binary package instead of the binary tarball distribution. Please note that older versions of Mac OS X (e.g. 10.1.x) are not supported by this package!

The package is located inside a disk image (.dmg) file, that you first need to mount by double-clicking its icon in the Finder. It should then mount the image and display its contents.

NOTE: Before proceeding with the installation, please make sure that no other MySQL server is running!

Please shut down all running MySQL instances before continuing by either using the MySQL Manager Application (on Mac OS X Server) or via mysqladmin shutdown on the command line.

To actually install the MySQL PKG, double click on the package icon. This will launch the Mac OS Package Installer, which will guide you through the installation of MySQL.

The Mac OS X PKG of MySQL will install itself into `/usr/local/mysql-<version>' and will also install a symbolic link `/usr/local/mysql', pointing to the new location. If a directory named `/usr/local/mysql' already exists, it will be renamed to `/usr/local/mysql.bak' first. Additionally, it will install the mysql grant tables by executing mysql_install_db after the installation.

The installation layout is similar to the one of the binary distribution, all MySQL binaries are located in directory `/usr/local/mysql/bin'. The MySQL socket will be put into `/etc/mysql.sock' by default. 「2.2.7 インストールレイアウト」節参照.

It requires a user account named mysql (which should exist by default on Mac OS X 10.2 and up).

If you are running Mac OS X Server, you already have a version of MySQL installed:

This manual section covers the installation of the official MySQL Mac OS X PKG only. Make sure to read Apple's help about installing MySQL (Run the "Help View" application, select "Mac OS X Server" help, and do a search for "MySQL" and read the item entitled "Installing MySQL").

Especially note, that the pre-installed version of MySQL on Mac OS X Server is being started with the command safe_mysqld instead of mysqld_safe!

If you previously used Marc Liyanage's MySQL packages for Mac OS X from http://www.entropy.ch, you can simply follow the update instructions for packages using the binary installation layout as given on his pages.

If you are upgrading from Marc's version or from the Mac OS X Server version of MySQL to the official MySQL PKG, you also need to convert the existing MySQL privilege tables. 「2.5.2 バージョン 3.23 から バージョン 4.0 へのアップグレード」節参照.

After the installation, you can start up MySQL by running the following commands in a terminal window. Please note that you need to have administrator privileges to perform this task!

shell> cd /usr/local/mysql
shell> sudo ./bin/mysqld_safe
(Enter your password)
(Press CTRL+Z)
shell> bg
(Press CTRL+D to exit the shell)

You should now be able to connect to the MySQL server, e.g. by running `/usr/local/mysql/bin/mysql'.

To enable the automatic startup of MySQL on bootup, you can download Marc Liyanage's MySQL StartupItem from the following location:

http://www2.entropy.ch/download/mysql-startupitem.pkg.tar.gz

We plan to add a StartupItem to the official MySQL PKG in the near future.

Please note that installing a new MySQL PKG does not remove the directory of an older installation - unfortunately the Mac OS X Installer does not yet offer the functionality required to properly upgrade previously installed packages. After you have copied over the MySQL database files from the previous version and have successfully started the new version, you should consider removing the old installation files to save up disk space. Additionally, you should also remove older versions of the Package Receipt directories located in `/Library/Receipts/mysql-<version>.pkg'.

2.2 General Installation Issues

2.2.1 MySQL を得る方法

現在のバージョンとダウンロードの指示についての情報は MySQL ウェブページ (http://www.mysql.com/) をチェックしてください。

主なダウンロードミラーはここにあります: http://mirrors.sunsite.dk/mysql/. For a complete upto-date list of MySQL web/download mirrors, see http://www.mysql.com/downloads/mirrors.html. There you will also find information about becoming a MySQL mirror site and how to report a bad or out-of-date mirror.

2.2.2 Verifying Package Integrity Using MD5 Checksums or GnuPG

After you have downloaded the MySQL package that suits your needs and before you attempt to install it, you should make sure it is intact and has not been tampered with.

MySQL AB offers two means of integrity checking: MD5 checksums and cryptographic signatures using GnuPG, the GNU Privacy Guard.

2.2.3 Verifying the MD5 Checksum

After you have downloaded the package, you should check, if the MD5 checksum matches the one provided on the MySQL download pages. Each package has an individual checksum, that you can verify with the following command:

shell> md5sum <package>

Note, that not all operating systems support the md5sum command - on some it is simply called md5, others do not ship it at all. On Linux, it is part of the GNU Text Utilities package, which is available for a wide range of platforms. You can download the source code from http://www.gnu.org/software/textutils/ as well. If you have OpenSSL installed, you can also use the command openssl md5 <package> instead. A DOS/Windows implementation of the md5 command is available from http://www.fourmilab.ch/md5/.

Example:

shell> md5sum mysql-standard-4.0.10-gamma-pc-linux-i686.tar.gz
155836a7ed8c93aee6728a827a6aa153
                mysql-standard-4.0.10-gamma-pc-linux-i686.tar.gz

You should check, if the resulting checksum matches the one printed on the download page right below the respective package.

Most mirror sites also offer a file named `MD5SUMS', which also includes the MD5 checksums for all files included in the `Downloads' directory. Please note however that it's very easy to modify this file and it's not a very reliable method! If in doubt, you should consult different mirror sites and compare the results.

2.2.4 Signature Checking Using GnuPG

A more reliable method of verifying the integrity of a package is using cryptographic signatures. MySQL AB uses the GNU Privacy Guard (GnuPG), an Open Source alternative to the very well-known Pretty Good Privacy (PGP) by Phil Zimmermann. See http://www.gnupg.org/ and http://www.openpgp.org/ for more information about OpenPGP/GnuPG and how to obtain and install GnuPG on your system. Most Linux distributions already ship with GnuPG installed by default.

Beginning with MySQL 4.0.10 (February 2003), MySQL AB has started signing their downloadable packages with GnuPG. Cryptographic signatures are a much more reliable method of verifying the integrity and authenticity of a file.

To verify the signature for a specific package, you first need to obtain a copy of MySQL AB's public GPG build key build@mysql.com. You can either cut and paste it directly from here, or obtain it from http://www.keyserver.net/.

Key ID:
pub  1024D/5072E1F5 2003-02-03
     MySQL Package signing key (www.mysql.com) <build@mysql.com>
Fingerprint: A4A9 4068 76FC BD3C 4567  70C8 8C71 8D3B 5072 E1F5

Public Key (ASCII-armored):

-----BEGIN PGP PUBLIC KEY BLOCK-----
Version: GnuPG v1.0.6 (GNU/Linux)
Comment: For info see http://www.gnupg.org

mQGiBD4+owwRBAC14GIfUfCyEDSIePvEW3SAFUdJBtoQHH/nJKZyQT7h9bPlUWC3
RODjQReyCITRrdwyrKUGku2FmeVGwn2u2WmDMNABLnpprWPkBdCk96+OmSLN9brZ
fw2vOUgCmYv2hW0hyDHuvYlQA/BThQoADgj8AW6/0Lo7V1W9/8VuHP0gQwCgvzV3
BqOxRznNCRCRxAuAuVztHRcEAJooQK1+iSiunZMYD1WufeXfshc57S/+yeJkegNW
hxwR9pRWVArNYJdDRT+rf2RUe3vpquKNQU/hnEIUHJRQqYHo8gTxvxXNQc7fJYLV
K2HtkrPbP72vwsEKMYhhr0eKCbtLGfls9krjJ6sBgACyP/Vb7hiPwxh6rDZ7ITnE
kYpXBACmWpP8NJTkamEnPCia2ZoOHODANwpUkP43I7jsDmgtobZX9qnrAXw+uNDI
QJEXM6FSbi0LLtZciNlYsafwAPEOMDKpMqAK6IyisNtPvaLd8lH0bPAnWqcyefep
rv0sxxqUEMcM3o7wwgfN83POkDasDbs3pjwPhxvhz6//62zQJ7Q7TXlTUUwgUGFj
a2FnZSBzaWduaW5nIGtleSAod3d3Lm15c3FsLmNvbSkgPGJ1aWxkQG15c3FsLmNv
bT6IXQQTEQIAHQUCPj6jDAUJCWYBgAULBwoDBAMVAwIDFgIBAheAAAoJEIxxjTtQ
cuH1cY4AnilUwTXn8MatQOiG0a/bPxrvK/gCAJ4oinSNZRYTnblChwFaazt7PF3q
zIhMBBMRAgAMBQI+PqPRBYMJZgC7AAoJEElQ4SqycpHyJOEAn1mxHijft00bKXvu
cSo/pECUmppiAJ41M9MRVj5VcdH/KN/KjRtW6tHFPYhMBBMRAgAMBQI+QoIDBYMJ
YiKJAAoJELb1zU3GuiQ/lpEAoIhpp6BozKI8p6eaabzF5MlJH58pAKCu/ROofK8J
Eg2aLos+5zEYrB/LsrkCDQQ+PqMdEAgA7+GJfxbMdY4wslPnjH9rF4N2qfWsEN/l
xaZoJYc3a6M02WCnHl6ahT2/tBK2w1QI4YFteR47gCvtgb6O1JHffOo2HfLmRDRi
Rjd1DTCHqeyX7CHhcghj/dNRlW2Z0l5QFEcmV9U0Vhp3aFfWC4Ujfs3LU+hkAWzE
7zaD5cH9J7yv/6xuZVw411x0h4UqsTcWMu0iM1BzELqX1DY7LwoPEb/O9Rkbf4fm
Le11EzIaCa4PqARXQZc4dhSinMt6K3X4BrRsKTfozBu74F47D8Ilbf5vSYHbuE5p
/1oIDznkg/p8kW+3FxuWrycciqFTcNz215yyX39LXFnlLzKUb/F5GwADBQf+Lwqq
a8CGrRfsOAJxim63CHfty5mUc5rUSnTslGYEIOCR1BeQauyPZbPDsDD9MZ1ZaSaf
anFvwFG6Llx9xkU7tzq+vKLoWkm4u5xf3vn55VjnSd1aQ9eQnUcXiL4cnBGoTbOW
I39EcyzgslzBdC++MPjcQTcA7p6JUVsP6oAB3FQWg54tuUo0Ec8bsM8b3Ev42Lmu
QT5NdKHGwHsXTPtl0klk4bQk4OajHsiy1BMahpT27jWjJlMiJc+IWJ0mghkKHt92
6s/ymfdf5HkdQ1cyvsz5tryVI3Fx78XeSYfQvuuwqp2H139pXGEkg0n6KdUOetdZ
Whe70YGNPw1yjWJT1IhMBBgRAgAMBQI+PqMdBQkJZgGAAAoJEIxxjTtQcuH17p4A
n3r1QpVC9yhnW2cSAjq+kr72GX0eAJ4295kl6NxYEuFApmr1+0uUq/SlsQ==
=YJkx
-----END PGP PUBLIC KEY BLOCK-----

You can import this key into your public GPG keyring by using gpg --import. See the GPG documentation for more info on how to work with public keys.

After you have downloaded and imported the public build key, now download your desired MySQL package and the corresponding signature, which is also available from the download page. The signature has the file name extension `.asc'. For example, the signature for `mysql-standard-4.0.10-gamma-pc-linux-i686.tar.gz' would be `mysql-standard-4.0.10-gamma-pc-linux-i686.tar.gz.asc'. Make sure that both files are stored in the same directory and then run the following command to verify the signature for this file:

shell> gpg --verify <package>.asc

Example:

shell> gpg --verify mysql-standard-4.0.10-gamma-pc-linux-i686.tar.gz.asc
gpg: Warning: using insecure memory!
gpg: Signature made Mon 03 Feb 2003 08:50:39 PM MET using DSA key ID 5072E1F5
gpg: Good signature from
     "MySQL Package signing key (www.mysql.com) <build@mysql.com>"

The "Good signature" message indicates that everything is all right.

For RPM packages, there is no separate signature - RPM packages actually have a built-in GPG signature and MD5 checksum. You can verify them by running the following command:

shell> rpm --checksig <package>.rpm

Example:

shell> rpm --checksig MySQL-server-4.0.10-0.i386.rpm
MySQL-server-4.0.10-0.i386.rpm: md5 gpg OK

Note: If you are using RPM 4.1 and it complains about (GPG) NOT OK (MISSING KEYS: GPG#5072e1f5) (even though you have imported it into your GPG public keyring), you need to import the key into the RPM keyring first. RPM 4.1 does not use your GPG keyring (and GPG itself) anymore, but rather maintains its own keyring (because it's a system wide application and the GPG public keyring is user-specific file). To import the MySQL public key into the RPM keyring, please use the following command:

shell> rpm --import <pubkey>

Example:

shell> rpm --import mysql_pubkey.asc

In case you notice that the MD5 checksum or GPG signatures do not match, first try to download the respective package one more time, maybe from another mirror site. If you repeatedly can not successfully verify the integrity of the package, please notify us about such incidents including the full package name and the download site you have been using at webmaster@mysql.com or build@mysql.com.

2.2.5 MySQL がサポートする OS

我々は GNU Autoconf を使用していますので、MySQL は POSIX スレッ ドと C++ コンパイラが動作する全ての新しいシステムに移植可能です。(クライ アントコードのコンパイルだけは C++ を必要としますが、スレッドは必要ではありません。) 我々は自身のソフトウェアを、最初に Sun Solaris (現在は 2.5 ~ 2.7) 上と SuSE Linux Version 7.x で使用し開発します。

多くの OS では、ネイティブスレッドは最新バージョ ンだけで動作することに注意してください。 MySQL は次の OS/スレッドパッケージの組み合わせで、コンパイルの 成功が報告されています。

全てのプラットフォームが MySQL Server をちゃんと動作させるものではありません。 我々は以下のような評価基準に基づいて重要な要件を任せるに足るプラットフォームで あるかを判断しています。:

Based on the preceding 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 okay, 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 preceding comparison 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 optimising for that particular platform. We are just stating our observations to help you decide on which platform to use MySQL on in your setup.

2.2.6 使用すべき MySQL のバージョン

make を行う前に決める事は、あなたが最新の開発リリースを使用するのか、 または最新の安定リリースを使用するのかです:

make 前の2番目の決定事項は、ソースディストリビューションとバイナリディ ストリビューションのどちらを使用するかです。多くの場合、バイナリがプラッ トフォーム用に存在していれば、おそらくバイナリディストリビューションを使 用すべきです。通常、それはソースディストリビューションよりも簡単にインス トールできます。

次のケースでは、おそらくソースインストールの方が良いでしょう:

MySQL の命名法では、リリース番号は3つの数値とサフィックスからな ります。例えば、mysql-3.21.17-beta のようなリリース名は次のように 解釈されます:

MySQL の全てのバージョンは、比較的安全に使用できることを確かめ るため、我々は標準テストとベンチマークを通して確認しています。標準テス トは以前に見つかった全てのバグをチェックするように拡張されるため、テスト スイートはより良く保持されます。

全てのリリースは少なくても次のテストがされていることに注意してください:

内部テストスイート
これは顧客のための製品システムの一部です。多くのテーブルと何百というメガ バイトのデータを持っています。
MySQL ベンチマークスイート
これは一般的な範囲のクエリを実行します。これは、最適化の最新バッチが実際 にコードをより速く作れるかどうかを確認するテストでもあります。 「5.1.4 The MySQL Benchmark Suite」節参照.
crash-me テスト
これは、データベースがサポートしている機能と、その許容量と制限を決定しよ うとします。 「5.1.4 The MySQL Benchmark Suite」節参照.

他のテストは我々の内部製品環境で最新の MySQL バージョンを我々が 少なくとも1つのマシンで使用することです。我々は動作のため 100ギガバイト 以上のデータを持ちます。

2.2.7 インストールレイアウト

この節では、バイナリとソース配布のインストールで生成されるディレクトリの デフォルトのレイアウトを説明します。

バイナリ配布はアンパックすることによりインストールされ、インストール場所 はあなたが選択した場所(通常 `/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' データベースとログファイル

ソースインストールのレイアウトはバイナリインストールと次の点が異なります:

スクリプト `scripts/make_binary_distribution' を実行することにより、 コンパイルされたソースディストリビューションから、あなた自身のバイナリイン ストレーションを生成できます。

2.2.8 アップデートがリリースされる方法と時

MySQL は MySQL AB でかなり速く進化していて、我々はこれを他の MySQL ユーザに共有してもらいたいです。我々は、他の人が必要とし ていると思われるとても便利な機能を持った時に、リリースの作成を試みます。

我々は、実装が簡単な機能を要求するユーザの手助けも試みます。我々は、我々 のライセンスユーザが求めるものにも注目し、特に我々の拡張 email サポート 顧客が求めるものに注目して、彼らの手助けを試みます。

新しいリリースをダウンロードする必要はありません。News 節は、新しいリリー スが、あなたが本当に求める何かを持っているかどうかをあなたに教えます。 「D MySQL Change History」節参照.

我々は MySQL の更新時は次のポリシーにしたがって行います:

現在の安定リリースはバージョン 3.23 です; 我々はすでにバージョン 4.0 の開発に移行しています。 しかし、安定バージョンでもバグはまだ修正されます。 我々は、バグ修正と``行なわなければいけない''ことを無視するような、完全な 凍結を考えていません。``幾分かの凍結''とは、``ほとんど確実に既に動作して いるものに影響を与えない''小さなことを追加するかもしれないということを意 味します。

MySQL uses a slightly different naming scheme from most other products. In general it's relatively safe to use any version that has been out for a couple of weeks without being replaced with a new version. 「2.2.6 使用すべき MySQL のバージョン」節参照.

2.2.9 MySQL Binaries Compiled by MySQL AB

サービスとして、我々 MySQL AB は MySQL のバイナリ配布を提供しています。 これらのコンパイルは MySQL AB 内部でおこなったり、我々にマシンの アクセスを提供してもらっている顧客のマシン上で行っています。

これらの配布物は Build-tools/Do-compile で作成され (このスクリプトは scripts/make_binary_distribution を使用して ソースをコンパイルし tar.gz バイナリを作成します)、 以下のコンパイルオプションで調整されています。

Binaries built on MySQL AB development systems:

Linux 2.4.xx i386 with gcc 2.95.3
CFLAGS="-O2 -mcpu=pentiumpro" CXX=gcc CXXFLAGS="-O2 -mcpu=pentiumpro -felide-constructors" ./configure --prefix=/usr/local/mysql --with-extra-charsets=complex --enable-thread-safe-client --enable-local-infile --enable-assembler --disable-shared --with-client-ldflags=-all-static --with-mysqld-ldflags=-all-static
Linux 2.4.xx ia64 with ecc (Intel C++ Itanium Compiler 7.0)
CC=ecc CFLAGS=-tpp1 CXX=ecc CXXFLAGS=-tpp1 ./configure --prefix=/usr/local/mysql --with-extra-charsets=complex --enable-thread-safe-client --enable-local-infile
Linux 2.4.xx alpha with ccc (Compaq C V6.2-505 / Compaq C++ V6.3-006)
CC=ccc CFLAGS="-fast -arch generic" CXX=cxx CXXFLAGS="-fast -arch generic -noexceptions -nortti" ./configure --prefix=/usr/local/mysql --with-extra-charsets=complex --enable-thread-safe-client --enable-local-infile --with-mysqld-ldflags=-non_shared --with-client-ldflags=-non_shared --disable-shared
Linux 2.2.xx sparc with egcs 1.1.2
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-extra-charsets=complex --enable-thread-safe-client --enable-local-infile --enable-assembler --disable-shared
Linux 2.4.xx s390 with gcc 2.95.3
CFLAGS="-O2" CXX=gcc CXXFLAGS="-O2 -felide-constructors" ./configure --prefix=/usr/local/mysql --with-extra-charsets=complex --enable-thread-safe-client --enable-local-infile --disable-shared --with-client-ldflags=-all-static --with-mysqld-ldflags=-all-static
Sun Solaris 2.8 sparc with gcc 3.2
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-extra-charsets=complex --enable-thread-safe-client --enable-local-infile --enable-assembler --with-named-z-libs=no --with-named-curses-libs=-lcurses --disable-shared
Sun Solaris 2.9 sparc with gcc 2.95.3
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-extra-charsets=complex --enable-thread-safe-client --enable-local-infile --enable-assembler --with-named-curses-libs=-lcurses --disable-shared
Sun Solaris 2.9 sparc with cc-5.0 (Sun Forte 5.0)
CC=cc-5.0 CXX=CC ASFLAGS="-xarch=v9" CFLAGS="-Xa -xstrconst -mt -D_FORTEC_ -xarch=v9" CXXFLAGS="-noex -mt -D_FORTEC_ -xarch=v9" ./configure --prefix=/usr/local/mysql --with-extra-charsets=complex --enable-thread-safe-client --enable-local-infile --enable-assembler --with-named-z-libs=no --enable-thread-safe-client --disable-shared
IBM AIX 4.3.2 ppc with gcc 3.2.1
CFLAGS="-O2 -mcpu=powerpc -Wa,-many " CXX=gcc CXXFLAGS="-O2 -mcpu=powerpc -Wa,-many -felide-constructors -fno-exceptions -fno-rtti" ./configure --prefix=/usr/local/mysql --with-extra-charsets=complex --enable-thread-safe-client --enable-local-infile --with-named-z-libs=no --disable-shared
IBM AIX 5.1.0 ppc with gcc 3.2.1
CFLAGS="-O2 -mcpu=powerpc -Wa,-many" CXX=gcc CXXFLAGS="-O2 -mcpu=powerpc -Wa,-many -felide-constructors -fno-exceptions -fno-rtti" ./configure --prefix=/usr/local/mysql --with-extra-charsets=complex --with-server-suffix="-pro" --enable-thread-safe-client --enable-local-infile --with-named-z-libs=no --disable-shared --with-innodb
HP-UX 10.20 pa-risc1.1 with gcc 3.1
CFLAGS="-DHPUX -I/opt/dce/include -O3 -fPIC" CXX=gcc CXXFLAGS="-DHPUX -I/opt/dce /include -felide-constructors -fno-exceptions -fno-rtti -O3 -fPIC" ./configure --prefix=/usr/local/mysql --with-extra-charsets=complex --enable-thread-safe-client --enable-local-infile --with-pthread --with-named-thread-libs=-ldce --with-lib-ccflags=-fPIC --disable-shared
HP-UX 11.11 pa-risc2.0 with aCC (HP ANSI C++ B3910B A.03.33)
CC=cc CXX=aCC CFLAGS=+DD64 CXXFLAGS=+DD64 ./configure --prefix=/usr/local/mysql --with-extra-charsets=complex --enable-thread-safe-client --enable-local-infile --disable-shared
Apple Mac OS X 10.2 powerpc with gcc 3.1
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-extra-charsets=complex --enable-thread-safe-client --enable-local-infile --disable-shared
FreeBSD 4.7 i386 with gcc 2.95.4
CFLAGS=-DHAVE_BROKEN_REALPATH ./configure --prefix=/usr/local/mysql --with-extra-charsets=complex --enable-thread-safe-client --enable-local-infile --enable-assembler --with-named-z-libs=not-used --disable-shared

The following binaries are built on third-party systems kindly provided to MySQL AB by other users. Please note that these are only provided as a courtesy. Since MySQL AB does not have full control over these systems, we can only provide limited support for the binaries built on these systems.

SCO Unix 3.2v5.0.6 i386 with gcc 2.95.3
CFLAGS="-O3 -mpentium" LDFLAGS=-static CXX=gcc CXXFLAGS="-O3 -mpentium -felide-constructors" ./configure --prefix=/usr/local/mysql --with-extra-charsets=complex --enable-thread-safe-client --enable-local-infile --with-named-z-libs=no --enable-thread-safe-client --disable-shared
Caldera Open Unix 8.0.0 i386 with CC 3.2
CC=cc CFLAGS="-O" CXX=CC ./configure --prefix=/usr/local/mysql --with-extra-charsets=complex --enable-thread-safe-client --enable-local-infile --with-named-z-libs=no --enable-thread-safe-client --disable-shared
Compaq Tru64 OSF/1 V5.1 732 alpha with cc/cxx (Compaq C V6.3-029i / DIGITAL C++ V6.1-027)
CC="cc -pthread" CFLAGS="-O4 -ansi_alias -ansi_args -fast -inline speed -speculate all" CXX="cxx -pthread" CXXFLAGS="-O4 -ansi_alias -fast -inline speed -speculate all -noexceptions -nortti" ./configure --prefix=/usr/local/mysql --with-extra-charsets=complex --enable-thread-safe-client --enable-local-infile --with-prefix=/usr/local/mysql --with-named-thread-libs="-lpthread -lmach -lexc -lc" --disable-shared --with-mysqld-ldflags=-all-static
SGI Irix 6.5 IP32 with gcc 3.0.1
CC=gcc CFLAGS="-O3 -fno-omit-frame-pointer" CXXFLAGS="-O3 -fno-omit-frame-pointer -felide-constructors -fno-exceptions -fno-rtti" ./configure --prefix=/usr/local/mysql --with-extra-charsets=complex --enable-thread-safe-client --enable-local-infile --disable-shared

The following compile options have been used for binary packages MySQL AB used to provide in the past. These binaries are currently not being updated anymore, but the compile options are kept in here for reference purposes.

Linux 2.2.x with x686 with 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-charsets=complex
SunOS 4.1.4 2 sun4c with 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
SunOS 5.5.1 (and above) sun4u with 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
SunOS 5.6 i86pc with gcc 2.8.1
CC=gcc CXX=gcc CXXFLAGS=-O3 ./configure --prefix=/usr/local/mysql --with-low-memory --with-extra-charsets=complex
BSDI BSD/OS 3.1 i386 with gcc 2.7.2.1
CC=gcc CXX=gcc CXXFLAGS=-O ./configure --prefix=/usr/local/mysql --with-extra-charsets=complex
BSDI BSD/OS 2.1 i386 with gcc 2.7.2
CC=gcc CXX=gcc CXXFLAGS=-O3 ./configure --prefix=/usr/local/mysql --with-extra-charsets=complex
AIX 2 4 with gcc 2.7.2.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 オプションを取り除いてく ださい。

For the Windows distribution, please see 「2.1.2 Windows への MySQL のインストール」節.

2.2.10 Installing a MySQL Binary Distribution

See also 「2.1.2.1 Installing the Binaries」節, 「2.1.1 Installing MySQL on Linux」節, and 「8.4.7 Building Client Programs」節.

MySQL の バイナリ配布プログラムをインストールする際は以下のツールが必要になります:

Linux では別の形式、RPM-based(RPM Package Manager)配布も行われています。 「2.1.1 Installing MySQL on Linux」節参照.

もしもこの問題にぶつかってしまった場合は mysqlbug を使用してください。 質問等は mysql@lists.mysql.com に送ってください。 問題点がバグに該当しなくても mysqlbug は情報を集めていますので解決の 手助けになることと思います。 mysqlbug を使用すれば問題の解決方法を得る 確率が増します。mysqlbug は解凍されたプログラムの `bin' 以下にあります。 「1.6.1.3 バグや問題を報告する方法」節参照.

MySQL バイナリ配布プログラムのインストール及び 立ち上げまでに必要となる基本操作は以下の通りです。

shell> groupadd mysql
shell> useradd -g mysql mysql
shell> cd /usr/local
shell> gunzip < /path/to/mysql-VERSION-OS.tar.gz | tar xvf -
shell> ln -s full-path-to-mysql-VERSION-OS mysql
shell> cd mysql
shell> scripts/mysql_install_db
shell> chown -R root  .
shell> chown -R mysql data
shell> chgrp -R mysql .
shell> bin/safe_mysqld --user=mysql &
or
shell> bin/mysqld_safe --user=mysql &
if you are running MySQL 4.x

新しいユーザを追加するには bin/mysql_setpermission スクリプトを 使用できます。使用の際はDBIMsql-Mysql-modulesの Perlモジュールをインストールする必要があります。

より詳細な情報をここから示します。

バイナリ配布のプログラムをインストールする際は以下に従ってください。 その後、 「2.4 インストール後の設定とテスト」節に進んでインストールの終了処理と動作試験を行ってください。

  1. バイナリ配布プログラムを解凍するためのディレクトリを用意してください。 そして、そこにバイナリ配布ファイルを置いてください。 以下の例では `/usr/local' にファイルを解凍し、`/usr/local/mysql' に MySQLをインストールします。(従って以下の例では操作するユーザが `/usr/local' に対して書き込み権限を持つことを前提としています。 もしも `/usr/local' への書き込みが禁じられている場合は rootとしてインストールを行う必要があります。
  2. プログラムの配布は以下のサイトから行ってください。 「2.2.1 MySQL を得る方法」節. MySQLのバイナリ配布は圧縮された tar 形式で行われており、 `mysql-VERSION-OS.tar.gz' のような形式の名前が付けられています。 ここで、VERSION はバージョン番号(例えば 3.21.15)を OS はプラットホームとなるOS(例えば pc-linux-gnu-i586)を示します。
  3. バイナリ配布ファイルに -max という表示があるものがありますが、 これはこのプログラムが transaction-safe 機能やその他の機能をサポート していることを示しています。 「4.7.5 mysqld-max, An Extended mysqld Server」節参照。 全てのバイナリプログラムは同じソースファイルからmakeされたものです。
  4. mysqldが動作するためのユーザとグループを作成してください。
    shell> groupadd mysql
    shell> useradd -g mysql mysql
    
    これらのコマンドは mysql グループと mysql ユーザを作成するものです。 useraddgroupadd というコマンドもありますが、 これらは使用プラットホームによって使い方が若干異なります。 また、adduseraddgroup と呼ばれる場合もあります。 mysql 以外のユーザやグループでも使用できます。
  5. インストール先のディレクトリを変更する場合は以下のようにします。 まずディレクトリを移動します。
    shell> cd /usr/local
    
  6. 以下のように移動したディレクトリ上でプログラムの展開を行い インストールディレクトリを作成してください。
    shell> gunzip < /path/to/mysql-VERSION-OS.tar.gz | tar xvf -
    shell> ln -s full-path-to-mysql-VERSION-OS mysql
    
    最初のコマンドで `mysql-VERSION-OS' という名前のディレクトリを作成します。 次のコマンドはそのディレクトリへのシンボリックリンクを作成し、 ユーザに単純な `/usr/local/mysql' という名前での利用を可能にします。
  7. 以下のようにインストールディレクトリへ移動します。
    shell> cd mysql
    
    複数のファイルが mysql 以下のディレクトリに展開されているのが おわかりになると思います。 中でもインストールに重要な役目を果たすものは `bin'`scripts' のサブディレクトリにあります。
    `bin'
    This directory contains client programs and the server You should add the full pathname of this directory to your PATH environment variable so that your shell finds the MySQL programs properly. 「F Environment Variables」節参照.
    `scripts'
    このディレクトリには mysql_install_db という mysql への アクセス管理を行うデータベースを初期化するためのスクリプトが置いてあります。
  8. mysqlaccessを使う必要があり、なおかつ、標準ディレクトリとは異なる場所に インストールを行いたい場合は、mysqlaccessmysqlクライアントを 起動できるように環境設定を行う必要があります。 `bin/mysqlaccess'の18行目位にある以下のような行を変更してください。
    $MYSQL     = '/usr/local/bin/mysql';    # path to mysql executable
    
    これを実際に mysql がインストールされているディレクトリに変更してください。 これをしないと mysqlaccess を使う際に Broken pipe エラーが発生します。
  9. 以下のようにすることによりアクセス管理データベースを作ることができます (初めてMySQLをインストールする時だけ必要)。
    shell> scripts/mysql_install_db
    
    使用する MySQL のバージョンが 3.22.10 より古い場合はこの操作をする時に MySQL サーバが 立ち上がっている必要がありましたが、現在のバージョンでは必要ありません。
  10. Change ownership of binaries to root and ownership of the data directory to the user that you will run mysqld as:
    shell> chown -R root  /usr/local/mysql/.
    shell> chown -R mysql /usr/local/mysql/data
    shell> chgrp -R mysql /usr/local/mysql/.
    
    最初のコマンドによって全てのファイルの owner 属性が root になります。 二行目のコマンドによってデータディレクトリ以下のファイル全ての owner 属性が mysql になります。 最後のコマンドによって全てのファイルの group 属性が mysql になります。
  11. PerlモジュールDBIDBDのインストールが必要なら 「2.7 Perl Installation Comments」節の項をご覧下さい。
  12. MySQL を OS のブート時に自動的に起動したい場合は support-files/mysql.server を 貴方のシステムの的確な場所にコピーして使用できます。 より詳しい情報は support-files/mysql.server のスクリプト自体や 「2.4.3 MySQL の自動起動と自動停止」節 にあります。

全てのファイルの展開とインストールが終了したら初期化と稼動試験を行います。

以下のようにしてMySQLサーバを立ち上げることができます。

shell> bin/safe_mysqld --user=mysql &

Now proceed to 「4.7.2 safe_mysqld, The Wrapper Around mysqld」節, and 「2.4 インストール後の設定とテスト」節参照.

2.3 MySQL ソースディストリビューションのインストール

ソースインストールに取り掛かる前に、最初に我々のバイナリがあなたのプラット フォームに有効で、動作するかどうかをチェックしてください。我々は、我々のバ イナリが可能な限りのオプションで構築されていることを確認するために多くの努 力をしています。

ソースから MySQL を作成しインストールするためには次のツールが必 要です:

-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.6.1.3 バグや問題を報告する方法」節参照.

2.3.1 素早いインストールの概要

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 &
or
shell> /usr/local/mysql/bin/mysqld_safe --user=mysql &
if you are running MySQL 4.x.

InnoDB テーブルをサポートしたい場合は、/etc/my.cnf ファイルを編集し て、innodb_... で始まるパラメータの前の # 文字を削除すべきで す。 「4.1.2 `my.cnf' オプションファイル」節参照, and 「7.5.2 InnoDB 起動オプション」節.

RPM ソースから開始する場合は:

shell> rpm --rebuild --clean MySQL-VERSION.src.rpm

これはインストールできるRPMバイナリを作成します

もし DBIMsql-Mysql-modules Perl モジュールをインストールするなら、 bin/mysql_setpermission スクリプトが使用する新しいユーザーを 追加することができます。

次にさらに詳細な説明を行ないます:

ソース配布のインストールには、次のステップに従い、それから インストール 後の初期化とテストのために 「2.4 インストール後の設定とテスト」節 に進んでください。

  1. 配布をアンパックしたいディレクトリを選んで、そこに移ってください。
  2. 配布ファイルを 「2.2.1 MySQL を得る方法」節. にリストされたサイトの一つから得てください。
  3. MySQL で Berkeley DB テーブルの使用に興味がある場合、Berkeley DB ソースコー ドのパッチバージョンを入手する必要があります。処理の前に Berkeley DB テー ブルの章を読んでください。 「7.6 BDB or BerkeleyDB Tables」節参照. MySQL ソース配布は圧縮された tar アーカイブとして提供さ れ、`mysql-VERSION.tar.gz' のような名前を持ちます。ここで VERSION は 4.0.12 のような番号です。
  4. mysqld を実行するユーザーとグループを追加します:
    shell> groupadd mysql
    shell> useradd -g mysql mysql
    
    これらのコマンドは mysql グループと mysql ユーザを追加します。 useraddgroupadd 構文は、別のバージョンの UNIX 上では少し異なるでしょ う。adduseraddgroup と呼ばれることもあります。ユーザとグ ループは mysql の代わりに他の何かにすることもできます。
  5. カレントディレクトリに配布をアンパックしてください:
    shell> gunzip < /path/to/mysql-VERSION.tar.gz | tar xvf -
    
    このコマンドは `mysql-VERSION' という名前のディレクトリを作成します。
  6. Change into the top-level directory of the unpacked distribution:
    shell> cd mysql-VERSION
    
    注意: 現在のこのトップレベルディレクトリで MySQL の configure と build を行なう必要があります。別のディレクトリでは build できません。
  7. リリースを configure し、全てをコンパイルしてください:
    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.6.1.3 バグや問題を報告する方法」節参照。 コンパイルが失敗する場合、いくらかのよくある問題での手助けのため、 「2.3.5 MySQL コンパイル時の問題」節 を参照してください。
  8. 全てをインストールしてください:
    shell> make install
    
    このコマンドは root として実行する必要があります。
  9. MySQL 権限テーブルを生成してください(以前に MySQL をイ ンストールしていない時にだけ必要です):
    shell> scripts/mysql_install_db
    
    注意: 3.22.10 より古い MySQL バージョンでは、 mysql_install_db 実行時に MySQL サーバが開始されましたが、 これはもはや真ではありません!
  10. バイナリのオーナーを 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番目のコマンドは ownermysql ユーザに変更し、 3番目のコマンドは group 属性を mysql グループに変更します。
  11. Perl DBI/DBD インタフェースのサポートをインストールしたい 場合、 「2.7 Perl Installation Comments」節 を見てください。
  12. MySQL をマシン起動時に自動的に開始したい場合、 support-files/mysql.server をシステムのスタートアップファイルがあ る場所にコピーしてください。さらなる情報は support-files/mysql.server スクリプト自身の中と、 「2.4.3 MySQL の自動起動と自動停止」節 に見つけられます。 「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 サーバーを走らせる」節参照.

Now proceed to 「2.4 インストール後の設定とテスト」節.

2.3.2 パッチの適用

時々、パッチは、メーリング・リストに流されたり、または MySQL Web サイトのパッチエリア (http://www.mysql.com/downloads/patches.html) に置かれます。

メーリング・リストからのパッチを適用するには、パッチが載っているメッセージを ファイルに保存して、あなたの 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 で止めます ) いくつかのシステムでは、現在実行しているものを止めない限り、 新しいバージョンをインストールできないようになっています。

2.3.3 典型的な configure オプション

configure スクリプトは MySQL 配布をどのようにコンフィグ するかを制御するための多くの処理を提供します。典型的には、 configure コマンドラインにオプションを使用してこれを行ないます。 いくつかの環境変数を使用しても configure に影響を与えることができ ます。 「F Environment Variables」節参照. configure がサポートするオプションの一覧は、次のコマンドを 実行してください:

shell> ./configure --help

一般的に使用される configure オプションのいくつかを以下に説明します:

2.3.4 開発ソースツリーからのインストール

警告: 我々の新しいテストコードについて我々を手助けすることに興味 がある場合にだけ、この節を読むべきです。MySQL を得て、あなたのシ ステム上で実行したいだけの場合は、標準リリースディストリビューションを使 用すべきです(ソースまたはバイナリディストリビューション)。

我々のもっとも新しい開発ソースツリーを得るには、次の手順に従ってください:

  1. Download BitKeeper from http://www.bitmover.com/cgi-bin/download.cgi. You will need Bitkeeper 3.0 or newer to access our repository.
  2. Follow the instructions to install it.
  3. After BitKeeper is installed, first go to the directory you want to work from, and then use one of the following commands to clone the MySQL version branch of your choice: To clone the 3.23 branch, use this command:
    shell> bk clone bk://mysql.bkbits.net/mysql-3.23 mysql-3.23
    
    To clone the 4.0 branch, use this command:
    shell> bk clone bk://mysql.bkbits.net/mysql-4.0 mysql-4.0
    
    To clone the 4.1 branch, use this command:
    shell> bk clone bk://mysql.bkbits.net/mysql-4.1 mysql-4.1
    
    In the preceding examples the source tree will be set up in the `mysql-3.23/', `mysql-4.0/', or `mysql-4.1/' subdirectory of your current directory. If you are behind a firewall and can only initiate HTTP connections, you can also use BitKeeper via HTTP. If you are required to use a proxy server, simply set the environment variable http_proxy to point to your proxy:
    shell> export http_proxy="http://your.proxy.server:8080/"
    
    Now, simply replace the bk:// with http:// when doing a clone. Example:
    shell> bk clone http://mysql.bkbits.net/mysql-4.1 mysql-4.1
    
    The initial download of the source tree may take a while, depending on the speed of your connection - please be patient.
  4. You will need GNU make, autoconf 2.53 (or newer), automake 1.5, libtool 1.4, and m4 to run the next set of commands. Note that automake 1.7 or newer doesn't yet work. If you are using trying to configure MySQL 4.1 you will also need bison 1.75. Older versions of bison may report this error: sql_yacc.yy:#####: fatal error: maximum table size (32767) exceeded. Note: the maximum table size is not actually exceeded, the error is caused by bugs in these earlier bison versions. The typical command to do in a shell is:
    cd mysql-4.0
    bk -r get -Sq
    aclocal; autoheader; autoconf; automake
    (cd innobase ; aclocal; autoheader; autoconf; automake) # for InnoDB
    (cd bdb/dist ; sh s_all ) # for Berkeley DB
    ./configure  # Add your favorite options here
    make
    
    If you get some strange error during this stage, check that you really have libtool installed! A 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 by removing flags that are Pentium-specific.
  5. When the build is done, run 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, with-tcp-port, and unix-socket-path options than those used for your production server.
  6. Play hard with your new installation and try to make the new features crash. Start by running make test. 「9.1.2 MySQL Test Suite」節参照.
  7. If you have gotten to the 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 that your shell can find them.
  8. After the initial bk clone operation to get the source tree, you should run bk pull periodically to get the updates.
  9. You can examine the change history for the tree with all the diffs by using 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 e-mail 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.
  10. BitKeeper has a nice help utility that you can access via bk helptool.
  11. Please note that any commits (bk ci or bk citool) will trigger the posting of a message with the changeset to our internals mailing list, as well as the usual openlogging.org submission with just the changeset comments. Generally, you wouldn't need to use commit (since the public tree will not allow bk push), but rather use the bk diffs method described previously.

You can also browse changesets, comments and sourcecode online by browsing to e.g. http://mysql.bkbits.net:8080/mysql-4.1 For MySQL 4.1.

The manual is in a separate tree which can be cloned with:

shell> bk clone bk://mysql.bkbits.net/mysqldoc mysqldoc

2.3.5 MySQL コンパイル時の問題

Solaris や Linux 上で gcc を使用した場合、一切警告無く 全ての MySQL プログラムがきれいに作れます。 他のシステムではインクルードファイルの違いから警告が出るかもしれません。 MIT-pthreads を使用した際の警告は 「2.3.6 MIT-pthreads に関して」節 を参照してください。 他の問題は、以下をチェックしてください。

多くの問題の解決のために、再 configure が必要です。 あなたが再構成する必要があるならば、以下に気をつけてください:

古いコンフィグやオブジェクトファイルの使用を防ぐため、 configure 前に以下のコマンドを実行してください:

shell> rm config.cache
shell> make clean

こうするかわりに、make distclean としても構いません。

以下に、 MySQL をコンパイルする際に起こりやすい問題をあげておきます:

2.3.6 MIT-pthreads に関して

このセクションでは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.5 MySQL がサポートする OS」節参照.

Note, that beginning with MySQL 4.0.2 MIT-pthreads are no longer part of the source distribution! If you require this package, you need to download it separately from http://www.mysql.com/Downloads/Contrib/pthreads-1_60_beta6-mysql.tar.gz

After downloading, extract this source archive into the top level of the MySQL source directory. It will create a new subdirectory mit-pthreads.

2.3.7 Windows Source Distribution

You will need the following:

Building MySQL

  1. Create a work directory (e.g., workdir).
  2. Unpack the source distribution in the aforementioned directory.
  3. Start the VC++ 6.0 compiler.
  4. In the File menu, select Open Workspace.
  5. Open the `mysql.dsw' workspace you find on the work directory.
  6. From the Build menu, select the Set Active Configuration menu.
  7. Click over the screen selecting mysqld - Win32 Debug and click OK.
  8. Press F7 to begin the build of the debug server, libs, and some client applications.
  9. When the compilation finishes, copy the libs and the executables to a separate directory.
  10. Compile the release versions that you want, in the same way.
  11. Create the directory for the MySQL stuff: e.g., `c:\mysql'
  12. From the workdir directory copy for the c:\mysql directory the following directories:
  13. Create the directory `c:\mysql\bin' and copy all the servers and clients that you compiled previously.
  14. If you want, also create the `lib' directory and copy the libs that you compiled previously.
  15. Do a clean using Visual Studio.

Set up and start the server in the same way as for the binary Windows distribution. 「2.1.2.2 Preparing the Windows MySQL Environment」節参照.

2.4 インストール後の設定とテスト

初めて 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> ./scripts/mysql_install_db
shell> ./bin/safe_mysqld --user=mysql &
or
shell> ./bin/mysqld_safe --user=mysql &
if you are running MySQL 4.x.

これは、いくつかのデータベースを生成します。mysql データベースは全 てのデータベース権限を保持します。test データベースは MySQL をテストするために使用できます。そして、 mysql_install_db を実行したユーザの権限エントリと root ユー ザも生成します(パスワードはありません)。これは mysqld サーバの起動 も行ないます。

mysql_install_db は古い権限テーブルを上書きしません。そのため、どの ような環境でも安全に実行できます。test データベースを持ちたくないな ら、mysqladmin -u root drop test で削除できます。

テストは、MySQL のトップディレクトリーから簡単に実行できます。 バイナリ配布を使用する場合、これ(トップディレクトリ)は インストール先のディレクトリーになるでしょう(`/usr/local/mysql')。 ソース配布の場合、これは MySQL のソースディレクトリです。

コマンドは本節といかに続く節で説明しますが、BINDIRmysqladminsafe_mysqld がインストールされたディレクトリを示します。 バイナリ配布を使用している場合、BINDIR はバイナリ配布の `bin' ディレクトリになります。 ソースからインストールした場合、BINDIR は、configure で特別指定しない限り、 `/usr/local/bin' です。 EXECDIRmysqld サーバーのインストール先です。 バイナリ配布を使用している場合、これは BINDIR ディレクトリと同一になります。 ソースからインストールした場合、`/usr/local/libexec' です。

テストについて以下に詳細に説明します:

  1. If necessary, start the mysqld server and set up the initial MySQL grant tables containing the privileges that determine how users are allowed to connect to the server. This is normally done with the mysql_install_db script:
    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」節. rootmysql_install_db を実行する必要があるとあなたは思うかもしれません。 しかし、 MySQL は root 以外のユーザーで起動できます。 データベースディレクトリがサーバーを起動したユーザに対して読み書きが許可されていれば良いのです。 MySQL を一般ユーザーで走らせる方法は 「A.3.2 一般ユーザで MySQL を動かす方法」節. もし mysql_install_db で問題が出たら、 「2.4.1 mysql_install_db 実行時の問題」節. を参照のこと。 mysql_install_db スクリプトを走らせるにはいくつか選択があります: これらの選択については 「4.3.4 MySQL 権限許可の初期設定」節 からさらに情報が得られます。
  2. MySQL サーバーを以下のようにして起動します:
    shell> cd mysql_installation_directory
    shell> bin/safe_mysqld &
    
    サーバの起動に問題があれば、 「2.4.2 MySQL サーバー起動時の問題」節 を見てください。
  3. code{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 オプションで起動することにより得られます。
  4. Verify that you can shut down the server:
    shell> BINDIR/mysqladmin -u root shutdown
    
  5. サーバーをリスタートするには、safe_mysqldmysqld を直接実行します。 例えば:
    shell> BINDIR/safe_mysqld --log &
    
    safe_mysqld が失敗するなら、 MySQL のインストールディレクトリーから実行してみてください。 もしそれでも起動しないなら、 「2.4.2 MySQL サーバー起動時の問題」節 を参照のこと。
  6. いくつかの簡単なテストでサーバーが動いているか確認できます。 以下のようになります:
    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-tests
    
    RPM バイナリ配布には `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
    
    The expected results are shown in the `./tests/auto_increment.res' file.

2.4.1 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.6.1.3 バグや問題を報告する方法」節参照.
There is already a mysqld daemon running
この場合、 mysql_install_db を実行する必要はありません。 mysql_install_db を実行するのは MySQL を初めてインストールした後、 たった一回だけです。
Installing a second mysqld daemon doesn't work when one daemon is running
これはすでに MySQL がインストールされており、 しかし新しいインストールを違うところに行おうとした場合に発生します。 (例えば、一度に二つのインストールを実行した場合など) 一般にこの問題は二つ目のサーバーを動いているサーバーと同じポート、ソケットを使用して起動しようとした場合に発生します。 この場合、Can't start server: Bind on TCP/IP port: Address already in use エラーメッセージか Can't start server : Bind on unix socket... エラーメッセージが出ます。 「4.1.3 同じマシンに多くのサーバをインストールする」節参照.
You don't have write access to `/tmp'
もしソケットファイルを標準の場所(`/tmp')に作成するための書き込み許可がないなら、 あるいは、一時ファイルを `/tmp' に作成できないなら、 mysql_install_db の実行時、あるいは mysqld の起動/使用時に エラーとなるでしょう。 違うディレクトリーにソケットファイルや一時ファイルを指定するには:
shell> TMPDIR=/some_tmp_dir/
shell> MYSQL_UNIX_PORT=/some_tmp_dir/mysqld.sock
shell> export TMPDIR MYSQL_UNIX_PORT
See 「A.4.5 MySQL ソケットファイル `/tmp/mysql.sock' を変更する方法、削除から守る方法」節. `some_tmp_dir' は書き込みが可能なディレクトリーを指定しなくてはなりません。 「F Environment Variables」節参照. この後、mysql_install_db を走らせ、サーバーを起動する事ができます:
shell> scripts/mysql_install_db
shell> BINDIR/safe_mysqld &
mysqld crashes immediately
もし RedHat バージョン 5.0 上で 2.0.7-5 より古い glibc を使用している場合、 全ての glibc パッチを当てなくてはなりません! これに関しては MySQL メールのアーカイブに情報が多くあります。 http://lists.mysql.com/. 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-privilegesmysqladmin reload を実行します。

2.4.2 MySQL サーバー起動時の問題

トランザクションをサポートするテーブル(BDB, InnoDB)を使用しようとする場合、 最初に `my.cnf' ファイルを生成して、使用しようとするテーブル型の起動オプショ ンを設定すべきです。 「7 MySQL テーブル型」節参照.

通常 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 サーバーを走らせる」節.

もし mysqld がすでに走っている場合、以下のコマンドにてパスの設定を知ることができます:

shell> mysqladmin variables

または

shell> mysqladmin -h 'your-host-name' variables

If you get Errcode 13, which means Permission denied, when starting mysqld this means that you didn't have the right to read/create files in the MySQL database or log directory. In this case you should either start mysqld as the root user or change the permissions for the involved files and directories so that you have the right to use them.

もし safe_mysqld がサーバーを起動しても接続できないようなら、 `/etc/hosts' ファイルに以下のような記述を持たせてください:

127.0.0.1       localhost

この問題はスレッドライブラリーがなくて MySQL を MIT-pthreads を 使用するようにして作ったシステムにだけ起こります。

mysqld を起動できない場合、問題を見つけるためにトレースファイルの作 成を試みることができます。 「E.1.2 Creating Trace Files」節参照.

InnoDB テーブルを使用している場合、InnoDB 固有の起動オプションを参照してく ださい。 「7.5.2 InnoDB 起動オプション」節参照.

BDB (Berkeley DB) テーブルを使用する場合は、BDB 固有の起動オプションに精通 すべきです。 「7.6.3 BDB startup options」節参照.

2.4.3 MySQL の自動起動と自動停止

mysql.serversafe_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 を変えても構いません。 他のユーザーで実行したい場合、この節の後で示すように、適切な user 行を `/etc/my.cnf' ファイルに追加してください。

mysql.server stop はサーバーにシグナルを送ってサーバーを停止します。 You can also take down the server manually by executing mysqladmin shutdown.

You need to add these start and stop commands to the appropriate places in your `/etc/rc*' files when you want to start up MySQL automatically on your server.

On most current Linux distributions, it is sufficient to copy the file mysql.server into the `/etc/init.d' directory (or `/etc/rc.d/init.d' on older Red Hat systems). Afterwards, run the following command to enable the startup of MySQL on system bootup:

shell> chkconfig --add mysql.server

As an alternative to the above, some operating systems also use `/etc/rc.local' or `/etc/init.d/boot.local' to start additional services on bootup. To start up MySQL using this method, you could append something like the following to it:

/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' オプションファイル」節参照.

2.5 MySQL のアップグレード/ダウングレード

MySQL 形式とデータファイルは、MySQL が同じベースバージョ ンである限り、同じアーキテクチャ上の異なるバージョン間でいつでも移動でき ます。現在のベースバージョンは 3 です。MySQL の実行時に キャラクタ・セットが変更された場合(これはソート順も変更します)、全てのテーブル に myisamchk -r -q --set-character-set=charset を行なう必要があります。 そうしなければ、インデックスが正しい順になりません。

もしあなたが神経質だったり新しいバージョンを恐れている場合、いつでもあな たの古い mysqldmysqld-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 の アップグレード後にコアダンプする兆候に気づいた場合は、特に そうしてください。

2.5.1 Upgrading From Version 4.0 to Version 4.1

In general what you have to do when upgrading to 4.1 from an earlier MySQL version:

The following is a more complete lists tell what you have to watch out for when upgrading to version 4.1;

Note that the table definition format (.frm) has changed slightly in 4.1. MySQL 4.0.11 can read the new .frm format but older version can not. If you need to go move tables from 4.1 to and earlier MySQL version you should use mysqldump. 「4.8.5 mysqldump, データベースとテーブルから、構造とデータをダンプ」節参照.

2.5.2 バージョン 3.23 から バージョン 4.0 へのアップグレード

In general what you have to do when upgrading to 4.0 from an earlier MySQL version:

MySQL 4.0 will work even if you don't do the above, but you will not be able to use the new security privileges that MySQL 4.0 and you may run into problems when upgrading later to MySQL 4.1 or newer. The ISAM file format still works in MySQL 4.0 but it's deprecated and will be disabled in MySQL 5.0.

古いクライアントは、4.0 のサーバ と問題なく動作するはずです。

Even if you do the above, you can still downgrade to MySQL 3.23.52 or newer if you run into problems with the MySQL 4.0 series. In this case you have to do a mysqldump of any tables using a full-text index and restore these in 3.23 (because 4.0 uses a new format for full-text index).

次のリストは、バージョン 4.0 にアップグレードする際に気をつけなければなら ないことです;

2.5.3 バージョン 3.22 から バージョン 3.23 へのアップグレード

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 にアップグレードするときに、注目する必要があるものを列挙します:

2.5.4 バージョン 3.21 から バージョン 3.22 へのアップグレード

バージョン 3.21 と バージョン 3.22 の間には互換性に影響する変更はありません。

DATE 型のフィールドを持たせて作成した新しいテーブルは、 日付の格納に新しい方法を使用することだけが、唯一の落とし穴です。 これらの新しいフィールドに古いバージョンの mysqld からアクセスすることはできません。

MySQL バージョン 3.22 インストール後、新しいサーバを開始して、 mysql_fix_privilege_tables スクリプトを実行すべきです。これは GRANT コマンドを使用するために必要な権限を追加します。これを忘れ ると、ALTER TABLECREATE INDEXDROP 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_bufferkey_buffer_size に名前が 変わりました。しかし、まだ前の名前もスターとアップファイル中で使用できま す。

2.5.5 バージョン 3.20 から バージョン 3.21 へのアップグレード

既に バージョン 3.20.28 より前のバージョンが稼働していて、バージョン 3.21.x に変更したい場合は、 次を行なう必要があります:

safe_mysqld --old-protocolmysqld 3.21 サーバを起動すれ ば、バージョン 3.20 配布からのクライアントでそれを使用できます。この場合、新しいク ライアント関数 mysql_errno() はサーバのエラーは何も返さず、 CR_UNKNOWN_ERROR だけを返します (ただしクライアントのエラーについ ては働きます)。そして サーバは古い password() チェックを新しいものの代わ りに使用します。

mysqld--old-protocol オプションを使わない場合、 次の変更をする必要があります:

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 (userpassword 引数の順番が変更されました)。 「8.2.2 The DBI Interface」節参照.

次の変更は古いアプリケーションでのクエリに影響します:

2.5.6 他のアーキテクチャへのアップグレード

もし、MySQL バージョン 3.23 を使用しているならば、 違うアーキテクチャのマシンに、.frm, .MYI,.MYD ファイルを コピーすることが出来ます。 ただし、両者間で、同じ浮動小数点のフォーマットをサポートしている場合に限ります。 (MySQL はどのようなバイト交換にも気をつけます)。

現在 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

You can also store the result in a file, then transfer the file to the target machine and load the file into the database there. For example, you can dump a database to a file on the source machine like this:

shell> mysqldump --quick db_name | gzip > db_name.contents.gz

(The file created in this example is compressed.) データベースの中身を含んでいるファイルを、目的のマシンに転送して、次のコ マンドを実行してください:

shell> mysqladmin create db_name
shell> gunzip < db_name.contents.gz | mysql db_name

データベース転送を実行するために、mysqldumpmysqlimport も使用できます。大きなテーブルでは、これは単純な mysqldump の使用 よりもとても速いです。次に示すコマンドでは、DUMPDIRmysqldump からの出力を格納するために使用するディレクトリの完全な パス名を表わしています。

まず、出力ファイルのためのディレクトリを作成して、データベースをダンプし ます:

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 を実行してください。

2.6 Operating System Specific Notes

2.6.1 Linux Notes (All Linux Versions)

以下の注意は、glibc に関して、MySQL をあなた自身で作成す るシチュエーションだけに適用されます。Linux を x86 マシンで実行する場合、 多くの場合は我々のバイナリを使用した方が良いです。我々は glibc の 最良パッチバージョンと我々のバイナリをリンクします。我々は最良のコンパイラ オプションでそれを作成し、高負荷サーバについて適切になるように試みています。 以下のテキストを読んで、何をあなたがやるべきかについて迷った時は、あなたの 必要にかなうかどうかをみるために、我々のバイナリをまず試してください。そし て、我々のバイナリが十分でないとわかった後にだけ、あなた自身の作成について 考えてください。この場合、それについての評価します。そのため、次回にはより 良いバイナリを作成できます。典型的なユーザについて、そして、多くの同時接続 と 2G Bytes 制限を超えるテーブルを設定する場合でも、多くの場合、我々のバイナリ は最良の選択です。

Linux では MySQL は LinuxThreads を使用します。 もし glibc2 を持たない古い Linux を使用している場合、 MySQL のコンパイルの前に、 LinuxThreads をインストールしなければなりません。 LinuxThreads は http://www.mysql.com/downloads/os-linux.html. から得ることが できます。

注意: 我々は SMP システム上での Linux 2.2.14 と MySQL で奇妙な問 題を経験しました; SMP システムの場合、Linux 2.4 ASAP にアップグレードする ことをお勧めします! これを行なうことで、あなたのシステムはより速くより安 定するでしょう!

注意: 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/init.d/boot.local')に追加すべきです:

echo 65536 > /proc/sys/fs/file-max
echo 8192 > /proc/sys/fs/dquot-max
echo 1024 > /proc/sys/fs/super-max

上記は、root でコマンドラインからも実行できますが、この場合、コンピュータ をリブートすると古い制限が使われます。

You can also run the preceding commands from the command-line as root, but these settings will be lost the next time your computer reboots.

Alternatively, you can set these parameters on bootup by using the sysctl tool, which is used by many Linux distributions (SuSE has added it as well, beginning with SuSE Linux 8.0). Just put the following values into a file named `/etc/sysctl.conf':

# Increase some values for MySQL
fs.file-max = 65536
fs.dquot-max = 8192
fs.super-max = 1024

`/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 threads 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" behaviour 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" behaviour 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 2G 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.

We have tested MySQL on the 2.4 kernel on a 2-CPU machine and found MySQL scales much better@-there was virtually no slowdown on queries throughput all the way up to 1000 clients, and the 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 to correct this behaviour (http://www.mysql.com/Downloads/Linux/linuxthreads-2.1-patch).

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 behaviour with a patch, available at http://www.mysql.com/Downloads/Linux/linuxthreads-2.2.2.patch. 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 1000000safe_mysqld に追加するか --core-file-size=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

実行時には、以下のうちの一つの方法で問題を解決できます:

富士通コンパイラ (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

2.6.1.1 Linux Notes for Binary Distributions

MySQL は少なくとも Linux バージョン 2.0 を必要とします。

Warning: We have reports from some MySQL users that they have got serious stability problems with MySQL with Linux kernel 2.2.14. If you are using this kernel you should upgrade to 2.2.19 (or newer) or to a 2.4 kernel. If you have a multi-cpu box, then you should seriously consider using 2.4 as this will give you a significant speed boost.

バイナリリリースは -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

この問題は、以下のうちのどれかの方法で解決できます:

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 カーネ ルでこの問題が解決されることを希望します。

2.6.1.2 Linux x86 Notes

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 で動作します。

If you are using Red Hat 8.0 or a new glibc 2.2.x library you should start mysqld with the option --thread-stack=192K. If you don't do it mysqld will die in gethostbyaddr() because the new glibc library requires > 128K memory on stack for this call. This stack size is now the default on MySQL 4.0.10 and above.

If you are using gcc 3.0 and above to compile MySQL, you must install the libstdc++v3 library before compiling MySQL; if you don't do this you will get an error about a missing __cxa_pure_virtual symbol during linking!

古い 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

2.6.1.3 Linux SPARC Notes

いくつかの埋め込み関数, 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 かそれ以上にしなくてはなりません。

2.6.1.4 Linux Alpha Notes

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.

We currently build the MySQL binary packages on SuSE Linux 7.0 for AXP, kernel 2.4.4-SMP, Compaq C compiler (V6.2-505) and Compaq C++ compiler (V6.3-006) on a Compaq 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 until MySQL version 3.23.52 and 4.0.2 we optimised the binary for the current CPU only (by using the -fast compile option); this meant that you could only use our binaries if you had an Alpha EV6 processor.

Starting with all following releases we added the -arch generic flag to our compile options, which makes sure the binary runs on all Alpha processors. We also compile statically to avoid library problems.

CC=ccc CFLAGS="-fast -arch generic" CXX=cxx \
CXXFLAGS="-fast -arch generic -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:

2.6.1.5 Linux PowerPC Notes

MySQL は最新の glibc を使用した MkLinux で動作します。 (glibc 2.0.7 でテストしました).

2.6.1.6 Linux MIPS Notes

Qube2 (Linux Mips) 上で MySQL を動作させるには、 最新の glibc ライブラリでなくてはなりません (glibc-2.0.7-29C2 は動作することが分かっています)。 そして、 egcs C++ compiler (egcs-1.0.2-9, gcc 2.95.2 以上) を 使用しなくてはなりません。

2.6.1.7 Linux IA64 Notes

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」節参照.

2.6.2 Windows Notes

This section describes using MySQL on Windows. This information is also provided in the `README' file that comes with the MySQL Windows distribution. 「2.1.2 Windows への MySQL のインストール」節参照.

2.6.2.1 Starting MySQL on Windows 95, 98 or Me

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

This calls the MySQL administation utility as user `root', which is the default Administrator in the MySQL grant system. Please note that the MySQL grant system is wholly independent from any login users under Windows.

注意: Win95 と Win98 は名前付パイプをサポートしていません。Win95 と Win98 では、Windows NT サーバホスト上で動いているリモートの MySQL への接続だけに、名前付パイプを使用できます。 (The MySQL server must also support named pipes, of course. For example, using mysqld-opt under NT/2000/XP 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 が何故起動 しないかの理由が含まれます。 「E.1.2 Creating Trace Files」節参照.

Use mysqld --help to display all the options that mysqld understands!

2.6.2.2 Starting MySQL on Windows NT, 2000 or XP

NT 4 上で TCP/IP を用いて MySQL を動作させるには、service pack 3(以上) が必須です!

Normally you should install MySQL as a service on Windows NT/2000/XP. In case the server was already running, first stop it using the following command:

C:\mysql\bin> mysqladmin -u root shutdown

This calls the MySQL administation utility as user `root', which is the default Administrator in the MySQL grant system. Please note that the MySQL grant system is wholly independent from any login users under Windows.

Now install the server service:

C:\mysql\bin> mysqld-max-nt --install

If any options are required, they must be specified as ``Start parameters'' in the Windows Services utility before you start the MySQL service.

The Services utility (Windows Service Control Manager) can be found in the Windows Control Panel (under Administrative Tools on Windows 2000). It is advisable to close the Services utility while performing the --install or --remove operations, this prevents some odd errors.

For information about which server binary to run, see 「2.1.2.2 Preparing the Windows MySQL Environment」節.

Please note that from MySQL version 3.23.44, you have the choice of set up the service as Manual instead (if you don't wish the service to be started automatically during the boot process):

C:\mysql\bin> mysqld-max-nt --install-manual

サービスは MySQL という名前で登録されます。 一度インストールしたら、 これは Services (コントロールパネルにある) を使用するか、NET START MySQL コマンドを使用するかして、 起動されなくてはなりません。

Once running, mysqld-max-nt can be stopped using mysqladmin, from the Services utility, or by using the command NET STOP MySQL.

When running as a service, the operating system will automatically stop the MySQL service on computer shutdown. In MySQL versions < 3.23.47, Windows only waited for a few seconds for the shutdown to complete, and killed the database server process if the time limit was exceeded (potentially causing problems). For instance, at the next startup the InnoDB storage engine had to do crash recovery. Starting from MySQL version 3.23.48, the Windows will wait longer for the MySQL server shutdown to complete. If you notice this is not enough for your intallation, it is safest to run the MySQL server not as a service, but from the Command prompt, and shut it down with mysqladmin shutdown.

There is a problem that Windows NT (but not Windows 2000/XP) by default only waits 20 seconds for a service to shut down, and after that kills the service process. You can increase this default by opening the Registry Editor `\winnt\system32\regedt32.exe' and editing the value of WaitToKillServiceTimeout at `HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control' in the Registry tree. Specify the new larger value in milliseconds, for example 120000 to have Windows NT wait upto 120 seconds.

Please note that when run as a service, mysqld-max-nt has no access to a console and so no messages can be seen. Errors can be checked in `c:\mysql\data\mysql.err'.

もし mysqld-max-nt をサービスとしてインストールする場合に 問題が発生した場合、フルパスで実行してみてください:

C:\> C:\mysql\bin\mysqld-max-nt --install

If this doesn't work, you can get mysqld-max-nt to start properly by fixing the path in the registry!

サービスとして mysqld-max-nt を起動したくないなら以下のようにします:

C:\> C:\mysql\bin\mysqld-max-nt --standalone

or

C:\> C:\mysql\bin\mysqld --standalone --debug

最新のバージョンでは、デバッグのトレースを `C:\mysqld.trace' に出します。 「E.1.2 Creating Trace Files」節参照.

2.6.2.3 Windows 上で MySQL を実行

MySQL supports TCP/IP on all Windows platforms and named pipes on NT/2000/XP. The default is to use named pipes for local connections on NT/2000/XP and TCP/IP for all other cases if the client has TCP/IP installed. The host name specifies which protocol is used:

Host name Protocol
NULL (none) On NT/2000/XP, try named pipes first; if that doesn't work, use TCP/IP. On 9x/Me, TCP/IP is used.
. Named pipes
localhost TCP/IP to current host
hostname TCP/IP

MySQL クライアントに named pipes を強制的に使用させるには、 --pipe オプションか、ホストに . を指定します。 そして、--socket オプションでパイプの名前を指定します。 In MySQL 4.1 you should use the --protocol=PIPE option.

Note that starting from 3.23.50, named pipes are only enabled if mysqld is started with --enable-named-pipe. This is because some users have experienced problems shutting down the MySQL server when one uses named pipes.

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

If mysqld is slow to answer to connections on Windows 9x/Me, there is probably a problem with your DNS. In this case, start mysqld with --skip-name-resolve and use only localhost and IP numbers in the MySQL grant tables. You can also avoid DNS when connecting to a mysqld-nt MySQL server running on NT/2000/XP by using the --pipe argument to specify use of named pipes. This works for most MySQL clients.

2つの MySQL コマンドラインツールがあります:
Binary Description
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 ユーザーにもパスワードを設定すべきです。次の例では、 すべての権限を持つ匿名ユーザを削除したあとに、 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 password'。回避策は、現在の MySQL バージョンにアップグレードすることです。これもフリーです。

現在の MySQL バージョンでは、GRANTREVOKE コ マンドで、簡単に新しいユーザを追加でき、権限を変更することができます。 「4.3.1 GRANTREVOKE 構文」節参照.

2.6.2.4 SSH を利用してリモートの MySQL に Windows から接続

以下は SSH を用いてリモートの MySQL サーバに安全に接続するための 方法について述べたものです。 (by David Carlson dcarlson@mplcomm.com):

You should now have an ODBC connection to MySQL, encrypted using SSH.

2.6.2.5 Windows 上で、異なるディスクにデータを分割する

Windows 上では、3.23.16 以上のバージョンの MySQL ディストリビュー ション中の mysqld-maxmysql-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.

2.6.2.6 Windows 上で MySQL クライアントをコンパイルする

ソースファイル中で `mysql.h' をインクルードする前に `windows.h' を インクルードするべきです:

#if defined(_WIN32) || defined(_WIN64)
#include <windows.h>
#endif
#include <mysql.h>

あなたのコードを、必要に応じて `libmysql.dll' 中でロードするための ラッパーである `libmysql.lib' ライブラリに動的にリンクすることも できますし、また `mysqlclient.lib' ライブラリを静的にリンクすることも できます。

mysqlclient ライブラリはスレッド対応ライブラリとしてコンパイル されていますので、あなたのコードもマルチスレッド対応になるように コンパイルするべきことに注意してください。

2.6.2.7 Windows 用 MySQL と Unix 用 MySQL の比較

MySQL-Windows バージョンは現在それ自体とても安定した(stableな)状態で供給されています。 MySQL-win32 バージョンは すべての機能が UNIX バージョンの MySQL と対応しています。 ただし、下記のような例外があります。

Win95 とスレッド
Win95は、各々のスレッドの作成のためにメインメモリのおよそ200バイトをメモリリーク します。もしあなたが多くの接続をすれば、MySQL の各々の接続が新しい スレッドを作成するので、あなたはWin95では長時間、mysqld を実行させるべきではあり ません! WindowsNT と Windows98 はこのバグを持ちません。
並行読み出し
MySQL は INSERTSELECT を混ぜることを可能にするために pread() 及び pwrite() 関数コールに依存します。現時点では pread()/pwrite() をエミュレートするために Mutex を用いています。長期的な計画では、 ファイルレベルのインターフェースを仮想インターフェースで置き換えて いくつもりなので、さらに速度を上げるために Windows NT/2000/XP 上で readfile()/writefile() インターフェースを使うことができます。 現在の実装は、しかし MySQL が利用可能なファイル数の上限が 1024 に なっています。これは Unix では可能な数の並行スレッドを NT/2000/XP 上では 動作させることができないことを意味しています。
ブロック読み込み
MySQL はそれぞれの接続のためにブロック読み込みを使います。 これは以下の事柄を意味しています: We plan to fix this problem when our Windows developers have figured out a nice workaround.
DROP DATABASE
複数のスレッドで使われているデータベースはDROPをすることができません。
タスクマネージャーからの MySQL の終了
Windows95では「Windowsの終了」やタスクマネージャから MySQL を終了することはできません。 mysqladmin shutdown で終了しなければなりません。
大文字小文字を区別しない名前
Windowsではファイルネームは大文字小文字が区別されません。 そのため、Windows用の MySQL では、テーブル名は大文字小文字が区別されません。 唯一の制限は、ステートメント(SQL文)中においては、データベースとテーブルの名前は 同じケース(大文字小文字)を使用して指定されなければならないという点です。 「6.1.3 名前のケース依存性」節参照.
The `\' directory character
Windows 95のパス名コンポーネントは、 `\' によって離されますが、その文字は同じく MySQL のエスケープ文字でもあります。もしあなたが 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 エラー
もしあなたが NT 上で最新の mysql-clients と MySQL 3.22 バージョン を使えば、あなたは、次のエラーを得ることになるはずです:
error 2017: can't open named pipe to host: . pipe...
これは、MySQL のリリースバージョンがデフォルトで NT の 名前つきパイプを 使っているために起こっています。 新しい MySQL クライアントで --host=localhost オプションを用いるか、 以下の情報を含むオプションファイル `C:\my.cnf' を作成することで、このエラーを 回避することができます。
[client]
host = localhost
Starting from 3.23.50, named pipes are only enabled if mysqld is started with --enable-named-pipe.
Access denied for user error
もしあなたが同じマシン上の MySQL サーバーにアクセスした時 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 が他のスレッドによって使用中のファイルを削除 できないという事実のためにしなければならないことです(私たちはこの 問題を回避するための方法を将来見出すかもしれません)。
DROP TABLE on a table that is in use by a MERGE table will not work on Windows because the MERGE handler does the table mapping hidden from the upper layer of MySQL. Because Windows doesn't allow you to drop files that are open, you first must flush all MERGE tables (with FLUSH TABLES) or drop the MERGE table before dropping the table. We will fix this at the same time we introduce VIEWs.
DATA DIRECTORY and INDEX DIRECTORY directives in CREATE TABLE is ignored on Windows, because Windows doesn't support symbolic links.

Here are some open issues for anyone who might want to help us with the Windows release:

他の Windows 特有の事柄は MySQL-Windows ディストリビューションに同梱されている `README' ファイルで説明されています。

2.6.3 Solaris Notes

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/os-solaris.html.

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

If you have an UltraSPARC, you can get 4% more performance by adding "-mcpu=v8 -Wa,-xarch=v8plusa" to CFLAGS and CXXFLAGS.

If you have Sun's Forte 5.0 (or newer) compiler, you can run configure like this:

CC=cc CFLAGS="-Xa -fast -native -xstrconst -mt" \
CXX=CC CXXFLAGS="-noex -mt" \
./configure --prefix=/usr/local/mysql --enable-assembler

You can create a 64 bit binary with:

CC=cc CFLAGS="-Xa -fast -native -xstrconst -mt -xarch=v9" \
CXX=CC CXXFLAGS="-noex -mt -xarch=v9" ASFLAGS="-xarch=v9" \
./configure --prefix=/usr/local/mysql --enable-assembler

In the MySQL benchmarks, we got a 4% speedup on an UltraSPARC when using Forte 5.0 in 32 bit mode compared to using gcc 3.2 with -mcpu flags.

If you create a 64 bit binary, it's 4 % slower than the 32 bit binary, but mysqld can instead handle more treads and memory.

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

-mtCFLAGSCXXFLAGS に加えます。

If you are using the SFW version of gcc (which comes with Solaris 8), you must add `/opt/sfw/lib' to the environment variable LD_LIBRARY_PATH before running configure.

If you are using the gcc available from sunfreeware.com, you may have many problems. You should recompile gcc and GNU binutils on the machine you will be running them from to avoid any problems.

If you get the following error when compiling MySQL with gcc, it means that your gcc is not configured for your version of 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'

The proper thing to do in this case is to get the newest version of gcc and compile it with your current gcc compiler! At least for Solaris 2.5, almost all binary versions of gcc have old, unusable include files that will break all programs that use threads (and possibly other programs)!

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 オプションで起動すれば、この問題に対処できるでしょう。 Please note that --set-variable is deprecated since MySQL 4.0, just use --back_log=50 on its own. 「4.1.1 mysqld コマンド行オプション」節参照.

もし自分の MySQL クライアントプログラムをリンクして 実行時に以下のようにエラーが出た場合:

ld.so.1: ./my: fatal: libmysqlclient.so.#:
open failed: No such file or directory

これは以下のどれかで回避できます:

configure や MySQL が -lz のリンクを試み、あなたがそれを インストールしていないという問題がある場合は、2つの選択肢があります:

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 という名前でシンボリックリンクを生成し てください。

As Solaris doesn't support core files for setuid() applications, you can't get a core file from mysqld if you are using the --user option.

2.6.3.1 Solaris 2.7/2.8 Notes

通常、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 `;'

これを解決するには、以下のうち一つを行います:

クライアントプログラムのリンク時に、リンカが -lz を見つけられない という問題が発生した場合、問題はおそらく `libz.so' ファイルが `/usr/local/lib' にインストールされたことです。次の方法の一つでこれ を修正できます:

2.6.3.2 Solaris x86 Notes

On Solaris 2.8 on x86, mysqld will core dump if you run 'strip' in. (訳注: GNU binutils を Sun 上で使用すると、CPU, version にかかわらず、 この現象に遭遇します。その場合は、/usr/ccs/bin/ の方を使います。)

gccegcs を 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 を使用して起動してください. 「E.1.3 Debugging mysqld under gdb」節参照.

2.6.4 BSD Notes

This section provides information for the various BSD flavours, as well as specific versions within those.

2.6.4.1 FreeBSD Notes

FreeBSD 3.x is recommended for running MySQL since the thread package is much more integrated.

The easiest and therefore 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

The recommended way to compile and install MySQL on FreeBSD with gcc (2.95.2 and up) is:

CC=gcc CFLAGS="-O2 -fno-strength-reduce" \
CXX=gcc CXXFLAGS="-O2 -fno-rtti -fno-exceptions -felide-constructors \
-fno-strength-reduce" \
./configure --prefix=/usr/local/mysql --enable-assembler
gmake
gmake install
./scripts/mysql_install_db
cd /usr/local/mysql
./bin/mysqld_safe &

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 have a lot of memory you should consider rebuilding the kernel to allow MySQL to take more than 512M of RAM. Take a look at option MAXDSIZ in the LINT config file for more info.

If you get problems with the current date in MySQL, setting the TZ variable will probably help. 「F Environment Variables」節参照.

To get a secure and stable system you should only use FreeBSD kernels that are marked -RELEASE.

2.6.4.2 NetBSD notes

To compile on NetBSD you need GNU make. Otherwise, the compile will crash when make tries to run lint on C++ files.

2.6.4.3 OpenBSD 2.5 Notes

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

2.6.4.4 OpenBSD 2.8 Notes

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 an error like Error in accept:: Bad file descriptor or error 9 when trying to open tables or directories, the problem is probably that you haven't allocated enough file descriptors for MySQL.

In this case try starting safe_mysqld as root with the following options:

--user=mysql --open-files-limit=2048

2.6.4.5 BSD/OS Version 2.x Notes

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. 「F Environment Variables」節参照.

2.6.4.6 BSD/OS Version 3.x Notes

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.

2.6.4.7 BSD/OS Version 4.x Notes

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 okay).

2.6.5 Mac OS X Notes

2.6.5.1 Mac OS X 10.x

MySQL should work without any problems on Mac OS X 10.x (Darwin). You don't need the pthread patches for this OS!

This also applies to Mac OS X 10.x Server. Compiling for the Server platform is the same as for the client version of Mac OS X. However please note that MySQL comes preinstalled on the Server!

2.1.3 Installing MySQL on Mac OS X」節参照.

2.6.5.2 Mac OS X Server 1.2 (Rhapsody)

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 Darwin 6.3 with the following configure line:

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-extra-charsets=complex --enable-thread-safe-client \
--enable-local-infile --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'

Alternatively, you could simply add /usr/local/mysql/bin to your PATH environment variable, e.g. by adding the following to `$HOME/.tcshrc':

setenv PATH $PATH:/usr/local/bin

2.6.6 Other Unix Notes

2.6.6.1 HP-UX Notes for Binary Distributions

Some of the binary distributions of MySQL for HP-UX are 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 here, where /path/to/depot is the full pathname of the depot file:

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.

2.6.6.2 HP-UX Version 10.20 Notes

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 optimisation flags (like -O6) as this may not be safe on HP-UX.

The following configure line should work with gcc 2.95:

CFLAGS="-I/opt/dce/include -fpic" \
CXXFLAGS="-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

The following configure line should work with gcc 3.1:

CFLAGS="-DHPUX -I/opt/dce/include -O3 -fPIC" CXX=gcc \
CXXFLAGS="-DHPUX -I/opt/dce/include -felide-constructors -fno-exceptions \
-fno-rtti -O3 -fPIC" ./configure --prefix=/usr/local/mysql \
--with-extra-charsets=complex --enable-thread-safe-client \
--enable-local-infile  --with-pthread \
--with-named-thread-libs=-ldce --with-lib-ccflags=-fPIC
--disable-shared

2.6.6.3 HP-UX Version 11.x Notes

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 the problem of getting 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

If you are using MySQL 4.0.5 with the HP-UX compiler you can use: (tested with cc B.11.11.04):

CC=cc CXX=aCC CFLAGS=+DD64 CXXFLAGS=+DD64 ./configure --with-extra-character-set=complex

You can ignore any errors of the following type:

aCC: warning 901: unknown option: `-3': use +help for online documentation

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.

Another reason for not beeing able to compile is that you didn't define the +DD64 flags above.

2.6.6.4 IBM-AIX notes

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 LDFLAGS="-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://publib.boulder.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

If you need to allocate a lot of memory to the mysqld process, it's not enough to just set 'ulimit -d unlimited'. You may also have to set in mysqld_safe something like:

export LDR_CNTRL='MAXDATA=0x80000000'

You can find more about using a lot of memory at: http://publib16.boulder.ibm.com/pseries/en_US/aixprggd/genprogc/lrg_prg_support.htm.

2.6.6.5 SunOS 4 Notes

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.

2.6.6.6 Alpha-DEC-UNIX Notes (Tru64)

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 \
-noexceptions -nortti"
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

2.6.6.7 Alpha-DEC-OSF/1 Notes

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 OSF/1 V4.0D and compiler "DEC C V5.6-071 on Digital Unix V4.0 (Rev. 878)" the compiler had some strange behaviour (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 OSF/1, 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.

2.6.6.8 SGI Irix Notes

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-innodb --with-berkeley-db \
--with-libwrap=/usr/local \
--with-named-curses-libs=/usr/local/lib/libncurses.a

2.6.6.9 Caldera (SCO) Notes

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)
  1. For OpenServer 5.0.X you need to use gcc-2.95.2p1 or newer from the Skunkware. http://www.caldera.com/skunkware/ and choose browser OpenServer packages or by ftp to ftp2.caldera.com in the pub/skunkware/osr5/devtools/gcc directory.
  2. You need the port of GCC 2.5.x for this product and the Development system. They are required on this version of Caldera (SCO) Unix. You cannot just use the GCC Dev system.
  3. You should get the FSU Pthreads package and install it first. This can be found at http://www.cs.wustl.edu/~schmidt/ACE_wrappers/FSU-threads.tar.gz. You can also get a precompiled package from http://www.mysql.com/Downloads/SCO/FSU-threads-3.5c.tar.gz.
  4. FSU Pthreads can be compiled with Caldera (SCO) Unix 4.2 with tcpip. Or OpenServer 3.0 or Open Desktop 3.0 (OS 3.0 ODT 3.0), with the Caldera (SCO) Development System installed using a good port of GCC 2.5.x ODT or OS 3.0 you will need a good port of GCC 2.5.x There are a lot of problems without a good port. The port for this product requires the SCO Unix Development system. Without it, you are missing the libraries and the linker that is needed.
  5. To build FSU Pthreads on your system, do the following:
    1. Run ./configure in the `threads/src' directory and select the SCO OpenServer option. This command copies `Makefile.SCO5' to `Makefile'.
    2. Run make.
    3. To install in the default `/usr/include' directory, login as root, then cd to the `thread/src' directory, and run make install.
  6. Remember to use GNU make when making MySQL.
  7. If you don't start 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.
  8. With SCO 3.2V5.0.5, you should use FSU Pthreads version 3.5c or newer. You should also use gcc 2.95.2 or newer! The following configure command should work:
    shell> ./configure --prefix=/usr/local/mysql --disable-shared
    
  9. With SCO 3.2V4.2, you should use FSU Pthreads version 3.5c or newer. The following 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.

Caldera (SCO) development notes:

If you want to install DBI on Caldera (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.

2.6.6.10 Caldera (SCO) Unixware Version 7.0 Notes

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.

Caldera provides libsocket.so.2 at ftp://stage.caldera.com/pub/security/tools for pre-OSR506 security fixes. Also, the telnetd fix at ftp://stage.caldera.com/pub/security/openserver/CSSA-2001-SCO.10/ as both libsocket.so.2 and libresolv.so.1 with instructions for installing on pre-OSR506 systems.

It's probably a good idea to install the above patches before trying to compile/use MySQL.

2.6.7 OS/2 Notes

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";

2.6.8 BeOS Notes

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.

2.6.9 Novell NetWare Notes

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.

2.7 Perl Installation Comments

2.7.1 Installing Perl on Unix

MySQLのPerlでの使用に関するサポートは DBI/DBDクライアントインターフェスの提供で行なわれます。 「8.2 MySQL Perl API」節参照. DBI/DBDはPerl5.004かそれ以上のバージョンが必要になります。 古いバージョンのPerlでは動きません

MySQL の Perl support にはここまでで既にインストールが済んでいる筈の MySQL のクライアントプログラミングサポートが必要となります。 もしも RPM ファイルからインストールをされているのならば クライアントプログラムはクライアントRPMにあるものの、 クライアントプログラミングサポートはデベロッパー RPM にあります。 まずデベロッパー RPM をインストールされたがどうかお確かめ下さい。

バージョン3.22.8からは Perl support がメインの MySQL 配布ファイルとは別になっています。 もし Perl support が必要であれば http://www.mysql.com/downloads/api-dbi.html. からお取りください。

Perl関係プログラムのの配布はtar形式圧縮ファイルとして行われており、 ファイル名が `MODULE-VERSION.tar.gz' の形式になっています。 ここで、MODULEはモジュール名称、VERSIONはバージョン番号を表しています。 Data-DumperDBI、及び、Msql-Mysql-modulesを入手してインストールしてください。 インストール手順は以下に示す通りです。なお、ここではData-Dumperのみの手順が示されていますが、 他のモジュールについても同様な手順でインストールできます。

  1. 以下のようにして作業ディレクトリで配布ファイルを伸長・展開してください。
    shell> gunzip < Data-Dumper-VERSION.tar.gz | tar xvf -
    
    This command creates a directory named `Data-Dumper-VERSION'.
  2. 展開先のトップディレクトリーに移動します。
    shell> cd Data-Dumper-VERSION
    
  3. コンパイル&ビルドを行います。
    shell> perl Makefile.PL
    shell> make
    shell> make test
    shell> make install
    

出来上がったモジュールの動作を確認するためにmake testのコマンドは重要になってきます。 このコマンドをMsql-Mysql-modulesをインストールしている時に使ってみてください。 MySQLサーバが動いていなければ失敗することになります。

MySQLをバージョンアップした際に DBI が core ダンプした場合は 必ず Msql-Mysql-modules を再コンパイルしてインストールしなおしてください。 そうでなくても MySQL のバージョンを変更した場合は再コンパイルしたほうが賢明です。

貴方のユーザ権限ではPerlのモジュールをインストールできない場合でも 以下の例のようにしてローカルディレクトリにモジュールをインストールできます。

http://www.iserver.com/support/contrib/perl5/modules.html

Installing New Modules that Require Locally Installed Modules. という見出しの文書をご覧下さい。

2.7.2 Installing ActiveState Perl on Windows

DBDモジュールとActiveState Perlをインストールするには以下の手順で行います。

以上でActiveState Perlのバージョン5.6がとりあえず動くことになります。

もしも動作しない場合は次のように MyODBC ドライバーをインストールして ODBC経由でMySQLサーバに接続する必要があります。

use DBI;
$dbh= DBI->connect("DBI:ODBC:$dsn","$user","$password") ||
  die "Got error $DBI::errstr when connecting to $dsn\n";

2.7.3 Installing the MySQL Perl Distribution on Windows

MySQL Perlの配布パッケージにはDBIDBD:MySQL、そして、DBD:ODBCが含まれています。

2.7.4 Problems Using the Perl DBI/DBD Interface

Perl が "`../mysql/mysql.so'を見つけられない" というメッセージを出した場合、 それは多分 Perl のシェアードライブラリ `libmysqlclient.so' を見つけることが出来ないのでしょう。

これは以下のような方法で解決できます。

DBD-mysql が次のようなエラーを発生する場合があります。 この原因の一つは gcc(又はgccでコンパイルされた古いバイナリ配布パッケージ)をお使いのケースです。

/usr/bin/perl: can't resolve symbol '__moddi3'
/usr/bin/perl: can't resolve symbol '__divdi3'

`mysql.so' ライブラリをビルドする時に -L/usr/lib/gcc-lib/... -lgcc を リンクコマンドに追加してください(makeコマンド実行時の出力をチェックすれば確認できます。)。 オプション-Lで指定されるのはlibgcc.aのあるディレクトリになります。

もう一つの原因はPerlとMySQLのどちからがgccでコンパイルされており、どちらかがそうでない場合です。 この場合はどちらもgccでコンパイルし、この不一致を解消すれば解決します。

Msql-Mysql-modulesがテストで次のようなエラーを出した時、

t/00base............install_driver(mysql) failed:
Can't load '../blib/arch/auto/DBD/mysql/mysql.so' for module DBD::mysql:
../blib/arch/auto/DBD/mysql/mysql.so: undefined symbol:
uncompress at /usr/lib/perl5/5.00503/i586-linux/DynaLoader.pm line 169.

これは、ファイル圧縮用ライブラリ -lz へのパスを追加すれば解決いたします。 `lib/DBD/mysql/Install.pm' に以下のような変更を行ってください。

$sysliblist .= " -lm";

to

$sysliblist .= " -lm -lz";

After this, you must run 'make realclean' and then proceed with the installation from the beginning.

このあと'make realclean'を実行し、最初からインストールをやり直す必要があります。

Caldera (SCO) のようなダイナミックリンクが使用できないシステムで Perl モジュールを使用する際は DBIDBD-mysqlをスタティックリンクしたバージョンのPerlを作成する必要があります。 DBDをスタティックにリンクするには、Perlのインストールディレクトリに DBIのプログラムを置きDBDをリンクし、インストールします。

Caldera (SCO) では以下のような環境変数をセットする必要があります。

shell> LD_LIBRARY_PATH=/lib:/usr/lib:/usr/local/lib:/usr/progressive/lib
or
shell> LD_LIBRARY_PATH=/usr/lib:/lib:/usr/local/lib:/usr/ccs/lib:\
/usr/progressive/lib:/usr/skunk/lib
shell> LIBPATH=/usr/lib:/lib:/usr/local/lib:/usr/ccs/lib:\
/usr/progressive/lib:/usr/skunk/lib
shell> MANPATH=scohelp:/usr/man:/usr/local1/man:/usr/local/man:\
/usr/skunk/man:

DBI をスタティックにリンクしたPerlを作成するためには、 先ず以下のコマンドを DBI がインストールされているディレクトリで実行してください。

shell> perl Makefile.PL -static -config
shell> make
shell> make install
shell> make perl

次に新しいPerlをインストールします。 通常 make perl でインストールに必要なファイル類を作成しますが、 Caldera (SCO)の場合は make -f Makefile.aperl inst_perl MAP_TARGET=perl のように行う必要があります。

次に、ここで作成された Perl で目的の DBD::mysql をスタティックにリンクされた Perl を作成するために使います。 Msql-Mysql-modules がインストールされたディレクトリで以下のようなコマンドを実行してください。

shell> perl Makefile.PL -static -config
shell> make
shell> make install
shell> make perl

最後に、この新しいPerlプログラムをインストールしてください。 make perlで必要なコマンドを再確認することができます。


Go to the first, previous, next, last section, table of contents.