\input texinfo  @c -*-texinfo-*-
@c Copyright 1997, 1998, 1999, 2000 TcX AB, Detron HB and MySQL Finland AB
@c
@c *********************************************************
@c Note that @node names are used on our Website.
@c So do not change node names without checking
@c Makefile.am and SitePages first.
@c *********************************************************
@c
@c %**start of header
@setfilename mysql.info
@c We want the types in the same index
@syncodeindex tp fn
@c Get version info. This file is generated by the Makefile!!
@include include.texi
@ifclear tex-debug
@c This removes the black squares in the right margin
@finalout
@end ifclear
@c Set background for HTML
@set _body_tags BGCOLOR=#FFFFFF TEXT=#000000 LINK=#101090 VLINK=#7030B0
@c @set _body_tags BGCOLOR=silver TEXT=#000000 LINK=#101090 VLINK=#7030B0
@c Set some style elements for the manual in HTML form. 'suggested'
@c natural language colours: aqua, black, blue, fuchsia, gray, green,
@c lime, maroon, navy, olive, purple, red, silver, teal, white, and
@c yellow. From Steeve Buehler <ahr@YogElements.com>
@set _extra_head <style> code {color:purple} tt {color:green} samp {color:navy} pre {color:maroon} </style>
@settitle @strong{MySQL} Reference Manual for version @value{mysql_version}.
@c We want single-sided heading format, with chapters on new pages. To
@c get double-sided format change 'on' below to 'odd'
@setchapternewpage on
@paragraphindent 0
@c %**end of header

@ifinfo
@format
START-INFO-DIR-ENTRY
* mysql: (mysql).               @strong{MySQL} documentation.
END-INFO-DIR-ENTRY
@end format
@end ifinfo

@titlepage
@sp 10
@center @titlefont{@strong{MySQL} Reference Manual}
@sp 10
@center Copyright @copyright{} 1997, 1998, 1999, 2000 TcX AB, Detron HB and MySQL Finland AB
@end titlepage

@c This should be added. The HTML conversion also needs a MySQL version
@c number somewhere.

@iftex
@c change this to double if you want formatting for double-sided
@c printing
@headings single
@everyheading @thispage @| @| @thischapter
@everyfooting @| @| Version: @value{mysql_version} Printed: @today{}
@end iftex

@node Top, Introduction, (dir), (dir)

@c @ifhtml
@c <IMG SRC="Images/mysql-logo.gif">
@c <!--Image doesn't exist. Can't find suitable replacement. (Matt) -->
@c @end ifhtml

@ifinfo
This is a manual for @strong{MySQL}. This version is about the
@value{mysql_version} version of @strong{MySQL}. For a @strong{3.20}
version see the relevant distribution.
@end ifinfo

@menu
* Introduction::                General Information about @strong{MySQL}
* Questions::                   @strong{MySQL} mailing lists and how to ask questions or report errors (bugs)
* Licensing and Support::       @strong{MySQL} licensing and support
* Installing::                  Installing @strong{MySQL}
* Compatibility::               How standards-compatible is @strong{MySQL}?
* Privilege system::            The @strong{MySQL} access privilege system
* Reference::                   @strong{MySQL} language reference
* Table types::                 @strong{MySQL} table types
* Tutorial::                    @strong{MySQL} Tutorial
* Server::                      @strong{MySQL} Server
* Replication::                 Replication
* Performance::                 Getting maximum performance from @strong{MySQL}
* MySQL Benchmarks::            The @strong{MySQL} benchmark suite
* Tools::                       @strong{MySQL} Utilities
* Maintenance::                 Maintaining a @strong{MySQL} installation
* Adding functions::            Adding new functions to @strong{MySQL}
* Adding procedures::           Adding new procedures to @strong{MySQL}
* ODBC::                        @strong{MySQL} ODBC Support
* Common programs::             Using @strong{MySQL} with some common programs
* Problems::                    Problems
* Common problems::             Solving some common problems with @strong{MySQL}
* Clients::                     @strong{MySQL} client tools and APIs
* Comparisons::                 How does @strong{MySQL} compare with other databases?
* MySQL internals::             @strong{MySQL} internals
* Environment variables::       @strong{MySQL} environment variables
* Users::                       Some @strong{MySQL} users
* Contrib::                     Contributed programs
* Credits::                     Contributors to @strong{MySQL}
* News::                        @strong{MySQL} change history
* Bugs::                        Known errors and design deficiencies in @strong{MySQL}
* TODO::                        List of things we want to add to @strong{MySQL} in the future (The TODO)
* Porting::                     Comments on porting to other systems
* Regexp::                      Description of @strong{MySQL} regular expression syntax
* Unireg::                      What is Unireg?
* Public license::              The @strong{MySQL} server license
* Win license::                 The @strong{MySQL} license for Microsoft operating systems
* Function Index::              SQL command, type and function index
* Concept Index::               Concept Index

@end menu

@cindex Overview
@cindex General Information
@node Introduction, Questions, Top, Top
@chapter @strong{MySQL} �ˤĤ��Ƥΰ��̾���

@menu
* What-is::                     @strong{MySQL} �Ȥϲ�����
* Manual-info::                 ���Υޥ˥奢��ˤĤ���
* History::                     @strong{MySQL} �����
* MySQL-Books::                 Books about MySQL
* Features::                    @strong{MySQL}�μ�ʵ�ǽ
* Stability::                   @strong{MySQL} �Ϥɤ줯�餤���꤫��
* Year 2000 compliance::        2000 ǯ�б�
* General-SQL::                 ����Ū�� SQL ����ȥ��塼�ȥꥢ��
* Useful Links::                ������ @strong{MySQL} ��Ϣ���
@end menu

����� @strong{MySQL} �Υ�ե���󥹥ޥ˥奢��Ǥ�; ����� 
@strong{MySQL} �С������ @value{mysql_version} �ˤĤ��Ƶ��Ҥ��Ƥ��ޤ���

@strong{MySQL} ��ȯŸ��ʤΤǡ��ޥ˥奢������ˤ˹�������ޤ������Τ��ᡢ
����饤��ǻ��Ȥ��ʤ��¤ꡢ���ΥС�����󤬴����ڤ�Ǥ����ǽ��������ޤ���
���Υޥ˥奢��κǿ��С������� @uref{http://www.mysql.com/doc.html} ��¿
�ͤʷ������֤��Ƥ���ޤ����ޥ˥奢����ξ���򸫤Ĥ���Ĥ餤���֤���Ĥʤ顢
������ǽ PHP �С������ @uref{http://www.mysql.com/php/manual.php3} ��
���Ȥ���ǽ�Ǥ���

@strong{MySQL} �ϤȤƤ��®�ǡ��ޥ������åɡ��ޥ���桼�������� SQL 
(Structured Query Language)�ǡ����١��������ФǤ���

Unix �� OS/2 �ץ�åȥե�����Ǥ� @strong{MySQL} �ϴ���Ū��̵���Ǥ��ꡢMicrosoft
�ץ�åȥե�����Ǥϡ�30���λ��Ѵ��֤�᤮�ƻ��Ѥ������ @strong{MySQL} �饤���󥹤�
���ʤ���Фʤ�ޤ���. @xref{Licensing and Support}.

@uref{http://www.mysql.com/, @strong{MySQL} �ۡ���ڡ���}�� @strong{MySQL} 
�ˤĤ��Ƥκǿ�������󶡤��Ƥ��ޤ���

���Υꥹ�Ȥϥޥ˥奢��Τ����Ĥ���ͭ�Ѥʥ����������������Ƥ��ޤ�:

@itemize @bullet
@item
@strong{MySQL} ��ǽ�Ϥ������ˤĤ��Ƥϡ�@ref{Features} �򻲾Ȥ��Ƥ���������

@item
���󥹥ȡ�����ˡ�ˤĤ��Ƥ� @ref{Installing} �򻲾Ȥ��Ƥ���������
@strong{MySQL} �򿷤����ޥ���� OS �˰ܹԤ��뤿��Υҥ�ȤˤĤ��Ƥ� 
@ref{Porting} �򻲾Ȥ��Ƥ���������

@item
3.21 ��꡼������Υ��åץ��졼�ɤˤĤ��Ƥξ���ϡ�
@ref{Upgrading-from-3.21} �򻲾Ȥ��Ƥ���������

@item
@strong{MySQL} Ƴ���Υ��塼�ȥꥢ��ˤĤ��Ƥϡ�@ref{Tutorial} �򻲾Ȥ��Ƥ���������

@item
SQL ����ȥ٥���ޡ�������ˤĤ��Ƥϥ٥���ޡ����󥰤Υǥ��쥯�ȥ�򻲾�
���Ƥ���������(@file{sql-bench} �ǥ��쥯�ȥ�Ǥ�)

@item
��������ǽ�ȥХ�����������ˤĤ��Ƥ� @ref{News} �򻲾Ȥ��Ƥ���������

@item
�����Τ��Ƥ���Х���̵����ǽ�ΰ����ˤĤ��Ƥ� @ref{Bugs} �򻲾Ȥ��Ƥ���
������

@item
����ηײ�ˤĤ��Ƥ� @ref{TODO} �򻲾Ȥ��Ƥ���������

@item
���Υץ��������Ȥؤ����Ƥι׸��ԤΥꥹ�ȤˤĤ��Ƥ� @ref{Credits} �򻲾Ȥ��Ƥ���
������
@end itemize

@strong{����:}

@c if the @email is at the beginning of a line the texi2html fails
���顼(�Х�)��ݡ��ȡ����䡢�����Ȥ�
�᡼��󥰥ꥹ�� @email{mysql@@lists.mysql.com} �����äƤ���������@xref{Bug reports}��
�Х���ݡ��Ȥ��������뤿��ˤ� @code{mysqlbug} ������ץȤ���Ѥ��٤��Ǥ���
@c FIX! RPMs are also binary
�������ǥ����ȥ�ӥ塼�����Ǥϡ�@code{mysqlbug} ������ץȤ� @file{scripts} �ǥ��쥯�ȥ�
�˸��Ĥ��뤳�Ȥ��Ǥ��ޤ����Х��ʥ�ǥ����ȥ�ӥ塼�����Ǥϡ�@code{mysqlbug} �� 
@file{bin} �ǥ��쥯�ȥ�˸��Ĥ��뤳�Ȥ��Ǥ��ޤ���

@c FIX! Remeber to create the alias!
���Υޥ˥奢��ؤ��ɲäޤ��Ͻ����˴�Ϣ������Ƥ�������ϡ������� 
@strong{MySQL} �ޥ˥奢������� (@email{docs@@mysql.com})��
���äƤ���������

@cindex @strong{MySQL}, what it is
@node What-is, Manual-info, Introduction, Introduction
@section @strong{MySQL} �Ȥϲ�����

@strong{MySQL} �������˥ޥ���桼�����ޥ������åɤ� SQL 
�ǡ����١��������ФǤ���SQL �������Ǥ�äȤ�ݥԥ�顼��
�ǡ����١�������Ǥ���@strong{MySQL} �ϡ������Хǡ���� @code{mysqld} ��
¿���μ���Υ��饤����ȥץ������ȥ饤�֥�꤫��ʤ륯�饤�����/����
�м����Ǥ���

SQL�ϡ��������¸�����������������ƥ����������뤳�Ȥ��ñ�ˤ��뤿���ɸ�ಽ���줿����Ǥ���
�㤨�С����ʤ��ϡ����ʰ���򸡺����뤿���SQL��Ȥäơ�
�����֥����Ȥ˴ؤ��륫�����ޡ���������Ѥ��뤳�Ȥ��Ǥ��ޤ���
@strong{MySQL} �ϡ�������̿�����¸������ˤ⡢��ʬ�ˤϤ䤯���ե쥭���֥�Ǥ���

@strong{MySQL} �μ����Ū�Ϲ�®�Ǵ��Ǵ�ñ�˻��ѤǤ��뤳�ȤǤ���
@strong{MySQL} ���ȼ��˳�ȯ����ޤ������桹�ϡ��ȤƤ��礭�ʥǡ���
�١�����¾�Υǡ����١����٥�����桹���󶡤����Τ���®���������٤�
��˽����Ǥ��� SQL �����Ф�ɬ�פȤ��Ƥ�������Ǥ����桹�ϡ�10,000 �ơ�
�֥��ޤ� 40 �ʾ�Υǡ����١����δĶ��� 1996 ǯ���� @strong{MySQL} ���
�Ѥ��Ƥ��ޤ������Υơ��֥�� 500 �ơ��֥�ʾ�� 700���ʾ�Υ쥳���ɤ�����ޤ���
�������100�����Х��ȤΡ��𴴶�̳�Υǡ����Ǥ���

@strong{MySQL} ������������Ǥδ��ܤϡ���ǯ��δ֡����ʴĶ��ι⤤�׵�
�ǻ��Ѥ���Ƥ����롼����Υ��åȤǤ���@strong{MySQL} �Ϥޤ���ȯ��Ǥ�����
˭�٤ǤȤƤ�ͭ�Ѥʴؿ����åȤ�����󶡤��Ƥ��ޤ���

@cindex How to pronounce @strong{MySQL}
@cindex @strong{MySQL}, how to pronounce
@strong{MySQL} �θ�����ȯ���� ``My Ess Que Ell'' �Ǥ�(MY-SEQUEL �ǤϤ���
�ޤ���)��

@cindex Manual information
@node Manual-info, History, What-is, Introduction
@section ���Υޥ˥奢��ˤĤ���

���Υޥ˥奢��ϰʲ��������ˤ��������ޤ���
(�ϥ�ɥ�̾�����񤭤ޤ����ɾ�ά�����������С�����Ͽ������ :) )��

@itemize @bullet
@item ̱��
@item hama
@item dale
@item kippara
@item kenji
@item aoki
@item tok21108
@item �����
@item tamori
@end itemize

@menu
* Manual conventions::          Conventions used in this manual
@end menu

���Υޥ˥奢��ϸ��� Texinfo, �ץ졼��ƥ�����, Info, HTML,
PostScript, PDF �������
������ޤ������������礭������ Postscript �� PDF �С�������
@strong{MySQL} �Υǥ����ȥ�ӥ塼�����ˤϴޤޤ�Ƥ��ޤ��󤬡��̤˥�����
�����ɤ���褦�ˤʤäƤ��ޤ���@uref{http://www.mysql.com/}.

�ץ饤�ޥ�ɥ�����Ȥ� Texinfo �ե�����Ǥ���HTML �С������� 
@code{texi2html} ���ѹ����줿�С������Ǽ�ưŪ���󶡤���ޤ����ץ졼��
�ƥ����Ȥ� Info �С������� @code{makeinfo} ���󶡤���ޤ���PostScript 
�С������� @code{texi2dvi} �� @code{divps} ����Ѥ����󶡤���ޤ���PDF 
�С������� Ghostscript �桼�ƥ���ƥ� @code{ps2pdf} ���󶡤���ޤ���

���Υޥ˥奢��� David Axmark, Michael (Monty) Widenius, Paul DuBois,
�ˤ�äƺ������졢�ݻ�����Ƥ��ޤ���¾�ι׸��ԤˤĤ��Ƥ� 
@ref{Credits} �򻲾Ȥ��Ƥ���������

@node Manual conventions,  , Manual-info, Manual-info
@subsection ���Υޥ˥奢����ǻ��Ѥ���Ƥ���ɽ��

���Υޥ˥奢�������ΰ������ɽ������Ѥ��Ƥ��ޤ�:

@table @asis
@item @code{constant}
�������ե���Ȥϼ��Τ�Τ˻��Ѥ���ޤ������ޥ��̾, ���ץ����; SQL ���ơ�
�ȥ���; �ǡ����١���̾, �ơ��֥�̾, �ե������̾; C �� Perl ������; �Ķ��ѿ���
��: ``@code{mysqladmin} ���ɤΤ褦��ư��뤫�򸫤뤿��ˤϡ�
@code{--help} ���ץ�����Ĥ��Ƶ�ư���Ƥ���������''

@item @file{filename}
������dz��줿�������ե���Ȥϥե�����̾�ȥѥ�̾�˻��Ѥ���ޤ�����: ``
�ǥ����ȥ�ӥ塼������ @file{/usr/local} �ǥ��쥯�ȥ��۲��˥��󥹥ȡ��뤵��ޤ���''

@item @samp{c}
������dz��줿�������ե���Ȥ�ʸ���������󥹤򼨤�����ˤ���Ѥ���ޤ���
��: ``�磻��ɥ����ɤ���ꤹ�뤿��ˤϡ�@samp{%} ʸ������Ѥ��Ƥ���������''

@item @emph{italic}
������å��ե���Ȥ϶�Ĵ�Τ���˻��Ѥ���ޤ�, @emph{���Τ褦��}��

@item @strong{boldface}
�ܡ���ɥե���Ȥϥ���������̾(�㤨�С�``@strong{process} �����ưפ�
Ϳ���ʤ��Ǥ�������'')�ȡ�@strong{�ä˶�����Ĵ}�������뤿��˻��Ѥ���ޤ���
@end table

���ޥ�ɤ�����Υץ������ˤ�äƼ¹Ԥ���뤳�Ȥ��̣���뤳�Ȥ�ɽ������
���ޥ�ɤȶ���ɽ�������ץ���ץȤˤ�äơ����Υץ�������ɽ���ޤ����㤨�С�
@code{shell>} �ϡ����ʤ��Υ������󥷥��뤫��¹Ԥ��륳�ޥ�ɤ�ɽ����
@code{mysql>} �� @code{mysql} ���饤����ȥץ�����फ��¹Ԥ��륳�ޥ�ɤ�ɽ���ޤ�:

@example
shell> type a shell command here
mysql> type a mysql command here
@end example

�����륳�ޥ�ɤ� Bourne �����빽ʸ�Ǽ�����ޤ���@code{csh} �����Υ���
�����Ѥ��Ƥ�����ϡ��鷺�����ѹ����ƥ��ޥ�ɤ�ȯ�Ԥ���ɬ�פ�����Ǥ���
�����㤨�С��Ķ��ѿ������ꤷ�ƥ��ޥ�ɤ�¹Ԥ��륷�����󥹤ϡ�Bourne ����
�빽ʸ�Ǥϼ��Τ褦�ˤʤ�ޤ�:

@example
shell> VARNAME=value some_command
@end example

@code{csh} �Ǥϡ����Τ褦�ʥ������󥹤�¹Ԥ��Ƥ�������:

@example
shell> setenv VARNAME value
shell> some_command
@end example

�ǡ����١���̾, �ơ��֥�̾, �ե������̾�ϥ��ޥ�ɤ�����ִ����ʤ���Ф����ʤ�
���Ȥ��褯����ޤ������Τ褦���ִ���ɬ�פʤ��Ȥ򼨤�����ˡ����Υޥ˥奢
��� @code{db_name}, @code{tbl_name}, @code{col_name} ����Ѥ��ޤ���
�㤨�С����Τ褦�ʥ��ơ��ȥ��Ȥ򸫤����:

@example
mysql> SELECT col_name FROM db_name.tbl_name;
@end example

����ϡ�Ʊ�ͤΥ��ơ��ȥ��Ȥ����Ϥ��뤿��ˤϡ������餯���Τ褦�ˡ�����
�����ȤΥǡ����١���̾, �ơ��֥�̾, �ե������̾�򶡵뤹�뤳�Ȥ��̣���ޤ�:

@example
mysql> SELECT author_name FROM biblio_db.author_list;
@end example

SQL ���ơ��ȥ��Ȥ���ʸ���Ǥ⾮ʸ���Ǥ⵭�ҤǤ��ޤ������Υޥ˥奢�뤬
SQL ���ơ��ȥ��Ȥ򼨤��Ȥ��ϡ����̤ʥ�����ɤ��������Ƥ�����ˤ�(��
���Ĵ���뤿���)���Υ�����ɤ���ʸ�������Ѥ��졢�Ĥ�Υ��ơ��ȥ��
�Ȥ˾�ʸ�������Ѥ���ޤ��� �㤨�С�@code{SELECT} ���ơ��ȥ��Ȥ�������
�ˤϼ���������Ǥ��礦:

@example
mysql> SELECT count(*) FROM tbl_name;
@end example

������@code{COUNT()} �ؿ���������Ǥϡ����ơ��ȥ��Ȥϼ��Τ褦�˽񤫤�
�ޤ�:

@example
mysql> select COUNT(*) from tbl_name;
@end example

���̤ʶ�Ĵ���տޤ���ʤ���硢���ƤΥ�����ɤ���ʸ���ǽ񤫤�ޤ���

��ʸ��������Ǥϡ��ѳ��(@samp{[} �� @samp{]})�ϥ��ץ�����ñ�����Ǥ�
�뤳�Ȥ򼨤�����˻��Ѥ���ޤ�:

@example
DROP TABLE [IF EXISTS] tbl_name
@end example

��ʸ���Ǥ������Ĥ��Τ�Τ���ʤ��硢��ľ�С�(@samp{|})�Ƕ��ڤ��ޤ���
���򥻥åȤ����ĤΥ��Ф����֤��Ȥ��Ǥ���Ȥ��ϡ��ѳ����˥ꥹ�Ȥ���
�ޤ���
(@samp{[} and @samp{]}):

@example
TRIM([[BOTH | LEADING | TRAILING] [remstr] FROM] str)
@end example

���򥻥åȤ����ĤΥ��Ф�����ɬ�פ�����Ȥ��ϡ��ȳ��(@samp{@{} 
�� @samp{@}})��˥ꥹ�Ȥ���ޤ�:

@example
@{DESCRIBE | DESC@} tbl_name @{col_name | wild@}
@end example

@cindex @strong{MySQL} version
@node History, MySQL-Books, Manual-info, Introduction
@section @strong{MySQL} �����

�桹���Ȥ�®�������٥�� (ISAM) �롼�������Ѥ��롢�桹�Υơ��֥��
��³���뤿��ˡ� �桹�ϰ���
@code{mSQL} ����Ѥ���Ĥ��Ǥ������������������Ĥ��Υƥ��Ȥθ塢�桹�� 
@code{mSQL} �ϲ桹��ɬ�פȤ���ۤɹ�®�ǤϤʤ��������٤���äƤ��ʤ��Ȥ�
�����˻��ޤ��������η�̡�@code{mSQL} �ȤۤȤ��Ʊ�� API ���󥿥ե���
������ġ��桹�Υǡ����١����ؤο����� SQL ���󥿥ե������˵��뤷�ޤ�����
���� API �ϥ����ɥѡ��ƥ������ɤΰܿ����ñ�ˤ��뤿������򤵤�ޤ�����

@strong{MySQL} ��̾����ͳ��ϴ����ˤ����餫�ǤϤ���ޤ��󡣲桹�Υ١���
�ǥ��쥯�ȥ��¿���Υ饤�֥��ȥġ������Ƭ�� ``my'' �� 10 ǯ�ʾ��Ȥ�
�Ƥ��ޤ�����������Monty ��̼(��ǯ���㤤)�� My �Ȥ���̾���Ǥ������Τ��ᡢ
����2�ĤΤɤ��餬 @strong{MySQL} ��̾����Ϳ�������ϡ��桹�ˤȤäƤ�̤��
��Ǥ���

@node MySQL-Books, Features, History, Introduction
@section Books about MySQL

While this manual is still the right place for up to date techical
information, its primary goal is to contain everything there is to know
about @strong{MySQL}. And it is sometimes nice to have a bound book to read
in bed or while you travel. Here are a list of books about @strong{MySQL} (in
English).

@multitable @columnfractions .3 .7
@item Title    @tab            @uref{http://www2.newriders.com/cfm/prod_book.cfm?RecordID=584,MySQL}
@item Publisher        @tab            New Riders
@item Author   @tab            Paul DuBois
@item Pub Date @tab            1st Edition December 1999
@item ISBN     @tab            0735709211
@item Pages    @tab            800
@item Price    @tab            $49.99 US
@item Downloadable examples  @tab            @uref{http://mysql.com/Contrib/Examples/samp_db.tar.gz, @code{samp_db.tar.gz}}
@item Errata  @tab            @uref{http://www.mysql.com/pauls-mysql-book-errata.html, are available here}
@end multitable
Foreword by Michael ``Monty'' Widenius, @strong{MySQL} Moderator

In @strong{MySQL}, Paul DuBois provides you with a comprehensive guide to
one of the most popular relational database systems. Paul has
contributed to the online documentation for @strong{MySQL}, and is an
active member of the @strong{MySQL} community. The principal @strong{MySQL}
developer, Monty Widenius, and a network of his fellow developers
reviewed the manuscript, providing Paul with the kind of insight
no one else could supply. 

Instead of merely giving you a general overview of @strong{MySQL}, Paul
teaches you how to make the most of its capabilities. Through two
sample database applications that run throughout the book, he
gives you solutions to problems you're sure to face. He helps you
integrate @strong{MySQL} efficiently with third-party tools, such as PHP
and Perl, enabling you to generate dynamic Web pages through
database queries. He teaches you to write programs that access
@strong{MySQL} databases, and also provides a comprehensive set of
references to column types, operators, functions, SQL syntax,
@strong{MySQL} programming, C API, Perl @code{DBI}, and PHP API.
@strong{MySQL} simply gives you the kind of information you won't find
anywhere else.

If you use @strong{MySQL}, this book provides you with: 
@itemize @bullet
@item
An introduction to @strong{MySQL} and SQL
@item
Coverage of @strong{MySQL}'s data types and how to use them 
@item
Thorough treatment of how to write client programs in C 
@item
A guide to using the Perl @code{DBI} and PHP APIs for developing
command-line and Web-based applications 
@item
Tips on administrative issues such as user accounts, backup,
crash recovery, and security 
@item
Help in choosing an ISP for @strong{MySQL} access
@item
A comprehensive reference for @strong{MySQL}'s data types, operators,
functions, and SQL statements and utilities 
@item
Complete reference guides for @strong{MySQL}'s C API, the Perl @code{DBI} API,
and PHP's @strong{MySQL}-related functions
@end itemize

@multitable @columnfractions .3 .7
@item Title    @tab            @uref{http://www.oreilly.com/catalog/msql/noframes.html,MySQL & mSQL}
@item Publisher        @tab            O'Reilly
@item Authors  @tab            Randy Jay Yarger, George Reese & Tim King
@item Pub Date @tab            1st Edition July 1999
@item ISBN     @tab            1-56592-434-7, Order Number: 4347
@item Pages    @tab            506
@item Price    @tab            $34.95
@end multitable

This book teaches you how to use @strong{MySQL} and @code{mSQL}, two popular and
robust database products that support key subsets of SQL on both Linux
and UNIX systems. Anyone who knows basic C, Java, Perl, or Python can
write a program to interact with a database, either as a stand-alone
application or through a Web page. This book takes you through the
whole process, from installation and configuration to programming
interfaces and basic administration.  Includes ample tutorial
material.

@multitable @columnfractions .3 .7
@item Title     @tab            @uref{http://shop.barnesandnoble.com/bookSearch/isbnInquiry.asp?isbn=0672319144,Sams Teach Yourself MySQL in 21 Days}
@item Publisher @tab            Sams
@item Authors   @tab            Mark Maslakowski and Tony Butcher
@item Pub Date  @tab            June 2000
@item ISBN      @tab            0672319144
@item Pages     @tab            N/A
@item Price     @tab            $39.99
@end multitable

Sams Teach Yourself @strong{MySQL} in 21 Days is for intermediate Linux users
who want to move into databases.  A large share of the audience to be web
developers needing a database to store large amounts of information that can
be retrieved via the Web. Sams Teach Yourself @strong{MySQL} in 21 Days is a
practical, step-by-step tutorial.  The reader will learn to design and employ
this open source database technology into his/her web site using practical,
hands-on examples to follow.

@multitable @columnfractions .3 .7
@item Title     @tab            @uref{http://shop.barnesandnoble.com/bookSearch/isbnInquiry.asp?isbn=0761524452,E-Commerce Solutions with MySQL}
@item Publisher @tab            Prima
@item Authors   @tab            N/A
@item Pub Date  @tab            September 2000
@item ISBN      @tab            0761524452
@item Pages     @tab            500
@item Price     @tab            $39.99
@end multitable

No description available.

@multitable @columnfractions .3 .7
@item Title     @tab            @uref{http://shop.barnesandnoble.com/bookSearch/isbnInquiry.asp?isbn=1861004281,Professional MySQL Programming}
@item Publisher @tab            Wrox
@item Authors   @tab            N/A
@item Pub Date  @tab            July 2000
@item ISBN      @tab            1861004281
@item Pages     @tab            1000
@item Price     @tab            $49.99
@end multitable

No description available.

@multitable @columnfractions .3 .7
@item Title     @tab            @uref{http://shop.barnesandnoble.com/bookSearch/isbnInquiry.asp?isbn=0672317842,PHP3 and MySQL Web Development}
@item Publisher @tab            N/A
@item Authors   @tab            William Jason Gilmore
@item Pub Date  @tab            October 2000
@item ISBN      @tab            672317842
@item Pages     @tab            N/A
@item Price     @tab            $39.99
@end multitable

No description available.

@node Features, Stability, MySQL-Books, Introduction
@section @strong{MySQL}�μ�ʵ�ǽ

@strong{MySQL} �ν��פ���ħ�Τ����Ĥ���ʲ��ι��ܤˤ����ޤ���

@c This list is too technical and should be divided into one feature
@c list comparable to commercial competition and a very technical on
@c with max limits (from crash-me) and so on.
@itemize @bullet
@item
�����ͥ륹��åɤ���Ѥ��봰���ʥޥ������åɡ������ͭ���Ǥ���д�ñ��
ʣ���� CPU ����ѤǤ��뤳�Ȥ��̣���ޤ���

@item
C, C++, Ruby, Eiffel, Java, Perl, PHP, Python ������ Tcl API��@xref{Clients}��

@item
¿���μ���Υץ�åȥե������ư��ޤ���@xref{Which OS}��

@item
¿���Υե�����ɷ�: 1, 2, 3, 4, 8 �Х���Ĺ������դ�/���̵������,
@code{FLOAT}, @code{DOUBLE}, @code{CHAR}, @code{VARCHAR}, @code{TEXT},
@code{BLOB}, @code{DATE}, @code{TIME}, @code{DATETIME}, @code{TIMESTAMP},
@code{YEAR}, @code{SET}, @code{ENUM} ����@xref{Column types}��

@item
��Ŭ�����줿 one-sweep multi-join ����Ѥ���ȤƤ�®����硣

@item
������� @code{SELECT} �� @code{WHERE} ����Ǥ����Ƥα黻�Ҥȴؿ��Υ��ݡ�
�ȡ���:
@example
mysql> SELECT CONCAT(first_name, " ", last_name) FROM tbl_name
           WHERE income/dependents > 10000 AND age > 30;
@end example

@item
SQL �ؿ��Ϲ��٤˺�Ŭ�����줿���饹�饤�֥����̤��Ƽ�������Ƥ��ơ�����
�����뤳�ȤΤǤ���Τ�Ʊ�����餤®���ΤǤ��� ���̡�������ν�����θ��
�ϡ��������������ƤϤ���ޤ���

@item
SQL @code{GROUP BY} �� @code{ORDER BY} ��δ����ʥ��ݡ��ȡ����롼�״ؿ� 
(@code{COUNT()}, @code{COUNT(DISTINCT)}, @code{AVG()}, @code{STD()}, @code{SUM()}, @code{MAX()},
@code{MIN()}) �Υ��ݡ��ȡ�

@item
ANSI SQL �� ODBC ��ʸ�Ǥ� @code{LEFT OUTER JOIN} �Υ��ݡ��ȡ�

@item
Ʊ�쥯������˰ۤʤ�ǡ����١�������Υơ��֥�򺮺ߤǤ��ޤ� (�С������ 
3.22)��

@item
�ȤƤ����ǰ����� �ø������ƥ� �ȥѥ���ɥ����ƥࡣ
�ۥ��ȥ١����ξ�������ǽ�Ǥ���
�����Ф���³����������ƤΥѥ���ɥȥ�ե��å��ϰŹ沽����Ƥ��뤿���
����ɤϰ����Ǥ���

@item
Windows95 �� ODBC (Open-DataBase-Connectivity) (�������Ĥ�)�����Ƥ� ODBC
2.5 �ؿ���¾��¿�������ʤ��� @strong{MySQL} �����Ф���³���뤿��ˡ��㤨
�� Access ����ѤǤ��ޤ���@xref{ODBC}��

@item
����ǥå������̤Ĥ��ΤȤƤ�®�� B-tree �ǥ������ơ��֥롣

@item
�ơ��֥���� 16 ����ǥå�����������ޤ����ƥ���ǥå����� 1 ���� 16 ��
�Υե�����ɤޤ��ϥե�����ɤΰ�������ʤ�ޤ������祤��ǥå���Ĺ�� 256 �Х��ȤǤ� 
(����� @strong{MySQL} �Υ���ѥ�������ѹ��Ǥ��ޤ�)������ǥå����� 
@code{CHAR} �ޤ��� @code{VARCHAR} �ե�����ɤ���Ƭ��ʬ����ѤǤ��ޤ���

@item
����Ĺ�Ȳ���Ĺ�Υ쥳���ɡ�

@item
����ơ��֥�Ȥ��ƻ��Ѥ���������ϥå���ơ��֥롣

@item
�礭�ʥǡ����١��������桹�ϡ�50,000,000 �쥳���ɤ�ޤत���Ĥ��Υǡ�
���١����� @strong{MySQL} ����Ѥ��Ƥ��ޤ���

@item
���ƤΥե�����ɤϥǥե�����ͤ�����ޤ��� �ơ��֥���ܤΥ��֥��åȤ��������뤿
��� @code{INSERT} ����ѤǤ�������Ū���ͤ�Ϳ�����Ƥ��ʤ��ե�����ɤϤ��Υ�
�ե�����ͤ����ꤵ��ޤ���

@item
�������Τ���� GNU Automake, Autoconf, @code{libtool} ����Ѥ��Ƥ��ޤ���

@item
C �� C++ �ǽ񤫤�Ƥ��ޤ������Ϥʼ���Υ���ѥ���ǥƥ��Ȥ���Ƥޤ���

@item
�ȤƤ�®������åɥ١����Υ��������ƥ����ƥࡣ

@item
����꡼��������ޤ��󡣻��ΤΥ���꡼����������(@code{purify})�ǥ�
���Ȥ���Ƥ��ޤ���

@item
@code{myisamchk} ��ޤ�Ǥ��ޤ�������ϡ��ơ��֥븡������Ŭ���������Τ���
�ΤȤƤ�®���桼�ƥ���ƥ��Ǥ���@xref{Maintenance}��

@item
�ۤʤ륭��饯�����åȤδ����ʥ��ݡ��ȡ�ISO-8859-1 (Latin1), big5, ujis �ʤɡ�
�㤨�С������󥸥ʥ�
����ʸ�� @ringaccent{a}, @"a ������ @"o �ϥơ��֥�̾��ե������̾�Ȥ��Ƶ�����
�ޤ���

@item
���ƤΥǡ����� ���򤵤줿����饯�������åȤη�������¸����Ƥ��ޤ����̾�ʸ����ե������
�����Ƥ���Ӥϥ��������¸�Ǥ���

@item
�����Ȥϡ�@strong{MySQL} �����С���ư���ˡ����򤵤줿����饯�������åȤ�
�˽��äƹԤʤ��ޤ���(�ǥե���Ȥϡ����������ǥ�����ˡ)��
��������˿����������Ƚ��������ɲä��뤳�Ȥǡ���
����ѹ���ǽ�Ǥ����ȤƤ����Ū�ʥ����Ȥ���򸫤�ˤϡ�Czech �����ȥ�����
�򸫤Ƥ��������� @strong{MySQL} ��¿���μ���Υ���饯�����åȤ򥵥ݡ���
��������ѥ������¹Ի��˻���Ǥ��ޤ���

@item
SQL92 ɸ��ˤ���褦�ʥơ��֥�ȥե�����ɤΥ����ꥢ��̾��

@item
@code{DELETE}, @code{INSERT}, @code{REPLACE}, @code{UPDATE} ��
�ѹ����줿(�ƶ��������)�Ԥο����֤��ޤ���
��������³���˥ե饰�����ꤹ�뤳�Ȥˤ�ꡢ�����Ŭ�礷���쥳���ɿ����֤�
���Ȥ��ǽ�Ǥ���

@item
�ؿ�̾�ϥơ��֥�̾��ե������̾�Ⱦ��ͤ��ޤ����㤨�� @code{ABS} ���������ե������
̾�Ǥ������¤ϡ��ؿ��ƤӽФ��ˡ��ؿ�̾�Ȥ����³�� @samp{(} �δ֤˶���
������ʤ����Ȥ����Ǥ���@xref{Reserved words}��

@item
���Ƥ� @strong{MySQL} �ץ������ϥ���饤��إ�פ����뤿��ˡ�
@code{--help} �� @code{-?} ���ץ����ǸƤӽФ����Ȥ��Ǥ��ޤ���

@item
�����Ф�¿���θ���ǥ��饤����ȤؤΥ��顼��å��������󶡤Ǥ��ޤ���
@xref{Languages}��

@item
���饤����Ȥϡ�TCP/IP ��³�ޤ��� Unix �����åȡ����뤤�� NT �ξ���
�͡���ɥѥ��פ���Ѥ��� @strong{MySQL} �����Ф���³���ޤ���

@item
@strong{MySQL} ��ͭ�� @code{SHOW} ���ޥ�ɤϥǡ����١������ơ��֥롢����
�ǥå����ˤĤ��Ƥξ�����Ф�����˻��ѤǤ��ޤ���@code{EXPLAIN} ���ޥ�
�ɤϥ��ץƥ��ޥ������ɤΤ褦�˥��������Ϥ��뤫����ꤹ�뤿��˻���
�Ǥ��ޤ���
@end itemize

@cindex Stability
@node Stability, Year 2000 compliance, Features, Introduction
@section @strong{MySQL} �Ϥɤ줯�餤���꤫��

������Ǥϡ�``@strong{MySQL} �Ϥɤ줯�餤���꤫��'' �� ``��Ϥ��Υץ�����
���Ȥ� @strong{MySQL} �˰�¸�Ǥ��뤫��'' �Ȥ�������ˤĤ��Ʋ������ޤ���

�桹�Ϥ����ǡ������Ĥ�����������餫�ˤ���¿���οͤ˴ط�����Ȼפ��뤵
��˽��פʼ���Τ����Ĥ���������뤳�Ȥ��ߤޤ���������ϡ��᡼��󥰥�
����(�����ǤϤȤƤ��ȯ�˥Х�����𤵤�Ƥ��ޤ�)��������ޤ줿���󤬰�
����֤���Ƥ��ޤ���

TcX �Ǥϡ�@strong{MySQL} �� 1996 �溢����桹�Υץ��������ȤDz��������
�ʤ�ư���Ƥ��ޤ������������˥�꡼�����줿�����桹�ϡ�@strong{MySQL} ��
�� ``�ƥ��Ȥ���Ƥ��ʤ�������'' ����ʬ�����뤳�Ȥ����դ��ޤ���������ϡ�
�桹�Ȥϰۤʤ���ˡ�ǥ������������뿷�����桼���ˤ�äƤ����˸��Ĥ����ޤ�����
�������ƥ�꡼���ϡ�(¿���ο�������ǽ����äƤ���Τ�)���Τ�Τ�������
�Ͼ��ʤ��ʤ�ޤ��������Ƽ��Υ�꡼���ΰ�Ĥ� ``����'' �ȸƤ֤��Ȥ��Ǥ����
���˲桹��˾��Ǥ��ޤ���

@strong{MySQL} �γƥ�꡼���ϼ���Ū�ǡ��桼���� ``���쥤������'' �����
�����ɤλ��Ѥ򳫻Ϥ�����ˤ������꤬����ޤ��������������Υ桼���ϡ�����
���쥤�����󤫤��Τ뤳�Ȥ��Ǥ��ޤ���; ������Ǹ����Τ��Ƥ��뤳����
���Ƥߤޤ���
������ @strong{MySQL} �� 3.22.x �С������ǰ����ޤ����Τ��Ƥ������
����Ƥ���Х������ƺǿ��ΥС������ǽ�������Ƥ��ޤ���bugs ���
�񤫤�Ƥ���Х��Ͻ����ޤ��������� ``�߷�'' ��Ϣ�Τ�ΤǤ���@xref{Bugs}.

@strong{MySQL} ��ʣ���γ��ؤ��͡�����Ω�⥸�塼��ǽ񤫤�Ƥ��ޤ�������
��Υ⥸�塼��ϡ����줾�줬�ɤΤ褦�˥ƥ��Ȥ���Ƥ��뤫�ȤȤ�˼��˥ꥹ
�Ȥ���Ƥ��ޤ�:

@table @strong
@item ISAM �ơ��֥���� --- ����
����� @strong{MySQL} 3.22 �Ȥ�������ΥС������ˤ����ơ�
���ƤΥǡ�������¸�ȸ�����������ޤ������Ƥ� @strong{MySQL} ��꡼���Ǥϡ�
���Υ�������ˤ�(��𤵤줿)�Х��ϰ�Ĥ⤢��ޤ��������ʥơ��֥������
ͣ�����ˡ�ϡ�����������ˤ��륵���Ф򻦤����Ȥ����Ǥ��������Ƴƥ������
�����ƤΥǡ����ϥǥ������˥ե�å��夵��뤿�ᡢ�����ʤ�ǡ�����
���������˲���������Ȥ������ȤϤޤ��ʤ��Ǥ��礦��
@strong{MySQL} ��ΥХ��Τ���˥ǡ�����
����줿�Ȥ����Х���ݡ��Ȥϰ�Ĥ⤢��ޤ���

@item The MyISAM table handler --- Beta
����� @strong{MySQL} 3.23 �Ǥο���ǽ�Ǥ�. 
����� ISAM �ơ��֥�Υ����ɤ򸵤˳�ĥ����Ƥ��ޤ�����
¿���������ʵ�ǽ����äƤ��ޤ���

@item �ѡ�����ñ����� --- ����
���Υ����ƥ���ˤ�Ĺ���֥Х��ϰ�Ĥ���𤵤�Ƥ��ޤ���

@item C ���饤����ȥ����� --- ����
�Τ��Ƥ�������Ϥ���ޤ���3.20 ��꡼���ν���ˤϡ�����/�����Хåե�
�������ˤ����Ĥ������¤�����ޤ�����3.21.x �ʹߡ��Хåե��ϥǥե���Ȥ� 
24M �ޤ�ưŪ���礭���ʤ�ޤ���

@item ɸ�९�饤����ȥץ������ --- ����
������ @code{mysql}, @code{mysqladmin}, @code{mysqlshow},
@code{mysqldump}, @code{mysqlimport} ��ޤߤޤ�.

@item ����Ū�� SQL --- ����
����Ū�� SQL ��ǽ�����ƥ��ʸ�������ưŪ������������Υ����ƥ�ˤ���
�𤵤줿�Х��ϰ�Ĥ⤢��ޤ���

@item �����ꥪ�ץƥ��ޥ��� --- ����

@item �ϰϥ��ץƥ��ޥ��� --- ����

@item ��祪�ץƥ��ޥ��� --- ����

@item ���å� --- �����
����ϤȤƤ⥷���ƥ�˰�¸���Ƥ��ޤ��������Ĥ��Υ����ƥ�Ǥϡ�����ϡ�ɸ
�� OS ���å� (fcntl) ����Ѥ��뤿���礭�����꤬����ޤ��������ξ���
�ϡ�@strong{MySQL} �ǡ����� @code{--skip-locking} �ե饰�Ĥ���ư������
���Ǥ����Τ��Ƥ�������ϡ������Ĥ��� Linux �����ƥ�� NFS �ޥ���Ȥ���
���ե����륷���ƥ���ѻ��� SunOS �Ǥ���

@item Linux ����å� --- �����
@code{fcntl()} ������Ǥ������꤬���Ĥ��äƤ��ޤ�������� @code{mysqld} 
�ؤ� @w{@code{--skip-locking}} ���ץ����λ��Ѥǽ����Ǥ��ޤ������ͤ��� 
0.5 ��꡼���� lockup �������𤷤ޤ�����1000�ʾ��Ʊ����³����Ѥ���ͽ
��Ǥ���С�LinuxThreads ��ƥ���ѥ��뤹��ɬ�פ�����ޤ������������ǥե�
��Ȥ� LinuxThread �Ǥ�¿������³��¹Ԥ��뤳�Ȥϲ�ǽ�Ǥ�(������ 1021 ��
��ˤʤ�ʤ��褦�ˤ��Ƥ�������)���ǥե���Ȥ� 2MB �Υ����å����֤ϡ�����
�ꥱ���������԰���ˤ��ޤ��������� 1021 �ĤΥ����ɥ���³��������� 
coredump ������������ޤ����ܤ����� Linux Notes ��������������

@item Solaris 2.5+ pthread --- ����
�桹�ϡ��桹�����Ƥ����ʤǤ������Ѥ��Ƥ��ޤ���

@item MIT ����å� (¾�Υ����ƥ�) --- �����
3.20.15 ������𤵤줿�Х��Ϥ���ޤ���3.20.15 �����Τ�줿�Х��Ϥ����
���󡣤����Ĥ��Υ����ƥ�Ǥϡ������Ĥ������٤��ʤ�Ȥ��� 
``misfeature'' ������ޤ�(1/20 �ä� sleep ���ƥ�����֤ǹԤʤ��ޤ�)��
�������MIT ����åɤϤ��٤Ƥ򾯤��٤����ޤ�������������ǥå����١���
�� @code{SELECT} �Ǥϡ����ơ��ȥ��Ȥ��̾���٤Υե졼��ǹԤ��뤿�ᡢ
mutex locking/thread juggling �Ϥ���ޤ���

@item ¾�Υ���åɼ��� --- ����ե� - �١���
¾�Υ����ƥ�ؤΰܹԤϤޤ��ȤƤ⿷������¿ʬ @strong{MySQL} �ˡ���������
��¿���Τϥ���åɼ������Ȥˡ�¿���ΥХ�����äƤ��ޤ���

@item @code{LOAD DATA...}, @code{INSERT ... SELECT} --- ����
���ͤ��Ϥ���˥Х��򸫤Ĥ����ȹͤ��ޤ�����������Ϸ�ɸ���Ǥ����������
�������˥ޥ˥奢����ɤ������å����Ƥ���������

@item @code{ALTER TABLE} --- ����
3.22.12 �Ǿ����ѹ����ޤ�����

@item DBD --- ����
���ߡ�Jochen Wiedmann
@email{wiedmann@@neckar-alb.de}
�ˤ�äƥ��Ƥ���Ƥ��ޤ������ա�

@item @code{mysqlaccess} --- �����
@email{Yves.Carlier@@rug.ac.be}
�ˤ�äƽ񤫤���Ƥ���Ƥޤ������ա�

@item @code{GRANT} --- �����
@strong{MySQL} 3.22.12 ���礭���ѹ����Ԥʤ��ޤ�����

@item @strong{MyODBC} (uses ODBC SDK 2.5) --- �����
�����Ĥ��Υץ������Ǥ�����ư��Ƥ���褦�˸����ޤ���
@end table

TcX �������ʧ�ä��ܵҤΤ���� email ���ݡ��Ȥ��󶡤��Ƥ��ޤ��������� 
@strong{MySQL} �᡼��󥰥ꥹ�Ȥ��̾���Ƥΰ���Ū�ʼ���˲������󶡤�
�Ƥ��ޤ����Х����̾魯���˥ѥå��ǽ������졢����ʥХ��ˤϡ��ۤȤ�ɤ���
�⿷������꡼��������ޤ���

@cindex Year 2000 compliance
@node Year 2000 compliance, General-SQL, Stability, Introduction
@section 2000 ǯ�б�

@strong{MySQL} ���Ȥ� 2000 ǯ����(Y2K)���Ф��Ʋ����������äƤ��ޤ���:

@itemize @bullet
@item
@strong{MySQL} �� Unix ���ִؿ�����Ѥ���@code{2069} ǯ�ޤ����դˤϲ���
����⤢��ޤ���; ���Ƥ�2���ǯ�� @code{1970} ���� @code{2069} ���ϰϤ�
����ȸ��ʤ���ޤ�������ϡ�@code{year} �ե��������� @code{01} ���Ǽ�����
�硢@strong{MySQL} �Ϥ���� @code{2001} �Ȥ��ư����Ȥ������Ȥ��̣���ޤ���

@item
���Ƥ� @strong{MySQL} ���մؿ��ϰ�ĤΥե����� @file{sql/time.cc} �˳�Ǽ
���졢2000ǯ�����ˤȤƤ����տ��������ɲ�����Ƥ��ޤ���

@item
@strong{MySQL} 3.22 �ʹߤΥС������Ǥϡ������� @code{YEAR} �ե�����ɷ��� 
@code{0} �� @code{1901} ���� @code{2155} �ޤǤ�ǯ��1�Х��Ȥdz�Ǽ�Ǥ���2
��ޤ���4���ɽ���Ǥ��ޤ���
@end itemize

2000ǯ�����Ǥʤ���ˡ�� @strong{MySQL} ����Ѥ��륢�ץꥱ�������Ǥ�����
�ˤʤ�ޤ����㤨�С�¿���θŤ����ץꥱ��������4���ͤǤϤʤ�2����(����
��ۣ��Ǥ�)����Ѥ���ǯ���Ǽ�����ޤ�����������ϡ�@code{00} �ޤ��� 
@code{99} �Τ褦���ͤ� ``�礱�Ƥ���'' �ͤ�ɽ���Ȥ��ƻ��Ѥ��륢�ץꥱ��
�����ˤ�äƺ���ޤ���

�����ˤ��������������������ΤϺ���Ǥ����͡��ʥ��ץꥱ��������͡�
�ʥץ������ˤ�äƽ񤫤�Ƥ��ơ����γơ����������������ؿ����͡�����
�߹�碌����Ѥ��뤫��Ǥ���

����ϡ�MySQL �� 2030 ǯ�ޤǤ����դ˲��������ʤ����Ȥ򼨤���ñ�ʥƥ���
�Ǥ���

@example
mysql> DROP TABLE IF EXISTS y2k;
mysql> CREATE TABLE y2k (date date, date_time datetime, time_stamp timestamp);
mysql> INSERT INTO y2k VALUES ("1998-12-31","1998-12-31 23:59:59",19981231235959);
mysql> INSERT INTO y2k VALUES ("1999-01-01","1999-01-01 00:00:00",19990101000000);
mysql> INSERT INTO y2k VALUES ("1999-09-09","1999-09-09 23:59:59",19990909235959);
mysql> INSERT INTO y2k VALUES ("2000-01-01","2000-01-01 00:00:00",20000101000000);
mysql> INSERT INTO y2k VALUES ("2000-02-28","2000-02-28 00:00:00",20000228000000);
mysql> INSERT INTO y2k VALUES ("2000-02-29","2000-02-29 00:00:00",20000229000000);
mysql> INSERT INTO y2k VALUES ("2000-03-01","2000-03-01 00:00:00",20000301000000);
mysql> INSERT INTO y2k VALUES ("2000-12-31","2000-12-31 23:59:59",20001231235959);
mysql> INSERT INTO y2k VALUES ("2001-01-01","2001-01-01 00:00:00",20010101000000);
mysql> INSERT INTO y2k VALUES ("2004-12-31","2004-12-31 23:59:59",20041231235959);
mysql> INSERT INTO y2k VALUES ("2005-01-01","2005-01-01 00:00:00",20050101000000);
mysql> INSERT INTO y2k VALUES ("2030-01-01","2030-01-01 00:00:00",20300101000000);
mysql> INSERT INTO y2k VALUES ("2050-01-01","2050-01-01 00:00:00",20500101000000);
mysql> SELECT * FROM y2k;
+------------+---------------------+----------------+
| date       | date_time           | time_stamp     |
+------------+---------------------+----------------+
| 1998-12-31 | 1998-12-31 23:59:59 | 19981231235959 |
| 1999-01-01 | 1999-01-01 00:00:00 | 19990101000000 |
| 1999-09-09 | 1999-09-09 23:59:59 | 19990909235959 |
| 2000-01-01 | 2000-01-01 00:00:00 | 20000101000000 |
| 2000-02-28 | 2000-02-28 00:00:00 | 20000228000000 |
| 2000-02-29 | 2000-02-29 00:00:00 | 20000229000000 |
| 2000-03-01 | 2000-03-01 00:00:00 | 20000301000000 |
| 2000-12-31 | 2000-12-31 23:59:59 | 20001231235959 |
| 2001-01-01 | 2001-01-01 00:00:00 | 20010101000000 |
| 2004-12-31 | 2004-12-31 23:59:59 | 20041231235959 |
| 2005-01-01 | 2005-01-01 00:00:00 | 20050101000000 |
| 2030-01-01 | 2030-01-01 00:00:00 | 20300101000000 |
| 2050-01-01 | 2050-01-01 00:00:00 | 00000000000000 |
+------------+---------------------+----------------+

13 rows in set (0.00 sec)
@end example

����ϡ�@code{DATE} �� @code{DATETIME} ����̤��Τ����ʤ����դˤ�����
����Τʤ����Ȥ�򤷤ᤷ�ޤ� (��������դ� 9999 ǯ�ޤǰ����ޤ�)

@code{TIMESTAMP} ���ϡ��������¸���ޤ�����@code{2030-01-01} �ޤǤǤ���
@code{TIMESTAMP} �� 32-bit �ޥ���Ǥ� @code{1970} ���� @code{2030} ���ϰϤǤ���
64-bit �ޥ���Ǥϡ� @code{2106} ǯ�ޤǰ�����ޤ���

@strong{MySQL} �� 2000ǯ�б��Ǥ�����ۣ��Ǥʤ����Ϥ��󶡤���ΤϤ��ʤ���
��Ǥ�Ǥ���ۣ������դ����ϥǡ�����2���ǯ���͡ˤΰ����ˤĤ��Ƥ� 
@strong{MySQL} �ε�§�ˤĤ��Ƥ� @ref{Y2K issues} �򻲾Ȥ��Ƥ���������

@node General-SQL, Useful Links, Year 2000 compliance, Introduction
@section ����Ū�� SQL ����ȥ��塼�ȥꥢ��

�����ܤ� @strong{MySQL} �᡼��󥰥ꥹ�Ȥο��ͤˤ�äƿ侩����Ƥ��ޤ�:

@example
Judith S. Bowman, Sandra L. Emerson and Marcy Darnovsky
The Practical SQL Handbook: Using Structured Query Language
Second Edition
Addison-Wesley
ISBN 0-201-62623-3
http://www.awl.com
@end example

�����ܤ� @strong{MySQL} �桼�����ˤ����Ĥ��ο���������Ƥ��ޤ�:

@example
Martin Gruber
Understanding SQL
ISBN 0-89588-644-8
Publisher Sybex 510 523 8233
Alameda, CA USA
@end example

SQL ���塼�ȥꥢ�뤬�ͥåȾ�ˤ���ޤ� 
@url{http://www.geocities.com/SiliconValley/Vista/2207/sql1.html}

SQL in 21 Tagen (online book in German language):
@url{http://www.mut.de/leseecke/buecher/sql/inhalt.htm}

@node Useful Links,  , General-SQL, Introduction
@section ������ @strong{MySQL} ��Ϣ���

���Υ�󥯰ʳ��ˤ⡢¿���� @strong{MySQL} �ץ�����ࡢ�ġ��롢API �� 
@uref{http://www.mysql.com/Contrib/, Contrib directory} ���鸫�Ĥ��ƥ���
������ɤ��뤳�Ȥ��Ǥ��ޤ���

@subheading Tutorials
@itemize @bullet

@item @uref{http://www.devshed.com/resource/advanced/mysql/index.html, A
beginner's tutoral of how to start using @strong{MySQL}}

@item @uref{http://www.analysisandsolutions.com/code/mybasic.htm}
Beginners @strong{MySQL} Tutorial on how to install and set up
@strong{MySQL} on a Windows machine.

@item @uref{http://www.devshed.com/Server_Side/MySQL/, A lot of @strong{MySQL} tutorials}

@item @uref{http://www.linuxplanet.com/linuxplanet/tutorials/1046/1/,
Setting Up a @strong{MySQL}-Based Website}

@item @uref{http://www.hotwired.com/webmonkey/backend/tutorials/tutorial1.html, @strong{MySQL}-Perl tutorial}

@item @uref{http://www.iserver.com/support/contrib/perl5/modules.html,Installing new Perl modules that require locally installed modules}

@item @uref{http://www.hotwired.com/webmonkey/databases/tutorials/tutorial4.html, PHP/@strong{MySQL} Tutorial}

@item @uref{http://www.useractive.com/, Hands on tutorial for @strong{MySQL}}
@end itemize

@subheading Porting MySQL / Using MySQL on different systems
@itemize @bullet
@item @uref{http://xclave.macnn.com/MySQL/,The MacOS Xclave}.
Running @strong{MySQL} on MacOSX
@item @uref{http://www.prnet.de/RegEx/mysql.html, MySql for MacOSX Server}
@item @uref{http://www.lilback.com/macsql/, Client libraries for the Macintosh}
@end itemize

@subheading Perl related links
@itemize @bullet
@item
@c Added 991122
@uref{http://haven.e-cactus.com/dbi_mysql, Perl DBI with @strong{MySQL} FAQ}
@end itemize

@subheading MySQL discussion forums
@itemize @bullet
@item
@uref{http://www.weberdev.com/, Examples using @strong{MySQL}; (check Top 20)}
@item
@uref{http://futurerealm.com/forum/futureforum.htm, FutureForum Web Discussion Software}
@end itemize

@c We should get longer descriptions for things in this category!
@subheading Commercial applications that support MySQL
@itemize @bullet
@item
@uref{http://www.supportwizard.com/, SupportWizard; Interactive helpdesk
on the web (This product includes a licensed copy of @strong{MySQL})}
@item 
@uref{http://www.stweb.org/, StWeb}
StWeb - Stratos Web and Application server - an easy-to-use, cross
platform, Internet/Intranet development and deployment system for
development of web-enabled applications. The standard version of StWeb
has a native interface to @strong{MySQL} database.
@item
@uref{http://www.rightnowtech.com/, Right Now Web; Web automation for customer service}
@item
@uref{http://www.ecker-software.de, Win32 GUI client}
A Win32 GUI client by David Ecker.
@item
@uref{http://www.icaap.org/Bazaar/, Bazaar; Interactive Discussion Forums with web interface}
@item
@uref{http://www.phonesweep.com/, PhoneSweepT} is the world's first
commercial Telephone Scanner. Many break-ins in recent years have come
not through the Internet, but through unauthorized dial-up
modems. PhoneSweep lets you find these modems by repeatedly placing
phone calls to every phone number that your organization
controls. PhoneSweep has a built-in expert system that can recognize
more than 250 different kinds of remote-access programs, including
Carbon Copy(TM), pcANYWHERET(TM), and Windows NT RAS. All information is stored
in the SQL database. It then generates a comprehensive report detailing
which services were discovered on which dial-up numbers in your
organization.
@end itemize

@subheading SQL ���饤�����/Report writers

@itemize @bullet
@item
@uref{http://www.urbanresearch.com/software/utils/urbsql/index.html,
@strong{MySQL} Editor/Utility for MS Windows Platforms.}
@item
@uref{http://www.xnot.com/kmysql, KDE @strong{MySQL} client}
@item
@c EMAIL: bilhaut_f@mail.cpod.fr (Frik Bilhaut)
@uref{http://www.penguinpowered.com/~kmysql, KMySQL}
KMySQL is a database client for KDE that primarily supports @strong{MySQL}.
@item
@uref{http://www.icaap.org/software/kiosk/, Kiosk; a @strong{MySQL} client for
database management}. Written in Perl. Will be a part of Bazaar.
@item
@uref{http://www.geocities.com/SiliconValley/Ridge/4280/GenericReportWriter/grwhome.html, A free report writer in Java}
@item
@uref{http://futurerealm.com/opensource/futuresql.htm, FutureSQL Web Database Administration Tool}.
FutureSQL by Peter F. Brown, is a Free, Open Source Rapid Application
Development web database administration tool, written in Perl,
using @strong{MySQL}. It uses @code{DBI:DBD} and @code{CGI.pm}. 

FutureSQL allows one to easily setup config files to view, edit, delete
and otherwise process records from a @strong{MySQL} database. It uses a data
dictionary, configuration files and templates, and allows "pre-processing"
and "post-processing" on both fields, records and operations. 
@item
@uref{http://www.javaframework.de,MySQLExport}
Export of @strong{MySQL} create statements and data in a lot of
different formats (SQL, HTML, CVS, text, ZIP, GZIP...)
@end itemize

@subheading @strong{MySQL} �򥵥ݡ��Ȥ��� Web ��ȯ�ġ���

@itemize @bullet
@item
@uref{http://www.php.net/, PHP: A server-side HTML-embedded scripting
language}
@item
@uref{http://www.midgard-project.org, The Midgard Application Server; a
powerful Web development environment based on @strong{MySQL} and PHP}
@item
@uref{http://www.smartworker.org, SmartWorker is a platform for web application development}
@item
@uref{http://xsp.lentus.se/, XSP: e(X)tendible (S)erver (P)ages and is a
HTML embedded tag language written in Java (previously known as XTAGS)}
@uref{http://www.dbServ.de/, dbServ} is an extension to a web server to
integrate databases output into your HTML code. You may use any HTML
function in your output. Only the client will stop you. It works as
standalone server or as JAVA servlet.
@item
@uref{http://www.chilisoft.com/, Platform independent ASP from Chili!Soft}
@c @item
@c no answer from server 990830
@c @uref{http://www.voicenet.com/~zellert/tjFM, A JDBC driver for @strong{MySQL}}
@item
@uref{http://www.wernhart.priv.at/php/, @strong{MySQL} + PHP demos}
@item
@uref{http://www.dbwww.com/, ForwardSQL: HTML interface to manipulate @strong{MySQL} databases}
@item
@uref{http://www.daa.com.au/~james/www-sql/, WWW-SQL: Display database
information}
@item
@uref{http://www.minivend.com/minivend/, Minivend: A Web shopping cart}
@item
@uref{http://www.heitml.com/, HeiTML: A server-side extension of HTML and
a 4GL language at the same time}
@item
@uref{http://www.metahtml.com/, Metahtml: A Dynamic Programming Language
for WWW Applications}
@item
@uref{http://www.binevolve.com/, VelocityGen for Perl and Tcl}
@item
@uref{http://hawkeye.net/, Hawkeye Internet Server Suite}
@item
@uref{http://www.fastflow.com/, Network Database Connection For Linux}
@item
@uref{http://www.wdbi.net/,
WDBI: Web browser as a universal front end to databases which supports
@strong{MySQL} well.}
@item
@uref{http://www.webgroove.com/, WebGroove Script: HTML compiler and server-side scripting language}
@item
@uref{http://www.ihtml.com/, A server-side web site scripting language}
@item
@uref{ftp://ftp.igc.apc.org/pub/myodbc/README, How to use @strong{MySQL} with ColdFusion on Solaris}
@item
@uref{http://calistra.com/MySQL/,Calistra's ODBC @strong{MySQL} Administrator}
@item
@uref{http://www.webmerger.com, Webmerger}
This CGI tool interprets files and generates dynamic output
based on a set of simple tags. Ready-to-run drivers for @strong{MySQL} and PostgreSQL
through ODBC.
@item
@uref{http://phpclub.unet.ru/index_e.php3, PHPclub}. Tips and tricks for PHP
@item
@uref{http://www.penguinservices.com/scripts, @strong{MySQL} and Perl Scripts}
@item
@uref{http://www.widgetchuck.com, The Widgetchuck; Web Site Tools and Gadgets}
@item
@uref{http://www.adcycle.com/, AdCycle} advertising management software
@item
@uref{http://www.bidsystems.com/pwPage, pwPage} provides an extremely
fast and simple approach to the creation of database forms.  That is,
if a database table exists and an HTML page has been constructed using
a few simple guidelines, pwPage can be immediately used for table data
selections, insertions, updates, deletions and selectable table content
reviewing.
@item
@uref{http://www.omnis-software.com/products/studio/studio.html, OMNIS}
OMNIS Studio is a rapid application development (RAD) tool.
@end itemize

@subheading Database design tools with MySQL support
@itemize @bullet
@item
@uref{http://www.mysql.com/dezign/index.html, "DeZign for
databases" is a database development tool using an 
entity relationship diagram (ERD).}
@end itemize

@subheading @strong{MySQL} �ġ���Ǥ� Web ������

@itemize @bullet
@item
@uref{http://bourbon.netvision.net.il/mysql/mod_auth_mysql/, An Apache
authentication module}
@item
@uref{http://www.roxen.com/, The Roxen Challenger Web server}
@end itemize

@subheading Extensions for other programs
@itemize @bullet
@item
@uref{http://www.seawood.org/msql_bind/, @strong{MySQL} support for BIND
(The Internet Domain Name Server)}
@item
@uref{http://www.inet-interactive.com/sendmail, @strong{MySQL} support for
Sendmail and Procmail}
@end itemize

@subheading Using @code{MySQL} with other programs

@itemize @bullet
@item
@uref{http://www.iserver.com/support/addonhelp/database/mysql/msaccess.html, Using @strong{MySQL} with Access}
@item
@uref{http://www.iserver.com/support/contrib/perl5/modules.html,Installing new Perl modules that require locally installed modules}
@end itemize

@subheading ODBC related links

@itemize @bullet
@item
@uref{http://www.iodbc.org/,Popular iODBC Driver Manager (libiodbc) now available in Open Source format}
@item
@uref{http://users.ids.net/~bjepson/freeODBC/,The FreeODBC Pages}
@item
@uref{http:/http://genix.net/unixODBC/,unixodbc} 
The unixODBC Project goals are to develop and promote unixODBC to be the
definitive standard for ODBC on the Linux platform.
This is to include GUI support for KDE. 
@end itemize

@subheading @strong{API} ��Ϣ���

@itemize @bullet
@item
@uref{http://www.amedea.cz/mysqlx/index.html, MySQL COM extension}
With this COM objects You can use MySQL also on Windows platform with ASP
pages or Delphi, Visual Basic, Visual C++, ... languages.
@item
@uref{http://www.jppp.com, www.jppp.com}
Partially implemented TDataset-compatible components for @strong{MySQL}.
@item
@uref{http://www.riverstyx.net/qpopmysql/,qpopmysql}
A patch to allow POP3 authentication from a @strong{MySQL} database.
There's also a link to Paul Khavkine's patch for Procmail to allow
any MTA to deliver to users in a @strong{MySQL} database.  
@item
@uref{http://www.pbc.ottawa.on.ca,Visual Basic class generator for Active X}
@item
@uref{http://www.lilback.com/macsql/, Client libraries for the Macintosh}
@c @item
@c @uref{http://tfdec1.fys.kuleuven.ac.be/~michael/fpc-linux/mysql,
@c @strong{MySQL} binding to Free Pascal}
@item
@uref{http://www.dedecker.net/jessie/scmdb/, SCMDB}.
SCMDB is an add-on for SCM that ports the mysql C library to scheme (SCM).
With this library scheme developers can make connections to a mySQL
database and use embedded SQL in their programs.
@end itemize


@subheading ¾�� @strong{MySQL} ��Ϣ���

@itemize @bullet
@item
@uref{http://www.wix.com/mysql-hosting, Registry of Web providers who
support @strong{MySQL}}
@item
@uref{http://www.softagency.co.jp/mysql/index.en.phtml, Links about using
@strong{MySQL} in Japan/Asia}
@item
@uref{http://www.open.com.au/products.html, Commercial Web defect tracking
system}
@item
@uref{http://www.stonekeep.com/pts/, PTS: Project Tracking System}
@item
@uref{http://tomato.nvgc.vt.edu/~hroberts/mot, Job and software tracking
system}
@c @item
@c Error 404 990830
@c @uref{http://home.wxs.nl/cgi-bin/planeteers/pgidszoek.cgi, Full-text search engine using @strong{MySQL}}
@item
@uref{http://www.cynergi.net/non-secure/exportsql/, ExportSQL: A script
to export data from Access95+}
@item
@uref{http://SAL.KachinaTech.COM/H/1/MYSQL.html, SAL (Scientific
Applications on Linux) @strong{MySQL} entry}
@item
@c Removed 990510
@c @item
@c @uref{http://www.cgishop.com/bin/mysqllist, @strong{MySQL} Apps and
@c Utilities Listing}
@c @uref{http://www.luth.se/~goggi/proj/mysql/man/mysql.pdf, The
@c @strong{MySQL} reference manual in Adobe PDF format}
@item
@uref{http://www.infotech-nj.com/itech/index.shtml, A consulting company
which mentions @strong{MySQL} in the right company}
@item
@uref{http://www.pmpcs.com/, PMP Computer Solutions. Database developers using
@strong{MySQL} and @code{mSQL}}
@item
@uref{http://www.aewa.org, Airborne Early Warning Association }
@item
@uref{http://abattoir.cc.ndsu.nodak.edu/~nem/mysql/udf/, @strong{MySQL} UDF Registry}
@item
@uref{http://21ccs.com/~gboersm/y2kmatrix/, Y2K tester}
@end itemize

@subheading SQL �ȥǡ����١������󥿥ե�����
@itemize @bullet
@item
@uref{http://java.sun.com/products/jdbc/, The JDBC database access API}
@item
@uref{http://www.gagme.com/mysql, Patch for @code{mSQL} Tcl}
@item
@uref{http://www.amsoft.ru/easysql/, EasySQL: An ODBC-like driver manager}
@item
@uref{http://www.lightlink.com/hessling/rexxsql.html, A REXX interface to SQL databases}
@item
@uref{http://www.binevolve.com/~tdarugar/tcl-sql, Tcl interface}
@end itemize

@subheading ��ȥ�����

@itemize @bullet
@item
@c Added 990601
@c EMAIL: thuss@little6.com (Todd Huss)
@uref{http://www.little6.com/about/linux/, Little6 Inc} An online contract and job finding site that is powered by @strong{MySQL}, PHP3 and Linux.
@item
@c Added 990521
@c EMAIL: nh@delec.com (Hillbrecht Nicole)
@uref{http://www.delec.com/is/products/prep/examples/BookShelf/index.html, DELECis} A tool which makes it very easy to create an automatically generated table documentation. They have used @strong{MySQL} as an example.
@c @item
@c Added 990531. Removed 000201 -> No answer from server
@c EMAIL: sfambro@hotmail.com (Steve Fambro)
@c @uref{http://shredder.elen.utah.edu/steve.html, Steve Fambro}
@c Uses @strong{MySQL} and webmerger. There is an employee database, and a
@c license plate database with all of the registered Utah vehicles (over
@c 1.2 million). The License plate field is indexed.....so the *searches*
@c are instantaneous.
@item
@c Added 990521
@c EMAIL: info@worldrecords.com (Jim Rota)
@uref{http://www.worldrecords.com, World Records} A search engine for information about music that uses @strong{MySQL} and PHP.
@item
@uref{http://www.webtechniques.com/archives/1998/01/note/,
A Contact Database using @strong{MySQL} and PHP}
@item
@uref{http://modems.rosenet.net/mysql/, Web based interface and Community Calender with PHP}
@item
@uref{http://www.odbsoft.com/cook/sources.htm, Perl package to generate html from a SQL table structure and for generating SQL statements from an html form.}
@item
@uref{http://www.gusnet.cx/proj/telsql/,Basic telephone database using @code{DBI}/@code{DBD}}.
@item
@uref{http://www.productivity.org/projects/mysql/, @strong{TmySQL}; A library to use @strong{MySQL} with Delphi}
@item
@uref{http://tecfa.unige.ch/guides/java/staf2x/ex/jdbc/coffee-break, JDBC examples by Daniel K. Schneider}
@item
@uref{http://www.spade.com/linux/howto/PostgreSQL-HOWTO-41.html,SQL BNF}
@item
@uref{http://www.ooc.com/, Object Oriented Concepts Inc; CORBA applications with examples in source}
@item
@uref{http://www.pbc.ottawa.on.ca/,DBWiz; Includes an example of how to manage own cursors in VB}
@item
@uref{http://keilor.cs.umass.edu/pluribus/, Pluribus}
Pluribus, is a free search engine that learns to improve
the quality of its results over time. Pluribus works by recording
which pages a user prefers among those returned for a query. A user
votes for a page by selecting it; Pluribus then uses that knowledge
to improve the quality of the results when someone else submits the
same (or similar) query. Uses PHP and @strong{MySQL}.
@item
@c EMAIL: paul@sword.damocles.com (Paul Bannister)
@uref{http://www.stopbit.com/, Stopbit}
A technology news site using @strong{MySQL} and PHP
@item
@c Added 990604
@c EMAIL: ah@dybdahl.dk 
@uref{http://www.jokes2000.com/scripts/, Example scripts at Jokes2000}
@item
@uref{http://www.linuxsupportline.com/~kalendar/ KDE based calendar manager}
The calendar manager has both single user (file based) and multi user
(@strong{MySQL} database) support.
@item
@uref{http://tim.desert.net/~tim/imger/,Example of storing/retrieving images with @strong{MySQL} and CGI}
@item
@uref{http://www.penguinservices.com/scripts, Online shopping cart system}
@end itemize

@subheading ����Ū�ʥǡ����١������
@itemize @bullet
@item
@uref{http://www.pcslink.com/~ej/dbweb.html, Database Jump Site}
@item
@uref{http://black.hole-in-the.net/guy/webdb/, Homepage of the webdb-l
(Web Databases) mailing list.}
@item
@uref{http://www.symbolstone.org/technology/perl/DBI/index.html,
Perl @code{DBI}/@code{DBD} modules homepage}
@item
@uref{http://www.student.uni-koeln.de/cygwin/, Cygwin tools. UNIX on top of Windows}
@item
@uref{http://dbasecentral.com/, dbasecentral.com; Development and distribution of powerful and easy-to-use database applications and systems.}
@item
@uref{http://www.Tek-Tips.com, Tek-Tips Forums} Tek-Tips Forums are 800+
independent peer-to-peer non-commercial support forums for Computer
Professionals.  Features include automatic e-mail notification of
responses, a links library, and member confidentiality guaranteed.
@end itemize

@strong{MySQL} ����Ѥ���¿���� web �ڡ����⤢��ޤ���@xref{Users}������
�ꥹ�Ȥ��ɲäǤ����Τ� @email{webmaster@@mysql.com} �����äƤ���������
We now require that you show a
@strong{MySQL} logo somewhere (It is okay to have it on a ``used tools'' page
or something similar) to be added.

@cindex Reporting errors
@cindex @strong{MySQL} mailing lists
@node Questions, Licensing and Support, Introduction, Top
@chapter @strong{MySQL} �᡼��󥰥ꥹ�Ȥȼ���򤹤���ˡ�ޤ��ϥ��顼(�Х�)����𤹤���ˡ

@menu
* Mailing-list::                @strong{MySQL} �᡼��󥰥ꥹ��
* Asking questions::            �����������
* Bug reports::                 �Х����������𤹤���ˡ
* Answering questions::         �᡼��󥰥ꥹ�ȤǼ���������뤿��Υ����ɥ饤��
@end menu

@node Mailing-list, Asking questions, Questions, Questions
@section @strong{MySQL} �᡼��󥰥ꥹ��

�ᥤ�� @strong{MySQL} �᡼��󥰥ꥹ�Ȥ���ɤ���ˤϡ���å�������
�Żҥ᡼�륢�ɥ쥹 @email{mysql-subscribe@@lists.mysql.com} �����äƤ���������

�ᥤ�� @strong{MySQL} �᡼��󥰥ꥹ�Ȥι��ɤ���ߤϡ���å�������
�Żҥ᡼�륢�ɥ쥹 @email{mysql-unsubscribe@@lists.mysql.com} �����äƤ���������

��å�������������Υ��ɥ쥹���������פǤ�����å������Υ��֥������Ȥ�
��ʸ��̵�뤵��ޤ���

@c the last two addresses in this paragraph are NOT @email because they
@c shouldn't be live links.
�⤷�����ʤ��Υ�ץ饤���ɥ쥹��������ʪ�Ǥʤ���硢���ɥ쥹�����Τ˻��ꤹ�뤳�Ȥ�����ޤ���
subscribe ���뤤�� unsubscribe �Τ��Ȥ˥ϥ��ե���դ������Τ��Ȥˤ��ʤ���
���ɥ쥹�򵭽Ҥ��ޤ��������� @samp{@@} ʸ���� @samp{=} ���֤��Ѥ��ƽ񤭤ޤ���
�㤨�С� @code{john@@host.domain} �ǹ��ɤ�������硢
 @code{mysql-subscribe-john=host.domain@@lists.mysql.com} ���˥�å�����������ޤ���

@email{mysql-subscribe@@lists.mysql.com} �� @email{mysql-unsubscribe@@lists.mysql.com} 
�ؤΥ᡼��� ezmlm �᡼��󥰥ꥹ�ȥץ����å��ˤ�äƼ�ưŪ�˽�������ޤ���
ezmlm �ˤĤ��Ƥξ���� @uref{http://www.ezmlm.org, The ezmlm Website}.

�ܥ᡼��󥰥ꥹ�Ȥؤ���Ƥ�Ԥ��ˤϡ�@code{mysql@@lists.mysql.com} �˥�å�����������ޤ���
��������subscribe ���뤤�� unsubscribe �Υ᡼���
 @email{mysql@@lists.mysql.com} ��@emph{����ʤ��Ǥ�������}��
�����Υ��ɥ쥹������줿�᡼��ϡ������Υ桼��������������Ƥ��ޤ��ޤ���

���ʤ��Υ������륵���Ȥ�¿���� @email{mysql@@lists.mysql.com} ���ɼԤ���Ĥ��Ȥ�
����ޤ������ξ�硢��������᡼��󥰥ꥹ�Ȥ��ꡢ@code{lists.mysql.com} �����
��ĤΥ�å����������Υ����Ȥ�����졢��������ʥꥹ�Ȥ�ʣ�̤����褦��
���Ƥ������������ξ�硢��������� @strong{MySQL} �ꥹ�Ȥؤ��ɲäȺ���ϡ�
���ʤ��Υ����ƥ�����Ԥ��䤤��碌�Ʋ�������

���� @strong{MySQL} �᡼��󥰥ꥹ�Ȥ�����ޤ�:

@table @code
@item announce
����� @strong{MySQL} �ȴ�Ϣ�ץ������ο������С������Υ��ʥ��󥹤Τ�
��Ǥ�������ϡ����Ƥ� @strong{MySQL} �桼��������٤��Ȳ桹���ͤ��뾯��
���̤Υꥹ�ȤǤ���

@item mysql
���̤� @strong{MySQL} �����Τ���μ�ʥꥹ�ȤǤ������������Ū�ʥꥹ�Ȥ�
�Ԥ��٤���Τ⤢�뤳�Ȥ����դ��Ƥ����������ְ�ä��ꥹ�Ȥ���Ƥ��Ƥ⡢��
�������ʤ��Ǥ��礦��

@item mysql-digest
�����������ȷ����� @code{mysql} �ꥹ�ȤǤ�������ϡ������˰�󡢰�Ĥ���
���ʥ᡼�뤬�����뤳�ȤǸġ��Υ�å��������Ƥ������뤳�Ȥ��̣���ޤ���

@item bugs
���Υꥹ�Ȥˤϡ������ǺƸ���ǽ�ʥХ���ݡ��Ȥ�����@code{mysqlbug} ���
�Ѥ�����Ƥ��٤��Ǥ�(Windows ��Ǽ¹Ԥ��Ƥ�����ϡ�OS �� 
@strong{MySQL} �С������ε��Ҥ�ޤ��٤��Ǥ�)���Ǥ���С�������� 
@strong{MySQL} �κǿ��ΰ���С�����󤫳�ȯ�С���������Ѥ���������
���Ȥ��٤��Ǥ��� �ޤ��줿�ƥ��ȥ�������ǡ�'mysql test < script' ���
�Ѥ��뤳�Ȥǡ�ï�⤬�Х���Ƹ��Ǥ���٤��Ǥ������Υꥹ�Ȥ���Ƥ��줿����
�ΥХ��ϡ����� @strong{MySQL} ��꡼���ǽ�������뤫�ɥ�����Ȳ������
���� �����ʥ����ɤ��ѹ������Ǥ���С��桹�Ϥ��������������ѥå�����
�Ƥ�Ԥʤ��ޤ���

@item bugs-digest
�����������ȷ����� @code{bugs} �ꥹ�ȤǤ���

@item developer
@strong{MySQL} �����ɤ�ư�����ͤΤ���Υꥹ�ȡ����Υꥹ�ȤǤ� 
@strong{MySQL} ��ȯ�ε����ȥѥå�����Ƥ��ǽ�Ǥ���

@item developer-digest
@code{developer} �ꥹ�ȤΥ����������ȥС������

@item java
@strong{MySQL} �� Java �ˤĤ��Ƥε�����¿���� JDBC �ɥ饤�ФˤĤ��ƤǤ���

@item java-digest
@code{java} �ꥹ�ȤΥ����������ȥС������

@item win32
Windows NT �Τ褦�� Microsoft OS ��� @strong{MySQL} �˴�Ϣ�������ơ�

@item win32-digest
@code{win32} �ꥹ�ȤΥ����������ȥС������

@item myodbc
ODBC �� @strong{MySQL} �ؤ���³�˴�Ϣ�������ơ�

@item myodbc-digest
@code{myodbc} �ꥹ�ȤΥ����������ȥС������

@item msql-mysql-modules
@strong{MySQL} �ǥ��ݡ��Ȥ��� Perl �ˤĤ��ƤΥꥹ�ȡ�

@item msql-mysql-modules-digest
@code{msql-mysql-modules} �ꥹ�ȤΥ����������ȥС������
@end table

��Ҥ����Τ�Ʊ����ˡ�����ƤΥꥹ�Ȥι��ɤޤ��Ϲ�����ߤ��Ǥ��ޤ������ʤ�
�ι��ɤޤ��Ϲ�����ߤΥ�å������ϡ�@code{mysql} �ǤϤʤ�Ŭ�ڤʥ᡼��󥰥ꥹ
�Ȥ����äƤ����������㤨�С� @code{myodbc} �ꥹ�Ȥ���ɤޤ��Ϲ�����ߤ���ˤϡ�
@email{myodbc-subscribe@@lists.mysql.com} �ޤ���
@email{myodbc-unsubscribe@@lists.mysql.com} �˥᡼�������ޤ���


@cindex Net etiquette
@node Asking questions, Bug reports, Mailing-list, Questions
@section ����ޤ��ϥХ����

�᡼��󥰥ꥹ�Ȥؼ����Ҥͤ����ˡ��ʲ��μ���Ƨ��Ǥ���������

@itemize @bullet
@item
@strong{MySQL} �Υ���饤��ޥ˥奢���Ĵ�٤뤳�Ȥ���Ϥ���ޤ���

@example
@uref{http://www.mysql.com/Manual_chapter/manual_toc.html}
@end example

�桹�ϡ����������Ĥ��ä�����β��ǥޥ˥奢������ˤ˹������뤳�Ȥǡ������
�ǿ����ݻ����褦�Ȥ��Ƥ��ޤ��� 

@item
@strong{MySQL} �᡼��󥰥ꥹ�ȥ��������֤򸡺����ޤ���

@example
@uref{http://www.mysql.com/doc.html}
@end example

@item
@uref{http://www.mysql.com/} 
�����Ƥ� Web �ڡ���(�ޥ˥奢���ޤ�)�򸡺����뤿��� 
@uref{http://www.mysql.com/search.html} ����ѤǤ��ޤ���
@end itemize

�����Dz��������Ĥ����ʤ����ϡ��᤯�� @strong{MySQL} �����ԤȤȤ�
��Ĵ�٤Ʋ��������ޤ����ʤ��μ���β��������Ĥ����ʤ���С���˿ʤߡ���
�Υ��������� @email{mysql@@lists.mysql.com} �إ᡼���������ˡ�ˤĤ��Ƥ��ɤ��
����������

@cindex Bug reports
@cindex Reporting bugs
@node Bug reports, Answering questions, Asking questions, Questions
@section �Х����������𤹤���ˡ

�ɤ��Х���ݡ��Ȥ�񤯤Τ�Ǧ�Ѥ��פ�ޤ����������ǽ���������Ԥʤ�����
�ϲ桹�Ȥ��ʤ�������֤����󤷤ޤ���
���ΥХ��ˤĤ��Ƥδ����ʥƥ��ȥ�������ޤ��ɤ��Х���ݡ��Ȥϡ����Υ�꡼
���Ǥ��줬����������ǽ�����ȤƤ�⤯�ʤ�ޤ���
������Ǥϡ����ʤ�Ρ��ޤ��������桹
�ν����ˤʤ�ʤ����Ȥˤ��ʤ��λ��֤�ϲ�񤷤ʤ��褦�ˡ����ʤ�����ݡ��Ȥ�
�������񤯤��Ȥ��������ޤ���

�桹�ϡ��Х���ݡ��Ȥޤ���ǽ�ʤ�����Ƥ�����ˤĤ��ƤΥ�ݡ��Ȥκ����� 
@code{mysqlbug} ������ץȤ���Ѥ��뤳�Ȥ��夷�ޤ���@code{mysqlbug} ��
������������� @file{scripts} �ǥ��쥯�ȥꡢ�ޤ��ϡ��Х��ʥ����ۤǤ� 
@strong{MySQL} �򥤥󥹥ȡ��뤷���ǥ��쥯�ȥ��۲��� @file{bin} �ǥ��쥯
�ȥ꤫�鸫�Ĥ����ޤ���@code{mysqlbug} ����ѤǤ��ʤ����ϡ�������˵�
�����Ƥ������Ƥ�ɬ�פʾ����ޤ��٤��Ǥ���

@code{mysqlbug} ������ץȤϡ�������¿���ξ����ưŪ�˸��Ĥ��Ф����Ȥǡ�
��ݡ��Ȥκ������������ޤ��������������פʲ�����­��ʤ���硢���ʤ���
��å������ˤ����ޤ�Ƥ��������� ������򿵽Ť��ɤ�ǡ������ǽҤ٤��
�Ƥ������Ƥξ��󤬥�ݡ�����˴ޤޤ�Ƥ��뤳�Ȥ��ǧ���Ƥ���������

�Х������Τ˼����ƥ��ȥ��������뤳�Ȥ��Ǥ���С�
@email{bugs@@list.mysql.com} �ꥹ�Ȥˤ������Ƥ��Ƥ�������������: ����
�ꥹ�Ȥˤϡ������ǺƸ���ǽ�ʥХ������ @code{mysqlbug} ������ץȤ����
������Ƥ��٤��Ǥ�(Windows ��Ǽ¹Ԥ��Ƥ�����ϡ�OS �� 
@strong{MySQL} �С������ε��Ҥ�ޤ��٤��Ǥ�)���Ǥ���С�������� 
@strong{MySQL} �κǿ��ΰ���С�����󤫳�ȯ�С���������Ѥ���������
���Ȥ��٤��Ǥ��� �ޤ��줿�ƥ��ȥ�������ǡ�'mysql test < script' ���
�Ѥ��뤳�Ȥǡ��ޤ��ϡ��Х���ݡ��Ȥ˴ޤ��줿������/Perl������ץȤ��
�Ԥ��뤳�Ȥǡ�ï�⤬�Х���Ƹ��Ǥ���٤��Ǥ������Υꥹ�Ȥ���Ƥ��줿����
�ΥХ��ϡ����� @strong{MySQL} ��꡼���ǽ�������뤫�ɥ�����Ȳ������
���� �����ʥ����ɤ��ѹ������Ǥ���С��桹�Ϥ��������������ѥå�����
�Ƥ�Ԥʤ��ޤ���

¿����������ޤ��å������������뤳�ȤϤǤ��ޤ��������ʤ����������
���ΤˤϤǤ��ʤ��Ȥ������Ȥ�Ф��Ƥ��Ƥ������������Ф��пͤϻ��¤�ʤ�
�Ƥ��ޤ��ޤ�������θ�����狼�äƤ���Ȼפ��������Ĥ��ξܺ٤����Ǥʤ�
�ȸ��ʤ��Ƥ��ޤ�����Ǥ����ɤ���§��: ��������������¤ä��Ȥ��ˤϡ�����
�Ƥ��������� �ǽ�ˤ��ʤ�����ʬ�ʾ����ޤ�ʤ��ä�����ˡ��ƤӼ��䤷��
�������ԤĤ��Ȥ��פ�����ꡢ���Ԥ򤢤ʤ��Υ�ݡ��Ȥ˽���������®��
�����ǤǤϤ���ޤ���

�ɤ�����ְ㤤�ϡ����Ѥ��Ƥ��� @strong{MySQL} ���ۤΥС�������ֹ�򼨤�
�ʤ����ޤ��� @strong{MySQL} �򥤥󥹥ȡ��뤷���ץ�åȥե������(�ץ��
�ȥե�����ΥС�������ֹ��ޤ��)�����ʤ����Ǥ�������ϤȤƤ��Ϣ����
����ǡ�100 �ΥХ���ݡ��ȤΤ��� 99 �ξ�硢���ξ��󤬤ʤ������Ω���ޤ�
�� �桹�� ``���λ�Ǥ�ư��ʤ��Ρ�'' �Τ褦�ʼ����ȤƤ��ɤ�������
���������Ʋ桹�ϡ��׵ᤵ�줿��ǽ�Ϥ��� @strong{MySQL} �С������˼�����
��Ƥ��ʤ����ޤ��ϡ���ݡ�����˽Ҥ٤��Ƥ���Х��Ͽ����� 
@strong{MySQL} �С������Ǵ��˽�������Ƥ���Ǥ��뤳�Ȥ򸫤Ĥ��ޤ���������
���顼�ϥץ�åȥե������¸�ǡ����ڥ졼�ƥ��󥰥����ƥ�ȥץ�åȥե���
��ΥС�������ֹ���Τ�ʤ����Ȥˤϡ����⽤�����뤳�ȤϤǤ��ޤ���

����˴�Ϣ���Ƥ�����ϡ�����ѥ���ˤĤ��Ƥξ����Ϳ���뤳�Ȥ�˺��ʤ�
�Ǥ������������Ф��пͤϥ���ѥ���ΥХ��򸫤Ĥ��ơ������ 
@strong{MySQL} �˴�Ϣ���Ƥ���ȹͤ��ޤ���¿���Υ���ѥ���Ϥ��ĤⳫȯ��
�ǡ��С�������夲�뤳�Ȥˤ�äƤ���ɤ��С������ˤʤ�ޤ������꤬��
��ѥ���˰�¸���Ƥ��뤫�ɤ�������ꤹ��ˤϡ��ɤΥ���ѥ��餬���Ѥ����
���뤫���Τ뤳�Ȥ�ɬ�פǤ������ƤΥ���ѥ��������ϥХ���ݡ��ȤȤߤʤ�
�졢����˽��ä���𤵤��٤��Ǥ��뤳�Ȥ����դ��Ƥ���������

�Ǥ����Ω�ĤΤϡ�������ɤ��������Х���ݡ��Ȥ˴ޤ���뤳�ȤǤ����Ĥ�
�ꡢ�����Ƴ��������ƤιԤʤä����Ȥ���ȡ����Τ˵��Ҥ��줿���ꤽ�켫��
�Ǥ����ɤ��Х���ݡ��Ȥϡ��Х��������Ƹ�������ˡ�򼨤����������ޤ��
�ΤǤ���

���꤬���顼��å�������Ϳ�����硢������ݡ��Ȥ˴ޤ�뤳�ȤϤȤƤ��
�פǤ��� �桹���ץ���������Ѥ��륢�������֤��鲿���򸡺����褦�Ȥ���
��硢���顼��å������ϥץ�����बͿ������Τ����Τ˰��פ��������ɤ���
��(��ʸ����ʸ��������٤��Ǥ���)���ɤΤ褦�ʥ��顼��å��������ä���
��Ф���ʤ�Ƥ��ȤϤ��ƤϤ����ޤ��󡨥�ݡ��Ȥ˴����ʥ�å������򥳥ԡ�
��ĥ��Ĥ��Ƥ���������

MyODBC �Ǥ����꤬�����硢MyODBC �ȥ졼���ե�������������ߤ�٤��Ǥ���
@xref{MyODBC bug report}��

���ʤ��Υ�ݡ��Ȥ��ɤ�¿���οͤ� 80��ǥ����ץ쥤����Ѥ��Ƥ���Ȥ�����
�Ȥ�Ф��Ƥ����Ʋ����������äơ�@code{mysql} ���ޥ�ɥ饤��ġ�������
���ƥ�ݡ��Ȥޤ��ϥ���ץ����������������Τ褦�ʥǥ����ץ쥤��ͭ������
Ķ�������(�㤨�С�@code{EXPLAIN SELECT} ���ơ��ȥ���; ��ҤΥ���ץ�
�򸫤Ƥ�������)�ˤϡ�@code{--vertical} ���ץ����(�ޤ��� @code{\G} ���ơ�
�ȥ��Ƚ�ü)����Ѥ��٤��Ǥ���

���ξ�����ݡ��Ȥ˴ޤ�Ƥ�������:

@itemize @bullet
@item
���Ѥ��Ƥ��� @strong{MySQL} ���ۤΥС�������ֹ� (�㤨�� @strong{MySQL}
3.22.22)���ɤΥС�������ư�����Ƥ��뤫�� @code{mysqladmin version} ��
�¹ԤǸ��Ĥ����ޤ���@code{mysqladmin} �� @strong{MySQL} �Υ��󥹥ȡ���
�ǥ��쥯�ȥ��۲��� @file{bin} �ǥ��쥯�ȥ�˸��Ĥ����ޤ���

@item
���ʤ�����Ȥ��Ƥ���ޥ���Υ᡼�����ȥ�ǥ롣

@item
���ڥ졼�ƥ��󥰥����ƥ�̾�ȥС������¿���Υ��ڥ졼�ƥ��󥰥����ƥ��
�ϡ�Unix ���ޥ�� @code{uname -a} �μ¹Ԥˤ�äƤ��ξ��������ޤ���

@item
���ˤϥ���(�¥���Ȳ��ۥ���)���̤�ط����ޤ������路����С������
�ޤ�Ƥ���������

@item
@strong{MySQL} �Υ��������ۤ���Ѥ��Ƥ�����ϡ����Ѥ�������ѥ����̾
���ȥС�������ֹ�ˤĤƤξ����ɬ�פǤ����Х��ʥ����ۤξ��ϡ�����̾��
ɬ�פǤ���

@item
���꤬����ѥ������ȯ�������硢���Τʥ��顼��å������ȡ����顼��ȯ��
�����ե����������Υ����ɤβ��ο��Ԥ�ޤ�Ʋ�������

@item

�����Υǡ����١����ơ��֥뤬����˴�Ϣ������ϡ�
@code{mysqldump --no-data db_name tbl_name1 tbl_name2 ...} ����ν��Ϥ�ޤ��
��������������ϥǡ����١������Ǥ�դΥơ��֥�ˤĤ��Ƥξ��������ȤƤ�
��ñ�Ƕ��Ϥ���ˡ�ǡ��桹�����ʤ��ξ����˰��פ����Τ��������������ˤ�
��ޤ���

@item
@code{SELECT} ���ơ��ȥ��ȤǤ�®�٤˴ؤ���Х�������Ǥϡ�
@code{EXPLAIN SELECT ...} �ν��Ϥȡ����ʤ��Ȥ� @code{SELECT} ���ơ��ȥ�
��Ȥ�Ϳ����Ԥο����˴ޤ��٤��Ǥ������ʤ��ξ����ˤĤ��ơ����¿����
�����ï�������ʤ����������褦�ˡ����Ŭ�ڤ�Ϳ���Ƥ��������� �㤨
�С����ϤȤƤ��ɤ��Х���ݡ��Ȥ���Ǥ��ʤ������ @code{mysqlbug} ������ץȤ���
�Ƥ���Ƥޤ���:

@code{mysql} ���ޥ�ɹԥġ����۲��Ǥμ¹���(����: ���������ǥ����ץ쥤��
�֤�80���Ķ���륹�ơ��ȥ��Ȥˤϡ�@code{\G} ���ơ��ȥ��Ƚ�ü����Ѥ�
�Ƥ�������):

@example
mysql> SHOW VARIABLES;
mysql> SHOW COLUMNS FROM ...\G
       <output-from-SHOW-COLUMNS>
mysql> EXPLAIN SELECT ...\G
       <output-from-EXPLAIN>
mysql> FLUSH STATUS;
mysql> SELECT ...;
       <A short version of the output from SELECT,
       including the time taken to run the query>
mysql> SHOW STATUS;
       <output from SHOW STATUS>
@end example

@item
�����Х��� @strong{MySQL} �¹����ȯ�������硢�Х���Ƹ��������ϥ���
��ץȤ�ɬ�פǤ������Υ�����ץȤ�ɬ�פʥ������ե��������Ƥ�ޤ��٤���
���������̩�ʥ�����ץȤϤ��ʤ��Τ˻����������ɤ��Ƹ��Ǥ��ޤ���

�⤷������ץȤ��󶡤��뤳�Ȥ��Ǥ��ʤ���С����ʤ��Ȥ⡢
@code{mysqladmin variables extended-status processlist} ��
���Ϸ�̤�᡼��ˤ�ޤ�٤��Ǥ��� ����Ϥ��ʤ��Υ����ƥ�ξ����
�󶡤��ޤ���

@item
@strong{MySQL} �������꤫��۾�ʷ�̤�Ϳ����Ȼפ����ϡ���̤����Ǥ�
������̤��ɤ��ʤ�٤����Ȥ������ʤ��ΰո��ȡ����ʤ��ΰո��δ��ܤ�������
����ͳ��ޤ�Ƥ���������

@item
����Υ���ץ���󶡤�����ˡ�������̾���ˤ�����⡢�ºݤξ�����¸�ߤ�
��Τ�Ʊ���ѿ�̾��ơ��֥�̾������Ѥ��������ɤ��Ǥ���������ѿ���ơ���
������̾���˴�Ϣ���뤳�Ȥ�����ޤ��� �����餯����Ϥޤ�ʥ������Ǥ�����
sorry ���� safe �������ɤ��Ǥ�����ɡ��ºݤ˻��äƤ��뤢�ʤ��Υ���ץ�
���Ʊ����������Ѥ��뤳�ȤϤ��ʤ��ˤȤäƤ��ñ�ǡ��桹�ˤȤäƤ����Ƥ�
��̣���ɤ����ȤǤ���¾�οͤ˸��������ʤ��ǡ����򤤤��Ĥ����äƤ����硢
@code{ftp} ����Ѥ��� @uref{ftp://www.mysql.com/pub/mysql/secret/} �˥ǡ�
����ž�����뤳�Ȥ��Ǥ��ޤ����ǡ����������˺ǹⵡ̩�Dz桹�ˤ�������������
�����ϡ���˿ʤ�ǡ�¾���ѿ�̾������Ѥ��ƥ���ץ���äƤߤƤ���������
����������ϺǸ������ȻפäƤ���������

@item
��ǽ�ʤ�С���Ϣ�ץ�������Ϳ����줿���ƤΥ��ץ�����ޤ�Ƥ���������
�㤨�С�@code{mysqld} �ǡ���󳫻ϻ��˻��Ѥ������ץ����� 
@strong{MySQL} ���饤����ȥץ������¹Ԥ˻��Ѥ������ץ����򼨤��Ƥ�
����������@code{mysqld}, @code{mysql} �ޤ��� @code{configure} ������ץ�
�ؤΥ��ץ����Ϥ��Ф��в����ؤΥ����ˤʤꡢ�ȤƤ��Ϣ���Ƥ��ޤ��� �Ȥ�
����������ޤ��Ȥ����Τϰ����ͤ��ǤϤ���ޤ��� Perl �� PHP �ʤɤ�
�⥸�塼�����Ѥ��Ƥ����硢�����ΥС�������ֹ��ޤ�Ƥ���������

@item
���ԤΥƥ��ȥ��������󶡤Ǥ��ʤ���硢�ޤ��ϥƥ��ȥơ��֥뤬�᡼��󥰥�
���Ȥ˥᡼�뤹��ˤ��礭������(10�԰ʾ�)��硢@code{mysqldump} ����Ѥ�
�Ƥ��ʤ��Υơ��֥�����פ������ʤ���������������� @file{README} �ե�
�������٤��Ǥ���

@code{tar} �� @code{gzip} �ޤ��� @code{zip} ����Ѥ��ơ��ե�����ΰ��̥���
�����֤������������Υ��������֤� @code{ftp} ����Ѥ��� 
@uref{ftp://www.mysql.com/pub/mysql/secret/} ��ž�����Ƥ������������줫
�������û�������� @email{mysql@@lists.mysql.com} �����äƤ���������

@item
���䤬���¥����ƥ�˴�Ϣ�����硢@code{mysqlaccess} �ν��ϡ�
@code{mysqladmin reload} �ν��ϡ���³���褦�Ȥ�����������줿���ƤΥ��顼
��å�������ޤ�Ƥ��������� ���¤�ƥ��Ȥ�������ޤ� @code{mysqlaccess} 
��¹Ԥ��٤��Ǥ������θ塢@code{mysqladmin reload version} ��¹Ԥ�����
������꤬ȯ������ץ������Ǥ���³���ߤ�٤��Ǥ���@code{mysqlaccess} 
��@strong{MySQL} ���󥹥ȡ���ǥ��쥯�ȥ��۲��� @file{bin} �ǥ��쥯�ȥ�
�˸��Ĥ����ޤ���

@item
���ʤ����Х��ˤĤ��ƤΥѥå�����äƤ���Τ��ɤ����Ǥ�������
�Υѥå������٤ơ��桹�����Ƥ����Τǡ����ʤ��Υѥå�����������Х���
�ƥ��Ⱦ�����󶡤��ʤ��Ƥ⡢�桹���������Ѥ����������
�Ȼפ�ʤ��Ǥ����������桹�Ϥ��ʤ��Υѥå�������򸫤Ĥ��뤫�⤷��ޤ���
�����ޤ��ϡ��������������Ǥ��ʤ����⤷��ޤ��󡣤��ξ��Ϥ������Ѥ�
���ޤ���

���Υѥå��˰�̣�����뤳�Ȥ����Τ˳Τ�����ʤ���С��桹�Ϥ������Ѥ�
�ޤ��󡣥ƥ��ȥ������ϲ桹�ˤ��μ�����򤷤ޤ����ѥå������ꤦ�����Ƥξ�
���򰷤����Ȥ򼨤��Ƥ����������ѥå���ư��ʤ��������Υ�����(���줬��
�Ǥ�)�򸫤Ĥ�����硢�ѥå��ϻ��Ѥ���ʤ��Ǥ��礦��

@item
�����Х���������ȯ������Τ������˰�¸���Ƥ���Τ����ˤĤ��Ƥο�¬���̾�
�ְ㤤�Ǥ����桹�Ǥ������ޤ��ǥХå�����Ѥ��ƥХ��μºݤθ����򸫤Ĥ���
����С����Τ��ȤϿ�¬�Ǥ��ޤ���

@item
�᡼���å�������ˡ����ʤ�����ե���󥹥ޥ˥奢��ȥ᡼�륢�������֤�
�����å��������Ȥ򼨤��Ƥ�����������������С����ʤ�������򤢤ʤ����Ȥ�
��褷�褦�Ȥ������Ȥ�¾�οͤ��狼��ޤ���

@item
@code{�ѡ������顼}��ȯ�������硢��ʸ��̩�˥����å����Ƥ��������� ��
���ְ�äƤ���Τ��򸫤Ĥ����ʤ���С�¿ʬ�����Ѥ��Ƥ��륯����� 
@strong{MySQL} �θ��ߤΥС�����󤬥��ݡ��Ȥ��Ƥ��ʤ��Ȥ������ȤǤ�����
�ߤΥС���������Ѥ��Ƥ��ơ�@uref{http://www.mysql.com/doc.html} �Υ�
�˥奢�뤬���ʤ��λ��Ѥ��Ƥ��륯���깽ʸ�򥫥С����Ƥ��ʤ����ϡ������ 
@strong{MySQL} �����ʤ��Υ�����򥵥ݡ��Ȥ��Ƥ��ʤ��Ȥ�����̣�Ǥ�������
��硢���ʤ�������ϡ����ι�ʸ�򤢤ʤ����ȤǼ������뤳�Ȥ���
@email{mysql-support@@mysql.com} �� email �Ǥ�����������褦�˿������ळ
�ȤǤ���

�ޥ˥奢�뤬���ʤ��λ��Ѥ��Ƥ��빽ʸ�򥫥С����Ƥ���Τ�@strong{MySQL} 
�θŤ��С���������Ѥ��Ƥ����硢ʸˡ���������줿�����ˤĤ���
@strong{MySQL} ���ѹ����������å����٤��Ǥ���@xref{News}�����ξ�硢��
�꿷�����С������� @strong{MySQL} �ؤΥ��åץ��졼�ɤ�����Ǥ��ޤ���

@item
�⤷���ʤ��Υǡ����������ʤä��褦�˻פ����ꡢ�ޤ��ϡ����������
�ơ��֥�˥�����������������顼�Ȥʤ�ʤ顢
�ޤ��ǽ�ˡ��ơ��֥�� @code{myisamchk} �Ǹ��������������ߤ�٤��Ǥ�
@xref{Maintenance}.

@item
�⤷����ä��夦�ơ��֥뤬����ˤʤ�褦�ʤ顢���ġ��ʤ�������Τ���
õ���Ф��٤��Ǥ��� ���ξ�硢@file{mysql-data-directory/'hostname'.err} �ե������
���������äƤ���Τ��ޤޤ�Ƥ����礬����ޤ��� ���Υե����뤫��
��Ϣ��������ȴ�������Х���ݡ��Ȥ˴ޤ�Ƥ���������
�̾ @code{mysqld} �� �����κ���� kill ����ʤ��¤��
�ơ��֥��@strong{���Ф�}�˲����ޤ��� �⤷�ʤ� @code{mysqld} ����̤Τ�
���Ĥ������ϡ��桹�����ʤ���������Τ���ν������󶡤��뤳�Ȥ���
�Ϥ뤫�˴�ñ�ˤʤ�ޤ�!
@xref{What is crashing}

@item
��ǽ�ʾ�硢�ǿ��� @strong{MySQL} �С����������������ɤ��ơ��������
�꤬��褵��뤫�ɤ���������å����Ƥ������������Ƥ� @strong{MySQL} �С�
�������̤��ƥƥ��Ȥ��졢����ʤ���ư��ޤ��� ���Ƥ���ǽ�ʸ¤������
�ߴ�������褦�˺���Ƥ��ơ������� @strong{MySQL} �С��������ڤ��ؤ�
�뤳�Ȥ��Ǥ���Ȳ桹�Ͽ����Ƥ��ޤ��� @xref{Which version}��
@end itemize

���ʤ������ݡ��ȸܵҤʤ顢���⤤ͥ���̤Ǽ�갷������
@email{mysql-support@@mysql.com} �˥Х���ݡ��Ȥ򥯥����ݥ��Ȥ��Ƥ���������
Ʊ�ͤˡ�¾��ï���������и��Ѥ�(�����Ƥ����餯���Ѥ�)���ɤ������Τ뤿
���Ŭ�ڤʥ᡼��󥰥ꥹ�Ȥˤ⡣

@strong{MyODBC} �ΥХ�����ξ���ˤĤ��Ƥϡ�@ref{ODBC Problems} �򻲾�
���Ƥ���������

�����Ĥ��ΰ���Ū������β��ˡ�Τ���� �� @xref{Problems}.

���������ʤ��˸Ŀ�Ū�������ơ��᡼��󥰥ꥹ�Ȥ������Ƥ��ʤ���������
�����󤷡����ʤ�������β��μ�����ˤʤä��ֻ��β��ä�¾�οͤˤ�Ϳ����
����ˡ����������᡼��󥰥ꥹ�Ȥ��������뤳�Ȥϡ��ɤ��������åȤǤ���

@cindex Net etiquette
@node Answering questions,  , Bug reports, Questions
@section �᡼��󥰥ꥹ�ȤǼ���������뤿��Υ����ɥ饤��

���ʤ��β����������ؿ���������ȹͤ������硢�Ҥͤ��ͤ˸Ŀ�Ū��ľ��
�ֻ��򤹤�����ˡ��᡼��󥰥ꥹ�Ȥ���Ƥ������Ȼפ��Ǥ��礦�����ꥸ��
�����Ƽ԰ʳ��οͤ⤽�줫�鲸�ä��������褦�˽�ʬ����Ū�˲��������
���뤳�Ȥ��ߤƤ����������᡼��󥰥ꥹ�Ȥ���Ƥ�����ϡ����ʤ��β���
�������β����Ƚ�ʣ���Ƥ��ʤ�����ǧ���Ʋ�������

���ʤ��ֻ�����ǡ�������ܼ���ʬ��������ߤƤ����������������Τ���Ѥ�
�뤳�Ȥ��̳�ȴ����ʤ��Dz�������

HTML �⡼�ɤ� ON �ˤ����֥饦������᡼���å���������Ƥ��ʤ��Ǥ�����
���� ¿���Υ桼���ϥ֥饦���ǥ᡼����ɤ�Ǥ��ޤ���

@cindex Licensing terms
@cindex Support terms
@node Licensing and Support, Installing, Questions, Top
@chapter @strong{MySQL} �饤���󥹤ȥ��ݡ���

(���������Τ��򤭤����Ḷʸ��ʻ�����Ƥ��ޤ�����ʸ�����Ǥʤ���ʸ���ܤ��̤��Ƥ���������
�⤷��̣�μ�㤤�򸫤Ĥ����ʤ顢@email{takeshi@@SoftAgency.co.jp} ��Ϣ�����Ƥ���������)

@menu
* Licensing policy::            @strong{MySQL} licensing policy
* Licensing policy on Win32::
* Copyright::                   Copyrights used by @strong{MySQL}
* Commercial use::              Distributing @strong{MySQL} commercially
* Licensing examples::          Example licensing situations
* Cost::                        @strong{MySQL} licensing and support costs
* Support::                     Types of commercial support
@end menu

This chapter describes @strong{MySQL} licensing and support arrangements,
including:

�ܾϤǤ� @strong{MySQL} �Υ饤���󥹤ȥ��ݡ��ȷ���ˤĤ��ƽҤ٤ޤ���

@itemize @bullet
@item
Our licensing policies for non-Microsoft and Microsoft operating systems

@item
The copyrights under which @strong{MySQL} is distributed
(@pxref{Copyright})

@item
Sample situations illustrating when a license is required
(@pxref{Licensing examples})

@item
Licensing and support costs (@pxref{Cost}), and
support benefits (@pxref{Support})
@end itemize


@itemize @bullet
@item
��Microsoft �� Mirosoft �Υ��ڥ졼�ƥ��󥰥����ƥ���Ф���饤���󥹤Υݥꥷ��

@item
@strong{MySQL} ���ۤˤ��������
(@pxref{Copyright})

@item
�饤���󥹤�ɬ�פȤʤ������
(@pxref{Licensing examples})

@item
�饤���󥹤ȥ��ݡ��Ȥ����� (@pxref{Cost}), ������
���ݡ��Ȥ����� (@pxref{Support})
@end itemize


@cindex Licensing policy
@node Licensing policy, Licensing policy on Win32, Licensing and Support, Licensing and Support
@section @strong{MySQL} licensing policy

The formal terms of the license for non-Microsoft operating systems such as
Unix or OS/2 are specified in @ref{Public license}.  Basically, our licensing
policy is as follows:

Unix��OS/2�ʤɤ���ޥ��������եȥ��ڥ졼�ƥ��󥰥����ƥ�ˤ�����饤���󥹤�
�����ʾ��� @ref{Public license}. ���������Ƥ���ޤ���
����Ū�ˡ��桹�Υ饤���󥹤Υݥꥷ���ϰʲ��Τ褦�ˤʤäƤ��ޤ���

@itemize @bullet
@item
For normal internal use, @strong{MySQL} generally costs nothing.  You do not
have to pay us if you do not want to.

@item
A license is required if:

@itemize @minus
@item
You sell the @strong{MySQL} server directly or as a part of another product
or service

@item
You charge for installing and maintaining a @strong{MySQL} server at some
client site

@item
You include @strong{MySQL} in a distribution that is non-redistributable
and you charge for some part of that distribution
@end itemize

@item
For circumstances under which a @strong{MySQL} license is required, you need
a license per machine that runs the @code{mysqld} server.  However, a
multiple-CPU machine counts as a single machine, and there is no restriction
on the number of @strong{MySQL} servers that run on one machine, or on the
number of clients concurrently connected to a server running on that
machine!

@item
You do not need a license to include client code in commercial programs.  The
client access part of @strong{MySQL} is in the public domain. The
@code{mysql} command line client includes code from the @code{readline}
library that is under the GNU Public License.

@item
@cindex @code{myisampack}
For customers who have purchased 1 license or @strong{MySQL} support, we provide
additional functionality.  Currently, this means we provide the
@code{myisampack} utility for creating fast compressed read-only
databases.  (The server includes support for reading such databases but
not the packing tool used to create them.)  When support agreements
generate sufficient revenue, we will release this tool under the same
license as the @strong{MySQL} server.

@item
If your use of @strong{MySQL} does not require a license, but you like
@strong{MySQL} and want to encourage further development, you are certainly
welcome to purchase a license anyway.

@item
If you use @strong{MySQL} in a commercial context such that
you profit by its use, we ask that you further the development of
@strong{MySQL} by purchasing some level of support.  We feel that if
@strong{MySQL} helps your business, it is reasonable to ask that you help
@strong{MySQL}.  (Otherwise, if you ask us support questions, you are not
only using for free something into which we've put a lot a work, you're
asking us to provide free support, too.)
@end itemize



@itemize @bullet
@item
�����Ǥλ��Ѥϡ�@strong{MySQL} �˥����ȤϤ�����ޤ��󡣤⤷˾�ޤʤ��ΤǤ���С�
�桹�˻�ʧ��ɬ�פϤ���ޤ���

@item
�饤���󥹤ϰʲ��Ǥ�ɬ�פǤ���

@itemize @minus
@item
@strong{MySQL} ��ľ�����䤹�뤫���ޤ���¾�����ʤ䥵���ӥ��ΰ����Ȥ���
 @strong{MySQL} �����䤹����

@item
@strong{MySQL} �Υ��󥹥ȡ������ƥʥ󥹥����ӥ��������Ȥ��硣

@item
�������ԲĤ�����ʪ�� @strong{MySQL} ��ޤᡢ���Τʤ��Τ����Ĥ�������򤫤����
@end itemize

@item
@strong{MySQL} �饤���󥹤�ɬ�פʾ𶷤Ȥ��ơ�@code{mysqld} �����Ф�
���餻��ޥ��� 1 ��ˤĤ� 1 �ĤΥ饤���󥹤�ɬ�פȤ��ޤ�. 
���������ޥ�� CPU �ޥ���ϣ���Υޥ���Ȥߤʤ��ޤ���
1��Υޥ��������餻�� @strong{MySQL} �����Фο������¤Ϥ���ޤ���
���Υޥ��������륵���С�����³���륯�饤����Ȥο��ˤ����¤�
����ޤ���

@item
���ΤΥץ������˥��饤����ȥ����ɤ�ޤि��ˡ��饤���󥹤�ɬ�פȤ��ޤ���
@strong{MySQL} �Υ��饤����ȥ�����������ʬ�ϥѥ֥�å��ɥᥤ��Ǥ���
@code{mysql} ���ޥ�ɥ饤�󥯥饤����Ȥϡ�GNU Public License ���ˤ���
@code{readline} ��ޤߤޤ���

@item
@cindex @code{myisampack}
For customers who have purchased 1 license or MySQL support, we provide
additional functionality.  Currently, this means we provide the
@code{myisampack} utility for creating fast compressed read-only
databases.  (The server includes support for reading such databases but
not the packing tool used to create them.)  When support agreements
generate sufficient revenue, we will release this tool under the same
license as the @strong{MySQL} server.

@item
@strong{MySQL} �λ��Ѥ˥饤���󥹤�ɬ�פȤ��ʤ����Ǥ⡢@strong{MySQL} ��������,
���ؤγ�ȯ���夷�����ʤ��,�Τ���,���ʤ����饤���󥹤����������ϴ��ޤ�
��Ƥ��ޤ�.

@item
���ʤ������Ѥ� @strong{MySQL} ����Ѥ��Ƥ��ꡢ��������פˤʤäƤ���Τʤ顢
�桹��,���ʤ��������Ĥ��Υ��ݡ��Ȥ�������뤳�Ȥˤ�ä� @strong{MySQL} �γ�ȯ��
¥�ʤ���褦����ߤޤ�. �桹��,@strong{MySQL} �����ʤ��Υӥ��ͥ��������ʤ�С�
���ʤ��� @strong{MySQL} �������褦�����Τ�ƻ���˹礦�ȴ����ޤ�. 
�ʤ��ʤ����桹�˼���Υ��ݡ��Ȥ����ΤǤ���С�
�桹��¿����ϫ�Ϥ�Ĥ��������Τ�̵���ǻ��Ѥ��뤳�ȤϤ��Ƥ���������
̵���Υ��ݡ��Ȥ��󶡤�桹����ळ�Ȥ�Ǥ�����
@end itemize

If you have any questions as to whether or not a license is required for your
particular use of @strong{MySQL}, please contact us.
@xref{Contact information}.

@strong{MySQL} �λ��Ѥ˺ݤ��ƥ饤���󥹤�ɬ�פǤ��뤫�ɤ����˴ؤ��Ƥμ��䤬����ʤ��
�桹���䤤��碌�Ƥ���������@xref{Contact information}.

If you require a @strong{MySQL} license, the easiest way to pay for it is to
use the license form on TcX's secure server at
@url{https://www.mysql.com/license.htmy}.  Other forms of payment are discussed
in @ref{Payment information}.

���ʤ��� @strong{MySQL} �饤���󥹤�ɬ�פȤ��Ƥ��ꡢ��ñ�ʻ�ʧ����ˡ��
˾��ΤǤ���С�TcX�ΰ����ʥ����Фˤ�����饤���󥹥ե��������Ѥ���
���ȤǤ�. @url{https://www.mysql.com/license.htmy}. 
�ۤ��λ�ʧ����ˡ�ˤĤ��Ƥ� @ref{Payment information}.
�����ܤǤι����� @uref{http://www.softagency.co.jp/}. ��


@strong{MySQL} licensing policy

@cindex Licensing on Win32
@node Licensing policy on Win32, Copyright, Licensing policy, Licensing and Support
@section MySQL licensing policy on Win32

For use under Microsoft operating systems (Win95/Win98/WinNT/Win2000),
you need a @strong{MySQL} license after a trial period of 30 days, with
the exceptions that are listed later.  @xref{Win license}.

A shareware version of @strong{MySQL}-Win32, that you can try before
buying, is available at @uref{http://www.mysql.com/mysql_w32.htmy}.  This
is based on a very late, stable @strong{MySQL} version, but compiled
with full debugging support, which makes this a lot slower than the
registered version.  After you have registered for a @strong{MySQL}
license, you will get a password that will enable you to access the
newest @strong{MySQL}-Win32 version.

Microsoft ���ڥ졼�ƥ��󥰥����ƥ�(Win95/Win98/WinNT/Win2000)���ˤ�������ѤǤϡ�
���ʤ���30���Υȥ饤������֤θ�� @strong{MySQL} �饤���󥹤�ɬ�פȤ��ޤ���
@xref{Win license}.

���ʤ������������˻�ߤ뤳�Ȥ��Ǥ��� @strong{MySQL}-Win32 �Υ������������С�������
@uref{http://www.mysql.com/mysql_w32.htmy}. �ˤ���ޤ�. 
����ϰ����Ǥ� @strong{MySQL} ��١����˥ե롦�ǥХå��⡼�ɤǥ���ѥ��뤷�Ƥ��ꡢ
������Ͽ�Ǥ���٤�®�٤��٤��ʤäƤ��ޤ���
�饤��������ʧ�ä����,���ʤ��ϺǤ⿷���� @strong{MySQL}-Win32 �С�������
�����������뤿��Υѥ���ɤ�����Ǥ��礦.

�����ܸ��� @strong{MySQL}-Win32 ��ɾ���Ǥȿ������ߤ� @uref{http://www.softagency.co.jp/}. ��

The reason for always requiring a license under Microsoft Windows is
that because Windows is a highly commercial OS with very high
development costs (it usually takes 3 times longer to build and test
things under windows), we see no other alternative than only give the
latest @strong{MySQL} Windows version to paying customers.  If we
didn't do this we would not be able to keep up development on
Windows.

We do give free @strong{MySQL} licenses on request in the following cases:

@itemize @bullet
@item
Educational purposes, like teaching students.
@item
Non-commercial research settings.
@item
Churches.
@item
Registered charity organizations.
@item
Individual students who have database related educational project.
@item
People who help us with @strong{MySQL} development in some constructive manner.
@end itemize

If something of the above applies to you, you can apply for a license by
sending an email to @email{mysql-licensing@@mysql.com}. This should include
a full description of for what you need a free @strong{MySQL} license.

As soon as we can afford it we plan to release @strong{MySQL} Win32
under the same license as @strong{MySQL} under other OS.  This will
however also require that we can find some Windows developers that would
like to work on @strong{MySQL} development under Windows and build
windows version for all @strong{MySQL} releases.


@cindex Copyright
@node Copyright, Commercial use, Licensing policy on Win32, Licensing and Support
@section Copyrights used by @strong{MySQL}

@menu
* Copyright changes::           Possible future copyright changes
@end menu

There are several different copyrights on the @strong{MySQL} distribution:

@strong{MySQL} ���ۤˤ����롢�����Ĥ��ۤʤ륳�ԡ��饤�Ȥ򼨤��ޤ���

@enumerate
@item
The @strong{MySQL}-specific source needed to build the
@code{mysqlclient} library and programs in the @file{client} directory
is in the public domain. Each file that is in the public domain has a
header which clearly states so. This includes everything in the
@file{client} directory and some parts of the @code{mysys},
@code{mystring} and @code{dbug} libraries.

@item
Some small parts of the source (GNU @code{getopt}) are covered by the
``GNU LIBRARY LIBRARY GENERAL PUBLIC LICENSE''.  See the
@file{mysys/COPYING.LIB} file.

@item
Some small parts of the source (GNU @code{readline}) are covered by the
``GNU GENERAL PUBLIC LICENSE''. See the @file{readline/COPYING} file.

@item
Some parts of the source (the @code{regexp} library) are covered by a Berkeley
style copyright.

@item
The other source needed for the @strong{MySQL} server on non-Microsoft
platforms is covered by the ``MySQL FREE PUBLIC LICENSE'', which is based on
the ``Aladdin FREE PUBLIC LICENSE.'' @xref{Public license}. When running
@strong{MySQL} on any Microsoft operating system, other licensing applies.
@end enumerate

@enumerate
@item
@file{client} �ǥ��쥯�ȥ�ʲ��� @code{mysqlclient} �饤�֥���
�ץ�����ෲ����������ɬ�פȤ��������� @strong{MySQL} �Υ������ϡ�
�ѥ֥�å��ɥᥤ��Ǥ���
���줾��Υѥ֥�å��ɥᥤ�󲼤Υե��������Ƭ�ˤϡ����λ����������Ƥ���ޤ���
����ϡ�@file{client} �ǥ��쥯�ȥ�ʲ������ե�����ȡ�
@code{mysys}, @code{mystring}, @code{dbug} �饤�֥��Τ����Ĥ���ޤߤޤ���

@item
�������Τ����Ĥ�����ʬ�� (GNU @code{getopt}) ``GNU LIBRARY GENERAL PUBLIC LICENSE''
 �˽��ä��ѹ�������ΤǤ���See the @file{mysys/COPYING.LIB} file.

@item
�������Τ����Ĥ�����ʬ�� (GNU @code{readline}) ``GNU GENERAL PUBLIC LICENSE'' �˽��ä��ѹ�������ΤǤ���
See the @file{readline/COPYING} file.

@item
�������Τ����Ĥ�����ʬ�� (@code{regexp} library) �С����쥤��������Υ��ԡ��饤�Ȥ˽��ä��ѹ�������ΤǤ���

@item
��Microsoft �ץ�åȥե������ @strong{MySQL} �����С���ɬ�פʥ������ϡ�
 ``MySQL FREE PUBLIC LICENSE'' ���ˤ���ޤ������Υ饤���󥹤� ``Aladdin FREE PUBLIC LICENSE''
 �򸵤ˤ��Ƥ��ޤ� @xref{Public license}��
Microsoft�Υ��ڥ졼�ƥ��󥰥����ƥ��� @strong{MySQL} ����Ѥ�����ϡ�
�㤦�饤���󥹤�Ŭ�Ѥ���ޤ���@xref{Win license}
@end enumerate


The following points set forth the philosophy behind our copyright policy:

�ʲ��ˤ����Υ��ԡ��饤�Ȥδ�����ǰ�򼨤��ޤ���


@itemize @bullet
@item
The SQL client library should be totally free so that it can be included in
commercial products without limitations.

@item
People who want free access to the software into which we have put a lot of
work can have it, so long as they do not try to make money directly by
distributing it for profit.

@item
People who want the right to keep their own software proprietary, but also
want the value from our work, can pay for the privilege.

@item
That means normal in-house use is FREE. But if you use @strong{MySQL} for
something important to you, you may want to help further its development by
purchasing a license or a support contract.  @xref{Support}.
@end itemize


@itemize @bullet
@item
�� SQL client �饤�֥�꡼��̵���Ǥ��뤳�ȡ�
����Ͼ��Ѥ����ʤ��Ф��Ƥ�̵���¤Ǥ��뤳�Ȥ�ޤࡣ

@item
����Τ�������ۤ�Ԥä��в������褦�Ȥ��ʤ��¤�ϡ�
�桹�����Ϥ��ƺ�ä��ܥ��եȥ����������¤ʤ����������Ǥ��롣

@item
��ʬ���ȤΥ��եȥ����������긢��ۤ�����,�桹�Υ��եȤ���Ѥ����в�����������
�ͤ��Ƥ���͡���,�ø����㤦���Ȥ��Ǥ��ޤ�.

@item
�����,�̾�������λ��Ѥ�̵���Ǥ��뤳�Ȥ��̣���ޤ���
������,���ʤ��ˤȤäƲ������פʤ�Τˤ������Ѥ���ʤ��,
���ʤ���,���ݡ��ȷ����������뤳�Ȥˤ�ä�,
 @strong{MySQL} �ΰ��ؤγ�ȯ�򥵥ݡ��Ȥ������뤫�⤷��ޤ���.
@end itemize


@node Copyright changes,  , Copyright, Copyright
@subsection Possible future copyright changes

We may choose to distribute older versions of @strong{MySQL} with the GPL in
the future. However, these versions will be identified as @strong{GNU MySQL}.
Also, all copyright notices in the relevant files will be changed to the
GPL.

�桹��,���� GPL �� @strong{MySQL} �ε켰�ΥС����������ۤ���������֤��⤷��ޤ���.
���ξ��,�����ΥС������� @strong{GNU MySQL} �Ȥ���Ĥ��Ǥ�.
�ޤ�,��Ϣ�ե��������Τ��٤Ƥ��Ǹ������ GPL ���Ѥ���Ĥ��Ǥ�.


@node Commercial use, Licensing examples, Copyright, Licensing and Support
@section Distributing @strong{MySQL} commercially����������

This section is a clarification of the license terms that are set forth in
the ``MySQL FREE PUBLIC LICENSE'' (FPL).  @xref{Public license}.

�ʲ��� ``MySQL FREE PUBLIC LICENSE'' (FPL) �����Τ˵����ޤ�. 
@xref{Public license}.

@strong{MySQL} may be @strong{used} freely, including by commercial
entities for evaluation or unsupported internal use. However,
@strong{distribution} for commercial purposes of @strong{MySQL}, or
anything containing or derived from @strong{MySQL} in whole or in part,
requires a written commercial license from TcX AB, the sole entity
authorized to grant such licenses.

@strong{MySQL} �λ��Ѥˤ����¤Ϥ���ޤ���
����Ͼ������ѤΤ����ɾ���䡢�������󥵥ݡ��Ȥǻ��Ѥ��뤳�Ȥ�ޤߤޤ���
���������ξ��Ǥ� TcX AB (�饤���󥹤�Ϳ���븢�¤����ͣ��ε���)
�ˤ�äƵ��ܤ��줿���ѥ饤���󥹤�ɬ�פǤ���
@strong{MySQL} ���Ȥ�����Ū��@strong{����}���뤳�ȡ�
@strong{MySQL} �ΰ��������뤤��������ޤ��ʪ������Ū��@strong{����}���뤳�ȡ�
@strong{MySQL} �����Ѥ��ƺ�ä�ʪ�ΰ��������뤤��������ޤ��ʪ������Ū��@strong{����}���뤳�ȡ�

You may not include @strong{MySQL} ``free'' in a package containing
anything for which a charge is being made, except as noted below.

������ȯ�����뤤���ʤ�ʪ����ˤ⡢@strong{MySQL} �� ``̵��'' �Ǵޤ�ǤϤ����ޤ���
���������ʲ��Ͻ����ޤ���

The intent of the exception provided in the second clause of the license is
to allow commercial organizations operating an FTP server or a bulletin board
to distribute @strong{MySQL} freely from it, provided that:

�ܥ饤���󥹤Σ����ܤ��㳰���֤�⤦���Ƥ���տޤϡ��������Τ����Ĥ��Ƥ��� FTP �����С���
�Ǽ������ǡ���ͳ�� @strong{MySQL} �����ۤ��뤳�Ȥ���Ĥ��뤿��Ǥ���

@enumerate
@item
The organization complies with the other provisions of the FPL, which
include among other things a requirement to distribute the full source
code of @strong{MySQL} and of any derived work, and to distribute the
FPL itself along with @strong{MySQL};

@item
The only charge for downloading @strong{MySQL} is a charge based on the
distribution service and not one based on the content of the information
being retrieved (i.e., the charge would be the same for retrieving a
random collection of bits of the same size);

@item
The server or BBS is accessible to the general public, i.e., the phone
number or IP address is not kept secret, and anyone may obtain access to
the information (possibly by paying a subscription or access fee that is
not dependent on or related to purchasing anything else).
@end enumerate

@enumerate
@item
�������Τ� FPL ��¾�ξ����������뤳�ȡ������׵����Ǥ�Ȥ�櫓
 @strong{MySQL} �Ȥ����ʤ�����ʪ���������������ۤȡ�
 @strong{MySQL} �Ȱ��� FPL ���Ȥ����ۤ��뤳�Ȥϼ�������뤳�ȡ�

@item
@strong{MySQL} �����������ɤ���԰٤ˤ����ݶ⤹����ǡ�
�������ʤ����ۥ����ӥ������ѤǤ��ꡢ���������о�ʪ�ˤ�ä��Ѥ��ʤ�����
(�㤨�С���������ʪ����äƤ��Ƥ�����̤�Ʊ���Ǥ����Ʊ�����ʤǤ��뤳�ȡ�)

@item
�����С���BBS �ϰ��̤˸�������Ƥ��ƥ���������ǽ�ʤ��ȡ��㤨�С������ֹ��
IP���ɥ쥹��������Ƥ��餺������⤬���ξ���˥��������Ǥ��뤳�ȡ�
(�ʤˤ����㤦�Ȥ������Ȥ˴�Ϣ�������¸�����ꤷ�ʤ��������䥢����������ˤ��ʪ���)
@end enumerate

If you want to distribute software in a commercial context that incorporates
@strong{MySQL} and you do @strong{not} want to meet these conditions, you
should contact TcX AB to find out about commercial licensing, which involves
a payment. The only ways you legally can distribute @strong{MySQL} or
anything containing @strong{MySQL} are by distributing @strong{MySQL} under
the requirements of the FPL, or by getting a commercial license from TcX AB.

@strong{MySQL} ���Ȥ߹�������ȥ��եȥ����������ۤ�������,
�����ξ�������������@strong{�ʤ�}�ʤ��,���ʤ���,����ǧ�Ĥ˴ؤ���
 TcX AB ��Ϣ������٤��Ǥ�.
���ȥ饤���󥹤ϻ�ʧ���˱ƶ���,���ݡ��Ȥ���¾��������ޤߤޤ�.
�����Ϥ��ʤ��� @strong{MySQL} ���Ȥ� @strong{MySQL} ��ޤ�ʪ��
��ˡŪ�����ۤ��뤳�Ȥ��Ǥ���ͣ�����ˡ�Ǥ�:
FPL�ξ��β��� @strong{MySQL} �����ۤ��뤳�Ȥ�,
�ޤ��� TcX AB ���龦�ȥ饤���󥹤����뤳�Ȥˤ�ä�.


@node Licensing examples, Cost, Commercial use, Licensing and Support
@section Example licensing situations���饤������

@menu
* Products that use MySQL::     Selling products that use @strong{MySQL}
* MySQL services::              Selling @strong{MySQL}-related services
* ISP::                         ISP @strong{MySQL} services
* Web server::                  Running a web server using @strong{MySQL}.
@end menu

This section describes some situations illustrating whether or not you must
license the @strong{MySQL} server.  Generally these examples involve
providing @strong{MySQL} as part of a product or service that you are selling
to a customer, or requiring that @strong{MySQL} be used in conjunction with
your product.  In such cases, it is your responsibility to obtain a license
for the customer if one is necessary.  (This requirement is waived if your
customer already has a @strong{MySQL} license.  But the seller must send
customer information and the license number to TcX, and the license must be a
full license, not an OEM license.)

���Υ��������Ǥϡ����ʤ����ɤ����ä������� @strong{MySQL} �����Х饤���󥹤�
���ʤ���Фʤ�ʤ����ݤ��򡢤����Ĥ��������ޤ���
���̤ˤ�������ϡ�
@strong{MySQL} �������ʤ����ܵҤ���äƤ������ʤ䥵���ӥ��ΰ����˴ޤޤ�Ƥ�����䡢
���ʤ������ʤ� @strong{MySQL} �λ��Ѥ��׵ᤷ�Ƥ�����ʤɤǤ���
���Τ褦�ʾ�硢�ܵҤΤ���˥饤���󥹤�����ΤϤ��ʤ�����Ǥ�Ǥ���
�ʤ����������Ǥˤ��θܵҤ� @strong{MySQL} �Υ饤���󥹤���äƤ�����ϤΤ����ޤ���
��������ϸܵҤξ���ȥ饤���󥹥ʥ�С���TcX������ɬ�פ����ꡢ���ġ�
���Υ饤���󥹤�OEM�饤���󥹤ǤϤʤ����ե�饤���󥹤Ǥʤ���Фʤ�ޤ��󡣡�

Note that a single @strong{MySQL} license covers any number of
CPUs/users/customers/@code{mysqld} servers on a machine!

@strong{MySQL} �饤���󥹰�Ĥǡ�����Υޥ����Ρ�
�� CPU��/�桼������/�ܵҿ�/@code{mysqld} ���򥫥С����ޤ���


@node Products that use MySQL, MySQL services, Licensing examples, Licensing examples
@subsection Selling products that use @strong{MySQL}

To determine whether or not you need a @strong{MySQL} license when selling
your application, you should ask whether the proper functioning of your
application is contingent on the use of @strong{MySQL} and whether you
include @strong{MySQL} with your product.  There are several cases to
consider:

���ץꥱ�����������䤹��Ȥ������ʤ��� @strong{MySQL} �饤���󥹤�
ɬ�פȤ��뤫�ɤ������ꤹ�뤿��ˤ�,
���ʤ��Υ��ץꥱ�������Ŭ�ڤ˵�ǽ���뤿��ˤ� @strong{MySQL} ��ɬ�פȤ��뤫�ɤ�����
���ʤ� @strong{MySQL} ��ޤफ�ɤ�����Ҥͤ�٤��Ǥ�. �ͤ����뤤���Ĥ�
�Υ�����������ޤ�:

@itemize @bullet
@item
Does your application require @strong{MySQL} to function properly?

If your product requires @strong{MySQL}, you need a license for any machine
that runs the @code{mysqld} server.  For example, if you've designed your
application around @strong{MySQL}, then you've really made a commercial
product that requires the engine, so you need a license.

If your application does not require @strong{MySQL}, you need not obtain a
license.  For example, if @strong{MySQL} just added some new optional
features to your product (such as adding logging to a database if
@strong{MySQL} is used rather than logging to a text file), it should fall
within normal use, and a license would not be required.

In other words, you need a license if you sell a product designed
specifically for use with @strong{MySQL} or that requires the @strong{MySQL}
server to function at all.  This is true whether or not you provide
@strong{MySQL} for your client as part of your product distribution.

It also depends on what you're doing for the client.  Do you plan to provide
your client with detailed instructions on installing @strong{MySQL} with your
software?  Then your product may be contingent on the use of @strong{MySQL};
if so, you need to buy a license.  If you are simply tying into a database
that you expect already to have been installed by the time your software is
purchased, then you probably don't need a license.

@item
Do you include @strong{MySQL} in a distribution and charge for that
distribution?

If you include @strong{MySQL} with a distribution that you sell to customers,
you will need a license for any machine that runs the @code{mysqld} server,
because in this case you are selling a system that includes @strong{MySQL}.

This is true whether the use of @strong{MySQL} with your product
is required or optional.

@item
Do you neither require for your product nor include @strong{MySQL} with it?

Suppose you want to sell a product that is designed generally to use ``some
database'' and that can be configured to use any of several supported
alternative database systems (@strong{MySQL}, PostgreSQL, or something
else).  That is, your product does not not require @strong{MySQL}, but can
support any database with a base level of functionality, and you don't rely
on anything that only @strong{MySQL} supports.  Does one of you owe us money
if your customer actually does choose to use @strong{MySQL}?

In this case, if you don't provide, obtain or set up @strong{MySQL} for the
customer should the customer decide to use it, neither of you need a
license.  If you do perform that service, see @ref{MySQL services, ,
@strong{MySQL} services}.
@end itemize

@itemize @bullet
@item
���ʤ��Υ��ץꥱ�������Ŭ�ڤ˵�ǽ���뤿��ˤϡ�@strong{MySQL} ��ɬ�פȤ��ޤ���?

���ʤ������ʤ� @strong{MySQL} ��ɬ�פȤ���ʤ��,@strong{mysqld} �����Ф�
���餻��ɤ�ʥޥ���ˤ�饤���󥹤�ɬ�פȤ��ޤ�. �㤨�Ф��ʤ���
 @strong{MySQL} �μ���Ǽ�ʬ�Υ��ץꥱ���������߷פ����ʤ�С�
�����˥��󥸥��ɬ�פȤ��뾦�����ʤ��ä����ˤʤ�Τǡ��饤���󥹤�ɬ�פǤ�.

���ʤ��Υ��ץꥱ������� @strong{MySQL} ��ɬ�פȤ��ʤ��ʤ��,���ʤ���
�饤���󥹤�����ɬ�פϤ���ޤ��� �㤨�� @strong{MySQL} ���������ʤ������ʤ�
�����Ĥ��ο�����Ǥ�դ���ħ��ä����ʤ��
�ʥƥ����ȥե�����ؤΥ����󥰤�ꡢ�ǡ����١����ؤΥ����󥰤� @strong{MySQL} ��
���Ѥ����褦�ʾ��ˡ�������̾�λ��Ѳ��ʤΤǡ��饤���󥹤�ɬ�פʤ��Ǥ��礦��

�����������, @strong{MySQL} �ȤȤ�˻��Ѥ�������ʤ������䡢
�����˵�ǽ���뤿��� @strong{MySQL} ��ɬ�פȤ���ΤǤ���С�
�饤���󥹤�ɬ�פǤ������ʤ��� @strong{MySQL} �����ʤΰ����Ȥ���
�ܵҤ����ۤ��褦�����ޤ��������ξ��ˤϥ饤���󥹤�ɬ�פǤ���

�ޤ������ʤ����ܵҤΤ���ˤ��Ƥ�����ˤ�ͤ�ޤ���
���ʤ���,���ʤ��Υ��եȥ������ȤȤ�� @strong{MySQL} �򥤥󥹥ȡ��뤷��
�ܵҤ��󶡤���Τ�ײ褷�Ƥ��ޤ���?  ���ΤФ���,���ʤ������ʤ�
 @strong{MySQL} �λ��Ѥ���Ȥ��Ƥ��ޤ��� �� �������Ȥ����,
���ʤ���,�饤���󥹤��㤦ɬ�פ�����ޤ�. 
If you are simply tying into a database
that you expect already to have been installed by the time your software is
purchased, then you probably don't need a license.

@item
 @strong{MySQL} ������ʪ�˴ޤᡢ��������ʪ������򤫤��ޤ�����

�⤷�ܵҤ��������ʪ�� @strong{MySQL} ��ޤ��ΤǤ���С�
 @code{mysqld} �����С������뤤���ʤ�ޥ���˥饤���󥹤�ɬ�פǤ���
�ʤ��ʤ顢 @strong{MySQL} ��ޤॷ���ƥ����äƤ��뤫��Ǥ���

��������ʤ� @strong{MySQL} �λ��Ѥ�
ɬ�ܤȤ��Ƥ��褦�����ץ����Ȥ��Ƥ��褦����Ŭ�Ѥ���ޤ���

@item
���ʤ������ʤ� @strong{MySQL} �򤽤���˴ޤळ�Ȥ��׵ᤷ�ޤ�����

``�ʤ�餫�Υǡ����١���'' �λ��Ѥ�ǥ����󤷤Ƥ������ʤǡ��������ʤ�
�����Ĥ��Υǡ������١��������ƥ�
(@strong{MySQL}, PostgreSQL, or something else) ���椫������Τ��
���Ѥ���褦��Ĵ����ǽ�Ǥ������ʡ��������ä�ʪ�򤢤ʤ���
������Ȥ��Ƥ���Ȳ��ꤷ�ޤ���
���ξ�硢���ʤ������ʤ� @strong{MySQL} ��ɬ�פȤ��ޤ��󤬡�
�����ʤ�ǡ����١����δ��ܵ�ǽ�򥵥ݡ��Ȥ��Ƥ��ꡢ
 @strong{MySQL} �����򥵥ݡ��Ȥ��Ƥ����ΤǤϤ���ޤ���
�����⤷�ܵҤ� @strong{MySQL} �λ��Ѥ���������ˡ����ʤ����桹�˻�ʧ����̳��
�������

���ξ�硢�⤷���θܵҤΤ���ˡ����ʤ��� @strong{MySQL} ���󶡤����ꤢ�뤤�ϡ�
���ꤷ���ꡢ���åȥ��åפ����ꤷ�Ƥ��ʤ��ʤ�С����ʤ��˥饤���󥹤����פǤ���
�⤷���ʤ����ܵҤˤ������ä������ӥ����󶡤���ʤ顢@ref{MySQL services, ,
@strong{MySQL} services}.
@end itemize


@node MySQL services, ISP, Products that use MySQL, Licensing examples
@subsection Selling @strong{MySQL}-related services��@strong{MySQL} ��Ϣ�����ӥ������

If you perform @strong{MySQL} installation on a client's machine and any
money changes hands for the service (directly or indirectly), then you must
buy a @strong{MySQL} license.

�⤷ @strong{MySQL} �򥯥饤����Ȥ˥��󥹥ȡ��뤷�����Υ����ӥ��Ǥʤ�餫��
����򤨤�ʤ�С�ľ�ܡ�������鷺�ˡ����ʤ��� @strong{MySQL} �饤���󥹤�
�������ʤ��ƤϤʤ�ޤ���

If you sell an application for which @strong{MySQL} is not strictly required
but can be used, a license may be indicated, depending on how @strong{MySQL}
is set up.  Suppose your product neither requires @strong{MySQL} nor includes
it in your product distribution, but can be configured to use @strong{MySQL}
for those customers who so desire.  (This would be the case, for example, if
your product can use any of a number of database engines.)

@strong{MySQL} �ϴ�����ɬ�פȤ����櫓�ǤϤʤ���,@strong{MySQL} ����Ѥ��뤳�Ȥ��Ǥ���
���ץꥱ�����������䤹��ʤ��,  @strong{MySQL} �򥻥åȥ��åפ�����ˡ�ˤ�ä�,
�饤���󥹤�ɬ�פˤʤ��礬����ޤ������ʤ�����������ʪ����� @strong{MySQL} ��
�ޤޤ�Ƥ��餺���ޤ��� @strong{MySQL} ��ɬ�פȤ��Ƥ��ʤ�����
���ʤ������ʤϸܵҤδ�˾�˹�碌�� @strong{MySQL} ����Ѥ���褦��Ĵ���Ǥ����Τ���
���ꤷ�ޤ���
���㤨��,���ʤ������ʤ�¿���Υǡ����١������󥸥�Τɤ줫����Ѥ��뤳�Ȥ�
�Ǥ���ʤ��,���ξ��˳�������Ǥ��礦.��

If the customer obtains and installs @strong{MySQL}, no license is needed.
If you perform that service for your customer, then a license is needed
because then you are selling a service that includes @strong{MySQL}.

�⤷�ܵҼ��Ȥ� @strong{MySQL} �����ꤷ���󥹥ȡ��뤹��ʤ�С�
���ʤ��˥饤���󥹤����פǤ����⤷���ʤ����������ä������ӥ���ܵҤ˹Ԥ��ʤ顢
�饤���󥹤�ɬ�פǤ����ʤ��ʤ顢 @strong{MySQL} ��ޤ�������ӥ��򤢤ʤ���
��뤳�Ȥˤʤ뤫��Ǥ���


@node ISP, Web server, MySQL services, Licensing examples
@subsection ISP @strong{MySQL} services

Internet Service Providers (ISPs) often host @strong{MySQL} servers for
their customers.

If you are an ISP that allows customers to install and administer
@strong{MySQL} for themselves on your machine with no assistance from you,
neither you nor your customer need a @strong{MySQL} license. Note that this
doesn't apply if you are are using Win32;  In this case you will always
need a license for each computer that runs the @strong{MySQL} server.

If you charge for @strong{MySQL} installation and administrative support as
part of your customer service, then you need a license because you are selling
a service that includes @strong{MySQL}.

���󥿡��ͥåȥ����ӥ��ץ��Х�����(ISP) �� @strong{MySQL} �����С���ʬ�Τ��Ҥ�
�󶡤��뤳�Ȥ⤷�Ф��ФǤ���

�⤷���ʤ��� ISP �ǡ��ܵҤ����ʤ��Υޥ���� @strong{MySQL} �򥤥󥹥ȡ��뤷�ƴ����������
���Ĥ��Ƥ���ΤǤ����(���ʤ��μ������̵����)��
���ʤ��ȸܵҤΤɤ���ˤ� @strong{MySQL} �饤���󥹤����פǤ���
�⤷ Win32 ����Ѥ��Ƥ���ʤ顢�����Ŭ�Ѥ���ʤ����Ȥ����դ��Ƥ���������
Win32 �ξ��ϡ�@strong{MySQL} �����С���¹Ԥ��륳��ԥ塼�����
�饤���󥹤�ɬ�פǤ���

�⤷���ʤ����ܵҥ����ӥ��Ȥ��� @strong{MySQL} �򥤥󥹥ȡ��뤷�������뤳�Ȥ�����򤫤��ʤ顢
���ʤ��� @strong{MySQL} ��ޤ�������ӥ�����äƤ��뤳�Ȥˤʤ�Τǡ�
���ʤ��ϥ饤���󥹤�ɬ�פǤ���


@node Web server,  , ISP, Licensing examples
@subsection Running a web server using @strong{MySQL}

If you use @strong{MySQL} in conjunction with a web server on Unix, you
don't have to pay for a license.

This is true even if you run a commercial web server that uses
@strong{MySQL}, since you are not selling @strong{MySQL} itself.  However, in
this case we would like you to purchase @strong{MySQL} support, because
@strong{MySQL} is helping your enterprise.

�⤷���ʤ��� UNIX ��� Web�����С� �ȤȤ�� @strong{MySQL} ����Ѥ���ʤ顢
�饤���󥹤��㤦ɬ�פϤ���ޤ���

����Ϥ��Ȥ� @strong{MySQL} ����Ѥ������Ѥ� Web�����С� �����餻�Ƥ��Ƥ⡢
 @strong{MySQL} ���Ȥ���äƤ��ʤ��Τǡ��饤���󥹤��㤦ɬ�פϤ���ޤ���
���������ξ�硢�桹�Ϥ��ʤ��� @strong{MySQL} ���ݡ��ȷ���򤹤뤳�Ȥ�˾�ߤޤ���
�ʤ��ʤ顢@strong{MySQL} �Ϥ��ʤ��λ��Ȥ�����Ƥ��뤫��Ǥ���


@cindex Costs, licensing and support
@cindex Licensing costs
@cindex Support costs
@node Cost, Support, Licensing examples, Licensing and Support
@section @strong{MySQL} licensing and support costs

@menu
* Payment information::         Payment information
* Contact information::         Contact information
@end menu

Our current license prices are shown below. All prices are in US
Dollars. If you pay by credit card, the currency is EURO (European Union Euro)
so the prices will differ slightly.

���ߤΥ饤���󥹤β��ʤ�ʲ��˼����ޤ������Ƥβ��ʤ� US �ɥ�Ǥ���
�⤷���ʤ������쥸�åȥ����ɤ��㤤�����ʤ�С��̲ߤ� EURO (European Union Euro)
�Ǥ����ʲ��ʤ��鷺���˰ۤʤ��

@multitable @columnfractions .25 .2 .3
@item @strong{Number of licenses} @tab @strong{Price per copy} @tab @strong{Total}
@item 1                  @tab US $200 @tab US $200
@item 10 pack            @tab US $150 @tab US $1500
@item 50 pack            @tab US $120 @tab US $6000
@end multitable

For high volume (OEM) purchases, the following prices apply:

���̹���(OEM ����)�ξ��ϡ�

@multitable @columnfractions .25 .2 .3 .25
@item @strong{Number of licenses}  @tab @strong{Price per copy} @tab @strong{Minimum at one time} @tab @strong{Minimum payment}
@item 100-999   @tab US $40        @tab 100                     @tab US $4000
@item 1000-2499 @tab US $25        @tab 200                     @tab US $5000
@item 2500-4999 @tab US $20        @tab 400                     @tab US $8000
@end multitable

For OEM purchases, you must act as the middle-man for eventual problems
or extension requests from your users. We also require that OEM
customers have at least an extended email support contract.  Note that
OEM licenses only apply for products where the user doesn't have direct
access to the @strong{MySQL} server (embedded system). In other words:
The @strong{MySQL} server should only be used with the application
that was supplied you.

��OEM ����򤹤��硢�桼����������������˾���Ф��ơ�
���ʤ�������ͤȤ��ƿ������ʤ��ƤϤʤ�ޤ���
������ OEM �εҤ��Ф������ʤ��Ȥ��ĥ�Żҥ᡼�륵�ݡ��ȷ�����׵ᤷ�ޤ���
OEM �饤���󥹤ϡ�@strong{MySQL} �����С���ľ�ܥ�����������ɬ�פΤʤ�
���ʤˤΤ�Ŭ�Ѥ���ޤ� (�Ȥ߹��ߥ����ƥ�)�� �����ʤ�С�
@strong{MySQL} �ϡ����������ʤ����󶡤��Ƥ��륢�ץꥱ�������ȶ��ˤΤ�
���Ѥ���ʤ��ƤϤʤ�ޤ���
(OEM ���������� MySQL �����С��饤���󥹤Τߤ�ñ�Τ���뤳�ȤϤǤ��ޤ���)

If you have a low-margin high-volume product, you can always talk to us
about other terms (for example, a percent of the sale price). If you do,
please be informative about your product, pricing, market and any other
information that may be relevant.

���⤷���ʤ�������¿������ʤ���äƤ���ʤ顢¾�ξ��ˤĤ��Ƥ��ĤǤ�
�桹���ä��礦���Ȥ��Ǥ��ޤ�(�㤨�����ͤΥѡ�����ơ����Ȥ�)��
�⤷���ʤ������ʤ���ꤿ���ʤ顢
���ʤ����������������ʡ��Ծ졢����¾��Ϣ���ܤ�桹���Τ餻�Ƥ���������

@cindex @code{myisampack}
After buying 1 @strong{MySQL} licenses, you will get a personal copy of
the @code{myisampack} utility.  You are not allowed to redistribute this
utility but you can distribute tables packed with it.

1 @code{MySQL} �饤���󥹤ι����塢@code{myisampack} �桼�ƥ���ƥ�����
�Ŀͤऱ�˥��ԡ��Ǥ��ޤ�������κ����ۤϵ��Ĥ���ޤ��󤬡�
@code{myisampack} �ǥѥå������ơ��֥�����ۤǤ��ޤ���

A full-price license is not a support agreement and includes very minimal
support. This means that we try to answer any relevant question. If the
answer is in the documentation, we will direct you to the appropriate
section. If you have not purchased a license or support, we probably will not
answer at all.

�����ʲ��ʥ饤���󥹤ϥ��ݡ��ȶ���Ǥʤ�,���˺Ǿ��¤Υ��ݡ��Ȥ�ޤߤޤ�. �����,�桹��
�ɤ�ʴ�Ϣ����ˤ������褦�Ȥ�������̣���ޤ�. �ֻ����ɥ�����Ȥˤ���ʤ��,
�桹��Ŭ�ڤʥ��������򤢤ʤ������Ĥ��Ǥ�. ���ʤ����饤���󥹤����ݡ��Ȥ����
���ʤ��ä��ʤ��, �桹�Ϥ��֤�����������Ĥ��Ϥ���ޤ���.

If you discover what we consider a real bug, we are likely to fix it in
any case. But if you pay for support we will notify you about the fix
status instead of just fixing it in a later release.

�⤷���ʤ������桹�������˥Х����ȹͤ���ʪ�򸫤Ĥ�����硢�����ʤ���Ǥ�
����������ޤ���
������, ���ʤ������ݡ��Ȥ��ʧ���ʤ��, ��Υ�꡼���Ǥ�����������������ˡ�
�桹�Ͻ������֤˴ؤ��Ƥ��ʤ������Τ���Ĥ��Ǥ�.

More comprehensive support is sold separately.  Descriptions of what each
level of support includes are given in @ref{Support}.  Costs for the various
types of commercial support are shown below.  Support level prices are in
EURO (European Union Euro). One EURO is about 1.17 USD.

������Ū�ʥ��ݡ��Ȥ��̡������䤵��ޤ�. ���줾��Υ�٥�Υ��ݡ��Ȥ��ޤ����
�ؤ��뵭�Ҥ� @ref{Support}. �ˤ���ޤ����͡��ʥ����פξ��ѥ��ݡ��Ȥβ��ʤϰʲ���
�����ޤ�. ���ݡ��ȥ�٥���ʤ� EURO (European Union Euro) �Ǥ���
1 EURO �Ϥ��褽 1.17 USD �Ǥ�.

@multitable @columnfractions .3 .3
@item @strong{Type of support} @tab @strong{Cost per year}
@item Basic email support      @tab EURO 170
@item Extended email support   @tab EURO 1000
@item Login support            @tab EURO 2000
@item Extended login support   @tab EURO 5000
@end multitable

You may upgrade from any
lower level of support to a higher level of support for the difference
between the prices of the two support levels.

���̥�٥�Υ��ݡ��Ȥ��顢������⤤��٥�Υ��ݡ��Ȥˡ�
2�ĤΥ��ݡ��Ȥβ��ʺ�ʬ�λ�ʧ���ǡ����åץ��졼�ɤ���ǽ�Ǥ���


@cindex Payment information
@node Payment information, Contact information, Cost, Cost
@subsection Payment information

Currently we can take SWIFT payments, cheques or credit cards.

����,SWIFT��ʧ��,���ڼ�ޤ��ϥ��쥸�åȥ����ɤǤλ�ʧ�����Ǥ��ޤ�.

Payment should be made to:
������ϡ�
@example
Postgirot Bank AB
105 06 STOCKHOLM, SWEDEN

TCX DataKonsult AB
BOX 6434
11382 STOCKHOLM, SWEDEN

SWIFT address: PGSI SESS
Account number: 96 77 06 - 3
@end example

Specify: license and/or support and your name and email address.

���ʤ��ι����饤���� ����/���� ���ݡ��Ȥ�,̾���� E�᡼�륢�ɥ쥹�򵭽ҤΤ��ȡ�

In Europe and Japan you can use EuroGiro (that should be less expensive) to the
same account.

�衼���åѤ����ܤǤ�,���ʤ��ϻ�ʧ���� EuroGiro(���줬����ǤϤʤ�) ����Ѥ��뤳�Ȥ��Ǥ��ޤ�.

If you want to pay by cheque, make it payable to ``MySQL Finland AB'' and
mail it to the address below:

���ʤ������ڼ�ˤ�äƻ�ʧ�������ȻפäƤ���ʤ��,����� ``Monty Program KB'' �˻�ʧ�������ˤ���,
�ʲ��Υ��ɥ쥹��͹�����Ƥ�������.

@example
TCX DataKonsult AB
BOX 6434, Torsgatan 21
11382 STOCKHOLM, SWEDEN
@end example

If you want to pay by credit card over the Internet, you can use
@uref{https://www.tcx.se/license.htmy, TcX's secure license form}.

���󥿡��ͥåȾ�ǥ��쥸�åȥ����ɤǻ�ʧ�������ȻפäƤ���ʤ��,
���ʤ��� @uref{https://www.tcx.se/license.htmy, TcX�ΰ����ʥ饤���󥹥ե�����} ����Ѥ��뤳�Ȥ��Ǥ��ޤ�.

You can also print a copy of the license form, fill it in and send it by fax
to:

�ޤ���Υڡ����Υ��ԡ���������ƽ񤭹���,�ե��å�����Ȥäưʲ��ˤ�������뤳�Ȥ�Ǥ��ޤ�.

+46-8-729 69 05

If you want us to bill you, you can use the license form and write ``bill
us'' in the comment field.  You can also mail a message to
@email{sales@@mysql.com} (@strong{not} @email{mysql@@lists.mysql.com}!)
with your company information and ask us to bill you.

���������ä��ߤ������,���ʤ��ϥ饤���󥹥ե��������Ѥ�,
������� ``����� ��˾'' ��񤤤Ƥ�������.
���뤤��,���ʤ��β�Ҥξ���򵭺ܤ�����å������� @email{sales@@mysql.com} �ˤ�����,
(@email{mysql@@lists.mysql.com} �ǤϤ���ޤ���!)
����������褦�˲桹�˰��ꤹ�����Ǥ��ޤ���


@cindex Contact information
@node Contact information,  , Payment information, Cost
@subsection Contact information

For commercial licensing, or if you have any questions about any of the
information in this section, please contact the @strong{MySQL} licensing
team. The much preferred method is by E-Mail to
@email{mysql-licensing@@mysql.com}. Fax is also possible but handling of
these may take much longer (Fax +46-8-729 69 05).

����ǧ�Ĥ��ܥ��������˴ؤ�����䤬����ʤ��,�ʲ���Ϣ�����Ƥ�������

@example
David Axmark
Detron HB
Kungsgatan 65 B
753 21 UPPSALA
SWEDEN
Voice Phone +46-18-10 22 80     (Timezone GMT+1. Swedish and English spoken)
@end example


@cindex Support, types
@cindex Types of support
@node Support,  , Cost, Licensing and Support
@section Types of commercial support

@menu
* Basic email support::         Basic email support
* Extended email support::      Extended email support
* Login support::               Login support
* Extended login support::      Extended login support
@end menu

@node Basic email support, Extended email support, Support, Support
@subsection Basic email support�������Żҥ᡼�륵�ݡ���

Basic email support is a very inexpensive support option and should be
thought of more as a way to support our development of @strong{MySQL}
than as a real support option.  We at TCX do give a lot of free support
in all the different @strong{MySQL} lists and the money we get from
basic eamil support is largely used to make this possible.

�����Żҥ᡼�륵�ݡ��Ȥ��������ѤΤ�����ʤ����ݡ��ȥ��ץ����Ǥ���,
�桹�� @strong{MySQL} �γ�ȯ�򥵥ݡ��Ȥ��������Υ��ݡ��ȥ��ץ����ǡ�
���褤��ˡ�Ȥ��ƹͤ�����٤��Ǥ�.

At this support level, the @strong{MySQL} mailing lists are the preferred
means of communication.  Questions normally should be mailed to the primary
mailing list (@email{mysql@@lists.mysql.com}) or one of the other regular
lists (for example, @email{mysql-win32@@lists.mysql.com} for Windows-related
@strong{MySQL} questions), as someone else already may have experienced and
solved the problem you have.  @xref{Asking questions}.

���Υ��ݡ��ȥ�٥�Ǥ�, @strong{MySQL} �᡼��󥰥ꥹ�Ȥϥ��ߥ�˥��������
����ˤϹ��ޤ����ˡ�Ǥ�. �̾�, ����ϼ��פʥ᡼��󥰥ꥹ��
(@email{mysql@@lists.mysql.com}) ��¾�Υ᡼��󥰥ꥹ�ȤΤɤ줫�����������٤��ǡ�
���㤨��, Windows �˴�Ϣ���� @strong{MySQL} �μ���Τ���� @email{mysql-win32@@lists.mysql.com} ��
�����¾��ï����Ʊ�������и�����, ���˲�褷�Ƥ��뤫�⤷��ʤ�����Ǥ���
 @xref{Asking questions}.

However, by purchasing basic email support, you also have access to the
support address @email{mysql-support@@mysql.com}, which is not available
as part of the minimal support that you get by purchasing a
@strong{MySQL} license.  This means that for especially critical
questions, you can cross-post your message to
@email{mysql-support@@mysql.com}.  (If the message contains sensitive
data, you should post only to @email{mysql-support@@mysql.com}.)

@emph{REMEMBER!} to ALWAYS include your registration number and
expiration date when you send a message to
@email{mysql-support@@mysql.com}.

�������������Żҥ᡼�륵�ݡ��Ȥ�������뤳�Ȥˤ�ä�, ���ʤ��ϥ��ݡ��ȥ��ɥ쥹
@email{mysql-support@@mysql.com} �˥��������Ǥ��ޤ�.
(���Υ᡼�륢�ɥ쥹�ϺǾ��� @strong{MySQL} �饤���󥹤ι����Ǥ������Բ�ǽ�Ǥ���)
������ä˽��פʼ���Τ���˻��Ѥ���Ƥ��ꡢ�ޤ���@email{mysql-support@@mysql.com}.
�ȥ������ݥ��Ȥ��뤳�Ȥ��ǽ�Ǥ���
�ʥ�å������˵�̩�Υǡ������ޤޤ���硢���ʤ��� @email{mysql-support@@mysql.com}.
��������������٤��Ǥ�.��

��å������� @email{mysql-support@@mysql.com} ������Ȥ��ϡ�
��®�ʱ�����μ¤ˤ��뤿��ˡ�ɬ�����ʤ�����Ͽ�ֹ����λ���դ��ź���Ƥ���������

Note that if you have encountered a critical repeatable bug and follow
the rules outlined in the manual section of how to report bugs and send
it to @email{bugs@@lists.mysql.com} we promise to try to fix this as
soon as possible, independent of your support level! @xref{Bug reports}.

Basic email support includes the following types of service:

�����Żҥ᡼�륵�ݡ��Ȥϰʲ��Υ����ӥ���ޤߤޤ���

@itemize @bullet
@item
If your question is already answered in the manual, we will inform you of the
correct section in which you can find the answer.  If the answer is not in
the manual, we will point you in the right direction to solve your problem.

@item
We guarantee a timely answer for your email messages.  We can't guarantee
that we can solve any problem, but at least you will receive an answer if we
can contact you by email.

@item
We will help with unexpected problems when you install @strong{MySQL} from a
binary distribution on supported platforms.  This level of support does not
cover installing @strong{MySQL} from a source distribution.  ``Supported''
platforms are those for which @strong{MySQL} is known to work.
@xref{Which OS}.

@item
We will help you with bugs and missing features. Any bugs that are found are
fixed for the next @strong{MySQL} release. If the bug is critical for
you, we will mail you a patch for it as soon the bug is fixed.  Critical
bugs always have the highest priority for us, to ensure that they are
fixed as soon as possible.

@item
Your suggestions for the further development of @strong{MySQL} will be
taken into consideration. By taking email support you have already
helped the further development of @strong{MySQL}. If you want to have
more input, upgrade to a higher level of support.

@item
If you want us to help optimize your system, you must upgrade to a
higher level of support.
@end itemize

@itemize @bullet
@item
�⤷���ʤ��μ��䤬���˥ޥ˥奢����������Ƥ���ΤǤ���С�
�����򸫤Ĥ����Ǥ��������������������򤢤ʤ��˶����ޤ���
�⤷�������ޥ˥奢���̵����С�������Τ����������������ؤ������ޤ���

@item
���ᤤ�ֿ����ݾ��פ��ޤ���ɬ������ɤ���������Ǥ�����ݾڤ��פ��ޤ�
�󤬡����ʤ��� E �᡼��ǥ��󥿥��Ȳ�ǽ�ʤ�о��ʤ��Ȥ��ֿ��ϼ������Ǥ���
����

@item
���ݡ��Ȥ���Ƥ���ץ�åȥե�����ˤ����ƥХ��ʥ꡼���۷��֤���
@strong{MySQL} �򥤥󥹥ȡ��뤹�����ͽ�����ʤ����꤬���줿��礪�����פ��ޤ���
���Υ�٥�Υ��ݡ��ȤǤϥ��������۷��֤��� @strong{MySQL} �򥤥󥹥ȡ���
������Ϥդ��ޤ�Ƥ���ޤ���``���ݡ����о�'' �ץ�åȥե�����Ȥϡ�
 @strong{MySQL} ��ư�����Τ��Ƥ����ΤǤ� @xref{Which OS}.

@item
�Х���­��ʤ���ǽ�������� �����դ��ä��Х����դ��Ƥϼ��� @strong{MySQL} 
��꡼���ˤ�����ľ����ޤ����⤷���ΥХ������ʤ��ˤȤä���̿Ū�Ǥ���С��������褽
�ΥХ����Ф���ѥå���᡼��Ǥ����ꤷ�ޤ�����̿Ū�Х��Ͼ�˹⤤ͥ���٤ˤʤꡢ
��ǽ�ʸ¤�®�����������Ԥ��ޤ���

@item
����ʤ� @strong{MySQL} ��ȯ�Τ���ˤ��ʤ��ΰո��Ϲ�θ����ޤ���
���ʤ��� E �᡼�륵�ݡ��Ȥ򤪻����ʤ�С��⤦���� @strong{MySQL} �ι��ʤ�
��ȯ�ؤμ�����򤵤�Ƥ�����ˤʤ�ޤ�����äȰո��������줿���ʤ�С�
��̤Υ��ݡ��Ȥ˥��åץ��졼�ɤ��Ƥ���������

@item
�⤷���ʤ����䶡�ˤ��Υ����ƥ�κ�Ŭ���μ������˾�ߤǤ���С�����
��̤Υ��ݡ��Ȥإ��åץ��졼�ɤ���ɬ�פ�����ޤ���

@item
@cindex @code{myisampack}
We include a binary version of the @code{myisampack} packing tool for
creating fast compressed read-only databases. The current server includes
support for reading such databases but not the packing tool used to
create them.
@end itemize


@node Extended email support, Login support, Basic email support, Support
@subsection Extended email support����ĥ�Żҥ᡼�륵�ݡ���

Extended email support includes everything in basic email support with
these additions:

@itemize @bullet
@item
Your email will be dealt with before mail from basic email support users and
non-registered users.

@item
Your suggestions for the further development of @strong{MySQL} will
receive strong consideration. Simple extensions that suit the basic
goals of @strong{MySQL} are implemented in a matter of days. By taking
extended email support you have already helped the further development
of @strong{MySQL}.

@item
@item
Typical questions that are covered by extended email support are:

@itemize @minus
@item
We will answer and (within reason) solve questions that relate to possible
bugs in @strong{MySQL}.  As soon as the bug is found and corrected, we
will mail a patch for it.

@item
We will help with unexpected problems when you install @strong{MySQL} from a
source or binary distribution on supported platforms.

@item
We will answer questions about missing features and offer hints how to work
around them.

@item
We will provide hints on optimizing @code{mysqld} for your situation.
@end itemize

@item
You are allowed to influence the priority of items on the @strong{MySQL}
TODO. This will ensure that the features you really need will be implemented
sooner than they might be otherwise.
@end itemize

@node Login support, Extended login support, Extended email support, Support
@subsection Login support���������󥵥ݡ���

Login support includes everything in extended email support with
these additions:

@itemize @bullet
@item
Your email will be dealt with even before mail from extended email
support users.

@item
Your suggestions for the further development of @strong{MySQL} will
be taken into very high consideration.  Realistic extensions that can be
implemented in a couple of hours and that suit the basic goals of
@strong{MySQL} will be implemented as soon as possible.

@item
If you have a very specific problem, we can try to log in on your system
to solve the problem ``in place.''

@item
Like any database vendor, we can't guarantee that we can rescue any data from
crashed tables, but if the worst happens we will help you rescue as much as
possible. @strong{MySQL} has proven itself very reliable, but anything is
possible due to circumstances beyond our control (for example, if your system
crashes or someone kills the server by executing a @code{kill -9} command).

@item
We will provide hints on optimizing your system and your queries.

@item
You are allowed to call a @strong{MySQL} developer (in moderation) and
discuss your @strong{MySQL}-related problems.
@end itemize

@node Extended login support,  , Login support, Support
@subsection Extended login support����ĥ�������󥵥ݡ���

Extended login support includes everything in login support with these
additions:

@itemize @bullet
@item
Your email has the highest possible priority.

@item
We will actively examine your system and help you optimize it and your
queries. We may also optimize and/or extend @strong{MySQL} to better
suit your needs.

@item
You may also request special extensions just for you. For example:
@example
mysql> select MY_CALCULATION(col_name1,col_name2) from tbl_name;
@end example

@item
We will provide a binary distribution of all important @strong{MySQL}
releases for your system, as long as we can get an account on a
similar system. In the worst case, we may require access to your system
to be able to create a binary distribution.

@item
If you can provide accommodations and pay for traveler fares, you can even
get a @strong{MySQL} developer to visit you and offer you help with your
troubles. Extended login support entitles you to one personal
encounter per year, but we are as always very flexible towards our customers!
@end itemize


@node Installing, Compatibility, Licensing and Support, Top
@chapter @strong{MySQL} �Υ��󥹥ȡ���

@menu
* Getting MySQL::               @strong{MySQL} ��������ˡ
* Which OS::                    @strong{MySQL} �����ݡ��Ȥ��� OS
* Which version::               ���Ѥ��� @strong{MySQL} �С������
* Many versions::               ���åץǡ��Ȥ���꡼���������ˡ�Ȼ�
* Installation layouts::        ���󥹥ȡ���쥤������
* Installing binary::           @strong{MySQL} �Х��ʥ����ۤΥ��󥹥ȡ���
* Installing source::           @strong{MySQL} ���������ۤΥ��󥹥ȡ���
* Compilation problems::        Problems compiling?
* MIT-pthreads::                MIT-pthreads �˴ؤ���
* Perl support::                Perl installation comments
* Source install system issues:: System-specific notes
* Win32::                       Win32 notes
* OS/2::                        OS/2 notes
* TcX binaries::                TcX binaries
* Post-installation::           ���󥹥ȡ���������ȥƥ���
* Upgrade::                     @strong{MySQL} �Υ��åץ��졼��/�����󥰥졼�ɻ������̤˹Ԥʤ����Ȥ��������뤫��
@end menu

���ξϤǤϡ��ɤΤ褦�ˤ��� @strong{MySQL} ���������󥹥ȡ��뤹��Τ���Τ٤ޤ�: 

@itemize @bullet
@item
@strong{MySQL} �����뤳�Ȥ��Ǥ��륵���ȤΥꥹ�� ��
@ref{Getting MySQL, , Getting @strong{MySQL}}.

@item
�ɤΥץ�åȥե�����򥵥ݡ��Ȥ��Ƥ��뤫�� �� @ref{Which OS}.

@item
@strong{MySQL} �Τ����Ĥ��ΥС������ϡ��Х��ʥꡢ������ξ��������ʪ������ޤ���
�ɤΥС���������Ѥ���Τ����ɤΥ����פ���Ѥ��뤫����뤿��ˤ�
 �� @ref{Many versions}.

@item
�Х��ʥ�ȥ������Υ��󥹥ȡ���ˤĤ��Ƥ� ��
 @ref{Installing binary}, �� @ref{Installing source}.
���줾��Υ��åȤˤϡ����ʤ����Ф��魯���⤷��ʤ�
�����ƥ����ͭ������Υ�������󤬴ޤޤ�ޤ���

@item
���󥹥ȡ����˹Ԥ����Ȥ������� �� @ref{Post-installation}. 
@strong{MySQL} �Υ��󥹥ȡ���ˤ����ơ��Х��ʥ�ޤ��ϥ��������ۤˤ�����餺��
�����Υץ����������Ŭ�Ѥ��ޤ���
@end itemize


@cindex Downloading
@cindex @strong{MySQL} version
@cindex Version, latest
@cindex Getting @strong{MySQL}
@node Getting MySQL, Which OS, Installing, Installing
@section @strong{MySQL} ��������ˡ

���ߤΥС������ȥ���������ɤλؼ��ˤĤ��Ƥξ����
@uref{http://www.mysql.com/, @strong{MySQL} �ۡ���ڡ���} ������å����Ƥ�
��������

��������TcX �Υ��󥿡��ͥå���³�Ϥ���ʤ�®������ޤ���; �����˰�������
���ߥ顼�����Ȥΰ�Ĥ���ºݤ˥���������ɤ��뤳�Ȥ�@emph{�����ᤷ�ޤ�}��

�����ޤ����٤�Ƥ���ߥ顼�� @email{webmaster@@mysql.com} ����𤷤Ƥ�����
����

@c START_OF_MIRROR_LISTING

@strong{�衼���å�:}

@itemize @bullet
@item
@c EMAIL: sl@iuinfo.tuwien.ac.at (Tony Sprinzl)
@image{Flags/austria} Austria [Univ. of Technology/Vienna] @ 
@uref{http://gd.tuwien.ac.at/db/mysql/, WWW}
@uref{ftp://gd.tuwien.ac.at/db/mysql/, FTP}
@item
@c EMAIL: delian@naturella.com (Delian Delchev)
@image{Flags/bulgaria} Bulgaria [Naturella] @ 
@uref{http://archive.nat.bg/pub/mirror/mysql/, WWW}
@uref{ftp://ftp.ntrl.net/pub/mirror/mysql/, FTP}
@item
@c Added: 990614
@c EMAIL: vuksan@veus.hr (Vladimir Vuksan)
@image{Flags/croatia} Croatia [HULK] @ 
@uref{http://ftp.linux.hr/pub/mysql/, WWW}
@uref{ftp://ftp.linux.hr/pub/mysql/, FTP}
@item
@c Added: 990614
@c EMAIL: kas@informatics.muni.cz (Jan Kasprzak)
@image{Flags/czech-republic} Czech Republic [Masaryk University in Brno] @ 
@uref{http://mysql.linux.cz/index.html, WWW}
@uref{ftp://ftp.fi.muni.cz/pub/mysql/, FTP}
@item
@c Added: 990920
@c EMAIL: <radek@sopik.cz> (Radek Libovicky) 
@image{Flags/czech-republic} Czech Republic [www.sopik.cz] @ 
@uref{http://www.mysql.cz/, WWW}
@item
@c Added: 000418
@c EMAIL: <feela@ipex.cz> (Ondrej Feela Filip)
@image{Flags/czech-republic} Czech Republic [www.gin.cz] @
@uref{http://mysql.gin.cz/, WWW}
@uref{ftp://ftp.gin.cz/pub/MIRRORS/www.mysql.com/, FTP}
@item
@c removed 991020 (no DNS entry). New name 991026. Added 991121
@c Statistics at http://mirror.borsen.dk/
@c EMAIL: mirrorman@borsen.dk  (Michael Kyed)
@image{Flags/denmark} Denmark [Borsen] @ 
@uref{ http://mysql.borsen.dk/, WWW}
@item
@c EMAIL: mkp@socsci.auc.dk (Martin Kasper Petersen)
@image{Flags/denmark} Denmark [SunSITE] @ 
@uref{http://SunSITE.auc.dk/mysql/, WWW}
@uref{ftp://SunSITE.auc.dk/pub/databases/mysql/, FTP}
@c @item
@c EMAIL: tonu@tradenet.ee (Samuel)
@c @image{Flags/estonia} Estonia [Tradenet] @ 
@c @uref{http://mysql.tradenet.ee, WWW}
@item
@c EMAIL: tonu@spam.ee (Tonu Samuel)
@image{Flags/estonia} Estonia [OKinteractive] @ 
@uref{http://mysql.mirror.ok.ee, WWW}
@item
@c Changed 990531
@c EMAIL: Steeve.Devergne@minet.net (Steeve Devergne)
@image{Flags/france} France [minet] @ 
@uref{http://www.minet.net/devel/mysql/, WWW}
@item
@c EMAIL: Jaakko.Hyvatti@eunet.fi
@image{Flags/finland} Finland [EUnet] @
@uref{http://mysql.eunet.fi/, WWW}
@item
@c Added 990829
@c EMAIL: tomi.hakala@clinet.fi (Tomi Hakala)
@image{Flags/finland} Finland [clinet] @
@uref{ftp://ftp.clinet.fi/mirrors/ftp.mysql.org/pub/mysql/, FTP}
@item
@c Added 981208
@c EMAIL: noel@uni-bonn.de (Noel Koethe)
@image{Flags/germany} Germany [Bonn University, Bonn] @ 
@uref{http://www.wipol.uni-bonn.de/MySQL//, WWW}
@uref{ftp://ftp.wipol.uni-bonn.de/pub/mirror/MySQL/, FTP}
@item
@c EMAIL: th@rz.fh-wolfenbuettel.de (Thorsten Ludewig)
@image{Flags/germany} Germany [Wolfenbuettel] @ 
@uref{http://www.fh-wolfenbuettel.de/ftp/pub/database/mysql/, WWW}
@uref{ftp://ftp.fh-wolfenbuettel.de/pub/database/mysql/, FTP}
@item
@c Ok 980114. Removed 981208 (down > 3 days) ok 981214
@c EMAIL: straub@gks.de (Hans-Peter Straub)
@image{Flags/germany} Germany [Staufen] @ 
@uref{http://mysql.staufen.de/, WWW}
@item
@c Added 990614
@c EMAIL: thomas.rohde@ecrc.de (Thomas Rohde)
@image{Flags/germany} Germany [Cable & Wireless] @ 
@uref{ftp://ftp.ecrc.net/pub/database/mysql/, FTP}
@item
@c Added 981208
@c EMAIL: christias@noc.ntua.gr (Panagiotis Christias)
@image{Flags/greece} Greece [NTUA, Athens] @ 
@uref{http://www.ntua.gr/mysql/, WWW}
@uref{ftp://ftp.ntua.gr/pub/databases/mysql/, FTP}
@c @item
@c File not found 990730
@c EMAIL: torlasz@xenia.sote.hu (Laszlo L. Tornoc)
@c @image{Flags/hungary} Hungary [Xenia] @
@c @uref{http://xenia.sote.hu/ftp/mirrors/www.mysql.com/, WWW}
@c @uref{ftp://xenia.sote.hu/pub/mirrors/www.mysql.com/,FTP}
@item
@c EMAIL: mirrors@gm.is (Tomas Edwardsson)
@image{Flags/iceland} Island [GM] @ 
@uref{http://mysql.gm.is/, WWW}
@uref{ftp://ftp.gm.is/pub/mysql, WWW}
@c @item
@c Out of date 990906
@c EMAIL: bourbon@netvision.net.il (Zeev Suraski)
@c @image{Flags/israel} Israel [Netvision] @ 
@c @uref{http://mysql.netvision.net.il/, WWW}
@c @item
@c Not working 99.03.06
@c EMAIL: maruzz@matrice.it (Giovanni Maruzzelli)
@c @image{Flags/italy} Italy [Matrice] @ 
@c @uref{http://www.matrice.it/risorse/mysql/, WWW}
@item
@c EMAIL: irena@yacc.it
@image{Flags/italy} Italy [Teta Srl] @ 
@uref{http://www.teta.it/mysql/, WWW}
@item
@c Added 991121
@c EMAIL: nick@iol.ie (Nick Hilliard)
@image{Flags/ireland} Ireland [Ireland On-Line/Dublin] @ 
@uref{http://mysql.iol.ie, WWW}
@uref{ftp://ftp.iol.ie/pub/mysql, FTP}
@item
@c EMAIL: W.Sylwestrzak@icm.edu.pl (Wojtek Sylwestrzak)
@c mirroring nightly at 05:25
@image{Flags/poland} Poland [Sunsite] @ 
@uref{http://sunsite.icm.edu.pl/mysql/, WWW}
@uref{ftp://sunsite.icm.edu.pl/pub/unix/mysql/, FTP}
@c @item
@c EMAIL: melo@co.telenet.pt (Pedro Melo)
@c Temp out of service (email from Pedro)
@c @image{Flags/portugal} Portugal [IP] @ 
@c @uref{http://mysql.ip.pt, WWW}
@item
@c EMAIL: Equipa de suporte do Leirianet <support@leirianet.pt>
@image{Flags/portugal} Portugal [lerianet] @ 
@uref{http://mysql.leirianet.pt, WWW}
@uref{ftp://ftp.leirianet.pt/pub/mysql/,FTP}
@item
@c EMAIL: kuzmin@dn.ru (Roma Kuzmin)
@image{Flags/russia} Russia [DirectNet] @ 
@uref{http://mysql.directnet.ru, WWW}
@uref{ftp://ftp.dn.ru/pub/MySQL, FTP}
@c @item
@c down 990113
@c EMAIL: nikkic@cityline.ru (Nikki Chumakov)
@c @image{Flags/russia} Russia [Cityline] @ 
@c @uref{ftp://mysql.cityline.ru/pub/mysql, FTP}
@c @uref{http://mysql.cityline.ru, WWW}
@c EMAIL: bar@izhcom.ru (Alexander I Barkov)
@item
@image{Flags/russia} Russia [IZHCOM] @ 
@uref{http://mysql.udm.net/, WWW}
@uref{ftp://ftp.izhcom.ru/pub/mysql/,FTP}
@item
@c Added 990507
@c EMAIL: demon@gpad.ac.ru (Dima Sivachenko)
@image{Flags/russia} Russia [Scientific Center/Chernogolovka] @ 
@uref{ftp://ftp.chg.ru/pub/databases/mysql/, FTP}
@item
@c EMAIL: sebi@dnttm.ro (Sebastian DEAC)
@image{Flags/romania} Romania [Timisoara] @ 
@uref{http://www.dnttm.ro/mysql, WWW}
@uref{ftp://ftp.dnttm.ro/pub/mysql, FTP}
@item
@c EMAIL: tim@lbi.ro (Bogdan Surdu)
@image{Flags/romania} Romania [Bucharest] @ 
@uref{http://www.lbi.ro/MySQL, WWW}
@uref{ftp://ftp.lbi.ro/mirrors/ftp.tcx.se, FTP}

@c @item
@c Removed 20000521 because there is no mirror here.
@c EMAIL: jips@masterd.es (Juan Ignacio P Sacrist)
@c @image{Flags/spain} Spain [MasterD]
@c @uref{http://mysql.masterd.es, WWW}

@item
@c EMAIL: Patrik.Karen@sdi.slu.se (Patrik Karen)
@c ftp -> remove old files
@image{Flags/sweden} Sweden [Sunet] @ 
@uref{http://ftp.sunet.se/pub/unix/databases/relational/mysql/, WWW}
@uref{ftp://ftp.sunet.se/pub/unix/databases/relational/mysql/, FTP}

@item
@c EMAIL: archive@sunsite.cnlab-switch.ch (Thomas Lenggenhager)
@image{Flags/switzerland} Switzerland [Sunsite] @
@uref{http://sunsite.cnlab-switch.ch/ftp/mirror/mysql/, WWW}
@uref{ftp://sunsite.cnlab-switch.ch/mirror/mysql/, FTP}

@c @item
@c @c simon@oyster.co.uk (Simon Gornall)
@c @image{Flags/great-britain} UK [Oyster/UK] @ 
@c @uref{ftp://ftp.oyster.co.uk/pub/mysql, FTP}

@item
@c gareth@omnipotent.net (Gareth Watts)
@image{Flags/great-britain} UK [Omnipotent/UK] @ 
@uref{http://mysql.omnipotent.net/, WWW}
@uref{ftp://mysql.omnipotent.net/, FTP}

@item
@c keet@mordor.plig.net (Christiaan Keet)
@image{Flags/great-britain} UK [PLiG/UK] @ 
@uref{http://ftp.plig.org/pub/mysql/, WWW}
@uref{ftp://ftp.plig.org/pub/mysql/, FTP}
@c @item
@c unknown
@c @image{Flags/great-britain} UK [MicroMuse] @ 
@c @uref{ftp://ftp.micromuse.co.uk/pub/packages/unix/databases/mysql/, FTP}

@item
@c lmjm@icparc.ic.ac.uk (Lee McLoughlin)
@image{Flags/great-britain} UK [SunSITE] @
@uref{http://sunsite.org.uk/packages/mysql/, WWW}
@uref{ftp://sunsite.org.uk/packages/mysql/, FTP}

@item
@c sander@paco.net (Alexander Ivanov)
@image{Flags/ukraine} Ukraine [PACO] @
@uref{http://mysql.paco.net.ua, WWW}
@uref{ftp://mysql.paco.net.ua/, FTP}

@end itemize

@strong{�̥���ꥫ:}

@itemize @bullet
@c @item
@c Not ok 990101 (only to 981007)
@c EMAIL: sysop@polarcom.com (Seamus Venasse)
@c @image{Flags/canada} Canada [Polaris Computing] @ 
@c @uref{http://mysql.polaris.ca/, WWW}

@item
@c Ok 980109
@c EMAIL: wojtek@tryc.on.ca (Wojtjeck Tryc)
@image{Flags/canada} Canada [Tryc] @ 
@uref{http://web.tryc.on.ca/mysql/, WWW}

@item
@c not updated 990218. Added again 990918
@c EMAIL: rhooper@cyberus.ca (Roy Hooper)
@image{Flags/canada} Canada [Cyberus] @ 
@uref{http://mysql.cyberus.ca/, WWW}
@uref{ftp://mysql.cyberus.ca/, FTP} 

@item
@c EMAIL:  mleber@he.net (Mike Leber)
@c Added 980312
@image{Flags/usa} USA [Hurricane Electric/San Jose] @ 
@uref{http://mysql.he.net, WWW}

@item
@c EMAIL: meltzer@icsnet.com (Jeffrey Meltzer)
@c Added 000108
@image{Flags/usa} USA [Meltzer/New York State] @ 
@uref{ftp://ftp.meltzer.org/pub/mysql/, FTP}

@c @item
@c No such directory 990830
@c EMAIL: tps@users.buoy.com (Tim Sailer) 
@c @image{Flags/usa} USA [Buoy/New York] @ 
@c @uref{http://www.buoy.com/mysql/, WWW}

@c @item
@c EMAIL: db@hpnc.com (Douglas Bowyer)
@c Added 980107, removed 981124 because of 'file not found'
@c @image{Flags/usa} USA [Hypernet Communications/Dallas] @ 
@c @uref{http://epsilon.hpnc.com/mysql, WWW}

@c @item @c **********************************
@c Not updated 980106
@c EX: twh@iquest.net (Thomas Holt) who no longer works there
@c @image{Flags/usa} USA [IQuest/Indiana] @ 
@c @uref{http://mirrors.iquest.net/mysql/, WWW}

@c @item @c **********************************
@c Only a partial mirror so we exclude it from the list
@c EX: lindberg@id.wustl.edu (Fred Lindberg)
@c @image{Flags/usa} USA [Washington University/St. Louis] @ 
@c @uref{ftp://ftp.id.wustl.edu/pub/database/mysql/, FTP}

@c removed 991111 -> no answer
@c @item
@c EMAIL: andrew@netcasting.net (Andrew Sawyers)
@c @image{Flags/usa} USA [Netcasting/West Coast] @ 
@c @uref{ftp://ftp.netcasting.net/pub/mysql/, FTP}

@c @item
@c No mirror! 980809 David
@c EMAIL: savages@savages.com (Shaun Savage)
@c @image{Flags/usa} USA [Savages/Oregon] @ 
@c @uref{http://mysql.savages.com, WWW}

@item
@c EMAIL: tcobb@staff.circle.net (Troy Cobb)
@image{Flags/usa} USA [Circle Net/North Carolina] @ 
@uref{http://www.mysql.net, WWW}

@item
@c EMAIL: paul@gina.net (Paul Vining)
@c mirrors ftp.sunet.se
@image{Flags/usa} USA [Gina net/Florida] @ 
@uref{http://www.gina.net/mysql/, WWW}

@c Out of date 2000-01-08 (Not updated since 1999-10)
@c @item
@c EMAIL: wswanson@pingzero.net (Wylie Swanson)
@c mirrors mysql.org
@c @image{Flags/usa} USA [pingzero/Los Angeles] @
@c @uref{http://mysql.pingzero.net/, WWW}

@item
@c EMAIL: ftpkeeper@mirror.sit.wisc.edu
@image{Flags/usa} USA [Wisconsin University/Wisconsin] @
@uref{http://mirror.sit.wisc.edu/mysql/, WWW}
@uref{ftp://mirror.sit.wisc.edu/mirrors/mysql/, FTP}

@item
@c EMAIL: ftp-admin@digex.net
@image{Flags/usa} USA [DIGEX] @ 
@uref{ftp://ftp.digex.net/pub/packages/database/mysql/, FTP}

@item
@c EMAIL: andrew.sawyers@thelinuxstore.com
@image{Flags/usa} USA [LinuxWired/Scottsdale, AZ] @
@uref{http://mysql.linuxwired.net/, WWW}
@uref{ftp://ftp.linuxwired.net/pub/mirrors/mysql/, FTP}

@end itemize

@strong{���ꥫ:}

@itemize @bullet
@item
@c EMAIL: gaiser@matrix.com.br (Roberto Gaiser)
@image{Flags/brazil} Brazil [Matrix] @ 
@uref{http://mysql.matrix.com.br, WWW}
@item
@c jpabuyer@vision.cl
@image{Flags/chile} Chile [Vision] @ 
@uref{http://mysql.vision.cl/, WWW}

@c @item
@c Removed 990730
@c @c EMAIL: dan@amerikanclaris.com (Danilo Lotina F.)
@c @image{Flags/chile} Chile [Amerikanclaris] @ 
@c @uref{http://www.labs.amerikanclaris.cl/mysql, WWW}
@c @uref{ftp://ftp.amerikanclaris.cl/pub/mysql, FTP}
@end itemize

@strong{������:}

@itemize @bullet
@item
@c EMAIL: mirnshi@netchina.com.cn (Meng Lingbo)
@image{Flags/china} China [Freecode] @ 
@uref{http://mysql.freecode.com.cn, WWW}

@item
@c EMAIL: Vincent_Fong@innovator.com.hk (Vincent Fong)
@image{Flags/china} China [Hong Kong] @
@uref{http://mysql.islnet.net, WWW} 

@item
@c EMAIL: george@netfirm.net (Hongsheng Zhu)
@image{Flags/china} China [Netfirm] @ 
@uref{http://mysql.netfirm.net, WWW}

@item
@c EMAIL: ahmlhs@nmsvr.chosun.com (Ho-sun Lee)
@image{Flags/south-korea} Korea [KREONet] @ 
@uref{http://linux.kreonet.re.kr/mysql/, WWW}

@c @item
@c ftp -> remove old files
@c EX: ahmlhs@nmsvr.chosun.com (Ho-sun Lee)
@c @image{Flags/south-korea} Korea [KREONet] @ 
@c @uref{ftp://linux.kreonet.re.kr/pub/tools/db/mysql/, FTP}

@item
@c Ok 980805
@c EMAIL: takeshi@SoftAgency.co.jp
@image{Flags/japan} Japan [SoftAgency] @ 
@uref{http://www.softagency.co.jp/MySQL, WWW}����
@uref{http://www.softagency.co.jp/, ���ܸ���MySQL�Υ����������(WWW) }

@c @item
@c Ok 980109 Removed 990730
@c EMAIL: satoshi@HappySize.co.jp (Satoshi TATSUOKA)
@c @image{Flags/japan} Japan [HappySize] @ 
@c @uref{http://www.happysize.co.jp/mysql/, WWW}
@c @uref{ftp://ftp.happysize.co.jp/pub/mysql/, FTP}

@item
@c Ok 981204
@c EMAIL: hiroyuki@nucba.ac.jp (hiroyuki kurimoto)
@image{Flags/japan} Japan [Nagoya Syouka University] @ 
@uref{http://mirror.nucba.ac.jp/mirror/mysql, WWW}
@uref{ftp://mirror.nucba.ac.jp/mirror/mysql, FTP}

@c @item
@c Removed 990308
@c EMAIL: terence@com5.net (Terence Chan)
@c @image{Flags/singapore} Singapore [Com5 Productions] @ 
@c @uref{http://mysql.com5.net, WWW}
@c @uref{ftp://ftp.com5.net/pub/mysql, FTP}

@item
@c EMAIL: csy@hjc.edu.sg
@image{Flags/singapore} Singapore [HJC] @
@uref{http://mysql.hjc.edu.sg, WWW}
@uref{ftp://ftp.hjc.edu.sg/mysql, FTP}

@item
@c 991118: Removed because a user complained about that the page contains
@c nothing about MySQL. 991119: Added again because it is a mirror again
@c EMAIL: dean@ht.net.tw (Dean Lin)
@image{Flags/taiwan} Taiwan [HT] @ 
@uref{http://mysql.ht.net.tw, WWW}

@item
@c EMAIL: linda@ttn.com.tw (Linda Hu)
@image{Flags/taiwan} Taiwan [TTN] @ 
@uref{http://mysql.ttn.net, WWW}

@c @item
@c Ok 980321 No connect -> removed 990730
@c EMAIL: tby@ccca.nctu.edu.tw (Bao-Yi Tuang)
@c @image{Flags/taiwan} Taiwan [NCTU] @ 
@c @uref{http://mysql.taconet.com.tw, WWW}
@c @item
@c Out of date 990905 (~2 months)
@c @item @c **********************************
@c Error 980106
@c EX: WolfySu@acer.net (Wolfy Su)
@c @image{Flags/taiwan} Taiwan [Acer] @ 
@c @uref{http://mysql.acer.net/, WWW}
@c @item @c **********************************
@c files to delete
@c EX: service@wownet.net
@c @image{Flags/taiwan} Taiwan [Wownet] @ 
@c @uref{ftp://ftp.wownet.net/mysql/, FTP}
@c @item @c **********************************
@c No conntact 980106
@c EX: serge@oneway.net
@c @image{Flags/taiwan} Taiwan [Oneway] @ 
@c @uref{ftp://ftp.oneway.com.tw/pub/mysql/, FTP}
@end itemize

@strong{�������ȥ�ꥢ:}

@itemize @bullet
@item
@c Added 980610
@c EMAIL: jason@dstc.edu.au (Jason Andrade)
@image{Flags/australia} Australia [AARNet/Queensland] @ 
@uref{http://mirror.aarnet.edu.au/mysql, WWW}
@uref{ftp://mirror.aarnet.edu.au/pub/mysql, FTP}

@c @item
@c Added 980805. Removed 000102 'no such directory'
@c EMAIL: sdd@ntccc.tas.gov.au (Scott Donovan)
@c @image{Flags/australia} Australia [Tas] @ 
@c @uref{http://ftp.tas.gov.au/mysql, WWW}
@c @uref{ftp://ftp.tas.gov.au/pub/mysql, FTP}

@item
@c Ok 980623
@c EMAIL: samh@bluep.com (Sam Hadzajlic)
@image{Flags/australia} Australia [Blue Planet/Melbourne] @ 
@uref{http://mysql.bluep.com/, WWW}
@c removed because ftp was not working 990729 & 30
@c @uref{ftp://mysql.bluep.com/pub/mirror1/mysql/, FTP}

@item
@c Added 990531
@c EMAIL: gavin@itworks.com.au (Gavin Cameron)
@image{Flags/australia} Australia [ITworks Consulting/Victoria] @ 
@uref{http://mysql.itworks.com.au, WWW}

@c @item
@c 980610 Only the toplevel dir!
@c EMAIL: lucifer@maths.uq.edu.au (David Conran)
@c @image{Flags/australia} Australia FTP @ 
@c @uref{ftp://ftp.sage-au.org.au/pub/database/mysql, [Sage]}
@end itemize

@strong{���եꥫ:}

@itemize @bullet

@item
@c Ok 981010
@c EMAIL: nick@mweb.com (Nick Rosenberg)
@image{Flags/south-africa1} South-Africa [Mweb/] @ 
@uref{http://www.mysql.mweb.co.za, WWW}

@item
@c Ok 981010
@c EMAIL: oskar@is.co.za (Oskar Pearson)
@image{Flags/south-africa1} South-Africa [The Internet Solution/Johannesburg] @ 
@uref{ftp://ftp.is.co.za/linux/mysql/, FTP}

@end itemize

@c END_OF_MIRROR_LISTING

@node Which OS, Which version, Getting MySQL, Installing
@section @strong{MySQL} �����ݡ��Ȥ��� OS

�桹�� GNU Autoconf ����Ѥ��Ƥ��ޤ��Τǡ�@strong{MySQL} �� POSIX �����
�ɤ� C++ ����ѥ��餬ư������Ƥο����������ƥ�˰ܿ���ǽ�Ǥ���(���饤
����ȥ����ɤΥ���ѥ�������� C++ ��ɬ�פȤ��ޤ���������åɤ�ɬ�פǤϤ���ޤ���)
�桹�ϼ��ȤΥ��եȥ������򡢺ǽ�� Sun Solaris (���ߤ� 2.5 & 2.6 & 2.7) ��ǡ����
�������ϰϤ� RedHat Linux 5.0 ��ǡ����Ѥ���ȯ���ޤ���

@strong{MySQL} �ϼ��� OS/����åɥѥå��������Ȥ߹�碌�ǡ�����ѥ����
��������𤵤�Ƥ��ޤ���¿���� OS �Ǥϡ��ͥ��ƥ��֥���åɤϺǿ��С�����
�������ư��뤳�Ȥ����դ��Ƥ���������

@itemize @bullet
@item
AIX 4.x with native threads
@item
BSDI 2.x with the included MIT-pthreads package
@item
BSDI 3.0, 3.1 and 4.x with native threads
@item
DEC UNIX 4.x with native threads
@item
FreeBSD 2.x with the included MIT-pthreads package
@item
FreeBSD 3.x with native threads
@item
HP-UX 10.20 with the included MIT-pthreads package
@item
HP-UX 11.x with the native threads.
@item
Linux 2.0+ with LinuxThreads 0.7.1 or @code{glibc} 2.0.7
@item
MacOS X Server
@item
NetBSD 1.3/1.4 Intel and NetBSD 1.3 Alpha (Requires GNU make)
@item
OpenBSD > 2.5 with native therads. OpenBSD < 2.5 with the included
MIT-pthreads package
@item
OS/2 Warp 3, FixPack 29 and OS/2 Warp 4, FixPack 4
@item
SGI Irix 6.x with native threads
@item
Solaris 2.5 and above with native threads on SPARC and x86
@item
SunOS 4.x with the included MIT-pthreads package
@item
SCO OpenServer with a recent port of the FSU Pthreads package
@item
SCO UnixWare 7.0.1
@item
Tru64 Unix
@item
Win95, Win98, NT and Win2000 (the newest version is currently available
only for users with a @strong{MySQL} license or @strong{MySQL} email
support).  For those who wish to test before they buy, we have released
@uref{http://www.mysql.com/mysql_w32.htmy,@strong{MySQL} 3.22.33} (an
older version) as shareware.
@end itemize

@cindex @strong{MySQL} binary distribution
@cindex @strong{MySQL} source distribution
@cindex Release numbers
@cindex Version, choosing
@cindex Choosing version
@node Which version, Many versions, Which OS, Installing
@section ���Ѥ��� @strong{MySQL} �С������

make ��Ԥ����˷�����ϡ����ʤ����ǿ��γ�ȯ��꡼������Ѥ���Τ���
�ޤ��Ϻǿ��ΰ����꡼������Ѥ���Τ��Ǥ���

@itemize @bullet
@item
�̾���ʤ����ǽ�� @strong{MySQL} ��Ȥ��Ϥ���硢�ޤ��ϥХ��ʥ�����
���ʤ�¾�Υ����ƥ�� @strong{MySQL} ��ܿ����褦�Ȥ����硢
�桹�ϳ�ȯ��꡼�� (���ߤ� @value{mysql_version}) �������
����ޤ�����ȯ��꡼���ˤ����̤������˰����Х��Ϥ���ޤ��󡣤���ϡ����ʤ��Υޥ����ǡ�
@code{crash-me} �ȥ٥���ޡ����ƥ��ȤǴ�ñ�˥ƥ��ȤǤ��ޤ���
@xref{Benchmarks}������: ���٤Ƥ� @strong{MySQL} ��꡼���Ϥ��줾��Υ�꡼
�������� @strong{MySQL} �٥���ޡ����ȹ��ϰϤʥƥ��ȥ������Ȥǥ����å�����
�ޤ���

@item
�����Ǥʤ��ơ��Ť������ƥ�Ǽ¹Ԥ��Ƥ��ƥ��åץ��졼�ɤ���������ɤ⡢
��ȯ�Ǥϻ�����ʤ����ϡ����ʤ������Ѥ��Ƥ���ʪ��Ʊ���֥������
�ǿ��Τ��(���ʤ������Ѥ��Ƥ���ʪ��꿷�����С�������ʪ)��
���åץ��졼�ɤ��٤��Ǥ��� ���ΥС������Ǥϡ���̿Ū�ʥХ�������������
���Ū�����Ǿ������ѹ���ԤäƤ��ޤ���
@end itemize

make ���Σ����ܤη������ϡ����������ۤȥХ��ʥ����ۤΤɤ������Ѥ��뤫�Ǥ�:

@itemize @bullet
@item
���ʤ������ߥХ��ʥ����ۤ�¸�ߤ���ץ�åȥե������� @strong{MySQL} ��
�¹Ԥ������Τʤ顢�������Ѥ��Ƥ����������̾���������ۤ��⥤�󥹥ȡ�
��ϴ�ñ�Ǥ���

@item
@strong{MySQL} ���� C �� C++ �����ɤ��ɤߤ���(������/�ޤ����ѹ�������)
���ϥ��������ۤ����ꤹ��٤��Ǥ��������������ɤϤ��ĤǤ��ˤΥޥ˥奢
��Ǥ������������ۤϥХ��ʥ����ۤ���¿���Υƥ��Ȥ����ޤ�Ǥ��ޤ���
@end itemize

@strong{MySQL} ��̿̾ˡ�Ǥϡ���꡼���ֹ��3�Ĥο��ͤȥ��ե��å��������
��ޤ����㤨�С�@code{mysql-3.21.17-beta} �Τ褦�ʥ�꡼��̾�ϼ��Τ褦��
��ᤵ��ޤ�:

@itemize @bullet
@item
�ǽ�ο���(@code{3})�ϥե����������ɽ���ޤ������ƤΥС������ 3 ��꡼
����Ʊ���ե�����ե����ޥåȤ�����ޤ����С������ 4 �����줿�������Ƥ�
�ơ��֥�Ͽ������������Ѵ�����ɬ�פ�����ޤ� (���Τ�����ɤ��ġ���Ϥ��
����ޤޤ�ޤ�)��

@item
2���ܤο���(@code{21})�ϥ�꡼����٥�Ǥ����̾����Ĥ������򤷤ޤ�����
�Ĥϥ�꡼��/����֥�����(���ߤ� @code{22})���⤦��Ĥϳ�ȯ�֥����Ǥ�(���ߤ� @code{23})��
�̾��ξ���Ȥ����Ǥ�������ȯ�С������Ϥ��ޤ���ǡ��ɥ�����Ȥ��ʤ��������Ĥ��Υ�
���ƥ�Ǥϥ���ѥ���˼��Ԥ��ޤ���

@item
3���ܤο���(@code{17})�ϥ�꡼����٥���ΥС�������ֹ�Ǥ�������Ͽ���
�����ۤ��٤����ä��ޤ������̤Ϥ��ʤ������򤷤���꡼����٥�κǿ��С�����
�����ޤ���

@item
���ե��å���(@code{beta})�ϥ�꡼���ΰ����٥��ɽ���ޤ�:

@itemize @minus
@item
@code{alpha} �ϡ�100% �ƥ��Ȥ���Ƥ��ʤ������Ĥ��ο������礭�ʥ����ɥ���
�����¸�ߤ��뤳�Ȥ򼨤����Τ��Ƥ���Х��� News ��˵��Ҥ���Ƥ��ޤ�
(�̾�Ϥ���ޤ���)��@xref{News}��¿���� alpha ��꡼���ˤϿ���������
��ɤȳ�ĥ�⤢��ޤ���
�礭�ʥ������ѹ���ޤ೫ȯ��Τ�Τϡ�alpha ��꡼����˸���ޤ���������
���ƥ�꡼�����˥ƥ��Ȥ���ޤ������줾��� @code{MySQL} ��꡼���ˤϴ���
�ΥХ��Ϥ���ޤ���

@item
@code{beta} �����Ƥο����������ɤ��ƥ��Ȥ��줿���Ȥ��̣���ޤ����礭�ʿ�
������Τ��ɲä���ޤ����Τ��Ƥ���Х��Ϥ���ޤ���
alpha �С������ǡ����ʤ��Ȥ�쥫��֡���̿Ū�ʥХ�����𤵤�ʤ��ơ���
�����ޥ�ɤ��꿮��Ǥ��ʤ�����褦�ʿ�������ǽ���ɲä���ײ褬�ʤ����ˡ�
alpha ���� beta �˥С�������ѹ�����ޤ���

@item
@code{gamma} �� beta �����Ф餯���ơ�������ư���褦�˸������ΤǤ���
�����ʽ����������ɲä���ޤ���
�����¿����¾�β�Ҥ���꡼���ȸƤ֤�ΤǤ���

@item
���ե��å������ʤ����ϡ�¿���ΰۤʤ���ǡ��ץ�åȥե������ͭ�ΥХ�
������ƥХ���ݡ��Ȥʤ��Ǥ��ΥС�����󤬤��Ф餯�δ�ư��Ƥ������Ȥ�
��̣���ޤ��� ��̿Ū�ʥХ�������������꡼����Ŭ�Ѥ���ޤ���
����ϲ桹�� stable ��꡼���ȸƤ֤�ΤǤ���
@end itemize
@end itemize

@strong{MySQL} �����ƤΥС������ϡ����Ū�����˻��ѤǤ��뤳�Ȥ�Τ���
�뤿�ᡢ�桹��ɸ��ƥ��Ȥȥ٥���ޡ������̤��Ƴ�ǧ���Ƥ��ޤ���ɸ��ƥ�
�Ȥϰ����˸��Ĥ��ä����ƤΥХ�������å�����褦�˳�ĥ����뤿�ᡢ�ƥ���
�������ȤϤ���ɤ��ݻ�����ޤ���

���ƤΥ�꡼���Ͼ��ʤ��Ƥ⼡�Υƥ��Ȥ�����Ƥ��뤳�Ȥ����դ��Ƥ�������:

@table @asis
@item �����ƥ��ȥ�������
����ϸܵҤΤ�������ʥ����ƥ�ΰ����Ǥ���¿���Υơ��֥�Ȳ�ɴ�Ȥ����ᥬ
�Х��ȤΥǡ�������äƤ��ޤ���

@item @strong{MySQL} �٥���ޡ�����������
����ϰ���Ū���ϰϤΥ������¹Ԥ��ޤ�������ϡ���Ŭ���κǿ��Хå����º�
�˥����ɤ���®�����뤫�ɤ������ǧ����ƥ��ȤǤ⤢��ޤ���
@xref{Benchmarks}��

@item @code{crash-me} �ƥ���
����ϡ��ǡ����١��������ݡ��Ȥ��Ƥ��뵡ǽ�ȡ����ε����̤����¤���ꤷ��
���Ȥ��ޤ���@xref{Benchmarks}��
@end table

¾�Υƥ��Ȥϲ桹���������ʴĶ��Ǻǿ��� @strong{MySQL} �С�������桹��
���ʤ��Ȥ�1�ĤΥޥ���ǻ��Ѥ��뤳�ȤǤ����桹��ư��Τ��� 100�����Х���
�ʾ�Υǡ���������ޤ���

@node Many versions, Installation layouts, Which version, Installing
@section ���åץǡ��Ȥ���꡼���������ˡ�Ȼ�

@strong{MySQL} �� TcX �Ǥ��ʤ�®���ʲ����Ƥ��ơ��桹�Ϥ����¾�� 
@strong{MySQL} �桼���˶�ͭ���Ƥ�餤�����Ǥ����桹�ϡ�¾�οͤ�ɬ�פȤ�
�Ƥ���Ȼפ���ȤƤ������ʵ�ǽ����ä����ˡ���꡼���κ������ߤޤ���

�桹�ϡ���������ñ�ʵ�ǽ���׵᤹��桼���μ�������ߤޤ����桹�ϡ��桹
�Υ饤���󥹥桼���������Τˤ����ܤ����ä˲桹�γ�ĥ email ���ݡ���
�ܵҤ������Τ����ܤ��ơ����μ�������ߤޤ���

��������꡼�������������ɤ���ɬ�פϤ���ޤ���News ��ϡ���������꡼
���������ʤ��������˵��벿������äƤ��뤫�ɤ����򤢤ʤ��˶����ޤ���
@xref{News}��

�桹�� @strong{MySQL} �ι������ϼ��Υݥꥷ���ˤ������äƹԤ��ޤ���

@itemize @bullet
@item
���줾��Υޥ��ʡ����åץǡ��Ȥǡ��С������ʸ������κǸ�ο��ͤ����ä�
�ޤ������פʿ���ǽ�����ΥС������ȤΥޥ��ʡ�����ߴ������ä����ˤϡ��С�
�����ʸ�������2���ܤο��ͤ����ä��ޤ����ե�����������ѹ����������ǽ�
�ο��ͤ����ä��ޤ���

@item
����˥ƥ��Ȥ��줿��꡼����ǯ���� 1-2 �󸽤�ޤ��������������ʥХ�����
�Ĥ��ä����ϡ��Х��ե��å��������Υ�꡼������꡼������ޤ���

@item
�����Υ�꡼������ 1-8 ������˸���ޤ���

@item
�����Ĥ��Υץ�åȥե�����Τ���ΥХ��ʥ����ۤϲ桹�ˤ�äƥ᥸�㡼��꡼
���������ޤ���¾�οͤ�¾�Υ����ƥ�Τ���˥Х��ʥ����ۤ���ޤ�����
�����餯���ˤǤϤ���ޤ���

@item
�̾�����ʥХ��򸫤Ĥ��ƽ�������Ȥ����ˡ�ͭ���ʥѥå�����ޤ���

@item
�����ǤϤʤ�����ɤ⺤�餵���Х��ˤϡ��桹���Τ餻��ĺ�����ͭ���ʥѥ�
����������ޤ�������¾�ξ�硢�礭�ʥѥå�����ˤ�����¿�����礷�ޤ���

@item
��������̿Ū�ʥХ�����꡼����ˤ����硢�桹�Ͽ�������꡼�����ǽ�ʸ�
�ꤹ���˺��ޤ���¾�β�Ҥ⤽�����Ƥ�餤�����Ǥ���:)
@end itemize

���ߤΰ����꡼���� 3.22 �Ǥ�; �桹�Ϥ��Ǥ� 3.23 �γ�ȯ�˰ܹԤ��Ƥ��ޤ���
������������С������Ǥ�Х��Ϥޤ���������ޤ���
�桹�ϡ��Х�������``�Ԥʤ�ʤ���Ф����ʤ�''���Ȥ�̵�뤹��褦�ʡ�������
����ͤ��Ƥ��ޤ���``��ʬ�������''�Ȥϡ�``�ۤȤ�ɳμ¤˴���ư���
�����Τ˱ƶ���Ϳ���ʤ�''�����ʤ��Ȥ��ɲä��뤫�⤷��ʤ��Ȥ������Ȥ��
̣���ޤ���

@node Installation layouts, Installing binary, Many versions, Installing
@section ���󥹥ȡ���쥤������

������Ǥϡ��Х��ʥ�ȥ��������ۤΥ��󥹥ȡ�������������ǥ��쥯�ȥ��
�ǥե���ȤΥ쥤�����Ȥ��������ޤ���

�Х��ʥ����ۤϥ���ѥå����뤳�Ȥˤ�ꥤ�󥹥ȡ��뤵�졢���󥹥ȡ�����
�Ϥ��ʤ������򤷤����(�̾� @file{/usr/local/mysql})����μ��Υǥ��쥯��
��������������ޤ�:

@multitable @columnfractions .3 .7
@item @strong{�ǥ��쥯�ȥ�} @tab @strong{�ǥ��쥯�ȥ������}
@item @file{bin}         @tab ���饤����ȥץ������, @code{mysqld} ������
@item @file{data}        @tab �����ե�����, �ǡ����١���
@item @file{include}     @tab ���󥯥롼��(�إå�)�ե�����
@item @file{lib}         @tab �饤�֥��
@item @file{scripts}     @tab @code{mysql_install_db}
@item @file{share/mysql} @tab ���顼��å������ե�����
@item @file{sql-bench}   @tab �٥���ޡ���
@end multitable

���������ۤ� configure ������ѥ��뤷����˥��󥹥ȡ��뤵��ޤ����ǥե�
��ȤǤϥ��󥹥ȡ��륹�ƥåפ� @file{/usr/local} �۲��Υե�����򼡤Υ�
�֥ǥ��쥯�ȥ�˥��󥹥ȡ��뤷�ޤ�:

@multitable @columnfractions .3 .7
@item @strong{�ǥ��쥯�ȥ�} @tab @strong{�ǥ��쥯�ȥ������}
@item @file{bin}         @tab ���饤����ȥץ������ȥ�����ץ�
@item @file{include/mysql}  @tab ���󥯥롼�ɥե�����
@item @file{info}        @tab Info �����Υɥ������
@item @file{lib/mysql}   @tab �饤�֥��
@item @file{libexec}     @tab @code{mysqld} ������
@item @file{share/mysql} @tab ���顼��å������ե�����
@item @file{sql-bench}   @tab �٥���ޡ����� @code{crash-me} �ƥ���
@item @file{var}         @tab �ǡ����١����ȥ����ե�����
@end multitable

���������󥹥ȡ���Υ쥤�����ȤϥХ��ʥꥤ�󥹥ȡ���ȼ��������ۤʤ�ޤ�:

@itemize @bullet
@item
@code{mysqld} �����Ф� @file{/bin} �ǤϤʤ� 
@file{libexec} �ǥ��쥯�ȥ�˥��󥹥ȡ��뤵��ޤ���
@item
�ǡ����ǥ��쥯�ȥ�� @file{data} �ǤϤʤ� 
@file{var} �Ǥ���
@item
@code{mysql_install_db} �� @file{/usr/local/mysql/scripts} �ǤϤʤ�
@file{/usr/local/bin} �ǥ��쥯�ȥ�˥��󥹥ȡ��뤵��ޤ���

@item
�إå����ե�����Υǥ��쥯�ȥ�� @file{include/mysql} �ǡ�
�饤�֥��Υǥ��쥯�ȥ�� @file{lib/mysql} �Ǥ���
@file{include} �� @file{lib} �ǤϤ���ޤ���
@end itemize

@node Installing binary, Installing source, Installation layouts, Installing
@section @strong{MySQL} �Х��ʥ����ۤΥ��󥹥ȡ���

@menu
* Linux-RPM::                   Linux RPM files
* Building clients::            Building client programs
* Binary install system issues::  System-specific issues
@end menu

���ˤ���˾ܺ٤�������Ԥʤ��ޤ�:

@strong{MySQL} �Х��ʥ����ۤ򥤥󥹥ȡ��뤹��ˤϡ����Υġ��뤬ɬ�פǤ�:

@itemize @bullet
@item
GNU @code{gunzip}�����ۤο�Ĺ�Τ��ᡣ

@item
Ŭ���� @code{tar}�����ۤ�Ÿ���Τ��ᡣGNU @code{tar} ��ư�����Ȥ��Τ���
���ޤ���
@end itemize

@cindex RPM
@cindex RedHat Package Manager
Linux �Ǥϡ�����Υ��󥹥ȡ�����ˡ�Ȥ��� RPM (RedHat Package
Manager) ����Ѥ��뤳�Ȥ��Ǥ��ޤ��� @xref{Linux-RPM}.

@c texi2html fails to split chapters if I use strong for all of this.
���꤬�������Ȥ��ϡ�@email{mysql@@lists.mysql.com} �˼������Ƥ������ 
@code{mysqlbug} ��@strong{��˻��Ѥ��Ƥ�������}�����꤬�Х��Ǥʤ��Ȥ���
�⡢@code{mysqlbug} �Ϥ��ʤ���������褹������ˤʤ�Ǥ����������ƥ��
���������ޤ���@code{mysqlbug} ����Ѥ��ʤ��ȡ����ʤ�������β�������
��ǽ�����������ʤ�ޤ��� @code{mysqlbug} �ϡ����ۤΥ���ѥå���� 
@file{bin} �ǥ��쥯�ȥ���˸��Ĥ����ޤ���@xref{Bug reports}.

@strong{MySQL} �Х��ʥ����ۤ򥤥󥹥ȡ��뤷�����Ѥ��뤿��˹Ԥʤ�ʤ���Фʤ�ʤ�
����Ū�ʥ��ޥ��:

@example
shell> gunzip < mysql-VERSION-OS.tar.gz | tar xvf -
shell> ln -s mysql-VERSION-OS mysql
shell> cd mysql
shell> scripts/mysql_install_db
shell> bin/safe_mysqld &
@end example

�����Ǥ���˾ܺ٤�������³���ޤ�:

�Х��ʥ����ۤΥ��󥹥ȡ���ˤϡ����Υ��ƥåפ˽��������줫�� ���󥹥ȡ�
���Υ��åȥ��åפȥƥ��ȤΤ���� @ref{Post-installation} �˿ʤ�Ǥ���
������

@enumerate
@item
�۲������ۤ򥢥�ѥå��������ǥ��쥯�ȥ������ǡ������˰ܤäƤ���������
�ʲ�����Ǥϡ�@file{/usr/local} �۲������ۤ򥢥�ѥå�����@strong{MySQL} 
�򥤥󥹥ȡ��뤹��ǥ��쥯�ȥ� @file{/usr/local/mysql} ���������ޤ���(��
�����äơ��ʲ��λؼ��� @file{/usr/local} �˥ե��������������ѡ��ߥå���
�����äƤ���Ȥߤʤ��ޤ����ǥ��쥯�ȥ꤬�ץ��ƥ��Ȥ���Ƥ�����ϡ�
@code{root} �ǥ��󥹥ȡ����Ԥʤ�ɬ�פ�����ޤ���)

@item
���ۥե����� @ref{Getting MySQL, , Getting @strong{MySQL}}. �˥ꥹ�Ȥ��줿�����Ȥΰ�Ĥ������Ƥ���������

@strong{MySQL} �Х��ʥ����ۤϰ��̤��줿 @code{tar} ���������֤Ȥ�����
���졢@file{mysql-VERSION-OS.tar.gz} �Τ褦��̾��������ޤ��������� 
@code{VERSION} �Ͽ���(�㤨�С�@code{3.21.15})�ǡ�@code{OS} �����ۤ��տ�
���Ƥ��륪�ڥ졼�ƥ��󥰥����ƥ�μ����ɽ���ޤ�(�㤨�� 
@code{pc-linux-gnu-i586})��

@item
���ۤ򥢥�ѥå��������󥹥ȡ���ǥ��쥯�ȥ���������Ƥ�������:

@example
shell> gunzip < mysql-VERSION-OS.tar.gz | tar xvf -
shell> ln -s mysql-VERSION-OS mysql
@end example

�ǽ�Υ��ޥ�ɤ� @file{mysql-VERSION-OS} �Ȥ���̾���Υǥ��쥯�ȥ������
���ޤ��������ܤΥ��ޥ�ɤϤ��Υǥ��쥯�ȥ�˥���ܥ�å���󥯤��������
��������ϥ��󥹥ȡ���ǥ��쥯�ȥ�� @file{/usr/local/mysql} �Ȥ��ơ���
���ñ�˻��Ȥ����뤿��Ǥ���

@item
���󥹥ȡ���ǥ��쥯�ȥ�˰ܤäƤ�������:

@example
shell> cd mysql
@end example

�����Ĥ��Υե�����ȥ��֥ǥ��쥯�ȥ꤬ @code{mysql} �ǥ��쥯�ȥ���˸���
�����ޤ������󥹥ȡ�����Ū�κǤ���פʤ�Τ� @file{bin} �� 
@file{scripts} ���֥ǥ��쥯�ȥ�Ǥ���

@table @file
@item bin
@tindex PATH environment variable
@tindex Environment variable, PATH
���Υǥ��쥯�ȥ�ϥ��饤����ȥץ������ȥ����Ф�ޤ�Ǥ��ޤ��������뤬 
@strong{MySQL} �ץ����������������Ĥ�����褦�ˡ����Υǥ��쥯�ȥ��
�ե�ѥ�̾�򤢤ʤ��� @code{PATH} �Ķ��ѿ����ɲä��٤��Ǥ���@xref{Environment variables}.

@item scripts
���Υǥ��쥯�ȥ�� @code{mysql_install_db} ������ץȤ�ޤ�Ǥ��ޤ�����
��ϥ����Х��������ѡ��ߥå������������뤿��˻��Ѥ���ޤ���
@end table

@item
@code{mysqlaccess} ����Ѥ������� @strong{MySQL} ���ۤ���ɸ��ξ��˻�
���������ϡ�@code{mysqlaccess} �� @code{mysql} ���饤����Ȥ򸫤Ĥ���
���Ȥ�������ѹ�����ɬ�פ�����ޤ���@file{bin/mysqlaccess} ������ץ�
�� 18 �����ն���Խ����Ƥ������������Τ褦�ʹԤ�õ���Ƥ�������:

@example
$MYSQL     = '/usr/local/bin/mysql';    # path to mysql executable
@end example

�ѥ��� @code{mysql} ���ºݤ˥����ƥ��ˤ�����Ƥ�����򼨤��褦���ѹ�
���Ƥ��������������Ԥʤ�ʤ��ȡ�@code{mysqlaccess} �¹Ի��� 
@code{broken pipe} ���顼�ˤʤ�Ǥ��礦��

@item
@strong{MySQL} ���ĥơ��֥��������ޤ�
 (����Ͻ��� @strong{MySQL} �򥤥󥹥ȡ��뤹��Ȥ������Ԥ��ޤ�):
@example
shell> scripts/mysql_install_db
@end example

3.22.10�����ΥС������� @strong{MySQL} �ϡ�@code{mysql_install_db}. �¹Ի���
@strong{MySQL} ��ư���Ƥ��ޤ���������Ϥ䤳��ϵ�ư���ʤ��ʤ�ޤ���

@item
Perl @code{DBI}/@code{DBD} ���󥿥ե������Υ��ݡ��Ȥ򥤥󥹥ȡ��뤷����
��硢@ref{Perl support} �򸫤Ƥ���������

@item
@strong{MySQL} ��ޥ���ư���˼�ưŪ�˳��Ϥ�������硢
@code{support-files/mysql.server} �򥷥��ƥ�Υ������ȥ��åץե����뤬������˥�
�ԡ����Ƥ�������������ʤ����� @code{support-files/mysql.server} ������ץȼ���
����ȡ�@ref{Automatic start} �˸��Ĥ����ޤ���
@end enumerate

���Ƥ�����ѥå�����ƥ��󥹥ȡ��뤵�줿�塢���ۤν�����ȥƥ��Ȥ�Ԥʤ�
�٤��Ǥ���

@strong{MySQL} �����С��ϰʲ��Υ��ޥ�ɤdz��ϤǤ��ޤ���

@example
shell> bin/safe_mysqld &
@end example

@xref{Post-installation}.

@cindex RPM
@cindex RedHat Package Manager
@c This node name is special
@node Linux-RPM, Building clients, Installing binary, Installing binary
@subsection Linux RPM notes

���������⤷ RedHat �ʳ��� Linux ����Ѥ��Ƥ��ꡢ.rpm �򡢼�ʬ�����Ѥ��Ƥ���
�ѥå��������������ƥ�δ������ˤ���������硢@strong{alien : http://kitenet.net/programs/alien/} �Ȥ����ġ����
���Ѥ��ޤ�������� RPM(Debian, Slackware) ��ʬ�����Ѥ��Ƥ���ѥå������η������Ѵ����Ƥ���ޤ���
��

RPM ����Ѥ��� @strong{MySQL} �򥤥󥹥ȡ��뤹�뤳�Ȥ�侩���ޤ���
@strong{MySQL} RPMS �� RedHat 5.2 �Ǻ������Ƥ��ޤ�����
¾�� @code{rpm} �� @code{glibc} �򥵥ݡ��Ȥ��Ƥ��� Linux �Ǥ�ư���Ǥ��礦��

RPM file �Ǥ�����, �㤨�� @code{Sorry, the host
'xxxx' could not be looked up} �ϡ�see @ref{Binary notes-Linux}.

�ʲ������Ѥ���Ǥ����� RPM files �Ǥ�:

@itemize @bullet
@item @code{MySQL-VERSION.i386.rpm}

@strong{MySQL} ��������
����ñ��¾�Υޥ��������äƤ��� @strong{MySQL} �����С�����³��������ʤ顢
��������פǤ��礦��

@item @code{MySQL-client-VERSION.i386.rpm}

@strong{MySQL} ���饤�����ɸ��ץ�����ࡣ
���Υѥå������ϤۤȤ�ɤξ�祤�󥹥ȡ��뤹�뤳�Ȥˤʤ�Ǥ��礦��

@item @code{MySQL-bench-VERSION.i386.rpm}

�٥���ޡ�����perl msql-mysql-modules RPM ��ɬ�ס�

@item @code{MySQL-devel-VERSION.i386.rpm}

¾�� @strong{MySQL} ���饤�����(perl�⥸�塼��Τ褦��)�򥳥�ѥ��뤹��Τ�ɬ�פ�
�饤�֥�꡼�ȥ��󥯥롼�ɥե������ޤߤޤ���

@item @code{MySQL-VERSION.src.rpm}

�嵭���ƤΥ������������¾�Υ������ƥ������Ѥ� RPM �����������ˤΤ�ɬ�פǤ��礦��
(�㤨�� Alpha or SPARC).
@end itemize

RPM �ѥå������˴ޤޤ��ե������ߤ�ˤ�:
@example
shell> rpm -qpl MySQL-VERSION.i386.rpm
@end example

���󥹥ȡ���κǾ�����ˡ��

@example
shell> rpm -i MySQL-VERSION.i386.rpm MySQL-client-VERSION.i386.rpm
@end example

���饤����ȥѥå����������򥤥󥹥ȡ��롧

@example
shell> rpm -i MySQL-client-VERSION.i386.rpm
@end example

RPM �ϥǡ����� @file{/var/lib/mysql} ����¸���ޤ���
RPM �ϵ�ư���˥����С���Ω��������褦�ˡ�@file{/etc/rc.d/} ����Ͽ���ޤ���
(This means that if you have performed a previous
installation, you may want to make a copy of your previously-installed
@strong{MySQL} startup file if you made any changes to it, so you don't lose
your changes.)

After installing the RPM file(s), the @file{mysqld} daemon should be running
and you should now be able to start using @strong{MySQL}.
@xref{Post-installation}.

If something goes wrong, can find more information in the binary
installation chapter. @xref{Installing binary}.

@cindex Client programs, building
@cindex Linking
@node Building clients, Binary install system issues, Linux-RPM, Installing binary
@subsection ���饤����ȥץ������Υӥ��

��ʬ�ǽ񤤤������軰�Ԥ��������� @strong{MySQL} ���饤����ȥץ������򥳥�ѥ��뤹���硢
@code{-lmysqlclient} ���ץ�������Ѥ��ƥ�󥯤���ʤ���Фʤ�ޤ���
�ޤ� @code{-L} ���ץ�������ꤷ�ơ��饤�֥�꤬�ɤ��ˤ��뤫���ꤹ��ɬ�פ�������⤢��ޤ���
�㤨�Х饤�֥�꤬ @file{/usr/local/mysql/lib} �˥��󥹥ȡ��뤵���ʤ�С�
��󥯤λ��� @code{-L/usr/local/mysql/lib -lmysqlclient} �Ȼ��ꤷ�ޤ���

@strong{MySQL} �إå����ե��������Ѥ��륯�饤����ȤΤ���ˡ�
���ʤ��������򥳥�ѥ��뤹����ˤϡ�@code{-I} ���ץ�������ꤷ�ʤ���Фʤ�ʤ����⤢��ޤ���
(�㤨��, @code{-I/usr/local/mysql/include})


@node Binary install system issues,  , Building clients, Installing binary
@subsection System ��ͭ������

@menu
* Binary notes-Linux::          Linux notes
* Binary notes-HP-UX::          HP-UX notes
@end menu

�ʲ��Υ��������Ǥ�����Υ����ƥ��˵������ǧ���줿�����Ĥ�������Τ򼨤��ޤ���

@node Binary notes-Linux, Binary notes-HP-UX, Binary install system issues, Binary install system issues
@subsubsection Linux notes

TcX �ΥХ��ʥ��꡼���� @code{-static} �ǥ�󥯤���Ƥ��ꡢ����Ϥ��ʤ��Υ����ƥब
�ɤΥС������Υ饤�֥�꡼����Ѥ��Ƥ��뤫���ˤ���ɬ�פ�����ޤ���
��äơ�LinuxThreads �⤳�ξ��ɬ�פ���ޤ���
@code{-static} �ǥ�󥯤��줿�ץ������Υ�������
�����ʥߥå���󥯤��줿�ץ���������礭���ʤ�ޤ���������(3-5%)®���ʤ�ޤ���
��������Ĥ�����Ȥ��ơ����Υ����ƥ��å���󥯤��줿�ץ������Ǥϡ�
�桼��������ؿ�(UDF)�����ѤǤ��ʤ����ȤǤ���
�⤷ UDF ����Ѥ���(��)���(C, C++�Ȥ���)����ʬ���Ȥ� @strong{MySQL} ��
�����ʥߥå���󥯤���Ѥ��ƥ���ѥ��뤷�ʤ��ƤϤʤ�ޤ���

�⤷ @code{glibc2} �ǤϤʤ� libc5 �Υ����ƥ����Ѥ��Ƥ���ʤ顢
���ΥХ��ʥ��꡼���Ǥϥۥ���̾����getpwnam()�ˤ����Ĥ����꤬�Фޤ���
(����� @code{glibc} ���ۥ���̾����getwpent()�ˤ����Ĥ��γ����饤�֥���
��¸���Ƥ��뤿��ǡ����Ȥ� @code{-static} ��󥯤��Ƥ��褷�ޤ���).
���ξ�硢@code{mysql_install_db} �¹Ի��˰ʲ��Υ��顼���Ф�Ǥ��礦��

@example
Sorry, the host 'xxxx' could not be looked up
@end example

���뤤�ϡ�@code{--user} ���ץ����� mysqld ��ư���褦�Ȥ����Ȥ���
�ʲ��Υ��顼���Ф��硧

@example
getpwnam: No such file or directory
@end example

��������ϡ��ʲ��Τ����Τɤ줫����ˡ�Dz��Ǥ��ޤ���

@itemize @bullet
@item
@strong{MySQL} ���������ۤ����ꤷ( RPM �� @code{tar} )�������
���󥹥ȡ��뤷�ޤ���

@item
@code{mysql_install_db --force} ��¹Ԥ��ޤ�; ����� @code{mysql_install_db} ��
������Ƥ��� @code{resolveip} �ƥ��Ȥ�¹Ԥ��ޤ���
�ޤ����ĥơ��֥���ǥۥ���̾���Ȥ��ʤ��ʤäƤ��ޤ��� 
�ۥ���̾�Ǥʤ� IP ���ɥ쥹����Ͽ���ޤ� (@code{localhost} �Ͻ�).
�⤷ @code{--force} ����äƤ��ʤ��褦�ʸŤ� @strong{MySQL} ����Ѥ��Ƥ���ʤ顢
���ǥ������ǡ�@code{resolveip} �ƥ��Ȥ� @code{mysql_install} ���������ޤ���
@item
mysqld �� @code{--user} ������� @code{su} �ǵ�ư��
@end itemize

Linux-Intel binary �� @strong{MySQL} RPM ��꡼���ϡ���äȤ�®���ʤ�褦��
Ĵ������Ƥ��ޤ����桹�Ϥ�äȤ��᤯���ꤷ������ѥ��顼���˻��Ѥ��Ƥ��ޤ���


@node Binary notes-HP-UX,  , Binary notes-Linux, Binary install system issues
@subsubsection HP-UX notes

Some of the binary distributions of @strong{MySQL} for HP-UX is
distributed as an HP depot file and as a tar file.  To use the depot
file you must be running at least HP-UX 10.x to have access to HP's
software depot tools.

The HP version of @strong{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.
@strong{MySQL} 3.22.26 and newer can also be built with HP's native
thread package.

Other configurations that may work:

@itemize @bullet
@item
HP 9000/7xx running HP-UX 10.20+
@item
HP 9000/8xx running HP-UX 10.30
@end itemize

The following configurations almost definitely won't work:

@itemize @bullet
@item
HP 9000/7xx or 8xx running HP-UX 10.x where x < 2
@item
HP 9000/7xx or 8xx running HP-UX 9.x
@end itemize

To install the distribution, use one of the
commands below, where @code{/path/to/depot} is the full path to the depot file:

@itemize @bullet
@item
To install everything, including the server, client and development tools:

@example
shell> /usr/sbin/swinstall -s /path/to/depot mysql.full
@end example

@item
To install only the server:

@example
shell> /usr/sbin/swinstall -s /path/to/depot mysql.server
@end example

@item
To install only the client package:

@example
shell> /usr/sbin/swinstall -s /path/to/depot mysql.client
@end example

@item
To install only the development tools:

@example
shell> /usr/sbin/swinstall -s /path/to/depot mysql.developer
@end example
@end itemize

The depot places binaries and libraries in @file{/opt/mysql} and data in
@file{/var/opt/mysql}. The depot also creates the appropriate entries in
@file{/sbin/init.d} and @file{/sbin/rc2.d} to start the server automatically
at boot time. Obviously, this entails being @code{root} to install.

To install the HP-UX tar distribution, you must have a copy of GNU @code{tar}.

@node Installing source, Compilation problems, Installing binary, Installing
@section @strong{MySQL} ���������ۤΥ��󥹥ȡ���

���������� @strong{MySQL} ����������󥹥ȡ��뤹�뤿��ˤϼ��Υġ��뤬ɬ
�פǤ�:

@itemize @bullet
@item
GNU @code{gunzip}�����ۤο�ĥ�Τ��ᡣ

@item
Ŭ���� @code{tar}�����ۤ�Ÿ���Τ��ᡣGNU @code{tar} ��ư�����Ȥ��Τ���
���ޤ���

@item
ANSI C++ ����ѥ��顣@code{gcc} >= 2.8.1, @code{egcs} >= 1.0.2, SGI C++,
SunPro C++ ��Ư�����Ȥ��Τ��Ƥ��륳��ѥ���Τ����Ĥ��Ǥ���
@code{libg++} �� @code{gcc} ���ѻ��ˤ�ɬ�פǤϤ���ޤ���@code{gcc}
2.7.x �ϡ�@file{sql/sql_base.cc} �Τ褦�ʡ������������� C++ �ե�����Τ�
���Ĥ��򥳥�ѥ���Ǥ��ʤ��Ȥ����Х�������ޤ���@code{gcc} 2.7.x ������
���ʤ���С�@strong{MySQL} �򥳥�ѥ���Ǥ���褦�� @code{gcc} �򥢥å�
���졼�ɤ���ɬ�פ�����ޤ���

@item
�ɤ� @code{make} �ץ�����ࡣGNU @code{make} �Ͼ�˿侩���졢������ɬ��
�Ȥ���ޤ������꤬����� GNU @code{make} 3.75 �ʾ�����Ȥ򤪴��ᤷ��
����
@end itemize

@c texi2html fails to split chapters if I use strong for all of this.
���꤬�������Ȥ��ϡ�@email{mysql@@lists.mysql.com} �˼������Ƥ������ 
@strong{@code{mysqlbug} ���˻��Ѥ��Ƥ�������}�����꤬�Х��Ǥʤ��Ȥ���
�⡢@code{mysqlbug} �Ϥ��ʤ���������褹������ˤʤ�Ǥ����������ƥ��
���������ޤ���@code{mysqlbug} ����Ѥ��ʤ��ȡ����ʤ�������β�������
��ǽ�����������ʤ�ޤ��� @code{mysqlbug} �ϡ����ۤΥ���ѥå���� 
@file{scripts} �ǥ��쥯�ȥ���˸��Ĥ����ޤ���@xref{Bug reports}��

@menu
* Quick install::               ���ᤤ���󥹥ȡ���γ���
* Applying patches::            �ѥå���Ŭ��
* configure options::           ŵ��Ū�� @code{configure} ���ץ����
@end menu

@node Quick install, Applying patches, Installing source, Installing source
@subsection ���ᤤ���󥹥ȡ���γ���

@strong{MySQL} �򥽡������饤�󥹥ȡ��뤹�뤿��˹Ԥʤ�ʤ���Фʤ�ʤ�
����Ū�ʥ��ޥ��(from an unpacked @code{tar} file):

@example
shell> ./configure
shell> make
shell> make install
shell> scripts/mysql_install_db
shell> /usr/local/mysql/bin/safe_mysqld &
@end example

RPM ���������鳫�Ϥ�����ϡ�

@example
shell> rpm --rebuild MySQL-VERSION.src.rpm
@end example

����ϥ��󥹥ȡ���Ǥ���RPM�Х��ʥ��������ޤ�

�⤷ @code{DBI} �� @code{Msql-Mysql-modules} Perl �⥸�塼��򥤥󥹥ȡ��뤹��ʤ顢
@code{bin/mysql_setpermission} ������ץȤ����Ѥ��뿷�����桼������
�ɲä��뤳�Ȥ��Ǥ��ޤ���

���ˤ���˾ܺ٤�������Ԥʤ��ޤ�:

���������ۤΥ��󥹥ȡ���ˤϡ����Υ��ƥåפ˽��������줫�� ���󥹥ȡ���
��ν�����ȥƥ��ȤΤ���� @xref{Post-installation} �˿ʤ�Ǥ���������

@enumerate
@item
���ۤ򥢥�ѥå��������ǥ��쥯�ȥ������ǡ������˰ܤäƤ���������

@item
���ۥե������ @ref{Getting MySQL, , Getting @strong{MySQL}}. �˥ꥹ�Ȥ��줿�����Ȥΰ�Ĥ������Ƥ���������

@strong{MySQL} ���������ۤϰ��̤��줿 @code{tar} ���������֤Ȥ����󶡤�
�졢@file{mysql-VERSION.tar.gz} �Τ褦��̾��������ޤ��������� 
@code{VERSION} �� @value{mysql_version} �Τ褦���ֹ�Ǥ���

@item
�����ȥǥ��쥯�ȥ�����ۤ򥢥�ѥå����Ƥ�������:
@example
shell> gunzip < mysql-VERSION.tar.gz | tar xvf -
@end example
���Υ��ޥ�ɤ� @file{mysql-VERSION} �Ȥ���̾���Υǥ��쥯�ȥ��������ޤ���

@item
����ѥå����줿���ۤΥȥåץ�٥�ǥ��쥯�ȥ�˰ܤäƤ�������:
@example
shell> cd mysql-VERSION
@end example

@item
��꡼���� configure �������Ƥ򥳥�ѥ��뤷�Ƥ�������:
@example
shell> ./configure --prefix=/usr/local/mysql
shell> make
@end example
@code{configure} �μ¹Ի��������Ĥ��Υ��ץ��������Ǥ��ޤ������ץ���
��ΰ����� @code{./configure --help} ��¹Ԥ��Ƥ���������@ref{configure
options, , @code{configure} options}, �����ͭ�Ѥʥ��ץ����Τ����Ĥ���
�Ĥ��Ƶ������Ƥ��ޤ���

@code{configure} �����Ԥ��ơ���������뤿��� @email{mysql@@lists.mysql.com} �˥᡼
����������Ȥ����硢@file{config.log} ��������β��μ�����ˤǤ����
�ͤ�����Ԥ�ޤ�Ƥ���������@code{configure} ���۾ェλ�����硢
@code{configure} ����ν��ϤκǸ�ο��Ԥ�ޤ�Ƥ����������Х���ݡ��Ȥ� 
@code{mysqlbug} ������ץȤ���Ѥ�����Ƥ��Ƥ���������@xref{Bug reports}��

����ѥ��뤬���Ԥ����硢�����餫�Τ褯��������Ǥμ�����Τ��ᡢ
@ref{Compilation problems} �򻲾Ȥ��Ƥ���������

@item
���Ƥ򥤥󥹥ȡ��뤷�Ƥ�������:
@example
shell> make install
@end example
���Υ��ޥ�ɤ� @code{root} �Ȥ��Ƽ¹Ԥ���ɬ�פ�����ޤ���

@item
@strong{MySQL} ���¥ơ��֥���������Ƥ�������(������ @strong{MySQL} ��
�󥹥ȡ��뤷�Ƥ��ʤ����ˤ���ɬ�פǤ�):
@example
shell> scripts/mysql_install_db
@end example

����: 3.22.10 ���Ť� @strong{MySQL} �С������Ǥϡ�
@code{mysql_install_db} �¹Ի��� @strong{MySQL} �����Ф����Ϥ���ޤ�������
����Ϥ�Ϥ俿�ǤϤ���ޤ���

@item
Perl @code{DBI}/@code{DBD} ���󥿥ե������Υ��ݡ��Ȥ򥤥󥹥ȡ��뤷����
��硢@ref{Perl support} �򸫤Ƥ���������

@item
@strong{MySQL} ��ޥ���ư���˼�ưŪ�˳��Ϥ�������硢
@code{support-files/mysql.server} �򥷥��ƥ�Υ������ȥ��åץե����뤬��
����˥��ԡ����Ƥ�������������ʤ����� 
@code{support-files/mysql.server} ������ץȼ��Ȥ���ȡ�@ref{Automatic
start} �˸��Ĥ����ޤ���
@end enumerate

���Ƥ����󥹥ȡ��뤵�줿�塢���ۤν�����ȥƥ��Ȥ�Ԥʤ��٤��Ǥ���

@strong{MySQL} �����С���ʲ��Υ��ޥ�ɤdz��ϤǤ��ޤ���
@code{BINDIR} �� @code{safe_mysqld} �����󥹥ȡ��뤵��Ƥ���ǥ��쥯�ȥ�
(@file{/usr/local/bin} by default) �Ǥ�:

@example
shell> BINDIR/safe_mysqld &
@end example

���ޥ�ɤ������� @code{mysqld daemon ended} ���顼�Ǽ��Ԥ����硢
@file{mysql-data-directory/'hostname'.err} �ե�����ˤʤ�餫�ξ����
���Ĥ��뤳�Ȥ��Ǥ��ޤ��� �褯���뤳�ȤȤ��ơ����Ǥ�¾�� @code{mysqld} ��
���äƤ�����ʤɤ�����ޤ��� @xref{Multiple servers}.

@xref{Post-installation}��

@node Applying patches, configure options, Quick install, Installing source
@subsection �ѥå���Ŭ��

�������ѥå��ϡ��᡼��󥰡��ꥹ�Ȥ�ή���줿�ꡢ�ޤ���
@strong{MySQL} FTP�����Ȥ� @uref{ftp://www.mysql.com/pub/mysql/Downloads/Patches,�ѥå����ꥢ} ���֤���ޤ���

�᡼��󥰡��ꥹ�Ȥ���Υѥå���Ŭ�Ѥ���ˤϡ��ѥå����ܤäƤ����å�������
�ե��������¸���ơ����ʤ��� @strong{MySQL} ���������ĥ꡼��
���־�Υǥ��쥯�ȥ꡼�˰�ư�����ʲ��Τ褦�˥��ޥ�ɤ�¹Ԥ��ޤ���

@example
shell> patch -p1 < patch-file-name
shell> rm config.cache
shell> make clean
@end example

FTP�����Ȥ��֤����ѥå��ϡ��ץ졼��ƥ����ȥե�����Ȥ��ơ�
���뤤�� @code{gzip} �ǰ��̤��줿�ե�����Ȥ������ۤ���ޤ���
�ץ졼��ƥ����ȤΥѥå��ξ��ϡ���˼������᡼��󥰥ꥹ�Ȥ�
�ѥå���Ʊ�ͤ�Ŭ�Ѥ��ޤ��� ���̤��줿�ѥå���Ŭ�Ѥ���ˤϡ�
 @strong{MySQL} ���������ĥ꡼��
���־�Υǥ��쥯�ȥ꡼�˰�ư�����ʲ��Τ褦�˥��ޥ�ɤ�¹Ԥ��ޤ���

@example
shell> gunzip  < patch-file-name.gz | patch -p1
shell> rm config.cache
shell> make clean
@end example

���줫���̾�Υ��������󥹥ȡ���λؼ��� @code{./configure} ���ƥåפ���
�Ϥ�ޤ���@code{make install} ���ƥå׼¹Ը塢���ʤ��� @strong{MySQL} ����
�Ф�Ƶ�ư���ޤ���

@code{make install} ��¹Ԥ������ˡ��������äƤ��륵���С���ߤ��ɬ�פ����뤫�⤷��ޤ���
( @code{mysqladmin shutdown} �ǻߤ�ޤ� ) 
�����Ĥ��Υ����ƥ�Ǥϡ����߼¹Ԥ��Ƥ����Τ�ߤ�ʤ��¤ꡢ
�������С������򥤥󥹥ȡ���Ǥ��ʤ��褦�ˤʤäƤ��ޤ���


@node configure options,  , Applying patches, Installing source
@subsection ŵ��Ū�� configure ���ץ����

@code{configure} ������ץȤ� @strong{MySQL} ���ۤ�ɤΤ褦�˥���ե���
���뤫�����椹�뤿���¿���ν������󶡤��ޤ���ŵ��Ū�ˤϡ�
@code{configure} ���ޥ�ɥ饤��˥��ץ�������Ѥ��Ƥ����Ԥʤ��ޤ���
�����Ĥ��δĶ��ѿ�����Ѥ��Ƥ� @code{configure} �˱ƶ���Ϳ���뤳�Ȥ��Ǥ�
�ޤ��� @xref{Environment variables}.
 @code{configure} �����ݡ��Ȥ��륪�ץ����ΰ����ϡ����Υ��ޥ�ɤ�
�¹Ԥ��Ƥ�������:

@example
shell> ./configure --help
@end example

�ɤ��Ȥ��� @code{configure} ���ץ����Τ����Ĥ��ʲ����������ޤ�:

@itemize @bullet
@item
@strong{MySQL} ���饤����ȥ饤�֥��ȥ��饤����ȥץ����������򥳥�
�ѥ��뤹��ˤϡ�@code{--without-server} ���ץ�������Ѥ��Ƥ�������:

@example
shell> ./configure --without-server
@end example

C++ ����ѥ��餬�ʤ���С�@code{mysql} �ϥ���ѥ���Ǥ��ޤ���(����� C++ 
���׵᤹�륯�饤����ȥץ������ΰ�ĤǤ�)�����ξ�硢@code{configure} 
���� C++ ����ѥ����ƥ��Ȥ��륳���ɤ����Ǥޤ������줫�� 
@code{./configure} �� @code{--without-server} ���ץ����Ĥ��Ǽ¹Ԥ��Ƥ�
������������ѥ��륹�ƥåפ� @code{mysql} �κ������ߤޤ�����
@file{mysql.cc} �ˤĤ��Ƥηٹ��̵��Ǥ��ޤ���(@code{make} ���ߤޤ��硢
���顼��ȯ�����Ƥ�Ĥ�κ������³����褦�� @code{make -k} ���Ƥ���
������)

@item
�����ե�����ȥǡ����١����ǥ��쥯�ȥ�� @file{/usr/local/var} �۲��ˤ�
�������ʤ����ϡ����ΰ�ĤΤ褦�� @code{configure} ���ޥ�ɤ���Ѥ��Ƥ�
������:
@example
shell> ./configure --prefix=/usr/local/mysql
shell> ./configure --prefix=/usr/local \
           --localstatedir=/usr/local/mysql/data
@end example
�ǽ�Υ��ޥ�ɤϥ��󥹥ȡ���ץ�ե��å������ѹ������ǥե���Ȥ� 
@file{/usr/local} �ǤϤʤ� @file{/usr/local/mysql} �۲��˥��󥹥ȡ��뤷
�ޤ������Υ��ޥ�ɤϥǥե���ȤΥ��󥹥ȡ���ץ�ե��å�������¸���ޤ�����
�ǡ����١����ǥ��쥯�ȥ�Υǥե���Ȱ���(�̾�� @file{/usr/local/var})��
��񤭤���@code{/usr/local/mysql/data} ���ѹ����ޤ���

@item
UNIX ����Ѥ��Ƥ��ơ������åȤΰ��֤�ǥե���Ȱ���(�̾�� @file{/tmp} �ޤ��� 
@file{/var/run})�Ǥʤ�¾�Τɤ����ˤ��������ϡ�@code{configure} ���ޥ�
�ɤ򼡤Τ褦�˻��Ѥ��ޤ�:
@example
shell> ./configure --with-unix-socket-path=/usr/local/mysql/tmp/mysql.sock
@end example
�ե�����̾�����Хѥ�̾�Ǥʤ��Ȥ����ޤ���

@item
��Ū��󥯤��줿�ץ������򥳥�ѥ��뤷�������(�㤨�С��Х��ʥ����ۤ�
�������뤿�ᡢ��ä�®�����뤿�ᡢ�����Ĥ��� RedHat ���ۤǤ���������
�뤿��)�ϡ����Τ褦�� @code{configure} ��¹Ԥ��ޤ�:

@example
shell> ./configure --with-client-ldflags=-all-static \
           --with-mysqld-ldflags=-all-static
@end example

@item
@code{gcc} ����Ѥ��Ƥ��ơ�@code{libg++} �� @code{libstdc++} �����󥹥ȡ�
�뤵��Ƥ��ʤ���硢@code{configure} �� @code{gcc} �� C++ ����ѥ���Ȥ�
�ƻ��Ѥ��뤳�Ȥ������Ƥ�������:

@tindex CC environment variable
@tindex Environment variable, CC
@tindex CXX environment variable
@tindex Environment variable, CXX
@example
shell> CC=gcc CXX=gcc ./configure
@end example

@code{gcc} �� C++ ����ѥ���Ȥ��ƻ��Ѥ������@code{libg++} �ޤ��� 
@code{libstdc++} �Υ�󥯤ϻ�ߤޤ���

����ѥ�����󥫤���ͭ�饤�֥�� @file{libmysqlclient.so.#} �������Ǥ�
�ʤ��Ȥ������顼�ˤʤ��硢@code{--disable-shared} ���ץ����� 
@code{configure} ��Ϳ���뤳�Ȥǡ�������������Ǥ��ޤ������ξ�硢
@code{configure} �϶�ͭ�饤�֥�� @code{libmysqlclient.so.#} ���������
����

@item
�� @code{NULL} ����(���ʤ����@code{NULL} ��������Ƥ��ʤ�����)�� 
@code{DEFAULT} �����ͤ���Ѥ��ʤ��褦�� @strong{MySQL} �򥳥�ե����Ǥ�
�ޤ�������ϡ��� @code{NULL} �ͤ��׵᤹�����Ƥι��ܤ��ͤ�����Ū�˻��ꤷ
�ʤ���С�@code{INSERT} ���ơ��ȥ��Ȥϥ��顼���������ޤ����ǥե������
�λ��Ѥ��ޤ���ˤϡ����Τ褦�� @code{configure} ��¹Ԥ��ޤ�:

@tindex CXXFLAGS environment variable
@tindex Environment variable, CXXFLAGS
@example
shell> CXXFLAGS=-DDONT_USE_DEFAULT_FIELDS ./configure
@end example

@item
�ǥե���ȤǤϡ�@strong{MySQL} �� ISO-8859-1 (Latin1) ʸ�����åȤ���Ѥ�
�ޤ����ǥե���ȥ��åȤ��ѹ�����ˤϡ�@code{--with-charset} ���ץ�����
���Ѥ��ޤ�:
@example
shell> ./configure --with-charset=CHARSET
@end example

@code{CHARSET} �ϼ��ΰ�ĤǤ�: @code{big5}, @code{cp1251}, @code{cp1257},
@code{czech}, @code{danish},@code{dec8}, @code{dos}, @code{euc_kr},
@code{gb2312}, @code{gbk}, @code{german1}, @code{hebrew}, @code{hp8},
@code{hungarian}, @code{koi8_ru}, @code{koi8_ukr}, @code{latin1}, @code{latin2},
@code{sjis}, @code{swe7}, @code{tis620}, @code{ujis}, @code{usa7},
@code{win1251} or @code{win1251ukr}.
@xref{Character sets}.

����: ʸ�����åȤ��ѹ����������ϡ�����ե����졼�����֤� @code{make
distclean} ��Ԥʤ�ɬ�פ�����ޤ��� (3.23.14 �����ξ��)

�����Фȥ��饤����ȴ֤�ʸ�����Ѵ����������ϡ�
@code{SET OPTION CHARACTER SET} ���ޥ�ɤ�Ĵ�٤�٤��Ǥ���
@xref{SET OPTION, , @code{SET OPTION}}.

@cindex @code{myisamchk}
@strong{�ٹ�:} �ơ��֥�������������ʸ�����åȤ��ѹ������硢
@code{myisamchk -r -q} �����ƤΥơ��֥�˼¹Ԥ���ɬ�פ�����ޤ��������Ǥ�
���ȡ�����ǥå����������������Ȥ���ޤ���(����ϡ�@strong{MySQL} �Υ�
�󥹥ȡ�����������Ĥ��Υơ��֥�����������ۤʤ�ʸ�����åȤ���Ѥ��� 
@strong{MySQL} �κƥ���ե������������ƺƥ��󥹥ȡ������ȯ�����ޤ���)

@item
�ǥХå������ɤĤ��� @strong{MySQL} �򥳥�ե�������ˤϡ�
@code{--with-debug} ���ץ�������Ѥ��ޤ�:
@example
shell> ./configure --with-debug
@end example
����ˤ�ꡢ�����Ĥ��Υ��顼�򸫤Ĥ���������ʥ��������Ƥ��ޤޤ졢
����ȯ�����Ƥ��뤫�ˤĤ��Ƥν��Ϥ��󶡤��ޤ���
@xref{Debugging server}.

@item
���ʤ��Υ��饤����ȥץ�����ब����åɤ���Ѥ��Ƥ����硢
@strong{MySQL} ���饤����ȥ饤�֥��� 
@code{--with-thread-safe-client} �ǥ���åɰ����Ѥ˥���ѥ��뤹��ɬ�פ�
����ޤ�; ����ϡ��ǥե���ȤǤϤ����Ĥ��Υ���åɰ����Ǥʤ��ؿ��ǡ��饤
�֥�꤬����åɰ����ؿ����������Ѥ���褦�ˤʤ�ޤ��������Ԥʤ�����
�Ǿ����ʥѥե����ޥ󥹥ڥʥ�ƥ�������ޤ������̾盧�Υ��ץ����λ��Ѥ�
�����˰����Ǥ���

@item
��ͭ�Υ����ƥ�˴ط����륪�ץ����ˤĤ��Ƥϡ����ξϤ���Υ����ƥ��ͭ
����Ǹ��Ĥ��뤳�Ȥ��Ǥ��ޤ���@xref{Source install system issues}��
@end itemize

@node Compilation problems, MIT-pthreads, Installing source, Installing
@section ����ѥ�������꤫��

Solaris ��� @code{gcc} ����Ѥ�����硢���ڷٹ�̵�����Ƥ� @strong{MySQL} �ץ�����ब���줤�˺��ޤ���
¾�Υ����ƥ�Ǥϥ��󥯥롼�ɥե�����ΰ㤤����ٹ𤬽Ф뤫�⤷��ޤ���
 MIT-pthreads ����Ѥ����ݤηٹ�� @ref{MIT-pthreads} �򻲾Ȥ��Ƥ���������
¾������ϡ��ʲ�������å����Ƥ���������

¿��������β��Τ���ˡ��� configure ��ɬ�פǤ���
���ʤ����ƹ�������ɬ�פ�����ʤ�С��ʲ��˵���Ĥ��Ƥ���������

@cindex Running @code{configure} after prior invocation
@cindex @code{configure}, running after prior invocation
@itemize @bullet
@item
�⤷ @code{configure} ����ټ¹Ԥ�����˼¹Ԥ���ʤ�С� @code{configure} ��
���˺�ä���������Ѥ��ޤ������ξ���� @file{config.cache} ����¸����ޤ���
 @code{configure} �ϵ�ư���ˤ��Υե������õ�����⤷¸�ߤ���ʤ�С�
������ξ���������ʪ�Ȥ����ɤ߹��ߤޤ���
����Ϥ��ʤ����ƥ���ե�������ʤ��̵���ˤʤ�ޤ���
@item
@code{configure} ��¹Ԥ��뤴�Ȥˡ� @code{make} ��¹Ԥ��ƥ���ѥ��뤷�ʤ���Фʤ�ޤ���
���������ǽ�ˡ����Υӥ�ɤǤǤ������֥������Ȥ򡢾ä��Ƥ����Ƥ���������
�ʤ��ʤ顢�㤦����ե������ץ����ˤ���������줿����Ǥ���
@end itemize

�Ť�����ե����䥪�֥������ȥե�����λ��Ѥ��ɤ����ᡢ
 @code{configure} ���˰ʲ��Υ��ޥ�ɤ�¹Ԥ��Ƥ���������

@example
shell> rm config.cache
shell> make clean
@end example

�������뤫���ˡ�@code{make distclean} �Ȥ��Ƥ⹽���ޤ���

�ʲ��ˡ� @strong{MySQL} �򥳥�ѥ��뤹��ݤ˵�����䤹������򤢤��Ƥ����ޤ���

@itemize @bullet
@item
@cindex @code{cc1plus} problems
@cindex @code{fatal signal 11}
@cindex @code{sql_yacc.cc} problems
@cindex Internal compiler errors
@cindex Virtual memory problems while compiling
@file{sql_yacc.cc} ����ѥ�����ˡ��ʲ��Τ褦�ʥ��顼���Ф���硢
���꡼������åפ�­��ޤ���

@example
Internal compiler error: program cc1plus got fatal signal 11
  or
Out of virtual memory
  or
Virtual memory exhausted
@end example

��������ϡ�@code{gcc} ������饤��Ÿ���� @file{sql_yacc.cc} �򥳥�ѥ��뤹��Τˡ�
�ȤƤ�¿���Υ��꡼��ɬ�פȤ��뤫��Ǥ���
���ξ�硢 @code{configure} �� @code{--with-low-memory} ���ץ�������Ǽ¹Ԥ��ޤ���

@example
shell> ./configure --with-low-memory
@end example

���Υ��ץ����ϡ� @code{gcc} ����Ѥ��Ƥ���ʤ� @code{-fno-inline} ���ץ�����
���ޥ�ɥ饤��˲ä���@code{gcc} �ʳ��ʤ�� @code{-O0} ��ä��ޤ���
¿���Υ��꡼�ȥ���åפ���äƤ��ʤ��¤�ϡ�@code{--with-low-memory} ���ץ�������Ѥ��٤��Ǥ���
��������Ϥ��ä����ʥϡ��ɥ����������Ǥⵯ���뤳�Ȥ��Τ��Ƥ��ޤ���
�̾ @code{--with-low-memory} ���ץ����Ǥ�������ϲ��Ǥ��ޤ���

@item
ɸ��Ǥϡ�@code{configure} �� @code{c++} �Ȥ���̾���ǥ���ѥ��顼����Ѥ���
GNU @code{c++} �� @code{-lg++} ��Ȥäƥ�󥯤��ޤ���
�⤷ @code{gcc} ����Ѥ��Ƥ���ʤ�С�����ե������˰ʲ��Τ褦�����꤬�Ф뤫�⤷��ޤ���

@cindex C++ compiler cannot create executables
@example
configure: error: installation or configuration problem:
C++ compiler cannot create executables.
@end example

@tindex CXX environment variable
@tindex Environment variable, CXX
��������ϡ�@code{g++}, @code{libg++} ���뤤�� @code{libstdc++} �˴�Ϣ������ΤǤ���

�����ΰ�ĤȤ��ƹͤ����뤳�Ȥϡ� @code{g++} ����äƤ��ʤ��������뤤�ϡ�
@code{g++} �Ϥ��äƤ� @code{libg++} �� @code{libstdc++} ���ʤ��Ȥ������Ǥ���
@file{config.log} �ե������ c++ ����ѥ��餬ư��ʤ��ä���ͳ��Ͽ���Ƥ��ޤ���
����������褹��������ꡢ���ʤ������äƤ��� C++ ����ѥ��顼�������
 @code{gcc} ����Ѥ��Ƥ⹽���ޤ���@code{CXX} �Ķ��ѿ��� @code{"gcc -O3"} �Ȥ��ƤߤƤ���������
�㤨�С�

@tindex CXX environment variable
@tindex Environment variables, CXX
@example
shell> CXX="gcc -O3" ./configure
@end example

����� @code{gcc} �� @code{g++} ��Ʊ�ͤ� C++ �������򥳥�ѥ��뤹��Τ�ư���ޤ�����
@code{libg++} �� @code{libstdc++} ��ɸ��Ǥϥ�󥯤���ޤ���

¾�β����ˡ�ϡ��������@code{g++}, @code{libg++}, @code{libstdc++} �򥤥󥹥ȡ��뤹�뤳�ȤǤ���

@item
�⤷�ʲ��Υ��顼�Τɤ줫����������硢 GNU @code{make} �ΥС�������夲�Ƥ���������

@example
making all in mit-pthreads
make: Fatal error in reader: Makefile, line 18:
Badly formed macro assignment
  or
make: file `Makefile' line 18: Must be a separator (:
  or
pthread.h: No such file or directory
@end example

@cindex Solaris troubleshooting
@cindex FreeBSD troubleshooting
@cindex Troubleshooting, Solaris
@cindex Troubleshooting, FreeBSD
Solaris �� FreeBSD �� @code{make} �ץ������ˤ����꤬���뤳�Ȥ��Τ��Ƥ��ޤ���

GNU @code{make} version 3.75 ��ư���ǧ����Ƥ��ޤ���

@tindex CC environment variable
@tindex Environment variable, CC
@tindex CXX environment variable
@tindex Environment variable, CXX
@tindex CFLAGS environment variable
@tindex Environment variable, CFLAGS
@tindex CXXFLAGS environment variable
@tindex Environment variable, CXXFLAGS
@item
�⤷ C,C++ �Τ���˥ե饰��Ϳ��������硢@code{CFLAGS} �� @code{CXXFLAGS} �Ķ��ѿ���
�ե饰���ɲä��Ƥ���������Ʊ�ͤˡ� @code{CC} �� @code{CXX} �˥���ѥ��顼̾��
Ϳ���뤳�Ȥ�Ǥ��ޤ���
�㤨�С�

@example
shell> CC=gcc
shell> CFLAGS=-O6
shell> CXX=gcc
shell> CXXFLAGS=-O6
shell> export CC CFLAGS CXX CXXFLAGS
@end example

@ref{TcX binaries} �ˤϥե饰��������ꥹ�Ȥ���Ƥ��ޤ���
�����ʥ����ƥ������Ω�ĤȻפ��ޤ���

@item
�ʲ��Τ褦�ʥ��顼�ξ�硢@code{gcc} ����ѥ��顼�򥢥åץ��졼�ɤ��Ƥ���������

@example
client/libmysql.c:273: parse error before `__attribute__'
@end example

@code{gcc} 2.8.1 ��ư��뤳�Ȥ���ǧ����Ƥ��ޤ�����
@code{gcc} 2.95.2 �ʾ�򤪴��ᤷ�ޤ���

@item
@code{mysqld} ����ѥ�����˰ʲ��Τ褦�ʥ��顼���Ф���硢
@code{configure} ��@code{accept()}, @code{getsockname()}, @code{getpeername()}
�κǸ�ΰ��������������Ф��Ƥ��ޤ���

@example
cxx: Error: mysqld.cc, line 645: In this statement, the referenced
     type of the pointer value "&length" is "unsigned long", which
     is not compatible with "int".
new_sock = accept(sock, (struct sockaddr *)&cAddr, &length);
@end example

�����������ˤϡ�@file{config.h} �ե�����(@code{configure} �ˤ������) �������ޤ���
�����Τ褦�ˡ�

@example
/* Define as the base type of the last arg to accept */
#define SOCKET_SIZE_TYPE XXX
@end example

@code{XXX} �� @code{size_t} �� @code{int} (���ʤ��Υ��ڥ졼�ƥ��󥰥����ƥब��¸���Ƥ��뷿)���Ѥ��ޤ���
(@code{configure} �������� @file{config.h} �Ϻ��ľ�����Τǡ�
���ν����� @code{configure} �����٤˹Ԥ�ʤ���Фʤ�ʤ����Ȥ�����)

@item
@file{sql_yacc.cc} �ե������ @file{sql_yacc.yy} ������������ޤ���
�̾
@strong{MySQL} �������������줿���ԡ��ȤȤ�ˤ���Τǡ�
@file{sql_yacc.cc} �ե������ʬ���ȤǺ������뤳�ȤϤ���ޤ���
���������ʲ��Υ��顼�ξ�硢�ƺ�������ɬ�פ�����ޤ���

@example
"sql_yacc.yy", line xxx fatal: default action causes potential...
@end example

����Ϥ��ʤ��� @code{yacc} �ΥС�������Խ�ʬ�Ǥ��뤳�Ȥ򼨤��Ƥ��ޤ���
@code{bison} (the GNU version of @code{yacc}) ������˥��󥹥ȡ��뤷�ƻ��Ѥ���ɬ�פ�����ޤ���

@item
�⤷ @code{mysqld} �� @strong{MySQL} ���饤����Ȥ�ǥХå��������ʤ顢
@code{configure} �� @code{--with-debug} ���ץ�����դ��Ǽ¹Ԥ��ޤ���
�����ƥ���ѥ��뤷�����������饤����ȥ饤�֥�꡼�ǥ��饤����Ȥ��󥯤��ޤ���
@xref{Debugging client}.
@end itemize

@node MIT-pthreads, Perl support, Compilation problems, Installing
@section MIT-pthreads �˴ؤ���

���Υ��������Ǥ�MIT-pthreads��ȤäƤ��뤵���˵���������ˤĤ��Ƥ����Ĥ��Ҥ٤�
���ޤ���

Linux �Ǥϡ�MIT-pthreads ����Ѥ��ƤϤʤ餺��
LinuxThreads �򥤥󥹥ȡ��뤹��٤��Ǥ���
@xref{Linux}.

�⤷���ʤ��Υ����ƥब����Υ���åɤΥ��ݡ��Ȥ��󶡤��ʤ���С����ʤ��ϡ�
MIT-pthreads�ѥå�������Ȥäơ�@strong{MySQL} ���ۤ���ɬ�פ�����ޤ���
����ˤϤۤȤ�ɤ�FreeBSD�����ƥࡢSunOS4.x,Solaris 2.4�Ȥ���������ۤ������Ĥ�
���ޤޤ�ޤ���
@xref{Which OS}.

@itemize @bullet
@item
�ۤȤ�ɤΥ����ƥ��Ǥ� @code{--with-mit-threads} ���ץ�����
@code{configure} �¹Ԥ��뤳�Ȥˤ�äơ�
MIT-pthreads���Ȥ��뤳�Ȥ������뤳�Ȥ��Ǥ��ޤ���

@example
shell> ./configure --with-mit-threads
@end example

MIT-pthreads��Ȥ������󥽡����ǥ��쥯�ȥ�ǹ��ۤ��뤳�Ȥϥ��ݡ��Ȥ���Ƥ��ޤ�
�󡣤ʤ��ʤ顢�䤿���Ϥ��Υ����ɤػ䤿�����ѹ���Ǿ��ˤ���������Ǥ���

@item
MIT-pthreads�ϡ�Unix�����åȼ����˻Ȥ��Ƥ��� @code{AF_UNIX} �ץ��ȥ���򥵥ݡ��Ȥ��ޤ���
����ϡ��⤷���ʤ����ȤäƤ��� MIT-pthreads �򥳥�ѥ��뤹��С����Ƥ���³�ϡ�
TCP/IP ��Ȥ�(�Ĥޤ꾯���٤��ʤ�)���Ȥ��̣���ޤ���
�⤷�����ʤ��� @strong{MySQL} ���ۤ������Ȥǡ���������Υ����С�����³�Ǥ��ʤ��ʤ�С�
����Ϥ��ʤ��Υ��饤����Ȥ��ǥե���Ȥ� Unix �����åȤ�Ȥä�
 @code{localhost} ����³���褦�Ȥ��Ƥ���Τ��⤷��ޤ���
����Ū�˥�������ۥ���̾����ꤹ�뤿��ˡ��ۥ���̾����Υ��ץ����
 (@code{-h} �� @code{--host}) �� @code{mysql} ����Ѥ��ơ�TCP/IP ��³���ƤߤƤ���������

@item
MIT-pthreads ���Ȥ��Ƥ��뤫�ɤ��������å��ϥ����Х����ɤ� configure ����Ȥ���
�����Ԥ��ޤ����⤷�����ʤ��� @code{--without-server} ��Ȥäƥ��饤����ȥ����ɤΤߤ�
�ӥ�ɤ��뤳�Ȥ����ꤷ���ʤ�С����饤����Ȥ� MIT-othreads ���Ȥ��Ƥ��뤫���ʤ�����
Unix�����å���³���ǥե���ȤǻȤ��Ƥ���Τ��狼��ޤ��󡣤ʤ��ʤ� Unix �����åȤ�
MIT-pthreads ���Ǥ�ư��ʤ�����Ǥ����ޤ������ʤ��Ϥ��Τ褦�ʥ��󥹥��󥹤Ǥ�
 @code{-h} �ޤ���  @code{--host} ��Ȥ�ɬ�פ�����ޤ���

@item
 @strong{MySQL} �� MIT-pthreads ��Ȥäƥ���ѥ��뤵���ȡ��ѥե����ޥ󥹾������Τ�
�᥷���ƥ���å��ϥǥե���Ȥǥǥ��������֥�Ȥ���ޤ���  @code{--use-locking} ���ץ����
����ꤷ�ƥ����С��������뤳�Ȥǡ������ƥ���å��ϻȤ���褦�ˤʤ�ޤ���

@item
�Ȥ��ɤ�(���ʤ��Ȥ�Solaris�Ǥ�) pthread �� @code{bind()} ���ޥ�ɤϲ��Υ��顼��å�����
�ʤ��˥����åȤؤ� bind �˼��Ԥ��뤳�Ȥ�����ޤ�������Ϸ�̤Ȥ��ƥ����С��ؤ���³
���ԤȤʤ�ޤ������Ȥ��С�

@example
shell> mysqladmin version
mysqladmin: connect to server at '' failed;
error: 'Can't connect to mysql server on localhost (146)'
@end example

������褹�뤿��� @code{mysqld} �����С���λ���ơ��Ƶ�ư���Ƥ�����������
��ϻ䤿���������С�������������ơ������˥ꥹ�����Ȥ����褦�Ȥ����Ȥ���������
��ޤ�����

@item
MIT-pthreads ��ȤäƤ���ȡ�@code{sleep()} �����ƥॳ����� @code{SIGINT} (break) 
�Ǥϳ����ߤǤ��ޤ��� ����ϡ�@code{mysqladmin --sleep} �����餻�Ƥ���Ȥ��ˤ���
�����뤳�Ȥ��狼�äƤ��ޤ���
�����ߤ�ȯ�����ƥץ���������ߤ������ˡ����ʤ��Ͻ�λ�����뤿��� @code{sleep()} ��������Ԥ��ʤ�
�ƤϤʤ�ޤ���

@item
��󥯤��Ƥ���Ȥ�(���ʤ��Ȥ�Solaris�Ǥ�)�����ʤ��Ϥ��Τ褦�� warning ��å�����
��������Ǥ��礦��������̵�뤷�Ƥ��ޤ��ޤ���

@example
ld: warning: symbol `_iob' has differing sizes:
    (file /my/local/pthreads/lib/libpthread.a(findfp.o) value=0x4;
file /usr/lib/libc.so value=0x140);
    /my/local/pthreads/lib/libpthread.a(findfp.o) definition taken
ld: warning: symbol `__iob' has differing sizes:
    (file /my/local/pthreads/lib/libpthread.a(findfp.o) value=0x4;
file /usr/lib/libc.so value=0x140);
    /my/local/pthreads/lib/libpthread.a(findfp.o) definition taken
@end example

@item
¾�Τ����Ĥ��� warnings ��ޤ�̵�뤷�Ƥ��ޤ��ޤ���

@example
implicit declaration of function `int strtoll(...)'
implicit declaration of function `int strtoul(...)'
@end example

@item
�䤿���Ϥޤ� MIT-pthread �ȤȤ��ư�� @code{readline} ��������Ƥ��ޤ���(�����ɬ�פǤ�
�ʤ��ΤǤ����������餯ï���ˤ϶�̣������Ǥ��礦)��
@end itemize

@node Perl support, Source install system issues, MIT-pthreads, Installing
@section Perl �Υ��󥹥ȡ���ˤĤ���

@menu
* Perl installation::           Installing Perl on Unix
* ActiveState Perl::            Installing ActiveState Perl on Win32
* Win32 Perl::                  Installing the @strong{MySQL} Perl distribution on Win32
* Perl support problems::       Problems using the Perl @code{DBI}/@code{DBD} interface
@end menu

@node Perl installation, ActiveState Perl, Perl support, Perl support
@subsection Unix �ؤ� Perl �Υ��󥹥ȡ���

@strong{MySQL} �� Perl @code{DBI}/@code{DBD} ���󥿡��ե������򥵥ݡ��Ȥ��ޤ���@xref{Perl}. 
@code{DBI}/@code{DBD} ���󥿡��ե������� Perl �Υ��饤����Ȥϡ�Perl 5.004 �ʾ夬ɬ�פǤ���
������Ť��С������� Perl �Ǥ���@emph{ư���ޤ���}��

@strong{MySQL} Perl �ϡ� @strong{MySQL} ���饤����ȡ��ץ�����ߥ󥰡����ݡ��Ȥ�
���˥��󥹥ȡ��뤵��Ƥ��뤳�Ȥ����Ǥ��� 
�⤷���ʤ��� RPM �ե����뤫�� @strong{MySQL} �򥤥󥹥ȡ��뤷���Τʤ顢
���饤����ȡ��ץ������ϡ����饤����� RPM �ˤ���ޤ��� ����
���饤����ȡ��ץ�����ߥ󥰡����ݡ��Ȥϡ���ȯ�Ը��� RPM �ˤ���ޤ��� 
��ȯ�Ը��� RPM �򥤥󥹥ȡ��뤷�����Ȥ�Τ���Ʋ������� 

������ 3.22.8 ���� @strong{MySQL} ���ۤȤ�ʬ���������ۤ���Ƥ��ޤ���
�⤷ Perl �⥸�塼��򥤥󥹥ȡ��뤷�����ʤ顢@uref{http://www.mysql.com/Contrib} ��
��ǧ���Ƥ��������������ˤ�����Ƥ��ޤ���

Perl ������ʪ�� @code{tar} �ǥ��������֤��졢���̤���Ƥ��ޤ���
@file{MODULE-VERSION.tar.gz} �Ȥ���̿̾��§�����ۤ���Ƥ��ޤ���
(@code{MODULE} �ϥ⥸�塼��̾��@code{VERSION} �ϥС�������ֹ�)

@code{Data-Dumper}, @code{DBI}, @code{Msql-Mysql-modules} ��ɬ�פǤ���
������äƤ����顢�ʲ��Τ褦�ˤ��ƥ��󥹥ȡ��뤷�ޤ���
@code{Data-Dumper} �⥸�塼�����ˤ��ޤ�����¾��Ʊ�ͤˤǤ��ޤ���

@enumerate
@item
����ʪ�򥫥��ȥǥ��쥯�ȥ��Ÿ����
@example
shell> gunzip < Data-Dumper-VERSION.tar.gz | tar xvf -
@end example
����� @file{Data-Dumper-VERSION} �Ȥ����ǥ��쥯�ȥ����ޤ���

@item
Ÿ�������ǥ��쥯�ȥ������ޤ���
@example
shell> cd Data-Dumper-VERSION
@end example

@item
����ѥ��롢���󥹥ȡ��롧
@example
shell> perl Makefile.PL
shell> make
shell> make test
shell> make install
@end example
@end enumerate

�⥸�塼�뤬ư��뤫��Τ����Τ� @code{make test} ���ޥ�ɤϽ��פǤ���
���󥿡��ե����������ɤΥƥ��ȤΤ���� @code{Msql-Mysql-modules} ��
���󥹥ȡ�����ˤ����Υ��ޥ�ɤ�¹Ԥ���ݤˤϡ�
@strong{MySQL} �����С�����Ư���Ƥ��ʤ���Фʤ�ޤ���
�Ǥʤ���С��ƥ��Ȥϼ��Ԥ��ޤ���

��������꡼���� @strong{MySQL} �򥤥󥹥ȡ��뤷�����˾��
 @code{Msql-Mysql-modules} ��ƹ��ۡ��ƥ��󥹥ȡ��뤹�뤳�Ȥ�
�����ͤ��Ǥ������٤Ƥ� @code{DBI} ������ץȤ� @strong{MySQL} ��
���åץ��졼�ɸ�˥�������פ��������˵��Ť������ϡ��ä�
�������Ƥ���������

�⤷ Perl module �������������ƥ�ǥ��쥯�ȥ꡼����������Perl�ǥ��쥯�ȥ�
�˥��󥹥ȡ���Ǥ��ʤ���硢�ʲ���ʸ������Ω���ޤ���

@example
@uref{http://www.iserver.com/support/contrib/perl5/modules.html}
@end example

���Υڡ����ΰʲ��򻲾Ȥ��Ƥ���������
@code{Installing New Modules that Require Locally Installed Modules}.


@node ActiveState Perl, Win32 Perl, Perl installation, Perl support
@subsection Win32 �ؤ� ActiveState Perl �Υ��󥹥ȡ���

Win32 ��ˡ� ActiveState Perl �� @strong{MySQL} @code{DBD} �⥸�塼���
���󥹥ȡ��뤹��ˤϡ��ʲ��Τ褦�ˤ��ʤ��ƤϤʤ�ޤ���

@itemize @bullet
@item Open a DOS shell.
@item �⤷ɬ�פʤ顢HTTP_proxy �ѿ��򥻥åȡ� �㤨��
@code{set HTTP_proxy=my.proxy.com:3128}
@item PPM �ץ������ε�ư�� @code{C:\perl\bin\ppm.pl}
@item @code{DBI} �Υ��󥹥ȡ���(�⤷���äƤ��ʤ����)�� @code{install DBI}
@item ����������ˡ� @code{ftp://ftp.de.uu.net/pub/CPAN/authors/id/JWIED/DBD-mysql-1.2212.x86.ppd } �򥤥󥹥ȡ���
@end itemize

The above should work at least with ActiveState Perl 5.6.

�⤷�嵭�Τ褦�˽���ʤ���С������ @strong{MyODBC} �ɥ饤�С������졢
 @strong{MySQL} �����С��� ODBC ��ͳ����³���ʤ��ƤϤʤ�ޤ���

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

@node Win32 Perl, Perl support problems, ActiveState Perl, Perl support
@subsection Win32 �ؤ� @strong{MySQL} Perl ����ʪ�Υ��󥹥ȡ���

@strong{MySQL} Perl ���ۤ� @code{DBI},
@code{DBD:MySQL} , @code{DBD:ODBC} ��ޤߤޤ���

@itemize @bullet
@item 
@uref{http://www.mysql.com/download.html} ����  Perl distribution for Win32 �������
@item @code{C:} �� unzip ���ޤ��� @file{C:\PERL} ���Ǥ��ޤ���
@item ���ʤ��Υѥ��� @file{C:\PERL\BIN} ��ä��ޤ���
@item ���ʤ��Υѥ��� @file{C:\PERL\BIN\MSWin32-x86-thread} ��
@file{C:\PERL\BIN\MSWin32-x86} ��ä��ޤ���
@item DOS shell �ǡ� @code{perl -v} ��¹Ԥ��� @code{perl} ��ƥ��Ȥ��ޤ���
@end itemize

@node Perl support problems,  , Win32 Perl, Perl support
@subsection Perl @code{DBI}/@code{DBD} ���ѻ�������

�⤷ Perl �� @code{../mysql/mysql.so} �⥸�塼�뤬���Ĥ���ʤ��ȥ�å�������Ф�����硢
���������ɥ饤�֥�� @file{libmysqlclient.so} ���ꤳ��ʤ��ä��ȹͤ����ޤ���

�ʲ��Τ褦����ˡ�Dz����ˡ������ޤ���

@itemize @bullet
@item
@code{Msql-Mysql-modules} �Υ���ѥ���Ǥϡ�
@code{perl Makefile.PL} ������
@code{perl Makefile.PL -static -config} �Ȥ��ޤ���

@item
@code{libmysqlclient.so} ��¾�Υ��������ɥ饤�֥�꤬����Ȥ���(@file{/usr/lib} �Ȥ� @file{/lib})�˥��ԡ����ޤ���

@item
@code{Linux} �ξ�硢@file{/etc/ld.so.conf} �ե�����ˡ�@code{libmysqlclient.so}
 ������ǥ��쥯�ȥ��񤭲ä���@code{ldconfig -v} ��¹Ԥ��ޤ���

@item
@tindex LD_RUN_PATH environment variable
@tindex Environment variable, LD_RUN_PATH
@code{LD_RUN_PATH} (@code{LD_LIBRARY_PATH}) �Ķ��ѿ��� @code{libmysqlclient.so}
 ������ǥ��쥯�ȥ��񤭲ä��ޤ���
@end itemize

�⤷ @code{DBD-mysql} �ǰʲ��Υ��顼���Ф���硢
@code{gcc} (���뤤�ϡ�@code{gcc} �ǥ���ѥ��뤵�줿�Ť��Х��ʥ�) ����Ѥ��Ƥ����
�פ��ޤ���

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

@file{mysql.so} �����������Υ�󥯥��ޥ�ɤ�
 @code{-L/usr/lib/gcc-lib/... -lgcc} ���ɲä��Ƥ���������
(Perl���饤����Ȥ���ݤ� @code{make} �ν��Ϥ�����å����Ƥ�������)
@code{-L} ���ץ����˻��ꤹ��Τϡ����ʤ��Υ����ƥ���� @file{libgcc.a} ������ǥ��쥯�ȥ�Ǥ���

Perl �� @strong{MySQL} �� @code{gcc} ����Ѥ��ƺ���Ƥ��ʤ����⸶���Ȥ��Ƥ���ޤ���
���ξ�硢ξ���� @code{gcc} �ǥ���ѥ��뤹�뤳�Ȥˤ�ꡢ�ߥ��ޥå����򤱤뤳�Ȥ��Ǥ��ޤ���

�����ʥߥå���󥯤򥵥ݡ��Ȥ��Ƥ��ʤ������ƥ�(like SCO)��Perl�⥸�塼�����Ѥ�������硢
@code{DBI} �� @code{DBD-mysql} ��ޤॹ���ƥ��å���Perl�������Ǥ��ޤ���
����ϡ��ޤ��� @code{DBI} �����ɤ���󥯤���Ƥ���Perl���äƸ��ߤ�Perl�ξ�˥��󥹥ȡ��뤷�ޤ���
�����ơ� @code{DBD} �����ɤ򤵤�˥�󥯤�����Perl���ꡢ����򥤥󥹥ȡ��뤷�ޤ���

SCO�Ǥϡ��Ķ��ѿ���ʲ��Τ褦�ˤ��ʤ��ƤϤʤ�ޤ���

@example
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:
@end example

�ǽ顢@code{DBI} �򥹥��ƥ��å���󥯤���Perl���뤿��ˡ�
 @file{perl/DBI} �ǥ��쥯�ȥ�ǰʲ��Τ褦�˼¹Ԥ��ޤ���

@example
shell> perl Makefile.PL -static -config
shell> make
shell> make install
shell> make perl
@end example

���θ塢���ʤ��Ͽ�����Perl�򥤥󥹥ȡ��뤷�ʤ���Фʤ�ޤ���
@code{make perl} �򤹤�ȡ����󥹥ȡ������˼¹Ԥ����ɬ�פ� @code{make} ���ޥ�ɤ�
ɽ�����ޤ���
SCO�Ǥϡ�@code{make -f Makefile.aperl inst_perl MAP_TARGET=perl} �Ȥ��ޤ���

���ˡ�@code{DBD::mysql} �򥹥��ƥ��å���󥯤���Perl���뤿��ˡ�
 @file{perl/Mysql-modules} �ǥ��쥯�ȥ�ǰʲ��Τ褦�˼¹Ԥ��ޤ���

@example
shell> perl Makefile.PL -static -config
shell> make
shell> make install
shell> make perl
@end example

����⿷����Perl�򥤥󥹥ȡ��뤷�ʤ��ƤϤʤ�ޤ���
@code{make perl} �ν��Ϥϻ��Ѥ��륳�ޥ�ɤ򼨤��ޤ���

@node Source install system issues, Win32, Perl support, Installing
@section System-specific issue

�ʲ��Υ��������ϡ����������ۤ��� @strong{MySQL} �򥤥󥹥ȡ��뤹��ݤ�
����Υ����ƥ��˵������ǧ���줿����Τ����Ĥ��򼨤��ޤ�.

@menu
* Solaris::                     Solaris notes
* Solaris 2.7::                 Solaris 2.7 notes
* Solaris x86::                 Solaris x86 notes
* SunOS::                       SunOS 4 notes
* Linux::                       Linux notes (all Linux versions)
* Alpha-DEC-Unix::              Alpha-DEC-Unix notes
* Alpha-DEC-OSF1::              Alpha-DEC-OSF1 notes
* SGI-Irix::                    SGI-Irix notes
* FreeBSD::                     FreeBSD notes
* NetBSD::                      NetBSD notes
* OpenBSD::                     OpenBSD 2.5 notes
* BSDI::                        BSD/OS notes
* SCO::                         SCO notes
* SCO Unixware::                SCO Unixware 7.0 notes
* IBM-AIX::                     IBM-AIX notes
* HP-UX 10.20::                 HP-UX 10.20 notes
* HP-UX 11.x::                  
* MaxOSX::                      MaxOSX notes
@end menu

@node Solaris, Solaris 2.7, Source install system issues, Source install system issues
@subsection Solaris notes

Solaris �Ǥ� @strong{MySQL} ��������Ÿ������Ȥ��ȥ�֥뤬�Ф�Ǥ��礦��
Solaris �� @code{tar} ��Ĺ��̾���򰷤����� @strong{MySQL} ��Ÿ�������硢
�ʲ��Τ褦�ʥ��顼�ˤʤ�ޤ���

@example
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
@end example

���ξ�硢GNU @code{tar} (@code{gtar}) ��Ÿ���˻��Ѥ��Ƥ���������
����ѥ��뤺�ߤΤ�Τ��ʲ��ˤ���ޤ���
@uref{http://www.mysql.com/Downloads/}.

Sun �ͥ��ƥ��֥���åɤ� Solaris 2.5 �ʾ��ư���ޤ���
2.4 �ʲ��ξ�硢@strong{MySQL} �ϻ�ưŪ�� MIT-pthreads ����Ѥ��ޤ� @xref{MIT-pthreads}.

�⤷��configure ���ˡ��ʲ��Υ��顼���Ф��ʤ顧

@example
checking for restartable system calls... configure: error can not run test
programs while cross compiling
@end example

����ϥ���ѥ��顼�Υ��󥹥ȡ���Ǥʤˤ���ְ�äƤ��ޤ�!
���ξ�硢���ʤ��ϡ���꿷�����С������إ���ѥ��顼�򥢥åץ��졼�ɤ��٤��Ǥ���
�ʲ��ιԤ� @code{config.cache} �ե�������ɲä��뤳�Ȥˤ�äơ�
����������褷�Ƥ⤫�ޤ��ޤ���

@example
ac_cv_sys_restartable_syscalls=$@{ac_cv_sys_restartable_syscalls='no'@}
@end example


�⤷���ʤ��� SPARC �� Solaris ����Ѥ��Ƥ���ʤ顢
@code{gcc} 2.95.2 ��侩���ޤ���
����� @uref{ttp://gcc.gnu.org/}. �Ǹ��Ĥ���ޤ���
@code{egs} 1.1.1 �� @code{gcc} 2.8.1 �� SPARC ��Ǥϴ�����ư��ʤ����Ȥ����ա�

@code{gcc} 2.95.2 ����Ѥ������侩���� @code{configure} ��:

@example
shell> CC=gcc CFLAGS="-O6" \
       CXX=gcc CXXFLAGS="-O6 -felide-constructors -fno-exceptions -fno-rtti" \
       ./configure --prefix=/usr/local/mysql --with-low-memory
@end example

�⤷ Sun Workshop 4.2 compiler ����Ѥ���ʤ顢@code{configure} ��ʲ��Τ褦�ˤ��ޤ���

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

@example
shell> CC=cc CFLAGS="-Xa -fast -xO4 -native -xstrconst -mt" \
       CXX=CC CXXFLAGS="-noex -XO4 -mt" \
       ./configure
@end example

@code{configure} ������ץȤμ��ιԤ�

@example
#if !defined(__STDC__) || __STDC__ != 1
@end example

�ʲ����Ѥ��ޤ�:

@example
#if !defined(__STDC__)
@end example

�⤷ @code{-Xc} ���ץ����� @code{__STDC__} ��ͭ���ˤ�����硢
Sun compiler �� Solaris ��  @file{pthread.h} �إå����ե��������Ѥ���
����ѥ��뤹�뤳�Ȥ��Ǥ��ޤ���
����ϥ���ΥХ��Ǥ�(���󥯥롼�ɥե����뤫����ѥ��顼�ΥХ�)

�⤷ @code{mysqld} ��ư���˰ʲ��Υ��顼���Ф���硢
�ޥ������åɤ򳰤���(���ץ���� @code{-mt} �����) Sun compiler ��Ȥä�
 @strong{MySQL} �򥳥�ѥ��뤷ľ���Ƥ���������

@example
libc internal error: _rmutex_unlock: rmutex not held
@end example

@code{-mt} �� @code{CFLAGS} �� @code{CXXFLAGS} �˲ä��ޤ���

@code{gcc} �� @strong{MySQL} �򥳥�ѥ��뤹��Ȥ��˰ʲ��Υ��顼���Ф���硢
����� @code{gcc} �����ʤ��� Solaris �ΥС�������Ѥ�Ĵ������Ƥ��ޤ���

@example
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'
@end example

���ξ�硢������ @code{gcc} �ǥ���ѥ��뤷�ޤ���
���ʤ��Ȥ� Solaris 2.5 �Ǥϡ��ۤȤ�ɤ� @code{gcc} �ΥХ��ʥ�ΥС�����󤬸Ť���
����åɤ���Ѥ���ץ������ˤϤ��Υ��󥯥롼�ɥե�����ϻȤ��ޤ���

Solaris �� �����ƥå���󥯤Υ����ƥ�饤�֥�꡼���Ѱդ��Ƥ��ޤ���
(@code{libpthreads} and @code{libdl})��
���Τ��ᡢ@code{--static} ���ץ����� @strong{MySQL} �򥳥�ѥ���Ǥ��ޤ���
�⤷������ߤ���硢�ʲ��Υ��顼�ˤʤ�ޤ���

@example
ld: fatal: library -ldl: not found
@end example

�⤷¿���Υץ�������®�� @code{mysqld} ����³���ߤ���硢
 @strong{MySQL} �����˰ʲ��Τ褦�˥��顼���Фޤ�:

@example
Error in accept: Protocol error
@end example

�����С��� @code{--set-variable back_log=50} ���ץ����ǵ�ư����С�����������н�Ǥ���Ǥ��礦��

�⤷��ʬ�� @strong{MySQL} ���饤����ȥץ��������󥯤���
�¹Ի��˰ʲ��Τ褦�˥��顼���Ф���硧

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

����ϰʲ��Τɤ줫�Dz���Ǥ��ޤ���

@table @bullet
@item
�ʲ��Υե饰�ǥ��饤����Ȥ��󥯤��ޤ�(@code{-Lpath} �������):
@code{-Wl,r/full-path-to-libmysqlclient.so}
@item
@code{libmysqclient.so} �� @file{/usr/lib} �˥��ԡ����ޤ�
@item
@tindex LD_RUN_PATH environment variable
@tindex Environment variable, LD_RUN_PATH
@code{LD_RUN_PATH} �Ķ��ѿ��� @file{libmysqlclient.so} ��¸�ߤ���Ȥ�����
���åȤ����塢���饤����Ȥ�¹Ԥ��ޤ���
@end table

@code{--with-libwrap} configure ���ץ������ѻ���@code{libwrap.a} ��ɬ
�פȤ���饤�֥���ޤ��ɬ�פ�����ޤ�:

@example
--with-libwrap="/opt/NUtcpwrapper-7.6/lib/libwrap.a -lnsl -lsocket
@end example

configure �� @strong{MySQL} �� @code{-lz} �Υ�󥯤��ߡ����ʤ��������
���󥹥ȡ��뤷�Ƥ��ʤ��Ȥ������꤬������ϡ����Ĥ�����褬����ޤ�:

@itemize @bullet
@item
�����̿��ץ��ȥ������ѤǤ���褦�ˤ�������硢ftp.gnu.org ���� zlib ��
���ꤷ�ƥ��󥹥ȡ��뤹��ɬ�פ�����ޤ���
@item
@code{--with-named-z-libs=no} ��Ĥ��� configure ��Ԥʤ��ޤ���
@end itemize

@node Solaris 2.7, Solaris x86, Solaris, Source install system issues
@subsection Solaris 2.7 notes

�̾Solaris 2.6 �ΥХ��ʥ�� Solaris 2.7 �ǻ��ѤǤ��ޤ���
�ۤȤ�ɤ� Solaris 2.6 ������� Solaris 2.7 ��Ŭ�ѤǤ��ޤ���

Solaris 2.7 �ϡ����󥯥롼�ɥե�����ˤ����Ĥ��Х�������ޤ���
@code{gcc} �ǰʲ��Τ褦�ʥ��顼���Ф���硧

@example
/usr/include/widec.h:42: warning: `getwc' redefined
/usr/include/wchar.h:326: warning: this is the location of the previous
definition
@end example

�ʲ��Τ褦�ˤ��Ʋ��򤷤ޤ���

@code{/usr/include/widec.h} �� @code{.../lib/gcc-lib/os/gcc-version/include} �˥��ԡ�
41 ���ܤ��ѹ�:

@example
�ѹ�����

#if     !defined(lint) && !defined(__lint)

�ѹ��塧

#if     !defined(lint) && !defined(__lint) && !defined(getwc)
@end example

����ˡ�@file{/usr/include/widec.h} ��ľ���ѹ����Ƥ⤫�ޤ��ޤ���
�ɤ������ˡ�ˤ��Ƥ⡢�ե����������ϡ�@file{config.cache} ��
�ä��� @code{configure} ��Ƽ¹Ԥ��ʤ��ƤϤʤ�ޤ���

@code{make} �¹Ի��˰ʲ��Τ褦�ʥ��顼�ˤʤä���硢@code{configure} ��
 @file{curses.h} �ե�����򸡽ФǤ��Ƥ��ޤ��� (����� @code{/usr/include/widec.h} ��
���顼�Τ���ˤ����ޤ�):

@example
In file included from mysql.cc:50:
/usr/include/term.h:1060: syntax error before `,'
/usr/include/term.h:1081: syntax error before `;'
@end example

������褹��ˤϡ��ʲ��Τ�����Ĥ�Ԥ��ޤ���

@itemize @bullet
@item
���Ҥ����Ȥ��ꡢ@file{/usr/include/widec.h} ��������configure ��Ƽ¹Ԥ��ޤ���
@item
@code{#define HAVE_TERM} �Ԥ� @file{config.h} �ե����뤫��ä���
@code{make} ��Ƽ¹Ԥ��ޤ���
@item
@code{CFLAGS=-DHAVE_CURSES CXXFLAGS=-DHAVE_CURSES ./configure} �ȥ���ե����㡼���ޤ���
@end itemize

@node Solaris x86, SunOS, Solaris 2.7, Source install system issues
@subsection Solarix x86 notes

@code{gcc} �� @code{egcs} �� Solaris x86 �ǻ��Ѥ�����硢load ���˥�������פ����硢
�ʲ��Τ褦�� @code{configure} ���ޤ�:

@example
shell> CC=gcc CFLAGS="-O6 -fomit-frame-pointer" \
       CXX=gcc \
       CXXFLAGS="-O6 -fomit-frame-pointer -felide-constructors -fno-exceptions -fno-rtti" \
       ./configure --prefix=/usr/local/mysql
@end example

����� @code{libstdc++} �饤�֥�꡼�� C++ ���������򤷤ޤ���

�⤷���줬�������ʤ���硢�ǥХå��⡼�ɤǥ���ѥ��뤷��
�ǥХå��Υȥ졼���ե������񤭽Ф��褦�ˤ��Ƶ�ư���뤫��
@code{gdb} ����Ѥ��Ƶ�ư���Ƥ���������
@xref{Debugging server}.

@node SunOS, Linux, Solaris x86, Source install system issues
@subsection SunOS 4 notes

SunOS 4 �Ǥ� MIT-pthreads ��ɬ�פǤ���
���Τ���ˡ� GNU @code{make} �� @strong{MySQL} �Υ���ѥ����ɬ�פˤʤ�ޤ���

�����Ĥ��� SunOS 4 �Ǥ� dynamic libraries �� @code{libtool} �����꤬����ޤ���
������򤱤뤿��ˡ��ʲ��Τ褦�ˤ��� @code{configure} ���ޤ���

@example
shell> ./configure --disable-shared --with-mysqld-ldflags=-all-static
@end example

@code{readline} �Υ���ѥ�������������Υ�˥󥰤��Фޤ�����
�����̵�뤷�ƹ����ޤ���

@code{mysqld} �򥳥�ѥ��뤹�����
�����Ĥ� @code{implicit declaration of function} ��˥󥰤��Ǥޤ�����
̵�뤷�ƹ����ޤ���

@node Linux, Alpha-DEC-Unix, SunOS, Source install system issues
@subsection Linux notes (all Linux versions)

Linux �Ǥ� @strong{MySQL} �� LinuxThreads ����Ѥ��ޤ���
�⤷ @code{glibc2} ������ʤ��Ť� Linux ����Ѥ��Ƥ����硢
@strong{MySQL} �Υ���ѥ�������ˡ�
LinuxThreads �򥤥󥹥ȡ��뤷�ʤ���Фʤ�ޤ���
@uref{http://www.mysql.com/Downloads/Linux}

����: 2.1.1 �Ȥ�������� @code{glibc} �С�������
@code{pthread_mutex_timedwait} ��������̿Ū�ʥХ�������ޤ��������
@code{INSERT DELAYED} ��Ԥʤ����˻��Ѥ���ޤ���@code{INSERT DELAYED} ��
���Ѥ����硢���Υѥå��� glibc �饤�֥����ɲ�@strong{���ʤ���Фʤ�
�ޤ���}:
@uref{http://www.mysql.com/Downloads/Patches/glibc-pthread_cond_timedwait.patch}��
@strong{MySQL} 3.23.7 �� @strong{MySQL} 3.22.32 �Ϥ��ΥХ��ΰ��Ū�ʲ���
��ޤ�Ǥ��ޤ���

1000�ʾ��Ʊ����³����Ѥ���ͽ��Ǥ���С�LinuxThreads �ˤ����Ĥ����ѹ�
�򤷤ơ��ƥ���ѥ��뤷��MySQL �򿷤��� libthread.a ����Ѥ���褦�˺ƥ�
�󥯤���ɬ�פ�����ޤ���sysdeps/unix/sysv/linux/bits/local_lim.h ��� 
PTHREAD_THREADS_MAX �� 4096 �������internals.h ��� STACK_SIZE �� 
256 KB �˸��������Ƥ�������������: STACK_SIZE ���ǥե���Ȥ� 2MB �Ǥ���
��硢MySQL �� 1000 ���٤���³�ǰ���Ǥʤ��ʤ�ޤ���

glibc 2.1.3-65 ������ʹߤξ�硢STACK_SIZE �����䤹ɬ�פϤ���ޤ���;
@code{mysqld} �� @code{thread_stack} �ͤ�������ѹ��Ǥ��ޤ���

If you use a lot of concurrent connections, you may suffer from a 2.2
kernel "feature" that penalizes a process for forking or cloning a child
in an attempt to prevent a fork bomb attack. This will cause MySQL not
to scale well as you increase the number of concurrent clients. On
single CPU systems, we have seen this manifested in a very slow thread
creation - which means it may take a long time to connect to MySQL ( as
long as 1 minute), and it may take just as long to shut it down. On
multiple CPU systems, we have observed a gradual drop in query speed as
the number of clients increases. In the process of trying to find a
solution, we have received a kernel patch from one of our users, who
claimed it made a lot of difference for his site. We have done some
limited testing in which the patch greatly improved the scalabitility of
MySQL. The patch is available
@uref{http://www.mysql.com/Downloads/Patches/linux-fork.patch,here} - be
warned, though, that we assume no reponsibility for any damage that this
patch could do - use at your own risk. We have also been told by the
Linux kernel developers that this problem is fixed in 2.4, although we
have not yet done any testing.

�⤷ @code{mysqld} ��ư���ʤ��ä��ꡢ @code{mysql_install_db} ��ư���ʤ���硢
�ʲ����ɤߤ�����Ƥ���������
LinuxThreads �� @code{libc}/@code{glibc} �饤�֥�꡼������Τ��� Linux �����ƥ�����˵�����ޤ���
������ @strong{MySQL} ��ư�����뤿��˴�ñ����ˡ��¿������ޤ���
���ִ�ñ����ˡ�ϡ��Х��ʥ�ˤʤä� @strong{MySQL} (not the RPM) ����Ѥ��뤳�ȤǤ���
���ΥС������ΥХ��ʥ�ϡ����ʤ����Ȥ�����ѥ��뤷����Τ�� 10% �ۤ�®���Ǥ��礦��
@xref{Compile and link options}.

����Τ��Ƥ�������Ȥ��ơ��Х��ʥ����ۤ� @code{libc5} �θŤ� Linux �����ƥ�
(RedHat 4.x , Slackware 3.6�ʲ�, Debian 1.3 bo �ʲ��ʤ�)
�ǻ��Ѥ���ȡ��ۥ���̾������̿Ū�ʥ��顼���Фޤ�
@xref{Binary notes-Linux}.

@code{myisamchk} �� @code{libc.so.5.3.12} �ǻ��Ѥ���ȥϥ󥰤�ޤ�.
�ǿ��� @code{libc} �˥��åץ��졼�ɤ��Ƥ���������

LinuxThreads ����Ѥ��Ƥ����硢���㣳�ĤΥץ�����������ޤ���
�����ϼ¥���åɤǡ���Ĥ� LinuxThreads �ޥ͡����㡼�Τ���ˡ�
��Ĥ���³�Υϥ�ɥ�ˡ��⤦�ҤȤĤϥ��顼��ȥ����ʥ�Υϥ�ɥ�Ǥ���

����: linux �����ͥ�� linuxthread �饤�֥��ϥǥե���ȤǤ� 1024 �����
�ɤ������Ĥ��Ȥ��Ǥ��ޤ�������ϥѥå���Ŭ�Ѥ��Ƥ��ʤ������ƥ��Ǥ� 
MySQL �ؤ���³�Ϻ��� 1021 �����Ǥ���Ȥ������Ȥ��̣���ޤ����ڡ��� 
@uref{http://www.volano.com/linuxnotes.html} �Ϥ������¤�ɤΤ褦�˲���
���뤫�ξ��󤬴ޤޤ�Ƥ��ޤ���

�⤷ @code{mysqld} �ǡ����ץ������� @code{ps} �ʤɤǤߤ�Ȼ��Ǥ���褦�Ǥ����, 
�̾盧��� @strong{MySQL} �Х��������줿�ơ��֥����äƤ��ޤ���
@xref{Crashing}.

LinuxThreads ����Ѥ��Ƥ��� @code{mysqladmin shutdown} ��ư���ʤ���硢
LinuxThreads 0.7.1 �ʾ�˥��åץ��졼�ɤ��Ƥ���������

RedHat ����Ѥ��Ƥ���, �ʲ��Τ褦�ʥ��顼���Ф���硧

@example
/usr/bin/perl is needed...
/usr/sh is needed...
/usr/sh is needed...
@end example

���ξ�硢 @code{rpm} �ΥС�������
 @file{rpm-2.4.11-1.i386.rpm} �� @file{rpm-devel-2.4.11-1.i386.rpm} (�ʾ�)
 �ˤ��ʤ��ƤϤ����ޤ���

RedHat 4.2 �ϰʲ����饢�åץ��졼�ɤ�����Ǥ��ޤ���
@uref{ftp://ftp.redhat.com/updates/4.2/i386}. 
���뤤��¾�ξ���
@uref{http://www.sunsite.unc.edu/pub/Linux/distributions/redhat/code/rpm/}

�⤷ @strong{MySQL} ���饤����Ȥ�¹Ԥ��ưʲ��Υ��顼�ˤʤä���硧

@example
ld.so.1: ./my: fatal: libmysqlclient.so.4: open failed: No such file or directory
@end example

�ʲ�����ˡ�Dz��Ǥ��ޤ���

@itemize @bullet
@item
���饤����Ȥ�ʲ��Υե饰��(@code{-Lpath}�Τ�����)��󥯤��ޤ���
@code{-Wl,r/path-libmysqlclient.so}
@item
@code{libmysqclient.so} �� @file{/usr/lib} �˥��ԡ����ޤ�
@item
@tindex LD_RUN_PATH environment variable
@tindex Environment variable, LD_RUN_PATH
@code{LD_RUN_PATH} �Ķ��ѿ��� @file{libmysqlclient.so} ��¸�ߤ���������ꤷ�ޤ���
(���饤����Ȥ�¹Ԥ����������ꤷ�ޤ�)
@end itemize

�ٻ��̥���ѥ��� @code{(fcc / FCC)} ����Ѥ��Ƥ����硢@strong{MySQL} 
�Υ���ѥ���ˤ����Ĥ������꤬����ޤ���Linux �إå��ե�����ϤȤƤ� 
@code{gcc} �ظ��Ǥ��뤿��Ǥ���

���� @code{configure} �Ԥ� @code{fcc/FCC} ��ư��ޤ�:

@example
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
@end example

@menu
* Linux-x86::                   Linux-x86 notes
* Linux-RedHat50::              RedHat 5.0 notes
* Linux-RedHat51::              RedHat 5.1 notes
* Linux-SPARC::                 Linux-Sparc notes
* Linux-Alpha::                 Linux-Alpha notes
* MKLinux::                     MkLinux notes
* Qube2::                       Qube2 Linux notes
@end menu

@node Linux-x86, Linux-RedHat50, Linux, Linux
@subsubsection Linux-x86 notes

@strong{MySQL} �� @code{libc} 5.4.12 �ʾ夬ɬ�פǤ���@code{libc} 5.4.46 ��ư��ޤ���
@code{glibc} 2.0.6 �ʾ�Ǥ�ư��ޤ���
@code{glibc} �� RPM �ˤϤ����Ĥ����꤬���ꡢ���åץǡ��Ȥ�����å����Ƥ���������
@code{glibc} 2.0.7-19 �� 2.0.7-29 RPM ��ư��ޤ���

�Ť� Linux ����ʪ�Ǥϡ�@code{configure} ���˰ʲ��Τ褦�ʥ��顼���Ф뤫�⤷��ޤ���

@example
Syntax error in sched.h. Change _P to __P in the /usr/include/sched.h file.
See the Installation chapter in the Reference Manual.
@end example

����� @code{_P} �ޥ�������ĤΥ������������������Ƥʤ�����ǡ�
���Υ��顼��å������Τ褦���н褷�Ƥ���������

�ʲ��Τ褦�ʥ�˥󥰤�̵�뤷�ƹ����ޤ���

@example
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'
@end example

Debian GNU/Linux �Ǥϡ�@strong{MySQL} ��ޥ���ε�ư����Ω�������뤿��ˤϡ�
�ʲ��Τ褦�ˤ��ޤ���

@example
shell> cp support-files/mysql.server /etc/init.d/mysql.server
shell> /usr/sbin/update-rc.d mysql.server defaults 99
@end example

@code{mysql.server} ������ץȤ� @strong{MySQL} �򥤥󥹥ȡ��뤷�����
 @file{share/mysql} directory �ˤ���ޤ���
���뤤�ϡ� @strong{MySQL} �Υ���������� @file{support-files} �ǥ��쥯�ȥ�ˤ���ޤ���


@code{mysqld} ���Ĥͤ˥������Ȼ��˥�����Ϥ���硢
�Ť� @file{/lib/libc.a} ����Ѥ��Ƥ��뤫�⤷��ޤ���
@file{sql/mysqld} ��õ�ơ������� @code{make install} ���ƤߤƤ���������
����Ϥ����Ĥ��� Slackware ����𤵤줿���ݤǤ���
RedHat 5.0 �� @code{glibc} �ΥС������ˤ�ä����꤬ȯ�����ޤ���
@xref{Linux-RedHat50}.

�⤷ @code{mysqld} ���󥯤�����˰ʲ��Τ褦�ʥ��顼���Ф���硢
 @file{libg++.a} �����������󥹥ȡ��뤵��Ƥ��ޤ���

@example
/usr/lib/libc.a(putc.o): In function `_IO_putc':
putc.o(.text+0x0): multiple definition of `_IO_putc'
@end example

@file{libg++.a} �λ��Ѥ��򤱤�ˤϡ� @code{configure} ��ʲ��Τ褦�ˤ��ޤ���

@example
shell> CXX=gcc ./configure
@end example

@node Linux-RedHat50, Linux-RedHat51, Linux-x86, Linux
@subsubsection RedHat 5.0 notes

�⤷ RedHat �� @strong{MySQL} �����꤬�����硢�ޤ� @code{glibc} �ΥС������򿷤�����Τˤ����Ƥ���������

RedHat �Υ��ե������ѥå�(including @code{glibc-2.0.7-19} and @code{glibc-devel-2.0.7-19})
�򥤥󥹥ȡ��뤷�Ƥ���ʤ顢 @strong{MySQL} ������ʤ�ư���Ϥ��Ǥ���

@code{glibc} 2.0.5 �ˤ� @code{pthread_key_create} �ѿ������������ʬ�˥Х������ꡢ
���åץǡ��Ȥ�ɬ�פǤ���@code{glibc} 2.0.5 ����Ѥ����硢
�����ƥ��å���󥯤���ƺ������줿 @strong{MySQL} �Х��ʥ�����ʪ����Ѥ��٤��Ǥ���
���������饳��ѥ��뤷������硢 @uref{http://www.mysql.com/Downloads/Linux} �ˤ���
LinuxThreads �ν����Ǥ򥤥󥹥ȡ��뤹�뤫��
���뤤�� @code{glibc} ��С�����󥢥åפ��ʤ��ƤϤʤ�ޤ���

�⤷ @code{glibc} or LinuxThreads �ΥС����������Τ����Τ��ȡ�
 @code{mysqld} �ϥ��ͥ��������٤˥���å��夷�ޤ���
�㤨�С�@code{mysqladmin version} �� @code{mysqld} �����˥���å��夷�ޤ���

�ޤ�������Τ���饤�֥�꡼����Ѥ��Ƥ���ȡ� @code{mysqld} �ϵ�ư���˥���å��夷�ޤ���
�����Ĥ��� Linux systems �Ǥϡ��ʲ��Τ褦�ˤ��� configure �Ǥ�����򤱤뤳�Ȥ��Ǥ��ޤ���

@example
shell> ./configure --with-mysqld-ldflags=-all-static
@end example

RedHat 5.0 �Ǥϡ�@code{glibc} 2.0.7-19 RPM ���ñ�˥��󥹥ȡ���Ǥ��ޤ��Τǡ�
���󥹥ȡ���塢@code{--with-mysqld-ldflags=-all-static} �ʤ��� @code{configure} �Ǥ��ޤ���

@code{glibc} 2.0.7 �Υ��������Ф���ѥå���
@example
@uref{http://www.mysql.com/Download/Linux/glibc-2.0.7-total-patch.tar.gz}
@end example
 �ˤ���ޤ���
���Υѥå��� @strong{MySQL} ���ƥ��Ȥ��줿�ѥå��ǡ���ñ��Ŭ�ѤǤ��ޤ���

�⤷ @strong{MySQL} ���ۻ��˥���å��夹���硢������ @strong{MySQL} ��
�Х��ʥ�����������ɤ��ƤߤƤ�������������ϥ����ƥ��å���󥯤Ǻ�������Ƥ��ꡢ
�饤�֥�꡼�ξ��ͤ��򤱤뤳�Ȥ��Ǥ������Ƥ� Linux ��ư���Ϥ��Ǥ���

@strong{MySQL} �ϥǥХå��Τ���ȥ졼���ե�����˾����񤭽Ф����Ȥ��Ǥ��ޤ���
�����������褹�뤿��˥ҥ�Ȥˤʤ�����¿�����Ϥ��ޤ���
@xref{Debugging server}.

@node Linux-RedHat51, Linux-SPARC, Linux-RedHat50, Linux
@subsubsection RedHat 5.1 notes

RedHat 5.1 �� @code{glibc} (@code{glibc} 2.0.7-13) �ϥ��꡼�꡼�����ޤ���
@code{glibc} �� 2.0.7-19 �˥��åץ��졼�ɤ��ʤ��ƤϤʤ�ޤ���
���뤤�ϡ��Х��ʥ����ۤ� @code{mysqld} ����Ѥ��뤫�Ǥ���
�⤷�����Ԥ�ʤ��ä���硢���꡼��Ϣ�����꤬ȯ�����ޤ�(out of memory, etc.,etc.)��
¿���ξ��ʲ��Τ褦�ˡ�

@example
Can't create a new thread (errno 11). If you are not out of available
memory, you can consult the manual for any possible OS dependent bug
@end example

@code{glibc} 2.0.7-19 �˥��åץ��졼�ɸ�ϡ�@strong{MySQL} ��
�����ʥߥå���󥯻���(�ǥե����)�� configure �Ǥ��ޤ���
����@code{glibc} 2.0.7-19 �򥽡������饤�󥹥ȡ��뤷�ʤ��¤ꡢ
@code{--with-mysqld-ldflags=-all-static} ���ץ����� @code{configure} ��@strong{���ѤǤ��ޤ���}��

@code{glibc} �ΥС������� @code{rpm -q glibc} �dz�ǧ�Ǥ��ޤ���

@node Linux-SPARC, Linux-Alpha, Linux-RedHat51, Linux
@subsubsection Linux-SPARC notes

�����Ĥ��������ߴؿ�, @code{readdir_r()} ������ޤ���
���θ���Ȥ��ơ�@code{SHOW DATABASES} ����˶����֤��ޤ���
����� configure �塢����ѥ��뤹�����ˡ�
@file{config.h} ���� @code{HAVE_READDIR_R} ����������ȤDz�褷�ޤ���

����¾�����Ĥ�������ϡ����ʤ��� Linux �˥ѥå������Ƥ�ɬ�פ�����ޤ���
�ѥå��� @uref{http://www.mysql.com/patches/Linux-sparc-2.0.30.diff} �ˤ���ޤ���
���Υѥå��ϡ�@code{vger.rutgers.edu} �ˤ��� @file{sparclinux-2.0.30.tar.gz} �ѤǤ���
(����������� 2.0.30 �Ȥϰ㤤�ޤ����ѥå�������2.0.30�����Ƥʤ��褦��)
������ LinuxThreads 0.6 ������ʾ�ˤ��ʤ��ƤϤʤ�ޤ���

����� @email{jacques@@solucorp.qc.ca} ����󤻤��ޤ�����

@node Linux-Alpha, MKLinux, Linux-SPARC, Linux
@subsubsection Linux-Alpha notes

@strong{MySQL} 3.23.12 ����Linux-Alpha ��Ǻǽ�˥ƥ��Ȥ��줿�С������Ǥ���
�⤷ @strong{MySQL} �� Linux-Alpha ��ǻ��Ѥ������ȹͤ����ʤ顢
���ΥС�������꿷������Τ���Ѥ��ޤ���

Linux-Alpha �Ǥΰ����礭������ϡ����Υץ�åȥե������ @code{glibc} ��
�ޤ������Ĥ����꤬���뤳�ȤǤ��� �ǿ��� @code{glibc} �����뤳�Ȥ���
�Ϥ���Ƥ���������

We have tested @strong{MySQL} on Alpha with our benchmarks + test suite and
it appears to work nicely.  The main thing we haven't yet had time to test
is how things works with many concurrent users.
 
When we compiled @strong{MySQL} we where using SuSE 6.3, kernel 2.2.13-SMP,
egcs 1.1.2 and libc-2.1.2-28.
 
We used the following configure line:

@example
CFLAGS="-O6 -fomit-frame-pointer" CXX=gcc CXXFLAGS="-O6 -fomit-frame-pointer -felide-constructors -fno-exceptions  -fno-rtti" ./configure --prefix=/usr/local/mysql --disable-shared
@end example

If you have access to Compaq's C compiler, the following configure line
will give you about 9 % more performance:
@example
CC=ccc CFLAGS="-fast -O3 -fomit-frame-pointer" CXX=gcc CXXFLAGS="-O6 -fomit-frame-pointer -felide-constructors -fno-exceptions -fno-rtti -mcpu=ev6 -Wa,-mev6" CXXLDFLAGS='/usr/lib/compaq/libots-2.2.7/libots.so /usr/lib/compaq/cpml-5.0.0/libcpml_ev6.a' ./configure --prefix=/usr/local/mysql --disable-shared
@end example

Note that the last example assumes your are using an Alpha EV6 processor.

Some known problems when running @strong{MySQL} on Linux-Alpha:

@itemize @bullet
@item
If you create many files ( > 10000) in one directory (as done by the
@code{test-create} in the @strong{MySQL} benchmarks, mysqld may report
the error @code{Can't create/write to file '...' (Errcode: 12)}. This
is probably a bug in the Linux-Alpha kernel.
@item
Debugging threaded applications like @strong{MySQL} will not work with
@code{gdb 4.18}.  You should download and use gdb 5.0 instead!
@item
If you try linking mysqld staticly, the resulting image will core dump
at start.  In other words, @strong{DON'T} use
@code{--with-mysqld-ldflags=-all-static}
@end itemize

We don't yet know if the following old information is still relevant, so we
leave this here until we have had time to test Linux-Alpha properly.

�⤷�����ʥ�����꤬������ (@strong{MySQL} dies unexpectedly
under high load)������� OS �ȥ���åɤΥХ��Ǥ��礦��
���ξ�硢@strong{MySQL} �򥷥��ʥ����Ѥ��ʤ��褦�ˡ�configure ���˻���Ǥ��ޤ���

@example
shell> CFLAGS=-DDONT_USE_THR_ALARM \
       CXXFLAGS=-DDONT_USE_THR_ALARM \
       ./configure ...
@end example

����� @strong{MySQL} �Υѥե����ޥ󥹤˱ƶ����ޤ��󤬡�
@code{mysqladmin kill} or @code{mysqladmin shutdown} ����Ѥ��ơ�
��³�� ``sleeping'' �ˤʤäƤ��륯�饤����Ȥ� kill �Ǥ��ޤ���
���Υ��ޥ�ɤ�ȯ�Ԥ����Ȥ������Υ��饤����Ȥϻ�ˤޤ���


@node MKLinux, Qube2, Linux-Alpha, Linux
@subsubsection MkLinux notes

@strong{MySQL} �Ϻǿ��� @code{glibc} ����Ѥ��� MkLinux ��ư��ޤ���
(@code{glibc} 2.0.7 �ǥƥ��Ȥ��ޤ���).

@node Qube2,  , MKLinux, Linux
@subsubsection Qube2 Linux notes

Qube2 (Linux Mips) ��� @strong{MySQL} ��ư�����ˤϡ�
�ǿ��� @code{glibc} �饤�֥��Ǥʤ��ƤϤʤ�ޤ���(@code{glibc-2.0.7-29C2} ��ư��뤳�Ȥ�ʬ���äƤ��ޤ�)�� �����ơ� @code{egcs} C++ compiler (@code{egcs-1.0.2-9}, @code{gcc 2.95.2} �ʾ�) ����Ѥ��ʤ��ƤϤʤ�ޤ���


@node Alpha-DEC-Unix, Alpha-DEC-OSF1, Linux, Source install system issues
@subsection Alpha-DEC-Unix notes

When compiling threaded programs under Digital UNIX, the documentation
recommends the @code{-pthread} option for @code{cc} and @code{cxx} and the
libraries @code{-lmach -lexc} (in addition to @code{-lpthread}).
You should run @code{configure} something like this:

@example
shell> CC="cc -pthread" CXX="cxx -pthread -O" \
       ./configure --with-named-thread-libs="-lpthread -lmach -lexc -lc"
@end example

When compiling @code{mysqld}, you may see a couple of warnings like this:

@example
mysqld.cc: In function void handle_connections()':
mysqld.cc:626: passing long unsigned int *' as argument 3 of
accept(int,sockadddr *, int *)'
@end example

You can safely ignore these warnings. They occur because @code{configure}
can't detect warnings, only errors.

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 @code{SIGHUP} signal.)  If so, try starting the server like this:

@example
shell> nohup mysqld [options] &
@end example

@code{nohup} causes the command following it to ignore any @code{SIGHUP}
signal sent from the terminal.  Alternatively, start the server by running
@code{safe_mysqld}, which invokes @code{mysqld} using @code{nohup} for you.

@node Alpha-DEC-OSF1, SGI-Irix, Alpha-DEC-Unix, Source install system issues
@subsection Alpha-DEC-OSF1 notes

If you have problems compiling and have DEC @code{CC} and @code{gcc}
installed, try running @code{configure} like this:

@example
shell> CC=cc CFLAGS=-O CXX=gcc CXXFLAGS=-O3 \
       ./configure --prefix=/usr/local/mysql
@end example

If you get problems with the @file{c_asm.h} file, you can create and use
a 'dummy' @file{c_asm.h} file with:

@example
shell> touch include/c_asm.h
shell> CC=gcc CFLAGS=-I./include \
       CXX=gcc CXXFLAGS=-O3 \
       ./configure --prefix=/usr/local/mysql
@end example

On OSF1 V4.0D and compiler "DEC C V5.6-071 on Digital UNIX V4.0 (Rev. 878)"
the compiler had some strange behavior (undefined @code{asm} symbols).
@code{/bin/ld} also appears to be broken (problems with @code{_exit
undefined} errors occuring while linking @code{mysqld}).  On this system, we
have managed to compile @strong{MySQL} with the following @code{configure}
line, after replacing @code{/bin/ld} with the version from OSF 4.0C:

@example
shell> CC=gcc CXX=gcc CXXFLAGS=-O3 ./configure --prefix=/usr/local/mysql
@end example

With the Digital compiler "C++ V6.1-029", the following should work:

@example
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
export CC CFLAGS CXX CXXFLAGS
./configure --prefix=/usr/mysql/mysql --with-low-memory --enable-large-files --with-mysqld-ldflags=-all-static --disable-shared --with-named-thread-libs="-lmach -lexc -lc"
@end example

In some versions of OSF1, the @code{alloca()} function is broken. Fix
this by removing the line in @file{config.h} that defines @code{'HAVE_ALLOCA'}.

The @code{alloca()} function also may have an incorrect prototype in
@code{/usr/include/alloca.h}.  This warning resulting from this can be ignored.

@code{configure} will use the following thread libraries automatically:
@code{--with-named-thread-libs="-lpthread -lmach -lexc -lc"}.

When using @code{gcc}, you can also try running @code{configure} like this:

@example
shell> CFLAGS=-D_PTHREAD_USE_D4 CXX=gcc CXXFLAGS=-O3 ./configure ....
@end example

If you have problems with signals (@strong{MySQL} dies unexpectedly
under high load) you may have found an OS bug with threads and
signals. In this case you can tell @strong{MySQL} not to use signals by
configuring with:

@example
shell> CFLAGS=-DDONT_USE_THR_ALARM \
       CXXFLAGS=-DDONT_USE_THR_ALARM \
       ./configure ...
@end example

This doesn't affect the performance of @strong{MySQL}, but has the side
effect that you can't kill clients that are ``sleeping'' on a connection with
@code{mysqladmin kill} or @code{mysqladmin shutdown}.  Instead, the client
will die when it issues its next command.

With @code{gcc} 2.95.2, you will probably run into the following compile error:

@example
sql_acl.cc:1456: Internal compiler error in `scan_region', at except.c:2566
Please submit a full bug report.
@end example

To fix this you should change to the @code{sql} directory and do a 'cut
and paste' of the last @code{gcc} line, but change @code{-O3} to @code{-O0} (or
@code{-O0} immediately after @code{gcc} if you don't have any @code{-O}
option on your compile line. After this is done you can just change back to
the top level directly and run @code{make} again.

@node SGI-Irix, FreeBSD, Alpha-DEC-OSF1, Source install system issues
@subsection SGI-IRIX notes

If you are using Irix 6.5.3 or newer @code{mysqld} will only be able to
create threads if you run it as a user with @code{CAP_SCHED_MGT}
privileges (like @code{root}) or give the @code{mysqld} server this privilege
with the following shell command:

@example
shell> chcap "CAP_SCHED_MGT+epi" /opt/mysql/libexec/mysqld
@end example

You may have to undefine some things in @file{config.h} after running
@code{configure} and before compiling.

In some Irix implementations, the @code{alloca()} function is broken. If the
@code{mysqld} server dies on some @code{SELECT} statements, remove the lines
from @file{config.h} that define @code{HAVE_ALLOC} and @code{HAVE_ALLOCA_H}.
If @code{mysqladmin create} doesn't work, remove the line from
@file{config.h} that defines @code{HAVE_READDIR_R}. You may have to remove
the @code{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 @code{rld} rollup, and the latest @code{libc} rollup.

You definately 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
@file{mysql.cc}:

@example
"/usr/include/curses.h", line 82: error(1084): invalid combination of type
@end example

Then type the following in the top-level directory of your @strong{MySQL}
source tree:

@example
shell> extra/replace bool curses_bool < /usr/include/curses.h > include/curses.h
shell> make
@end example

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 @code{gcc}, you can use the following
@code{configure} command:

@example
shell> CC=gcc CXX=gcc CXXFLAGS=-O3 \
       ./configure --prefix=/usr/local/mysql --with-thread-safe-client --with-named-thread-libs=-lpthread
@end example

@node FreeBSD, NetBSD, SGI-Irix, Source install system issues
@subsection FreeBSD notes

FreeBSD 3.x is recommended for running @strong{MySQL} since it the thread package
is much more integrated.

�Ǥ��ñ�˥��󥹥ȡ��뤹����ˡ�ϡ�@uref{http://www.freebsd.org} ��
mysql-server �� mysql-client �� ports �����Ѥ��뤳�ȤǤ���
@uref{http://www.freebsd.org}

����ϰʲ��Τ褦��������⤿�餷�ޤ���
@itemize @bullet
@item
���ץƥ��ޥ������줿 @strong{MySQL} ��ư��
@item
��ư configuration �� build
@item
�������ȥ��å��ѤΥ�����ץȤ� /usr/local/etc/rc.d �˥��󥹥ȡ���
@item
Ability to see which files that are installed with pkg_info -L. And to
remove them all with pkg_delete if you no longer want @strong{MySQL} on that
machine.
@end itemize

FreeBSD 2.x ��Ǥ� MIT-pthreads �򡢤����� versions 3 �ʾ�Ǥϡ�
�ͥ��ƥ��֤Υ���åɤ���Ѥ��Ƥ���������
�Ƕ�Τ����Ĥ��� 2.2.x �Ǥϥͥ��ƥ��֤Υ���å� ��ư���ǽ�Ǥ�����
mysqld �� ��Ȥ��Ȥ������꤬������ޤ���

̾�����������μ¤ˤ��Ƥ����Ƥ��������� �Ǥʤ��ȡ�mysqld ����³����ݡ�
̾�����ˤȤƤ���֤������ꡢ��³�˼��Ԥ���Ǥ��礦��

�μ¤� @file{/etc/hosts} �ե������ @code{localhost} ����Ͽ����Ƥ���褦��
���Ƥ��������� (�Ǥʤ��ȡ��ǡ����١����ؤ���³�����꤬�Фޤ�)��
 @file{/etc/hosts} �ե�����ϡ��ʲ��ιԤ���Ϥޤ�٤��Ǥ���

@example
127.0.0.1       localhost localhost.your.domain
@end example

�⤷ @code{configure} �� MIT-pthread ����Ѥ����ʬ���ä���硢
MIT-pthreads notes ���ɤ�٤��Ǥ��� @xref{MIT-pthreads}.

If you get an error from @code{make install} that it can't find
@file{/usr/include/pthreads}, @code{configure} didn't detect that you need
MIT-pthreads. This is fixed by executing these commands:
 
@example
shell> rm config.cache
shell> ./configure --with-mit-threads
@end example

FreeBSD �� @code{make} �ο����񤤤�  GNU �� @code{make} �Ⱦ����㤤�ޤ���
�⤷ @code{make} �ˤ���������꤬�Ф��ʤ顢 GNU @code{make} ��
���󥹥ȡ��뤹�٤��Ǥ���

FreeBSD �Ǥϡ��ǥե���ȤΥե�����ϥ�ɥ�ξ���ͤ��ȤƤ⾯�ʤ�
�ͤǤ��뤳�Ȥ��Τ��Ƥ��ޤ���@xref{Not enough file handles}.
safe_mysqld ��� ulimit -n �Υ����Ȥ򳰤�����/etc/login.conf �ե������
mysqld �桼�����������ͤ����ä����ޤ���
(/etc/login.conf ���ѹ��κݤ� cap_mkdb /etc/login.conf �Ǻƹ��ۤ�ɬ�פǤ�)��
�⤷�ǥե���Ȥ���Ѥ������ʤ���С����Υ桼������ password �ե��������
Ŭ�ڤ� Class ��Ϳ���뤳�ȤǤ⡢�ѹ���ǽ�ˤʤ�ޤ���(use: chpass mysqld-user-name)

�⤷ @strong{MySQL} �����߻������꤬����ʤ顢
 @code{TZ} �Ķ��ѿ������ꤷ�ʤ��ƤϤʤ�ޤ��� @xref{Environment variables}.


�����ǰ��ꤷ�������ƥ�������ʤ顢 @code{-STABLE} �Υ����ͥ������
���Ѥ��Ƥ���������


@node NetBSD, OpenBSD, FreeBSD, Source install system issues
@subsection NetBSD notes

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

@node OpenBSD, BSDI, NetBSD, Source install system issues
@subsection OpenBSD 2.5 notes

On OpenBSD 2.5, you can compile @strong{MySQL} with native threads with the
following options:

@example
CFLAGS=-pthread CXXFLAGS=-pthread ./configure --with-mit-threads=no
@end example

@node BSDI, SCO, OpenBSD, Source install system issues
@subsection BSD/OS notes

@menu
* BSDI2::                       BSD/OS 2.x notes
* BSDI3::                       BSD/OS 3.x notes
* BSDI4::                       BSD/OS 4.x notes
@end menu

@node BSDI2, BSDI3, BSDI, BSDI
@subsubsection BSD/OS 2.x notes

If you get the following error when compiling @strong{MySQL}, your
@code{ulimit} value for virtual memory is too low:

@example
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
@end example

Try using @code{ulimit -v 80000} and run @code{make} again.  If this
doesn't work and you are using @code{bash}, try switching to @code{csh}
or @code{sh}; some BSDI users have reported problems with @code{bash}
and @code{ulimit}.

If you are using @code{gcc}, you may also use have to use the
@code{--with-low-memory} flag for @code{configure} to be able to compile
@file{sql_yacc.cc}.

�⤷ @strong{MySQL} �����߻������꤬����ʤ顢
 @code{TZ} �Ķ��ѿ������ꤷ�ʤ��ƤϤʤ�ޤ��� @xref{Environment variables}.

@node BSDI3, BSDI4, BSDI2, BSDI
@subsubsection BSD/OS 3.x notes

Upgrade to BSD/OS 3.1. If that is not possible, install BSDIpatch M300-038.

Use the following command when configuring @strong{MySQL}:

@example
shell> env CXX=shlicc++ CC=shlicc2 \
       ./configure \
           --prefix=/usr/local/mysql \
           --localstatedir=/var/mysql \
           --without-perl \
           --with-unix-socket-path=/var/mysql/mysql.sock
@end example

The following is also known to work:

@example
shell> env CC=gcc CXX=gcc CXXFLAGS=-O3 \
       ./configure \
           --prefix=/usr/local/mysql \
           --with-unix-socket-path=/var/mysql/mysql.sock
@end example

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
@code{--skip-thread-priority} option to @code{safe_mysqld}!  This will run
all threads with the same priority; on BSDI 3.1, this gives better
performance (at least until BSDI fixes their thread scheduler).

If you get the error @code{virtual memory exhausted} while compiling,
you should try using @code{ulimit -v 80000} and run @code{make} again.
If this doesn't work and you are using @code{bash}, try switching to
@code{csh} or @code{sh}; some BSDI users have reported problems with
@code{bash} and @code{ulimit}.

@node BSDI4,  , BSDI3, BSDI
@subsubsection BSD/OS 4.x notes

BSDI 4.x has some thread related bugs.  If you want to use @strong{MySQL}
on this, you should install all thread related patches. At least
M400-023 should be installed.

On some BSDI 4.x systems, you may get problems with shared libraries. The
symptom is that you can't execute any client programs, like for example
@code{mysqladmin}.  In this case you need to reconfigure not to use
shared libraries with the @code{--disable-shared} option to configure.

@node SCO, SCO Unixware, BSDI, Source install system issues
@subsection 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 @code{MySQL} with just:

@example
CC=gcc CXX=gcc ./configure ... (options)
@end example

@enumerate
@item
For OpenServer 5.0.X you need to use GDS in Skunkware 95 (95q4c).  This
is necessary because GNU @code{gcc} 2.7.2 in Skunkware 97 does not have
GNU @code{as}.  You can also use @code{egcs} 1.1.2 or newer
@uref{http://www.egcs.com/}.  If you are using @code{egcs} 1.1.2 you have
to execute the following command:

@example
shell> cp -p /usr/include/pthread/stdtypes.h /usr/local/lib/gcc-lib/i386-pc-sco3.2v5.0.5/egcs-2.91.66/include/pthread/
@end example
@item
You need the port of GCC 2.5.? for this product and the Development
system.  They are required on this version of SCO UNIX.  You cannot
just use the GCC Dev system.
@item
You should get the FSU Pthreads package and install it first.  This can be
found at
@uref{http://www.cs.wustl.edu/~schmidt/ACE_wrappers/FSU-threads.tar.gz}.
You can also get a precompiled package from
@uref{ftp://www.mysql.com/pub/mysql/Downloads/SCO/FSU-threads-3.5c.tar.gz}.
@item
FSU Pthreads can be compiled with SCO UNIX 4.2 with tcpip.  Or
OpenServer 3.0 or Open Desktop 3.0 (OS 3.0 ODT 3.0), with the 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.? 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.
@item
To build FSU Pthreads on your system, do the following:
@enumerate
@item
Run @code{./configure} in the @file{threads/src} directory and select
the SCO OpenServer option. This command copies @file{Makefile.SCO5} to
@file{Makefile}.
@item
Run @code{make}.
@item
To install in the default @file{/usr/include} directory, login as root,
then @code{cd} to the @file{thread/src} directory, and run @code{make
install}.
@end enumerate
@item
Remember to use GNU @code{make} when making @strong{MySQL}.
@item
On OSR 5.0.5, you should use the following configure line:
@example
shell> CC="gcc -DSCO" CXX="gcc -DSCO" ./configure
@end example
The @code{-DSCO} is needed to help configure detect some thread
functions properly.  If you forget @code{-DSCO}, you will get the following
error message while compiling:
@example
my_pthread.c: In function `my_pthread_mutex_init':
my_pthread.c:374: `pthread_mutexattr_default' undeclared (first use this function)
@end example
@item
If you don't start @code{safe_mysqld} as root, you probably will get only the
default 110 open files per process.  @code{mysqld} will write a note about this
in the log file.
@item
With SCO 3.2V5.0.5, you should use FSU Pthreads version 3.5c or newer.
The following @code{configure} command should work:
@example
shell> CC="gcc -belf" ./configure --prefix=/usr/local/mysql --disable-shared
@end example
@item
With SCO 3.2V4.2, you should use FSU Pthreads version 3.5c or newer.
The following @code{configure} command should work:
@example
shell> CFLAGS="-D_XOPEN_XPG4" CXX=gcc CXXFLAGS="-D_XOPEN_XPG4" \
       ./configure \
           --with-debug --prefix=/usr/local/mysql \
           --with-named-thread-libs="-lgthreads -lsocket -lgen -lgthreads" \
           --with-named-curses-libs="-lcurses"
@end example
You may get some problems with some include files. In this case, you can
find new SCO-specific include files at
@uref{ftp://www.mysql.com/pub/mysql/Downloads/SCO/SCO-3.2v4.2-includes.tar.gz}.
You should unpack this file in the @file{include}
directory of your @strong{MySQL} source tree.
@end enumerate

SCO development notes:

@itemize @bullet
@item
@strong{MySQL} should automatically detect FSU Pthreads and link @code{mysqld}
with @code{-lgthreads -lsocket -lgthreads}.
@item
The SCO development libraries are reentrant in FSU Pthreads. SCO claims
that its libraries' functions are reentrant, so they must be reentrant with
FSU Pthreads. FSU Pthreads on OpenServer tries to use the SCO scheme to
make reentrant library.
@item
FSU Pthreads (at least the version at @code{www.mysql.com}) comes linked with
GNU @code{malloc}.  If you encounter problems with memory usage, make sure that
@file{gmalloc.o}
is included in @file{libgthreads.a} and @file{libgthreads.so}.
@item
In FSU Pthreads, the following system calls are pthreads-aware: @code{read()},
@code{write()}, @code{getmsg()}, @code{connect()}, @code{accept()},
@code{select()} and @code{wait()}.
@end itemize

If you want to install DBI on SCO, you have to edit the @file{Makefiles} in
DBI-xxx and each subdirectory:

@example
OLD:                                  NEW:
CC = cc                               CC = gcc -belf
CCCDLFLAGS = -KPIC -W1,-Bexport       CCCDLFLAGS = -fpic
CCDLFLAGS = -wl,-Bexport              CCDLFLAGS =

LD = ld                               LD = gcc -belf -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 -belf -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
@end example

This is because the Perl dynaloader will not load the @code{DBI} modules
if they were compiled with @code{icc} or @code{cc}.

Perl works best when compiled with @code{cc}.

@node SCO Unixware, IBM-AIX, SCO, Source install system issues
@subsection SCO Unixware 7.0 notes

You must use a version of @strong{MySQL} at least as recent as 3.22.13, because
that version fixes some portability problems under Unixware.

We have been able to compile @strong{MySQL} with the following @code{configure}
command on UnixWare 7.0.1:

@example
shell> CC=cc CXX=CC ./configure --prefix=/usr/local/mysql
@end example

If you want to use @code{gcc}, you must use @code{gcc} 2.95.2 or newer.

@node IBM-AIX, HP-UX 10.20, SCO Unixware, Source install system issues
@subsection IBM-AIX notes

Automatic detection of @code{xlC} is missing from Autoconf, so a
@code{configure} command something like this is needed when using the IBM
compiler:

@example
shell> CC="xlc_r -ma -O3 -qstrict -DHAVE_INT_8_16_32" \
       CXX="xlC_r -ma -O3 -qstrict -DHAVE_INT_8_16_32" \
       ./configure
@end example

If you change the @code{-O3} to @code{-O2} in the above configure line,
you must also remove the @code{-qstrict} option (this is a limitation in
the IBM C compiler).

If you are using @code{gcc} or @code{egcs} to compile @strong{MySQL}, you
@strong{MUST} use the @code{-fno-exceptions} flag, as the exception
handling in @code{gcc}/@code{egcs} is not thread-safe!  (This is tested with
@code{egcs} 1.1.)  We recommend the following @code{configure} line with
@code{egcs} and @code{gcc} on AIX:

@example
shell> CXX=gcc \
       CXXFLAGS="-felide-constructors -fno-exceptions -fno-rtti" \
       ./configure --prefix=/home/monty --with-debug --with-low-memory
@end example

If you have problems with signals (@strong{MySQL} dies unexpectedly
under high load) you may have found an OS bug with threads and
signals. In this case you can tell @strong{MySQL} not to use signals by
configuring with:

@example
shell> CFLAGS=-DDONT_USE_THR_ALARM CXX=gcc \
       CXXFLAGS="-felide-constructors -fno-exceptions -fno-rtti -DDONT_USE_THR_ALARM" \
       ./configure --prefix=/home/monty --with-debug --with-low-memory
@end example

This doesn't affect the performance of @strong{MySQL}, but has the side
effect that you can't kill clients that are ``sleeping'' on a connection with
@code{mysqladmin kill} or @code{mysqladmin shutdown}.  Instead, the client
will die when it issues its next command.

On some versions of AIX, linking with @code{libbind.a} makes @code{getservbyname} core
dump. This is an AIX bug and should be reported to IBM.


@node HP-UX 10.20, HP-UX 11.x, IBM-AIX, Source install system issues
@subsection HP-UX 10.20 notes

There are a couple of ``small'' problems when compiling @strong{MySQL} on
HP-UX.  We recommend that you use @code{gcc} instead of the HP-UX native
compiler, because @code{gcc} produces better code!

We recommend one to use gcc 2.95 on HP-UX.  Don't use high optimization
flags (like -O6) as this may not be safe on HP-UX.

Note that MIT-pthreads can't be compiled with the HP-UX compiler,
because it can't compile @code{.S} (assembler) files.

The following configure line should work:

@example
CFLAGS="-DHPUX -I/opt/dce/include" CXXFLAGS="-DHPUX -I/opt/dce/include -felide-constructors -fno-exceptions -fno-rtti" CXX=gcc ./configure --with-pthread --with-named-thread-libs='-ldce' --prefix=/usr/local/mysql --disable-shared
@end example

If you are compiling @code{gcc} 2.95 yourself, you should NOT link it with
the DCE libraries (@code{libdce.a} or @code{libcma.a}) if you want to compile
@strong{MySQL} with MIT-pthreads.  If you mix the DCE and MIT-pthreads
packages you will get a @code{mysqld} to which you cannot connect.  Remove
the DCE libraries while you compile @code{gcc} 2.95!

@node HP-UX 11.x, MaxOSX, HP-UX 10.20, Source install system issues
@subsection HP-UX 11.x notes

For HPUX 11.x we recommend @strong{MySQL} 3.23.15 or later.

If you are using @code{gcc} 2.95.1 on a unpatched HPUX 11.x system you will
get the error:

@example
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 `int pthread_atfork(void (*)(...), void (*)
(...), void (*)(...))' conflicts with
/usr/include/sys/pthread.h:440: previous declaration `int pthread_atfork(void (*)(), void (*)(), void (*)())' here
In file included from item.h:306,
                 from mysql_priv.h:158,
                 from item.cc:19:
@end example

The problem is that HP-UX doesn't define @code{pthreads_atfork()} consistently.
It has conflicting prototypes in
@file{/usr/include/sys/unistd.h}:184 and
@file{/usr/include/sys/pthread.h}:440 (I post the details below).

One solution is to copy @file{/usr/include/sys/unistd.h} into
@file{mysql/include} and edit @file{unistd.h} and change it to match
the definition in @file{pthread.h}.  Here's the diff:

@example
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));
@end example

After this, the following configure line should work:

@example
CFLAGS="-fomit-frame-pointer -O6 -fpic" CXX=gcc CXXFLAGS="-felide-constructors -fno-exceptions -fno-rtti -O6" ./configure --prefix=/usr/local/mysql --disable-shared
@end example

Here is some information that a HPUX 11.x user sent us about compile
@strong{MySQL} with HPUX:x compiler

@itemize @bullet
@item
@example
 Environment:
      proper compilers.
         setenv CC cc
         setenv CXX aCC
      flags
         setenv CFLAGS -D_REENTRANT
         setenv CXXFLAGS -D_REENTRANT
         setenv CPPFLAGS -D_REENTRANT
     % aCC -V
     aCC: HP ANSI C++ B3910B X.03.14.06
     % cc -V /tmp/empty.c
     cpp.ansi: HP92453-01 A.11.02.00 HP C Preprocessor (ANSI)
     ccom: HP92453-01 A.11.01.00 HP C Compiler
     cc: "/tmp/empty.c", line 1: warning 501: Empty source file.
@end example
@item
@example
  configuration:
     ./configure  --with-pthread        \
     --prefix=/source-control/mysql     \
     --with-named-thread-libs=-lpthread \
     --with-low-memory
@end example
@item
    added '#define _CTYPE_INCLUDED' to include/m_ctype.h. This
    symbol is the one defined in HP's /usr/include/ctype.h:

@example
     /* Don't include std ctype.h when this is included */
     #define _CTYPE_H
     #define __CTYPE_INCLUDED
     #define _CTYPE_INCLUDED
     #define _CTYPE_USING   /* Don't put names in global namespace. */
@end example
@item
I had to use the compile-time flag @code{-D_REENTRANT} to get the
compiler to recognize the prototype for
@code{localtime_r}. Alternatively I could have supplied the prototype
for @code{localtime_r}. But I wanted to catch other bugs without needing
to run into them. I wasn't sure where I needed it so I added it to all
flags.
@item
The optimization flags used by @strong{MySQL} (-O3) are not recognized
by HP's compilers. I did not change the flags.
@end itemize

@node MaxOSX,  , HP-UX 11.x, Source install system issues
@subsection MacOS X notes

You can get @strong{MySQL} to work on MacOS X by following the links to
the MacOS X ports. @xref{Useful Links}.

@strong{MySQL} 3.23.7 should include all patches necessary to configure
it on MacOSX. You must however first install the pthread package from
@uref{http://www.prnet.de/RegEx/mysql.html,MySql for MacOSX Server} 
before configuring MySQL.

You might want to also add aliases to your shell's resource file to
access @code{mysql} and @code{mysqladmin} from the command line.

@example
alias mysql '/usr/local/mysql/bin/mysql'
alias mysqladmin '/usr/local/mysql/libexec/mysqladmin'
@end example

@node Win32, OS/2, Source install system issues, Installing
@section Win32 notes

������Ǥ� Win32 ��Ǥ� @strong{MySQL} �λ��Ѥȥ��󥹥ȡ���ˤĤ��ƽҤ٤ޤ���
����� @strong{MySQL} Win32 ����ʪ�� @file{README} �ե�����ˤ�Ҥ٤��Ƥ��ޤ���

@menu
* Win32 installation::          Installing @strong{MySQL} on Win32
* Win95 start::                 Starting @strong{MySQL} on Win95 / Win98
* NT start::                    Starting @strong{MySQL} on NT
* Win32 running::               Running @strong{MySQL} on Win32
* Win32 and SSH::               Connecting to a remote @strong{MySQL} from Win32 with SSH
* Win32 symbolic links::        Splitting data across different disks under Win32
* Win32 vs. Unix::              @strong{MySQL}-Win32 compared to Unix @strong{MySQL}
@end menu

@node Win32 installation, Win95 start, Win32, Win32
@subsection Win32 �ؤ� @strong{MySQL} �Υ��󥹥ȡ���

�⤷������ @strong{MySQL} ����äƤ��ʤ��ʤ顢�ǽ�˰ʲ�����
�������������С����������������ɤ��٤��Ǥ���

@uref{http://www.mysql.com/mysql_w32.htmy,@strong{MySQL} 3.22.x}

���ܸ��Ǥ�ɾ���ǡ������������(3.22)�μ����ϰʲ��ˤʤ�ޤ���
@uref{http://www.softagency.co.jp/, @strong{MySQL} ���ܸ���}

�⤷¾�Υץ�����फ�� @strong{MySQL} ����³���褦�ȹͤ��Ƥ���ʤ顢
¿ʬ @strong{MyODBC} �ɥ饤�С���ɬ�פǤ��礦�� �����
@uref{http://www.mysql.com/ownload_myodbc.html,@strong{MySQL} download page}.
�ˤ���ޤ���

���ܸ��Ǥ� @strong{MyODBC} �ɥ饤�С� �ϡ�
@uref{http://www.softagency.co.jp/,@strong{MyODBC} ���ܸ���}

���줾�������ʪ�Υ��󥹥ȡ���򤹤�ˤϡ�����������ɤ���ʪ��
�ɤ��� ����Υǥ��쥯�ȥ�� unzip ����@code{Setup.exe} �ץ�������
�¹Ԥ��ޤ���

ɸ��Ǥϡ�@strong{MySQL}-Win32 �� @file{C:\mysql} �˥��󥹥ȡ��뤵���褦��
�ʤäƤ��ޤ��� �⤷�㤦���� @strong{MySQL} �򥤥󥹥ȡ��뤷�����ʤ顢
���� @file{C:\mysql} �˥��󥹥ȡ��뤷����ˡ����Υե�������ư���ޤ���
 @strong{MySQL} �� @file{C:\mysql} �����ư�����ʤ�С�
 @code{mysqld} ���Ф��ơ���ư���ɬ�������ͤФʤ�ޤ���
�⤷ @strong{MySQL} �� @file{D:\programs\mysql} �˰�ư�����ʤ�,
@code{mysqld} ��ʲ��Τ褦�ˤ��Ƶ�ư���ޤ���
@code{D:\programs\mysql\bin\mysqld --basedir D:\programs\mysql}
�ʤ��� @code{C:\mysql\bin\mysqld --help} �Ȥ���ȡ����ƤΥ��ץ����ɽ������ޤ���

�����Ǥ� @strong{MySQL} �Ǥϡ�@file{C:\my.cnf} �ե�������������
������ @strong{MySQL} �����С��Υ��ץ����򵭽Ҥ��뤳�Ȥ���ǽ�Ǥ���
@file{\mysql\my-xxxxx.cnf} �� @file{C:\my.cnf} �˥��ԡ�����
����ʬ�δĶ��˹�碌���Խ����ƻ��Ѥ��Ƥ���������
���ƤΥѥ��ˤ� @code{\} �ǤϤʤ��� @code{/} ����Ѥ��ʤ��ƤϤʤ�ޤ���
�⤷ @code{\} ����Ѥ�����ˤϡ�������ܤ��ޤ��� @strong{MySQL} �Ǥ�
 @code{\} �ϥ���������ʸ��������Ǥ���
@xref{Option files}.


@node Win95 start, NT start, Win32 installation, Win32
@subsection Win95 / Win98 ��Ǥ� @strong{MySQL} ��ư

@strong{MySQL} �� TCP/IP �򥯥饤����Ȥ��饵���С��ؤ���³�˻��Ѥ��ޤ���
�ʤ���ϡ����ʤ��Υͥåȥ����Τ����ʤ�ޥ��󤫤�� @strong{MySQL} �����С���
��³�Ǥ���Ǥ��礦�ˡ� ���Τ��ᡢ@strong{MySQL} ��ư�������ˡ�
���ʤ��� TCP/IP �򥤥󥹥ȡ��뤷�ʤ��ƤϤʤ�ޤ���
����� Windows CD-ROM �ˤ���ޤ���

�⤷�Ť� Win95 (for example OSR2) ����Ѥ��Ƥ���ʤ顢
����ϸŤ� Winsock �ѥå���������Ѥ��Ƥ��뤫�⤷��ޤ���
@strong{MySQL} �� Winsock 2 ���׵ᤷ�ޤ��� �ǿ��� Winsock ��
@uref{http://www.microsoft.com,Microsoft} �ˤ���ޤ���
 Win98 �ϥǥե���Ȥǿ����� Winsock 2 �饤�֥��Ǥ��Τǡ�
����� Win98 �ˤ����ƤϤޤ�ޤ���

2�Ĥΰ㤦 @strong{MySQL} �����С�������ޤ���

@multitable @columnfractions .15 .85
@item @code{mysqld} @tab �ե�ǥХå���ͭ���ˤ��ơ���ư memory allocation ������å�����褦�˥���ѥ���
@item @code{mysqld-opt} @tab Pentium �ץ����å����Ѥ˺�Ŭ������ʪ
@end multitable

ξ���Ȥ� Intel �ץ����å��� >= i386 ��ư��ޤ���

@code{mysqld} �����С���ư����ˤ�, MS-DOS ����ʲ��Τ褦�ˤ��ʤ��ƤϤʤ�ޤ���

@example
C:\mysql\bin\mysqld
@end example

����� @code{mysqld} ��Хå����饦��ɤ�ư�����ޤ���

@strong{MySQL} �����С��� kill �ˤϡ�

@example
C:\mysql\bin\mysqladmin -u root shutdown
@end example

Note that Win95/Win98 don't support creation of named pipes.  On
Win95/Win98, you can only use named pipes to connect to a remote
@strong{MySQL} running on an NT server.

If @code{mysqld} doesn't start please check whether or not the
@file{\mysql\mysql.err} file contains any reason for this.  You can also
try to start it with @code{mysqld --standalone};  In this case you may
get some useful information on the screen that may help solve this.

The last option is to start @code{mysqld} with @code{--debug}.  In this
case @code{mysqld} will write a log file in @file{\mysqld.trace}
that should contain the reason why @code{mysqld} doesn't start.  If you
make a bug report about this, please only send the lines where something
seams to go wrong to the mailing list!

@node NT start, Win32 running, Win95 start, Win32
@subsection NT ��Ǥ� @strong{MySQL} ��ư

The Win95/Win98 section also applies to @strong{MySQL} on NT, with the
following differences:

TCP/IP �� @strong{MySQL} ��ư�����ˤϡ�service pack 3(�ʾ�) ��ɬ�ܤǤ��� 

NT �Ǥ�, �����С���̾���� @code{mysqld-nt} �Ǥ�.  �̾�ʲ��Τ褦�ˤ���
 NT �Υ����ӥ��Ȥ��� @strong{MySQL} �򥤥󥹥ȡ��뤷�ʤ��ƤϤʤ�ޤ���

@example
C:\mysql\bin\mysqld-nt --install
@end example

(@code{mysqld} �� @code{mysqld-opt} �� NT ���ư����뤳�Ȥ����ޤ���
�����������ϡ������ӥ��Ȥ��ƥ������Ȥ����뤳�Ȥ����褺���ޤ���
named pipes �λ��Ѥ����ޤ���)

@strong{MySQL} �����ӥ��ε�ư����ߤϡ�

@example
NET START mysql
NET STOP mysql
@end example

���ξ�硢@code{mysqld} �ˡ������ʤ륪�ץ�������ѤǤ��ʤ����Ȥ����ա�

�⤷ @code{mysqld-nt} �򥪥ץ����̵���ǵ�ư����ɬ�פ�����ʤ�С�
 @code{mysqld-nt} �򥹥���ɥ�������Υץ������Ȥ��� NT ������餻�뤳�Ȥ�
����ޤ��� �⤷ @code{mysqld-nt} �򥪥ץ����̵���� NT ��ǵ�ư����ȡ�
 @code{mysqld-nt} �ϼ�ʬ���Ȥ򥵡��ӥ��Ȥ���Ω���夲�褦�Ȥ��ޤ���
�ǥե���ȤΥ����ӥ����ץ�������Ѥ��ơ�
 �⤷���� @code{mysqld-nt} ��ߤ�Ƥ����ʤ顢 @code{NET START mysql} ��
��ư���ʤ��ƤϤʤ�ޤ���

�����ӥ��� @code{MySql} �Ȥ���̾������Ͽ����ޤ��� ���٥��󥹥ȡ��뤷���顢
����� Services Control Manager (SCM) Utility (����ȥ�����ѥͥ�ˤ���)
����Ѥ��뤫��@code{NET START MySQL} ���ޥ�ɤ���Ѥ��뤫���ơ�
��ư����ʤ��ƤϤʤ�ޤ���
�⤷�����ץ���󤬤ʤˤ���ꤵ��Ƥ��ʤ��ʤ顢@code{MySQL} �����ӥ��������ˡ�
SCM Utility �� "Startup parameters" �˵��Ҥ��ʤ��ƤϤʤ�ޤ���
��������� @code{mysqld-nt} �� @code{mysqladmin} �� SCM utility ��
@code{NET STOP MySQL} ���ޥ�ɤ���ߤǤ��ޤ���
�⤷ SCM ����Ѥ��� @code{mysqld-nt} ��ߤ���ʤ顢
 @code{mysqld shutdown normally} �ˤĤ��Ƥ��Ѥʥ�å��������Ǥޤ���
When run as a service, @code{mysqld-nt} has no access to a console and so no
messages can be seen.

NT �Ǥϰʲ��Υ��顼��å��������Ф뤫�⤷��ޤ���

@multitable @columnfractions .3 .7
@item Permission Denied @tab Means that it cannot find @code{mysqld-nt.exe}
@item Cannot Register   @tab Means that the path is incorrect
@end multitable

�⤷ @code{mysqld-nt} �򥵡��ӥ��Ȥ��ƥ��󥹥ȡ��뤹�����
���꤬ȯ��������硢�ե�ѥ��Ǽ¹Ԥ��ƤߤƤ���������

@example
C:\mysql\bin\mysqld-nt --install
@end example

�⤷�����ư��ʤ��褦�ʤ顢�쥸���ȥ���Υѥ���������� @code{mysqld-nt} ��
��ư�Ǥ���Ǥ��礦��

�����ӥ��Ȥ��� @code{mysqld-nt} ��ư�������ʤ��ʤ�ʲ��Τ褦�ˤ��ޤ���

@example
C:\mysql\bin\mysqld-nt --standalone
@end example

or

@example
C:\mysql\bin\mysqld --standalone --debug
@end example

�ǿ��ΥС������Ǥϡ��ǥХå��Υȥ졼���� @file{C:\mysqld.trace} �˽Ф��ޤ���

@node Win32 running, Win32 and SSH, NT start, Win32
@subsection Win32 ��� @strong{MySQL} ��¹�

@strong{MySQL}�����Ƥ� Win32 �ץ�åȥե������� TCP/IP �򥵥ݡ��Ȥ���
NT ��� named pipe �򥵥ݡ��Ȥ��ޤ���
�ǥե���Ȥϡ�NT ��ǥ����������³����Ȥ��˥͡���ɡ��ѥ��פ����Ѥ��졢
���Τۤ������Ƥξ��� TCP/IP �����Ѥ���ޤ���
 �ۥ���̾�ϤɤΥץ��ȥ������Ѥ��뤫����ޤ���

@multitable @columnfractions .3 .7
@strong{Host name} @tab @strong{protocol}
@item NULL (none) @tab  NT �ǤϺǽ�˥͡���ɡ��ѥ��פ��ߡ�ư���ʤ���� TCP/IP ����Ѥ��ޤ��� Win95/Win98 �Ǥ� TCP/IP ����Ѥ��ޤ���
@item . @tab �͡���ɡ��ѥ���
@item localhost @tab TCP/IP to current host
@item hostname  @tab TCP/IP
@end multitable

@strong{MySQL} ���饤����Ȥ� named pipes ����Ū�˻��Ѥ�����ˤϡ�
@code{--pipe} ���ץ�������ꤷ�ޤ��� �����ơ�@code{--socket} ���ץ�����
�ѥ��פ�̾������ꤷ�ޤ���

@strong{MySQL} ��ư���Ƥ��뤫�ɤ����ϡ��ʲ��Τ褦�ˤ��Ƴ�ǧ�Ǥ��ޤ���

@example
C:\mysql\bin\mysqlshow
C:\mysql\bin\mysqlshow -u root mysql
C:\mysql\bin\mysqladmin version status proc
C:\mysql\bin\mysql test
@end example

�⤷ Win95/Win98 ��� @code{mysqld} �ؤ���³���٤��褦�ʤ顢DNS �����꤫�⤷��ޤ���
���ξ�硢 @code{mysqld} �� @code{--skip-name-resolve} ���ץ�����
��ư����@strong{MySQL} ���ĥơ��֥�ˤϡ�@code{localhost} �� IP ���ɥ쥹����
���Ѥ��ޤ���
NT������� @code{mysqld-nt} @strong{MySQL} �����С����Ф��Ƥ���³����
 DNS ���򤱤뤿��ˡ� @code{--pipe} ��������ꤷ�ƥ͡���ɡ��ѥ��פ�
���ѤǤ��ޤ��� ����ϤۤȤ�ɤ� @strong{MySQL} ���饤����Ȥ�ư���ޤ���

2�Ĥ� @strong{MySQL} ���ޥ�ɥ饤��ġ��뤬����ޤ���
@multitable @columnfractions .15 .85
@item @code{mysql} @tab Compiled on native Win32, which offers very limited text
editing capabilities.
@item @code{mysqlc} @tab Compiled with the Cygnus GNU compiler and libraries, which offers @code{readline} editing.
@end multitable

�⤷ @code{mysqlc.exe} ����Ѥ������ʤ�, 
@file{C:\mysql\lib\cygwinb19.dll} �� @file{\windows\system} (���������ѥ�)
�˥��ԡ����ʤ��ƤϤʤ�ޤ���

Win32 �� @strong{MySQL} �ν���θ��¤ϡ�������������ƤΥ桼������
�Ф��ơ����ƤΥǡ����١��������Ƥθ��¤�Ϳ�����Ƥ��ޤ���
@strong{MySQL} ������ˤ��뤿��ˡ����ƤΥ桼�����˥ѥ���ɤ�
���ꤹ�٤��Ǥ����ޤ���@code{mysql.user} �ơ��֥뤫��
@code{Host='localhost'} �� @code{User=''} �ȤʤäƤ���쥳���ɤ�
������٤��Ǥ���

@code{root} �桼�����ˤ�ѥ���ɤ����ꤹ�٤��Ǥ���
(The following example starts by removing the anonymous user, that allows
anyone to access the 'test' database)

@example
C:\mysql\bin\mysql mysql
mysql> DELETE FROM user WHERE Host='localhost' AND User='';
mysql> QUIT
C:\mysql\bin\mysqladmin reload
C:\mysql\bin\mysqladmin -u root password your_password
@end example

�ѥ���ɤ����ꤷ���塢�⤷ @code{mysqld} �����С�����ߤ�����ʤ顢
�ʲ��Τ褦�ˤ��ޤ���

@example
mysqladmin --user=root --password=your_password shutdown
@end example 

If you are using the old shareware version of @strong{MySQL} 3.21 under
Windows, the above command will fail with an error: @code{parse error
near 'SET OPTION password'}.  This is because the old shareware version,
which is based on @strong{MySQL} 3.21, doesn't have the @code{SET PASSWORD}
command.  The fix is in this case is to upgrade to the 3.22 shareware
version.

With the newer @strong{MySQL} versions you can easily add new users
and change privileges with @code{GRANT} and @code{REVOKE} commands.
@xref{GRANT}.


@node Win32 and SSH, Win32 symbolic links, Win32 running, Win32
@subsection SSH �����Ѥ��ƥ�⡼�Ȥ� @strong{MySQL} �� Win32 ������³

SSH �����Ѥ��ơ�Win32 ���顢�ɤ���äƥ�⡼�Ȥ� MySQL ����³���뤫�������Ǥ���
(by David Carlson).

@itemize @bullet
@item
���ʤ��� windows �ޥ���� SSH ���饤����Ȥ򥤥󥹥ȡ��뤷�ޤ� - ��ϥե꡼�Ǥ�
SSH ���饤����Ȥ���Ѥ��ޤ����� @uref{http://www.doc.ic.ac.uk/~ci2/ssh/}.
¾��ͭ�פʾ���ϡ�
@uref{http://www.npaci.edu/Security/npaci_security_software.html} and
@uref{http://www.npaci.edu/Security/samples/ssh32_windows/index.html}.
@item
SSH ��ư�� Host Name �� ���ʤ��� MySQL �����С���̾���� IP ���ɥ쥹�˥��åȤ��ޤ���
userid �򡢤��ʤ��Υ����С��ؤΥ�������̾�˥��åȤ��ޤ���
@item
"local forwards" �򥯥�å��� @code{local port: 3306},
@code{host: localhost}, @code{remote port: 3306} �ˤ��줾�쥻�åȡ�
@item
������¸(Save)�� ��¸���Ƥ⼡����ľ�����Ǥ��ޤ���
@item
SSH �Ǥ��ʤ��Υ����С��˥�������
@item
�ʤˤ� ODBC ���ץꥱ�������(�㤨�� Access) ��ư��
@item
ODBC �ɥ饤�С������Ѥ��� MySQL �ؤο������ե�����ȥ�󥯤������
������̾�λ��Ⱥ�����ˡ���Ѥ��ʤ��Ǥ����������С��� "localhost" ��
���뤳�Ȥ��㤤�ޤ�
@end itemize

That's it. It works very well with a direct Internet connection. I'm
having problems with SSH conflicting with my Win95 network and Wingate -
but that'll be the topic of a posting on another software company's
usegroup!

@findex Symbolic links
@findex Using multiple disks to start data
@node Win32 symbolic links, Win32 vs. Unix, Win32 and SSH, Win32
@subsection Splitting data across different disks under Win32

On windows @strong{MySQL} 3.23.16 and above is compiled with the
@code{-DUSE_SYMDIR} option.  This allows you to put a database on
different disk by adding a symbolic link to it (in a similar manner that
symbolic links works on Unix).

On windows you make a symbolic link to a database by creating a file
that contains the path to the destination directory and saving this in
the @code{mysql_data} directory under the filename @code{database.sym}.
Note that the symbolic link will only be used if the directory
@code{mysql_data_dir\database} doesn't exist.

For example if you want to have database @code{foo} on @file{D:\data\foo} you
should create the file @file{C:\mysql\data\foo.sym} that should contains the
text @code{D:\data\foo}.  After this, all tables created in the database
@code{foo} will be created in @file{D:\data\foo}.

@node Win32 vs. Unix,  , Win32 symbolic links, Win32
@subsection @strong{MySQL}-Win32 compared to Unix @strong{MySQL}

@strong{MySQL}-Win32 �С������ϸ��ߤ��켫�ΤȤƤ���ꤷ��(stable��)���֤Ƕ��뤵��Ƥ��ޤ���
MySQL-win32 �С������� ���٤Ƥε�ǽ��UNIX�С�������MySQL���б����Ƥ��ޤ���
�������������Τ褦���㳰������ޤ���

@table @strong
@item Win95 �ȥ���å�
Win95�ϡ��ơ��Υ���åɤκ����Τ���˥ᥤ�����Τ��褽200�Х��Ȥ����꡼��
���ޤ�������Τ���ˡ��⤷���ʤ���¿������³�򤹤�С�@strong{MySQL} �γơ�����³��������
����åɤ��������Τǡ����ʤ���Win95�Ǥ�Ĺ���֡�@code{mysqld} ��¹Ԥ�����٤��ǤϤ���
�ޤ���
WinNT and Win98 don't suffer from this bug.

@item Concurrent reads
@strong{MySQL} depends on the @code{pread()} and @code{pwrite()} calls to be
able to mix @code{INSERT} and @code{SELECT}. As windows doesn't support these
calls, @strong{MySQL} can't currently handle concurrent reads on windows.
We plan to fix this by adding an extra mutex to each open file and simulate
@code{pread()}/@code{pwrite()}.

@item �֥��å��ɤ߹���
@strong{MySQL} �Ϥ��줾�����³�Τ���˥֥��å��ɤ߹��ߤ�Ȥ��ޤ���
����ϰʲ��λ������̣���Ƥ��ޤ���
@itemize @bullet

@item
��³�ϡ�@strong{MySQL} ��Unix�С������ǵ�����褦�ˡ�8���֤θ�˼�ưŪ����³����
���ڤ���櫓�ǤϤ���ޤ���

@item
�⤷��³���֥ϥ󥰤���Сס�@strong{MySQL}��λ���ʤ��Ǥ�������Ǥ��뤳�Ȥϡ��Բ�ǽ�Ǥ���

@item
@code{mysqladmin kill} �ϡ����꡼�פ��Ƥ�����³��Ǥ�Ư���ʤ��Ϥ��Ǥ���

@item
���꡼�פ��Ƥ�����³�����뤫���ꡢ@code{mysqladmin shutdown} �ϡ����䤹�뤳�Ȥ��Ǥ��ޤ���
@end itemize

�䤿���ϡ��ᤤ����ˤ���������뤳�Ȥ�ײ褷�Ƥ��ޤ���

@item UDF �ؿ�
�������ꡢ@strong{MySQL}-Win32 �ϥ桼��������Ǥ���ؿ��򥵥ݡ��Ȥ��ޤ���

@item @code{DROP DATABASE}
ʣ���Υ���åɤǻȤ��Ƥ���ǡ����١�����DROP�򤹤뤳�Ȥ��Ǥ��ޤ���

@item �������ޥ͡����㡼����� @strong{MySQL} �ν�λ
Windows95�Ǥϡ�Windows�ν�λ�פ䥿�����ޥ͡����㤫�� @strong{MySQL} ��λ���뤳�ȤϤǤ��ޤ���
@code{mysqladmin shutdown} �ǽ�λ���ʤ���Фʤ�ޤ���

@item ��ʸ����ʸ������̤��ʤ�̾��
Win32�Ǥϥե�����͡������ʸ����ʸ�������̤���ޤ������Τ��ᡢWin32�Ѥ� @strong{MySQL} ��
�ϥơ��֥�̾����ʸ����ʸ�������̤���ޤ���ͣ������¤ϡ�̾��������Υ��ơ��ȥ��
�Ȥλ����Ʊ����������Ϳ�����ʤ���Фʤ�ʤ����Υǡ����١�����ɽ�Ǥ���
���Τ褦�ʥ����꡼��Ư���ޤ��󡣤��줬ɽ�� @code{MY_TABLE}, @code{my_table} ξ���򻲾Ȥ��뤫���
����

@example
SELECT * FROM my_table WHERE MY_TABLE.col=1;
@end example

@item The @samp{\} (�ǥ��쥯�ȥ�̾)
Win95�Υѥ�̾����ݡ��ͥ�Ȥϡ� @samp{\} �ˤ�ä�Υ����ޤ���������ʸ����Ʊ���� @strong{MySQL} �Υ�
��������ʸ���Ǥ⤢��ޤ����⤷���ʤ��� @code{LOAD DATA INFILE} �ޤ��� @code{SELECT ... INTO OUTFILE} ��Ȥäơ�UNIX�ǤΥե�����͡���� @samp{/} ��񤯤褦�ˤ������ʤ顢���������
��\\�פ� @samp{\} ����֥�ǻȤ�ʤ��ƤϤʤ�ޤ���

@example
LOAD DATA INFILE "C:\\tmp\\skr.txt" INTO TABLE skr;
SELECT * FROM skr INTO OUTFILE 'C:/tmp/skr.txt';
@end example

@item @code{Can't open named pipe} ���顼
�⤷���ʤ����ǿ��� mysql-clients �����NT�ξ�� @strong{MySQL}-Win32 �Υ������������С������
��Ȥ��С����ʤ��ϡ����Υ��顼�����뤳�Ȥˤʤ�Ϥ��Ǥ�:

@example
error 2017: can't open named pipe to host: . pipe...
@end example

@tindex .my.cnf file
����ϡ� @strong{MySQL} �Υ�꡼���С�����󤬥ǥե���Ȥ�NT�ξ�˥͡���ɥѥ��פ�ȤäƤ�
�뤿��˵����äƤ��ޤ���
���ʤ��Ͽ����� @strong{MySQL} ���饤����Ȥˤޤ��� @file{C:\my.cnf} �ե�������뤵��(���Υե���
��ϰʲ��ξ����ޤߤޤ�)�� @code{--host=localhost} ���ץ�����Ȥ����Ȥˤ�äƤ��Υ�
�顼���򤱤��ޤ���

@example
[client]
host = localhost
@end example

@item @code{Access denied for user} error
�⤷���ʤ���Ʊ���ޥ����� @strong{MySQL} �����С��˥�������������
@code{Access denied for user: 'some-user@@unknown' to database 'mysql'}
 ���顼������ʤ顢����Ϥ��ʤ��� @strong{MySQL} �����ʤ�
�Υޥ���Υۥ���̾�����������Ǥ��Ƥʤ����Ȥ��̣���ޤ���

�����������ˤϤ���
���ϥե����� @file{\windows\hosts} ���ꡢ�ʲ��ξ����񤯤��Ȥˤ�äƤ��٤��Ǥ���
(��:Windows95,98�ˤ�\Windows�ե������˥���ץ�Ȥ��ơ�lmhosts.sam�ץե����뤬
���ˤ���Ϥ��Ǥ�)

@example
127.0.0.1       localhost
@end example
@end table

�����ˤ�Win32��꡼��������Ƥ����ï���Τ���ˤ����Ĥ������ץ�ˤʤäƤ�������
������ޤ�:

@itemize @bullet
@item
Make a single user @code{MYSQL.DLL} server.  This should include everything in
a standard @strong{MySQL} server, except thread creation.  This will make
@strong{MySQL} much easier to use in applications that don't need a true
client/server and don't need to access the server from other hosts.

@item
Add some nice ``start'' and ``shutdown'' icons to the @strong{MySQL} installation.
@file{MySQL.DLL}.

@item
Create a tool to manage registry entries for the @strong{MySQL} startup
options.  The registry entry reading is already coded into @code{mysqld.cc},
but it should be recoded to be more ``parameter'' oriented.
The tool should also be able to update the @file{\my.cnf} file if the user
would prefer to use this instead of the registry.

@item
NT��� @code{mysqld} �򥵡��ӥ��Ȥ��� @code{--install} �ե饰����Ͽ����Ȥ����⤷���ʤ������ޥ�ɥ�
����ξ�ǥǥե���ȤΥ��ץ�����Ʊ�����ä��뤳�Ȥ��Ǥ���С�����ϡ��ɤ�����
������������Ϻ��������äơ� @file{C:\my.cnf} �ե����������ˤ��뤳�Ȥ����Ѥ��Ƥ���
����

@item
���ʤ�����åץȥåפ�����Win95�����Ǥ���ȡ���åץȥåפΥ쥸�塼�व������
 @code{mysqld} �ǡ����Ͽ�������³���������ޤ��󡣻䤿���ϡ����줬Win95��TCP/IP���ޤ�
�ϡ� @strong{MySQL} ����������Ǥ��뤫�ɤ����狼��ޤ���

@item
�ޤ����������ޥ͡����㤫�� @code{mysqld} ��λ�����뤳�Ȥ��Ǥ���Фۤ�Ȥ��˿��ڤǤ��礦��
���ΤȤ��������ʤ��� @code{mysqladmin shutdown} ��Ȥ�ʤ���Фʤ�ޤ���

@item
@code{mysql} �Υ��ޥ�ɥ饤��ġ���Ȥ��� @code{readline} ��Win32�˰ܿ����ޤ��󤫡�

@item
ɸ��� @strong{MySQL} ���饤�����(@code{mysql}��@code{mysqlshow}��@code{mysqladmin}������ӡ�@code{mysqldump})��GUI
�С�����󤬤���Ф����Ǥ��礦�ͤ���

@item
�⤷ @file{net.c} �Υ����åȤء��ɤ߹��ߡפȡֽ񤭹��ߡפ�interruptible�ʤ�С�����Ϥ�
���ΤǤ��������줬�Ǥ����Win32��� @code{mysqladmin kill} ����Ѥ��Ƴ����줿����åɤ�
λ�Ǥ���ΤǤ�����

@item
@strong{MySQL}-Win32/@strong{MyODBC} �ˤĤ��ƽ񤫤줿Windows�ץ�����ߥ󥰤Υɥ�����ȡĤ���餬
ư���Ƥ��뤳�Ȥ��ǧ�ѤߤǤ��뤳�ȡ�

@item
@code{mysqld} �ϥǥե���ȥ�������ǤϤʤ�����ˡ�C�ץ�������ǵ�ư���ޤ����䤿���ϡ�
�����Ƚ���Τ���ˡ� @code{mysqld} �ˡ����ߤΥ��������Ȥ碌������

@item
MysqlManager�ˤ�ä�¿���Υ��ץ�����

@item
���饤����Ȥȥ����С��Υ��ߥ�˥��������ץ��ȥ�����ѹ���sockets��TCP/IP����
����Windows�����Υ��ߥ�˥���������Ȥ�

@item
UDF �ؿ��� @code{.DLL} �Ǥμ���

@item
Add macros to use the faster thread-safe increment/decrement methods
provided by Win32.

@end itemize

¾��win32�˸��ꤵ�줿�ɾ��� @strong{MySQL}-Win32 �ǥ����ȥ�ӥ塼������Ʊ������Ƥ���
 @file{README} �ե��������������Ƥ��ޤ���


@node OS/2, TcX binaries, Win32, Installing
@section OS/2 notes

@strong{MySQL} uses quite a few open files. Because of this, you
should add something like the following to your @file{CONFIG.SYS} file:

@example
SET EMXOPT=-c -n -h1024
@end example

If you don't do this, you will probably run into the following error:

@example
File 'xxxx' not found (Errcode: 24)
@end example

When using @strong{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.  @strong{MySQL} must be installed
in a partition that supports long file names such as HPFS, FAT32, etc.

The @file{INSTALL.CMD} script must be run from OS/2's own @file{CMD.EXE}
and may not work with replacement shells such as @file{4OS2.EXE}.

The @file{scripts/mysql-install-db} script has been renamed: it is now called
@file{install.cmd} and is a REXX script which will set up the default
@strong{MySQL} security settings and create the WorkPlace Shell icons
for @strong{MySQL}.

Dynamic module support is compiled in but not fully tested. Dynamic
modules should be compiled using the Pthreads runtime library.

@example
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
@end example

@strong{Note:} Due to limitations in OS/2, UDF module name stems must not
exceed 8 characters. Modules are stored in the @file{/mysql2/udf}
directory; the @code{safe-mysqld.cmd} script will put this directory in
the @code{BEGINLIBPATH} environment variable. When using UDF modules,
specified extensions are ignored --- it is assumed to be @file{.udf}.
For example, in Unix, the shared module might be named @file{example.so}
and you would load a function from it like this:

@example
CREATE FUNCTION metaphon RETURNS STRING SONAME "example.so";
@end example

Is OS/2, the module would be named @file{example.udf}, but you would not
specify the module extension:

@example
CREATE FUNCTION metaphon RETURNS STRING SONAME "example";
@end example


@node TcX binaries, Post-installation, OS/2, Installing
@section TcX binaries

�����ӥ��Ȥ��ơ�TcX �� @strong{MySQL} �ΥХ��ʥ����ۤ��󶡤��Ƥ��ޤ���
�����Υ���ѥ���� TcX �����Ǥ����ʤä��ꡢ�桹�˥ޥ����
�����������󶡤��Ƥ��äƤ���ܵҤΥޥ����ǹԤäƤ��ޤ���

����������ʪ�� @code{scripts/make_binary_distribution} �Ǻ������졢
�ʲ��Υ���ѥ��륪�ץ�����Ĵ������Ƥ��ޤ���

@table @asis
@item SunOS 4.1.4 2 sun4c with @code{gcc} 2.7.2.1
@code{CC=gcc CXX=gcc CXXFLAGS=-O3 ./configure --prefix=/usr/local/mysql --disable-shared}

@item SunOS 5.5.1 sun4u with @code{egcs} 1.0.3a
@code{CC=gcc CFLAGS="-O6 -fomit-frame-pointer" CXX=gcc CXXFLAGS="-O6 -fomit-frame-pointer -felide-constructors -fno-exceptions -fno-rtti" ./configure --prefix=/usr/local/mysql --with-low-memory}

@item SunOS 5.6 sun4u with @code{egcs} 2.90.27
@code{CC=gcc CFLAGS="-O6 -fomit-frame-pointer" CXX=gcc CXXFLAGS="-O6 -fomit-frame-pointer -felide-constructors -fno-exceptions -fno-rtti" ./configure --prefix=/usr/local/mysql --with-low-memory}

@item SunOS 5.6 i86pc with @code{gcc} 2.8.1
@code{CC=gcc CXX=gcc CXXFLAGS=-O3 ./configure --prefix=/usr/local/mysql --with-low-memory}

@item Linux 2.0.33 i386 with @code{pgcc} 2.90.29 (@code{egcs} 1.0.3a)
@code{CFLAGS="-O6 -mpentium -mstack-align-double -fomit-frame-pointer" CXX=gcc CXXFLAGS="-O6 -mpentium -mstack-align-double -fomit-frame-pointer -felide-constructors -fno-exceptions -fno-rtti" ./configure --prefix=/usr/local/mysql --enable-assembler --with-mysqld-ldflags=-all-static}

@item SCO 3.2v5.0.4 i386 with @code{gcc} 2.7-95q4
@code{CC=gcc CXX=gcc CXXFLAGS=-O3 ./configure --prefix=/usr/local/mysql}

@item AIX 2 4 with @code{gcc} 2.7.2.2
@code{CC=gcc CXX=gcc CXXFLAGS=-O3 ./configure --prefix=/usr/local/mysql}

@item OSF1 V4.0 564 alpha with @code{gcc} 2.8.1
@code{CC=gcc CFLAGS=-O CXX=gcc CXXFLAGS=-O3 ./configure --prefix=/usr/local/mysql --with-low-memory}

@item Irix 6.3 IP32 with @code{gcc} 2.8.0
@code{CC=gcc CXX=gcc CXXFLAGS=-O3 ./configure --prefix=/usr/local/mysql}

@item BSDI BSD/OS 3.1 i386 with @code{gcc} 2.7.2.1
@code{CC=gcc CXX=gcc CXXFLAGS=-O ./configure --prefix=/usr/local/mysql}

@item BSDI BSD/OS 2.1 i386 with @code{gcc} 2.7.2
@code{CC=gcc CXX=gcc CXXFLAGS=-O3 ./configure --prefix=/usr/local/mysql}
@end table

��Ǽ��������ץ����ʳ��Ǻ�Ŭ����ܤ������Ϥ���Ǥ⡢��ȯ�Ը�����
�᡼��󥰥ꥹ�Ȥ˥ݥ��ȤǤ��ޤ���
@email{developer@@lists.mysql.com}.

RPM ���ۤǤ� @strong{MySQL} 3.22 �� user-contributed �Ȥ��Ƥ��ޤ���
3.22 ��Ϥ��ᡢ�����Ĥ��� RPM �ѥå������� TcX ���Ǥ���


@node Post-installation, Upgrade, TcX binaries, Installing
@section ���󥹥ȡ���������ȥƥ���

@menu
* mysql_install_db::            Problems running @code{mysql_install_db}
* Starting server::             Problems starting the @strong{MySQL} server
* Automatic start::             Starting and stopping @strong{MySQL} automatically
* Option files::                Option files
@end menu

���� @strong{MySQL}�򥤥󥹥ȡ��뤷����(�Х��ʥ꤫��Ǥ⥽��������Ǥ�Ǥ���)��
�����С���ư����뤿��ˡ����ĥơ��֥���������ʤ��ƤϤʤ�ޤ���
�ޤ��ޥ���ε�ư������߻��ˡ������С���ư�dz��ϡ���ߤ��뤳�Ȥ�Ǥ��ޤ���

�̾���ĥơ��֥�Υ��󥹥ȡ���ȥ����С��γ��Ϥϡ�
�������ǥ����ȥ�ӥ塼�����ʤ�ʲ��Τ褦�ˤ��ޤ���

@example
shell> ./scripts/mysql_install_db
shell> cd mysql_installation_directory
shell> ./bin/safe_mysqld &
@end example

�Х��ʥ�ǥ����ȥ�ӥ塼�����Ǥϼ���Ԥʤ��ޤ�:

@example
shell> cd mysql_installation_directory
shell> ./bin/mysql_install_db
shell> ./bin/safe_mysqld &
@end example

�ƥ��Ȥϡ�@strong{MySQL} �Υȥåץǥ��쥯�ȥ꡼�����ñ�˼¹ԤǤ��ޤ���
�Х��ʥ����ۤ���Ѥ����硢����(�ȥåץǥ��쥯�ȥ�)��
���󥹥ȡ�����Υǥ��쥯�ȥ꡼�ˤʤ�Ǥ��礦(@file{/usr/local/mysql})��
���������ۤξ�硢����� @strong{MySQL} �Υ������ǥ��쥯�ȥ�Ǥ���

���ޥ�ɤ�����Ȥ�����³������������ޤ�����@code{BINDIR} ��
@code{mysqladmin} �� @code{safe_mysqld} �����󥹥ȡ��뤵�줿�ǥ��쥯�ȥ�򼨤��ޤ���
�Х��ʥ����ۤ���Ѥ��Ƥ����硢@code{BINDIR} �ϥХ��ʥ����ۤ� @file{bin} �ǥ��쥯�ȥ�ˤʤ�ޤ���
���������饤�󥹥ȡ��뤷����硢@code{BINDIR} �ϡ�@code{configure} �����̻��ꤷ�ʤ��¤ꡢ
@file{/usr/local/bin} �Ǥ���
@code{EXECDIR} �� @code{mysqld} �����С��Υ��󥹥ȡ�����Ǥ���
�Х��ʥ����ۤ���Ѥ��Ƥ����硢����� @code{BINDIR} �ǥ��쥯�ȥ��Ʊ��ˤʤ�ޤ���
���������饤�󥹥ȡ��뤷����硢@file{/usr/local/libexec} �Ǥ���

�ƥ��ȤˤĤ��ưʲ��˾ܺ٤��������ޤ�:

@enumerate
@item
ɬ�פʤ�С�@code{mysqld} �����С���ư�� @strong{MySQL} �ε��ĥơ��֥���������ޤ���
(���ĥơ��֥�ϥ桼�������ɤΤ褦�ʸ��¤��äƥ����С�����³�����������ꤹ���ΤǤ���)
������̾@code{mysql_install_db} ������ץȤǽ��������ޤ���

@example
shell> scripts/mysql_install_db
@end example

�̾@code{mysql_install_db} �μ¹ԤϽ��� @strong{MySQL} �򥤥󥹥ȡ���
�������Ȱ��٤���ɬ�פǤ���  ���Ǥ˥��󥹥ȡ��뤵��Ƥ����Τ�
���åץ��졼�ɤ���ݤˤϤ��μ������Ф��ޤ���
�ʤ�������@code{mysql_install_db} �ϼ¤˰����ǡ����Ǥ˥ơ��֥뤬
¸�ߤ��Ƥ�����Ϥ����ʤ�ơ��֥�⹹�����ޤ��󡣤������äơ�
�¹Ԥ��٤����ɤ����狼��ʤ����ϡ�@code{mysql_install_db} ����
���餻�뤳�Ȥ��Ǥ��ޤ���

@code{mysql_install_db} �� 6�ĤΥơ��֥����ޤ� (@code{user}, @code{db},
@code{host}, @code{tables_priv}, @code{columns_priv} and @code{func})
@code{mysql} �ǡ����١����ˡ� ����θ��¾��֤ˤĤ��Ƥ�������
@ref{Default privileges}.  �����θ��¤� @strong{MySQL} @code{root} �桼������
�ʤ�Ǥ�Ǥ���褦�˵��Ĥ��������ơ�����⤬
@code{'test'} �Ȥ���̾���� @code{'test_'} �ǤϤ��ޤ�̾������
�ǡ����١�������������ѤǤ���褦�˵��Ĥ���Ƥ��ޤ���

�⤷���ĥơ��֥�����ꤷ�Ƥ��ʤ���硢�����С���ư���˰ʲ��Υ��顼���Фޤ���

@tindex host.frm, problems finding
@example
mysqld: Can't find file: 'host.frm'
@end example

�Х��ʥ����ۤ� @strong{MySQL} �Ǥϡ��⤷ @strong{MySQL} ��
 @code{./bin/safe_mysqld} ��¹Ԥ��ʤ��ǵ�ư�������ˡ����Υ��顼�������ޤ���!

@code{root} �� @code{mysql_install_db} ��¹Ԥ���ɬ�פ�����Ȥ��ʤ��ϻפ����⤷��ޤ���
�������� @strong{MySQL} �� @code{root} �ʳ��Υ桼�����ǵ�ư�Ǥ��ޤ���
�ǡ����١����ǥ��쥯�ȥ꤬�����С���ư�����桼�����Ф����ɤ߽񤭤����Ĥ���Ƥ�����ɤ��ΤǤ���
@strong{MySQL} ����̥桼���������餻����ˡ�� @ref{Changing MySQL user, , Changing
@strong{MySQL} user}.

�⤷ @code{mysql_install_db} �����꤬�Ф��顢
@ref{mysql_install_db, , @code{mysql_install_db}}. �򻲾ȤΤ��ȡ�

@code{mysql_install_db} ������ץȤ����餻��ˤϤ����Ĥ����򤬤���ޤ���

@itemize @bullet
@item
@code{mysql_install_db} �����餻�������Խ����ơ����Ĥν�����֤��ѹ����Ƥ⤤���Ǥ��礦��
�����¿���Υޥ����Ʊ����������򤷤� @strong{MySQL} �򥤥󥹥ȡ��뤹��ݤ�
��Ω���ޤ��� ���ξ�硢�����Ĥ��� @code{INSERT} ��ʸ�� @code{mysql.user} ��
@code{mysql.db} �ơ��֥�ˤ��������ɲä���褦�ˤ�������Ǥ��ߤޤ�!

@item
�⤷���󥹥ȡ����˵��Ĥ��ѹ���������硢 @code{mysql -u root mysql} �� @strong{MySQL} @code{root} �桼��������³����ľ�ܵ��ĥơ��֥���ѹ����� SQL ʸ��¹Ԥ��ޤ���

@item
���Ǥ˵��ĥơ��֥뤬�������줿���֤ǡ������˵��ĥơ��֥�������ľ�����Ȥ��Ǥ��ޤ���
����Ϥ��Ǥ˥��󥹥ȡ��뤵�줿�ơ��֥뤬������䡢@code{mysql_install_db} ���Խ�������ˤ����פ����⤷��ޤ���
@end itemize

����������ˤĤ��Ƥ� @ref{Default privileges} ���餵��˾��������ޤ���

@item
@strong{MySQL} �����С���ʲ��Τ褦�ˤ��Ƶ�ư���ޤ���
@example
shell> cd mysql_installation_directory
shell> bin/safe_mysqld &
@end example
�����Фε�ư�����꤬����С�@ref{Starting server} �򸫤Ƥ���������

@item
@code{mysqladmin} �ǥ����С������äƤ��뤫��ǧ���ޤ���
�����С���Ω���夬����³������դ��뤫��ǧ�����ñ����ˡ��ʲ��˼����ޤ���

@example
shell> BINDIR/mysqladmin version
shell> BINDIR/mysqladmin variables
@end example

�㤨�С�@code{mysqladmin version} �ν��ϤϤ��ʤ��Υץ�åȥե������
 @strong{MySQL} �ΥС���������Ϥ��ޤ���
���Ϥϰʲ����ͤˤǤޤ���

@example
shell> BINDIR/mysqladmin version
mysqladmin  Ver 6.3 Distrib 3.22.9-beta, for pc-linux-gnu on i686
TCX Datakonsult AB, by Monty

Server version          3.22.9-beta
Protocol version        10
Connection              Localhost via UNIX socket
TCP port                3306
UNIX socket             /tmp/mysql.sock
Uptime:                 16 sec

Running threads: 1  Questions: 20  Reloads: 2  Open tables: 3
@end example

@code{BINDIR/mysqladmin} �λ�����ˡ�ϡ�@code{--help} ���ץ����ǵ�ư���뤳�Ȥˤ�������ޤ���

@item
�����С��򥷥�åȥ����󤹤�ˤϡ�

@example
shell> BINDIR/mysqladmin -u root shutdown
@end example

@item
�����С���ꥹ�����Ȥ���ˤϡ�@code{safe_mysqld} �� @code{mysqld} ��ľ�ܼ¹Ԥ��ޤ���
�㤨�С�

@example
shell> BINDIR/safe_mysqld --log &
@end example

@code{safe_mysqld} �����Ԥ���ʤ顢 @strong{MySQL} �Υ��󥹥ȡ���ǥ��쥯�ȥ꡼����¹Ԥ��ƤߤƤ���������
�⤷����Ǥⵯư���ʤ��ʤ顢@ref{Starting server} �򻲾ȤΤ��ȡ�

@item
�����Ĥ��δ�ñ�ʥƥ��Ȥǥ����С���ư���Ƥ��뤫��ǧ�Ǥ��ޤ���
�ʲ��Τ褦�ˤʤ�ޤ���

@example
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_% |      |
+------+--------+------+
@end example

¾�Υץ�åȥե������ @strong{MySQL} �Υѥե����ޥ󥹤���Ӥ��뤿���
 @file{sql-bench} �˥٥���ޡ���������ޤ���
@file{sql-bench/Results} �ǥ��쥯�ȥ�ˤϡ�¾�Υǡ����١�����ץ�åȥե������
�٥����¹Ԥ�����̤�����ޤ���
���ƤΥƥ��Ȥ�¹Ԥ���ˤϡ��ʲ��Τ褦�ˤ��ޤ���

@example
shell> cd sql-bench
shell> run-all-tests
@end example

RPM �Х��ʥ����ۤˤ� @file{sql-bench} �ǥ��쥯�ȥ꤬����ޤ���
(RPM �Υ��������ۤˤϴޤޤ�ޤ�)
���ξ�硢�٥���ޡ����򥤥󥹥ȡ��뤷�ʤ��ƤϤʤ�ޤ���
@strong{MySQL} 3.22 �ΥХ��ʥ����ۤ��顢
@file{mysql-bench-VERSION-i386.rpm} �Ȥ���̾���� RPM �ѥå��������äƤ��ꡢ
����ˤϥ٥���ޡ����Υǡ����ȥ����ɤ��ޤޤ�ޤ���

@file{tests} ���֥ǥ��쥯�ȥ�ǥƥ��Ȥ��뤳�Ȥ��ǽ�Ǥ���
�㤨�С�@file{auto_increment.tst} �μ¹Ԥϰʲ��Τ褦�ˤ��ޤ���

@example
shell> BINDIR/mysql -vvf test < ./tests/auto_increment.tst
@end example

����η�̤� @file{./tests/auto_increment.res} �ե�����˽񤭽Ф���ޤ���
@end enumerate


@node mysql_install_db, Starting server, Post-installation, Post-installation
@subsection @code{mysql_install_db} �¹Ի�������

������Ǥ� @code{mysql_install_db} ��¹Ԥ����ݤˤǤ��魯���⤷��ʤ�����ˤĤ��ƽҤ٤ޤ���

@table @strong
@item @code{mysql_install_db} doesn't install the privilege tables

����� @code{mysql_install_db} �����¥ơ��֥�򥤥󥹥ȡ���Ǥ��ʤ��ä����Υ�å������Ǥ�����
³���ưʲ��Τ褦�˥�å��������Ф���硧

@example
starting mysqld daemon with databases from XXXXXX
mysql daemon ended
@end example

���ξ�硢���տ��� log �ե������Ĵ�٤Ƥ���������
���顼��å������˽ФƤ��� @file{XXXXXX} �ǥ��쥯�ȥ�˥����ե����뤬���ꡢ
����� @code{mysqld} ���ʤ��������Ȥ��ʤ��ä���������Ƥ���Ϥ��Ǥ���
�⤷���������ä����狼��ʤ���硢���Υ����ե������ޤ�� @code{mysqlbug} ����Ѥ���
�Х���ݡ��Ȥ���Ƥ��Ƥ���������
@xref{Bug reports}.

@item There is already a @code{mysqld} daemon running

���ξ�硢 @code{mysql_install_db} ��¹Ԥ���ɬ�פϤ���ޤ���
@code{mysql_install_db} ��¹Ԥ���Τ� @strong{MySQL} ����ƥ��󥹥ȡ��뤷���塢
���ä��������Ǥ���

@item Installing a second @code{mysqld} daemon doesn't work when one daemon is running

����Ϥ��Ǥ� @strong{MySQL} �����󥹥ȡ��뤵��Ƥ��ꡢ
���������������󥹥ȡ����㤦�Ȥ����˹Ԥ����Ȥ�������ȯ�����ޤ���
(�㤨�С����٤���ĤΥ��󥹥ȡ����¹Ԥ������ʤ�)
���̤ˤ������������ܤΥ����С���ư���Ƥ��륵���С���Ʊ���ݡ��ȡ������åȤ���Ѥ��Ƶ�ư���褦�Ȥ�������ȯ�����ޤ���
���ξ�硢@code{Can't start server: Bind on TCP/IP port: Address already in use} ���顼��å�������
@code{Can't start server : Bind on unix socket...} ���顼��å��������Фޤ���
�����������С��ϰʲ��Τ褦�ˤ��ư㤦�ݡ��ȡ������åȤǵ�ư�Ǥ��ޤ���

@tindex MYSQL_UNIX_PORT environment variable
@tindex MYSQL_TCP_PORT environment variable
@tindex Environment variable, MYSQL_UNIX_PORT
@tindex Environment variable, MYSQL_TCP_PORT
@example
shell> MYSQL_UNIX_PORT=/tmp/mysqld-new.sock
shell> MYSQL_TCP_PORT=3307
shell> export MYSQL_UNIX_PORT MYSQL_TCP_PORT
shell> scripts/mysql_install_db
shell> bin/safe_mysqld &
@end example

The environment variables ��Ͽ�� @code{mysqld} �˱ƶ�����¾�δĶ��ѿ���
������ޤ�Ǥ��ޤ���@xref{Environment variables}��

���θ塢��ĤΥǡ�����㤦�ݡ��ȡ������åȤǼ¹Ԥ���褦�ˡ���ư������ץȤ��ѹ����ޤ���
�㤨�С�@code{safe_mysqld}  ����Ľ񤭤ޤ�����@code{--socket}, @code{--port} �� @code{--basedir}
 ���ץ����򤽤줾��� @code{safe_mysqld} �˻��ꤷ�ޤ���

@item @file{/tmp} �˽񤭹��ߵ��Ĥ򤢤ʤ������äƤ��ʤ��ʤ�

�⤷�����åȥե������ɸ��ξ��(@file{/tmp})�˺������뤿��ν񤭹��ߵ��Ĥ��ʤ��ʤ顢
���뤤�ϡ�����ե������ @file{/tmp} �˺����Ǥ��ʤ��ʤ顢
@code{mysql_install_db} �μ¹Ի������뤤�� @code{mysqld} �ε�ư�����ѻ���
���顼�Ȥʤ�Ǥ��礦��

�㤦�ǥ��쥯�ȥ꡼�˥����åȥե���������ե��������ꤹ��ˤϡ�

@tindex TMPDIR environment variable
@tindex MYSQL_UNIX_PORT environment variable
@tindex Environment variable, TMPDIR
@tindex Environment variable, MYSQL_UNIX_PORT
@example
shell> TMPDIR=/some_tmp_dir/
shell> MYSQL_UNIX_PORT=/some_tmp_dir/mysqld.sock
shell> export TMPDIR MYSQL_UNIX_PORT
@end example

@file{some_tmp_dir} �Ͻ񤭹��ߤ���ǽ�ʥǥ��쥯�ȥ꡼����ꤷ�ʤ��ƤϤʤ�ޤ���
@xref{Environment variables}.

���θ塢@code{mysql_install_db} �����餻�������С���ư��������Ǥ��ޤ���

@example
shell> scripts/mysql_install_db
shell> BINDIR/safe_mysqld &
@end example

@item @code{mysqld} crashes at once

�⤷ RedHat 5.0 ��� 2.0.7-5 ���Ť� @code{glibc} ����Ѥ��Ƥ����硢
���Ƥ� @code{glibc} �ѥå������Ƥʤ��ƤϤʤ�ޤ���
����˴ؤ��Ƥ� @strong{MySQL} �᡼��Υ��������֤˾���¿������ޤ���
�᡼��󥰥ꥹ�ȤΥ��������֤Υ�󥯤�
@uref{http://www.mysql.com/doc.html, @strong{MySQL} documentation page}.
see @ref{Linux}.

@code{mysqld} �� @code{--skip-grant-tables} ����ǵ�ư���뤳�Ȥ�Ǥ��ޤ���
�����ưʲ��Τ褦�� @code{mysql} ����Ѥ��Ƽ�ʬ���Ȥμ�ˤ����Ĥ�ä��ޤ���

@example
shell> BINDIR/safe_mysqld --skip-grant-tables &
shell> BINDIR/mysql -u root mysql
@end example

@code{mysql} �����ư�� @code{mysql_install_db} �˽񤫤�Ƥ��� SQL ���ޥ�ɤ�¹Ԥ��ޤ���
���ĥơ��֥�򥵡��С����ɤ߹��ޤ�����ˤϡ�
 @code{mysqladmin flush-privileges} �� @code{mysqladmin reload} ��¹Ԥ��ޤ���
@end table


@node Starting server, Automatic start, mysql_install_db, Post-installation
@subsection @strong{MySQL} �����С���ư��������

�̾� @code{mysqld} �����С��ε�ư�ϡ��ʲ��λ��Ĥ���ˡ�Τ�����ĤǹԤ��ޤ���

@itemize @bullet
@item
@code{mysql.server} �ˤ�뵯ư�����Υ�����ץȤϥ����ƥ�ε�ư������߻��˻Ȥ��ޤ���
�ܺ٤� @ref{Automatic start}
@item
@code{safe_mysqld} �ˤ�뵯ư������� @code{mysqld} �ؤ�Ŭ�ڤʥ��ץ�������ꤷ��
�����Υ��ץ����ǥ����С��ε�ư���ߤޤ���
@item
NT ��Ǥ� @code{mysqld} �򼡤Τ褦�˥����ӥ��Ȥ��ƥ��󥹥ȡ��뤹�٤��Ǥ�:
@example
bin\mysqld-nt --install               # Install MySQL as a service
@end example

����ȡ����Τ褦�� @code{mysqld} ��ư/��ߤǤ��ޤ�:
@example
NET START mysql
NET STOP mysql
@end example

����: ���ξ�� mysqld ���Ф���¾�Υ��ץ����ϻ��ѤǤ��ޤ���
 
���Τ褦�ˤ��ƥ����ӥ������Ǥ��ޤ�:
@example
bin\mysqld-nt --remove                # remove MySQL as a service
@end example 
@item
@code{mysqld} ��ľ�ܵ�ư��
@end itemize

�ɤ���ˡ�ǥ����С���ư���Ƥ⡢�⤷��ư�˼��Ԥ���С������ե�������ǧ���Ƥ���������
�ʤ����Ԥ�������Ͽ����Ƥ��ޤ��������ե�����ϥǡ����١����ǥ��쥯�ȥ�ˤ���ޤ���
(�Х��ʥ����ۤξ�� @file{/usr/local/mysql/data} �����������ۤξ�� @file{/usr/local/var}��
 Windows �Ǥ� @file{\mysql\mysql.err} )
�ǡ����١����ǥ��쥯�ȥ�� @file{host_name.err} �� @file{host_name.log} �Ȥ���
�ե����� (@code{host_name} �Ϥ��ʤ��Υ����С�̾) ��õ���Ƥ���������
�ʲ��Τ褦�ˤ��Ƥ��Υե�����κǸ�ο��Ԥ��ǧ���ޤ���

@example
shell> tail host_name.err
shell> tail host_name.log
@end example

@code{mysqld} �ǡ����ε�ư���ˡ��ǡ����ϥǡ����ǥ��쥯�ȥ�˥ǥ��쥯�ȥ���Ѥ��ޤ���
�����ե������ pid (process ID) �ե����뤬���Υǥ��쥯�ȥ�˽񤱤����
�����ƥǡ����١��������Υǥ��쥯�ȥ�ˤ�����򡢥ǡ������׵ᤷ�ޤ���

�ǡ����ǥ��쥯�ȥ�ξ�������ʪ�Υ���ѥ�����˻��ꤵ��Ƥ��ޤ���
@code{mysqld} �����ʤ��Υ����ƥ��˥ǡ����١����ǥ��쥯�ȥ�򸫤Ĥ���ʤ��ä���硢
�����С���ư���ޤ���
 @code{mysqld} �� @code{--help} ���ץ����ǵ�ư����� @code{mysqld} ��
�ǥե���ȤΥѥ����Τ뤳�Ȥ��Ǥ��ޤ��Τǡ�
�����С�����ư���ʤ���ͳ���㤦�ѥ�����Ѥ��Ƥ��뤿��˵����äƤ��뤫�ɤ������狼��ޤ���
�ѥ����㤦��硢@code{mysqld} �Υ��ޥ�ɥ饤��ΰ������������ѥ�����ꤷ�ơ��ǥե�����ͤ�
��񤭤��뤳�Ȥ���ǽ�Ǥ���(����饪�ץ����� @code{safe_mysqld} �ˤ�Ʊ�ͤ˻��ѤǤ��ޤ�)

�̾@strong{MySQL} �����󥹥ȡ��뤵�줿�ǥ��쥯�ȥ�Υ١����ǥ��쥯�ȥ������
 @code{mysqld} �˶�����Ф����Ϥ��Ǥ���
����� @code{--basedir} ���ץ�������ꤷ�ޤ���
 @code{--help} ���ץ�������Ѥ���Хѥ����ѹ�����ǧ�Ǥ��ޤ���
(@code{--help} ��@emph{ɬ��} �Ǹ�˻���Τ���)
���㤨�С�

@example
shell> EXECDIR/mysqld --basedir=/usr/local --help
@end example

�ѥ������꤬�פ��̤�˸��ä����Ȥ��ǧ�����顢 @code{--help} ���ץ����򳰤��ƥ����С���ư���ޤ���

�ʲ��Υ��顼�ξ�硢¾�Υץ������ʤ�¾�� @code{mysqld} �����С��ˤ�
@code{mysqld} �����Ѥ��褦�Ȥ��Ƥ��� TCP/IP �����åȤ�ȤäƤ��ޤ���

@example
Can't start server: Bind on TCP/IP port: Address already in use
  or
Can't start server : Bind on unix socket...
@end example

¾�� @code{mysqld} �����С������äƤ��ʤ����� @code{ps} �dz�ǧ���ޤ���
�⤷¾�Υ����С�����ư���Ƥ��ʤ��ʤ顢 @code{telnet your-host-name tcp-ip-port-number} 
���ޥ�ɤ�¹Ԥ������� @code{RETURN} �����򤿤����ƤߤƤ���������
�⤷�� @code{telnet: Unable to connect to remote host: Connection refused} �Τ褦��
���顼���Ф���硢�ʤˤ��� @code{mysqld} �����Ѥ��褦�Ȥ��Ƥ���ݡ��Ȥ���˻ȤäƤ��ޤ���
@xref{mysql_install_db, , @code{mysql_install_db}}, and @ref{Multiple
servers}.

@code{safe_mysqld} ������ץȤϡ����������ۤ���Ǥ�Х��ʥ����ۤ� @strong{MySQL} ����Ǥ⡢
���Ȥ��㤦���˥��󥹥ȡ��뤵��Ƥ��Ƥ⡢�����С���ư�Ǥ���褦�˺���Ƥ��ޤ���
 @code{safe_mysqld} �ϰʲ��Τɤ줫��Ĥ����Ǥ��뤳�Ȥ���Ԥ��ޤ���

@itemize @bullet
@item
 @code{safe_mysqld} ����ư���줿�����ȥǥ��쥯�ȥ꤫������Хѥ��ˡ�
�����С��ȥǡ����١����������硣
 @code{safe_mysqld} �� @file{./bin}, @file{./data} �ǥ��쥯�ȥ�(�Х��ʥ�����ʪ�ξ��)��
���뤤�� @file{./libexec}, @file{./var} �ǥ��쥯�ȥ�(����������ʪ�ξ��)��õ���ޤ���
���ʤ��� @strong{MySQL} �򥤥󥹥ȡ��뤷���ǥ��쥯�ȥ�(�㤨�� @file{/usr/local/mysql} �ǥ��쥯�ȥ�)
���� @code{safe_mysqld} ��¹Ԥ�����硢���ξ���Ŭ�礷�ޤ���

@item
�����С��ȥǡ����١��������Хѥ��ʲ��ˤʤ���硢@code{safe_mysqld} �����Хѥ��Ǥ�����õ���ޤ���
ŵ��Ū�ʥǥ��쥯�ȥ�� @file{/usr/local/libexec} �� @file{/usr/local/var} �Ǥ���
�ºݤΥǥ��쥯�ȥ�� @code{safe_mysqld} ����������ʪ�����������Ȥ��˷����ޤ���
������ @strong{MySQL} �����󥹥ȡ��뤵�줿ɸ��Υѥ������������֤���Ƥ��ʤ���Фʤ�ޤ���
@end itemize

@code{safe_mysqld} �ϥ����С��ȥǡ����١�����ʬ����ư���줿�ǥ��쥯�ȥ꤫������Хѥ���õ���ޤ���
��äơ� @code{safe_mysqld} �� @strong{MySQL} �Υ��󥹥ȡ���ǥ��쥯�ȥ꤫�鵯ư����¤�ϡ�
 @strong{MySQL} �Х��ʥ�����ʪ��ʬ�ι����ʤȤ����˥��󥹥ȡ���Ǥ��ޤ���
���ξ��ε�ư�ϡ�

@example
shell> cd mysql_installation_directory
shell> bin/safe_mysqld &
@end example

�⤷ @code{safe_mysqld} �� @strong{MySQL} ���󥹥ȡ���ǥ��쥯�ȥ꤫�鵯ư���Ƥ⼺�Ԥ���ʤ顢
@code{safe_mysqld} �򤢤ʤ��Υ����ƥ��Ѥ� @code{mysqld} �Υѥ���ѥ�̾�Υ��ץ�����
�񤭴����Ƥ⤫�ޤ��ޤ���
���ξ�硢 @strong{MySQL} �򥢥åץ��졼�ɤ�����硢���ʤ����ѹ�����
 @code{safe_mysqld} �Ͼ�񤭤����Τǡ��ѹ�������Τϥ��󥹥ȡ������˥��ԡ����Ƥ�����
�Ƥ��ᤵ�ʤ��ƤϤʤ�ޤ���

�⤷ @code{mysqld} �����Ǥ����äƤ����硢�ʲ��Υ��ޥ�ɤˤƥѥ���������Τ뤳�Ȥ��Ǥ��ޤ���

@example
shell> mysqladmin variables

or

shell> mysqladmin -h 'your-host-name' variables
@end example

�⤷ @code{safe_mysqld} �������С���ư���Ƥ���³�Ǥ��ʤ��褦�ʤ顢
 @file{/etc/hosts} �ե�����˰ʲ��Τ褦�ʵ��Ҥ�������Ƥ���������

@example
127.0.0.1       localhost
@end example

��������ϥ���åɥ饤�֥�꡼���ʤ��� @strong{MySQL} �� MIT-pthreads ��
���Ѥ���褦�ˤ��ƺ�ä������ƥ�ˤ���������ޤ���

Windows �Ǥϡ����Τ褦�ˤ��� @code{mysqld} �ε�ư���ߤ뤳�Ȥ��Ǥ��ޤ�:

@example
C:\mysql\bin\mysqld --standalone --debug
@end example

����ϡ��Хå������ɤ�ư�����@file{\mysqld.traec} �˥ȥ졼�����
�Ф��ޤ������������θ������褹�������ˤʤ�ޤ���@xref{Win32}��

@node Automatic start, Option files, Starting server, Post-installation
@subsection @strong{MySQL} �μ�ư��ư�ȼ�ư���

@code{mysql.server} ������ץȤ� @code{start}, @code{stop} ��������ꤹ�뤳�Ȥˤ��
�����С���ư����ߤǤ��ޤ���

@example
shell> mysql.server start
shell> mysql.server stop
@end example

@code{mysql.server} �� @strong{MySQL} ���󥹥ȡ���ǥ��쥯�ȥ�� @file{share/mysql} �ǥ��쥯�ȥꡢ
�ޤ��� @strong{MySQL} �������ĥ꡼�� @file{support-files} �ǥ��쥯�ȥ�ˤ���ޤ���

@code{mysql.server} �ϥ����С���ư���������� @strong{MySQL} �����󥹥ȡ��뤵�줿
�ǥ��쥯�ȥ�˥ǥ��쥯�ȥ���Ѥ���@code{safe_mysqld} ��ư���ޤ���
�⤷ɸ��ʳ��˥��󥹥ȡ��뤷�Ƥ���Х��ʥ����ۤ���Ѥ��Ƥ���ʤ顢 
@code{mysql.server} ���Խ�����ɬ�פ����뤫�⤷��ޤ���
@code{safe_mysqld} ��ư���������������ǥ��쥯�ȥ�� @code{cd} ����褦���ѹ����ޤ���
@code{safe_mysqld} ��¾�Υ��ץ�����Ϳ����褦�� @code{mysql.server} ���Ѥ��Ƥ⹽���ޤ���
¾�Υ桼�����Ǽ¹Ԥ�������硢@code{mysql_daemon_user=root} ���ѹ����Ƥ⹽���ޤ���
@code{safe_mysqld} ��¾�Υ��ץ�����Ϳ���뤿��ˡ�
@code{mysql.server} ���ѹ����Ƥ⹽���ޤ���

@code{mysql.server stop} �ϥ����С��˥����ʥ�����äƥ����С�����ߤ��ޤ���
@code{mysqladmin shutdown} �Ǽ�ư�ǥ����С�����Ȥ����Ȥ�Ǥ��ޤ���

@strong{MySQL} ����Ѥ��Ƥ������ʤΤ���ˡ�����饹�����ȡ����ȥåפ�
 @file{/etc/rc*} �˽񤭤����Ȼפ��뤫�⤷��ޤ���
�����Ǥ��������ϡ��ѹ����� @code{mysql.server} �ϡ�
 @strong{MySQL} �򥢥åץ��졼�ɤ����Ȥ��˾�񤭤����Ȥ������ȤǤ���
��äơ��ѹ�������Τϥ��󥹥ȡ������˥��ԡ����äƤ����٤��Ǥ���

�⤷���ʤ��Υ����ƥब @file{/etc/rc.local} ��ư������ץȤȤ��ƻ��Ѥ��Ƥ���ʤ顢
�ʲ��Τ褦�ˤ�����˵��Ҥ��ޤ���

@example
/bin/sh -c 'cd /usr/local/mysql ; ./bin/safe_mysqld &'
@end example

�������Х�����ե�����Ǥ��� @file{/etc/my.cnf} �ˡ� @code{mysql.server} ��
���ץ����򵭽Ҥ��뤳�Ȥ��ǽ�Ǥ���@file{/etc/my.cnf} �ե�����ϰʲ��Τ褦��
���ҤˤʤäƤ��ޤ���

@example
[mysqld]
datadir=/usr/local/mysql/var
socket=/tmp/mysqld.sock
port=3306

[mysql.server]
user=mysql
basedir=/usr/local/mysql
@end example

@code{mysql.server} ������ץȤϰʲ����ѿ�����Ѥ��ޤ���
@code{user}, @code{datadir}, @code{basedir}, @code{bindir} ������ @code{pid-file}.

@xref{Option files}.

@cindex Default options
@cindex Option files
@node Option files,  , Automatic start, Post-installation
@subsection ���ץ����ե����� ( @code{my.cnf} )

@strong{MySQL} 3.22 �Υ����С������饤����ȤȤ�ˡ����ץ����ե����뤫��ǥե���Ȥε�ư���ץ������ɤ߹��ळ�Ȥ��Ǥ��ޤ���

UNIX �Ǥ� @strong{MySQL} �ϰʲ��Υե����뤫��ǥե���ȥ��ץ������ɤߤޤ���

@tindex .my.cnf file
@multitable @columnfractions .3 .7
@item @strong{�ե�����̾} @tab @strong{��̣}
@item @code{/etc/my.cnf} @tab ���ΤΥ��ץ����
@item @code{DATADIR/my.cnf} @tab �����и�ͭ���ץ����
@item @code{~/.my.cnf} @tab �桼����ͭ���ץ����
@end multitable

@code{DATADIR} �� @strong{MySQL} �ǡ����ǥ��쥯�ȥ�Ǥ� (����
@file{/usr/local/mysql/data} or @file{/usr/local/var}).
���Υǥ��쥯�ȥ��configure���˷��ꤵ��Ƥ��ꡢ @code{--datadir} �� @code{mysqld} ��ư���˻��ꤷ�Ƥ��ѹ�����ޤ���
(�����С��ϥ��ޥ�ɥ饤��ΰ���������������˥��ץ����ե������õ���ޤ���
��äơ�@code{--datadir} ��������ꤷ�Ƥ⥪�ץ����ե������õ��������ꤹ�뤳�ȤˤϤʤ�ޤ���)

Win32 �Ǥ� @strong{MySQL} �ϰʲ��Υե����뤫��ǥե���ȥ��ץ������ɤߤޤ���

@multitable @columnfractions .3 .7
@item @strong{�ե�����̾} @tab @strong{��̣}
@item @code{windows-system-directory\my.ini}
@item @code{C:\my.cnf} @tab ���ΤΥ��ץ����
@item @code{C:\mysql\data\my.cnf} @tab �����и�ͭ���ץ����
@end multitable

����: Win32 �Ǥ� @code{\} ������� @code{/} �����ƤΥѥ��򵭽Ҥ��٤���
����@code{\} ����Ѥ����硢@code{\} �� @strong{MySQL} �Υ���������ʸ��
�ʤΤǡ��������Ť˵��Ҥ���ɬ�פ�����ޤ���

@cindex Environment variables
@strong{MySQL} �Ͼ嵭��ɽ�ˤ�����Ƥ����˥��ץ����ե�������ɤߤޤ���
�⤷ʣ�����ץ����ե����뤬���ä���硢�夫���ɤޤ줿���꤬ͭ���ˤʤ�ޤ���
���ƤΥ��ץ����ϥ��ޥ�ɥ饤��ΰ����˾�񤭤���ޤ���
�����Ĥ��Υ��ץ����ϴĶ��ѿ�������Ǥ��ޤ���
���ץ����ե�����ȥ��ޥ�ɥ饤��ΰ����ϴĶ��ѿ����񤭤��ޤ���

�ʲ��Υץ������ϥ��ץ����ե�����򥵥ݡ��Ȥ��ޤ���@code{mysql},
@code{mysqladmin}, @code{mysqld}, @code{mysqldump}, @code{mysqlimport},
@code{myisamchk} and @code{myisampack}.

���ץ����ե�����ˤϡ��ץ�����ब���ݡ��Ȥ��Ƥ��륳�ޥ�ɥ饤��� long ���ץ����(�㤨�С�@code{-u} �ǤϤʤ��� @code{--user} ����)��񤯤��Ȥ��Ǥ��ޤ���
�ץ������� @code{--help} �ǵ�ư����С������ǽ���ѿ�̾�������ޤ���

���ץ����ե�����ν񼰤ϰʲ��Ǥ���

@table @code
@item #comment
�����Ȥ� @samp{#} �� @samp{;} ʸ���ǻϤ�ޤ������ιԤ�̵�뤷�ޤ���

@item [group]
���롼�������
@code{group} �ϥ��ץ������������ץ�����फ���롼�פ�̾���Ǥ���
��������θ塢@code{���ץ����} �� @code{set-variable} �Ԥǡ����Υ��롼�פ˥��ץ�����Ϳ���ޤ���
���Υ����������ϰϤϡ�¾�Υ��롼������ιԤ���뤫���ե�����κǸ�����ޤǤǤ���

@item option
����ϥ��ޥ�ɥ饤��� @code{--option} �������Ǥ���

@item option=value
����ϥ��ޥ�ɥ饤��� @code{--option=value} �������Ǥ���

@item set-variable = variable=value
����ϥ��ޥ�ɥ饤��� @code{--set-variable variable=value} �������Ǥ���
����� @code{mysqld} �ѿ��ǻ��Ѥ��������Ǥ���
@end table

@code{client} ���롼�פϡ����Ƥ� @strong{MySQL} ���饤�����(@code{mysqld}�Ͻ�)���Ф��ƥ��ץ�����������ޤ���
����ϥ����С�����³����ݤ˻��Ѥ���ѥ���ɤ����Ǥ��륰�롼�פǤ���
(���ξ�硢���ץ����ե�����ϼ�ʬ�������ɤ߽񤭤Ǥ���褦�ˤ��Ƥ�������)

���ץ������ͤ�����ˤ������ƤΥ֥��ʸ���ϼ�ư�Ǽ�������ޤ���
�ͤȤ��ơ�@samp{\b},@samp{\t}, @samp{\n}, @samp{\r}, @samp{\\} and @samp{\s}
 �Υ��������ץ������󥹤����ѤǤ��ޤ���
(@samp{\s} == blank).

���ץ����ե������㡧

@example
[client]
port=3306
socket=/tmp/mysql.sock

[mysqld]
port=3306
socket=/tmp/mysql.sock
set-variable = key_buffer_size=16M
set-variable = max_allowed_packet=1M

[mysqldump]
quick
@end example

�桼�������ץ����ե������㡧

@example
[client]
# The following password will be sent to all standard MySQL clients
password=my_password

[mysql]
no-auto-rehash
@end example

@tindex .my.cnf file
�⤷���������ۤ���äƤ���ʤ顢 @file{my-xxxx.cnf} �Ȥ���̾���Υ���ץ�ե������ @file{support-files} �ǥ��쥯�ȥ�˸��뤳�Ȥ��Ǥ��ޤ���
�⤷�Х��ʥ����ۤ���Ѥ��Ƥ���ʤ顢 @file{DIR/share/mysql} �ǥ��쥯�ȥ��õ���Ƥ�������
(������ @code{DIR} �� @strong{MySQL} �����󥹥ȡ��뤵�줿�ǥ��쥯�ȥ�Υѥ�̾�ǡ����̤� @file{/usr/local/mysql})��
���� @file{my-xxxx.cnf} �ե������ʬ�Υǥ��쥯�ȥ�� @file{.my.cnf} �Ȥ���̾���ǥ��ԡ����ƻ��ѤǤ��ޤ���

@strong{MySQL} �ץ������˥��ץ����ե�������ɤޤ��ʤ��褦�ˤ���ˤϡ�
���ޥ�ɥ饤��ΰ��ֺǽ�� @code{--no-defaults} ��񤭤ޤ���
����ϥ��ץ����κǽ�Ǥʤ���ͭ���ˤʤ�ޤ���
�ɤΥ��ץ�����������Ƥ��뤫�Τ����ˤϡ�@code{--print-defaults} ��ǽ�Υ��ץ����˻��ꤷ�ޤ���

����Υ���ե����ե��������Ū�˻��Ѥ�������硢���ץ���� 
@code{--defaults-file=�ǥե���ȥե�����Υե�ѥ�} ����ѤǤ��ޤ�������
��Ԥʤ���硢���ꤷ���ե�����������ɤޤ�ޤ���

��ȯ�Ը������󡧡����ץ����ե�������������ƤΥ��ץ����򥳥ޥ�ɥ饤��ΰ��������˽�������褦�˴�ñ�������ޤ�Ƥ��ޤ���
����ϥ��ץ�����Ǹ�˽�������ץ�������ʣ��Ω������������Թ�褯ư���ޤ���
�⤷���ץ����ե�������ɤ߹��ൡǽ�Τʤ��Ť��ץ���������Ѥ��Ƥ���ʤ顢
���ä���Ԥ������դ��ƽ񤱤Ф��������Ǥ���
����ư��ˤĤ��Ƥ� @strong{MySQL} ���饤����ȥץ������Υ����ɤ򻲹ͤˤ��Ƥ���������


@node Upgrade,  , Post-installation, Installing
@section @strong{MySQL} �Υ��åץ��졼��/�����󥰥졼�ɻ������̤˹Ԥʤ����Ȥ��������뤫��

@strong{MySQL} �����ȥǡ����ե�����ϡ�@strong{MySQL} ��Ʊ���١����С�����
��Ǥ���¤ꡢƱ���������ƥ������ΰۤʤ�С������֤Ǥ��ĤǤ��ư�Ǥ�
�ޤ������ߤΥ١����С������� 3 �Ǥ���@strong{MySQL} �μ¹Ի���
ʸ�����åȤ��ѹ����줿���(����ϥ����Ƚ���ѹ����ޤ�)�����ƤΥơ��֥�
�� @code{myisamchk -r -q} ��Ԥʤ�ɬ�פ�����ޤ����������ʤ���С�����ǥ�
��������������ˤʤ�ޤ���

�⤷���ʤ������м����ä��꿷�����С������򶲤�Ƥ����硢���ĤǤ⤢��
���θŤ� @code{mysqld} �� @code{mysqld}-'old-version-number' �Τ褦�ʲ�
���˥�͡���Ǥ��ޤ����⤷������ @code{mysqld} ��ͽ�����̲�����Ԥä���
�硢ñ��ˤ���򥷥�åȥ����󤷡��Ť� @code{mysqld} ��Ƶ�ư���뤳�Ȥ�
�Ǥ��ޤ���

���åץ��졼�ɻ��ˤϡ�������󡢸Ť��ǡ����١�����Хå����åפ⤷�Ƥ���
�٤��Ǥ��������Ͼ������м��ˤʤ�Τ��ɤ����ȤǤ���

���åץ��졼�ɸ塢�ƥ���ѥ��뤵�줿���饤����ȥץ������ǡ�
@code{Commands out sync} ��ͽ�����̥�������פΤ褦�����꤬�������硢
�����餯���ץ������Υ���ѥ�����˸Ť��إå���饤�֥��ե���������
�����ΤǤ��礦�����ξ�硢@file{mysql.h} �ե������ @file{libmysql.a} ��
���֥�꤬�������� @strong{MySQL} ���ۤ���Τ�ΤǤ��뤫�ɤ�����Τ����
����ˡ����դ�����å����٤��Ǥ����⤷��äƤ���С��ץ�������ƥ����
���뤷�Ƥ���������

�⤷������ @code{mysqld} �����С�����ư�Ǥ��ʤ��Ȥ����ѥ����̵����
��³�Ǥ��ʤ��Ȥ��������Ĥ������꤬ȯ��������硢�����Υ��󥹥ȡ���ǤǤ���
�Ť� @file{my.cnf} �ե����뤬���뤫�ɤ������ǧ���Ƥ���������
@code{program-name --print-defaults} �dz�ǧ�Ǥ��ޤ�.  �⤷���ν��Ϥ�
�ץ�������̾�ΰʳ���ʪ���֤�����硢ͭ���ˤʤäƤ��� @code{my.cnf} �ե����뤬
����ޤ���

��������꡼���� @strong{MySQL} �򥤥󥹥ȡ��뤷�����˾��
 @code{Msql-Mysql-modules} ��ƹ��ۡ��ƥ��󥹥ȡ��뤹�뤳�Ȥ�
�����ͤ��Ǥ������٤Ƥ� @code{DBI} ������ץȤ� @strong{MySQL} ��
���åץ��졼�ɸ�˥�������פ��������˵��Ť������ϡ��ä�
�������Ƥ���������

@menu
* Upgrading-from-3.22::         3.22 ���� 3.23 �С������ؤΥ��åץ��졼��
* Upgrading-from-3.21::         3.21 ���� 3.22 �С������ؤΥ��åץ��졼��
* Upgrading-from-3.20::         3.20 ���� 3.21 �С������ؤΥ��åץ��졼��
* Upgrading-to-arch::           ¾�Υ������ƥ�����ؤΥ��åץ��졼��
@end menu

@cindex Compatibility, between MySQL versions
@node Upgrading-from-3.22, Upgrading-from-3.21, Upgrade, Upgrade
@subsection 3.22 ���� 3.23 �С������ؤΥ��åץ��졼��

@strong{MySQL} 3.23 �Ͽ����� @code{MyISAM} ���Υơ��֥�ȡ��Ť� @code{ISAM} ����
�ơ��֥�򥵥ݡ��Ȥ��ޤ���
3.23 ����Ѥ���ݡ��Ť��ơ��֥�(ISAM) ���Ѵ�����ɬ�פϤ���ޤ���
�ǥե���ȤǤϡ������������ơ��֥뤬 @code{MyISAM} ���ˤʤ�ޤ���
(����� @code{mysqld} �� @code{--default-table-type=isam} ���ץ�����
��ư���뤳�Ȥˤ�ꡢ�ѹ��Ǥ��ޤ�)��
 @code{ISAM} �ơ��֥�� @code{MyISAM} ���ѹ�����ˤϡ�
 @code{ALTER TABLE} ����Ѥ��뤫��@code{mysql_convert_table_format} 
perl ������ץȤ���Ѥ��ޤ���

3.22 �� 3.21 �Υ��饤����Ȥ�����ʤ� 3.23 �����С���ư��ޤ���

�ʲ��ˡ�3.23 �˥��åץ��졼�ɤ���Ȥ��ˡ����ܤ���ɬ�פ������Τ���󤷤ޤ���

@itemize @bullet
@item @code{IF} �Υǥե���Ȥ�����ͷ��ϸ���ξ���ΰ����˰�¸���ޤ����ǽ�ΰ��������ǤϤ���ޤ���
@item @code{AUTO_INCREMENT} ����Ǥ�Ư���ޤ���
@item @code{INNER} �� @code{DELAYED} �ϡ�ͽ���ˤʤ�ޤ�����
@item @code{FLOAT(X)} ����������ư���������ˤʤ�ޤ��������������ͤǤϤ���ޤ���
@item @code{DECIMAL(length,dec)} �������length �����Ϥ�Ϥ����侮�����ξ���ޤߤޤ���
@item @code{TIME} ʸ����ϰʲ��Υե����ޥåȤΤ����줫�Ǥʤ���Фʤ�ޤ���
@code{[[[DAYS] [H]H:]MM:]SS[.fraction]} ��
@code{[[[[[H]H]H]H]MM]SS[.fraction]}
@item @code{LIKE} �ϡ�Ʊ��ʸ������� @code{'='} �롼�����Ѥ��ơ�
��Ӥ�Ԥ��褦�ˤʤ�ޤ�����
�⤷�Ť������ˡ�ˤ���ʤ�С� @strong{MySQL} �� @code{CXXFLAGS=-DLIKE_CMP_TOUPPER}
 �ե饰�ǥ���ѥ��뤷�ޤ���
@item @code{REGEXP} �ϡ��̾��ʸ����(�� binary) �Ǥϡ����������¸�ˤʤ�ޤ�����
@item @code{MyISAM} �ơ��֥�(@code{.MYI}) �θ����������ˤϡ�@code{CHECK TABLE}
����Ѥ��뤫��@code{myisamchk} ����Ѥ��ޤ���
@code{isamchk} �� ISAM(@code{.ISM}) �ơ��֥��Ѥ˻��Ѥ��ޤ���.
@item �⤷��3.22 �� 3.23 �δ֤Ǹߴ������������  @code{mysqldump} ��Ԥ������ʤ�С�
 @code{--opt} �� @code{--full} ���ץ����� @code{mysqldump} �˻��ꤷ�ƤϤ����ޤ���
@item ���Ƥ� @code{DATE_FORMAT()} ������å����Ƥ���������
�ƥե����ޥå�ʸ�������ˤ� @samp{%} ʸ����ɬ�פˤʤ�ޤ�����
(@strong{MySQL} 3.22 �С������ʹߤǤϤ���ʸˡ��������ޤ���)
@item
@code{mysql_fetch_fields_direct} ���ؿ��ˤʤ� (���ޤǤϥޥ������ä��Τ�)��
@code{MYSQL_FIELD} ���ǤϤʤ� @code{MYSQL_FIELD} �ݥ��󥿡������֤��ޤ���
@item
@code{mysql_num_fields()} �ϡ� @code{MYSQL*} object ���Ϥ�Ȥ����Ȥ��Ǥ��ޤ���
(����Ϻ��� @code{MYSQL_RES*} ������˼��ؿ��ˤʤ�ޤ���)��
����ˡ� @code{mysql_field_count()} ����Ѥ��٤��Ǥ���
@item
@code{MySQL} 3.22 �Ǥ�, @code{SELECT DISTINCT ...} �ν��Ϥ�
�ۤȤ�ɤ��Ĥ⥽���Ȥ���ޤ����� 3.23 �Ǥ�, �����Ȥ�Ԥä���̤�����ˤ�
@code{GROUP BY} �� @code{ORDER BY} ����Ѥ��ʤ��ƤϤʤ�ޤ���
@item
�⤷�����פ���쥳���ɤ�̵���ä���硢@code{SUM()} �� 0 ������� @code{NULL} ���֤��褦�ˤʤ�ޤ�����
����� ANSI SQL ���Ǥ���
@item
������ͽ���: @code{CASE, THEN, WHEN, ELSE and END}
@item @code{NULL} �ͤǤ� @code{AND} �� @code{OR} �ϸ��� 0 �ǤϤʤ� 
@code{NULL} ���֤��ޤ���
This mostly affects queries that uses @code{NOT}
on an @code{AND/OR} expression as @code{NOT NULL} = @code{NULL}.
@end itemize

@cindex Compatibility, between MySQL versions
@node Upgrading-from-3.21, Upgrading-from-3.20, Upgrading-from-3.22, Upgrade
@subsection 3.21 ���� 3.22 �С������ؤΥ��åץ��졼��

3.21 �� 3.22 �δ֤ˤϸߴ����˱ƶ������ѹ��Ϥ���ޤ���@code{DATE} ����
ȼ�ä��������줿�������ơ��֥�ϡ����դγ�Ǽ�˿�������ˡ����Ѥ��뤳�Ȥ�
���� pitfall �Ǥ��������ο������ե�����ɤ˸Ť��С������� 
@code{mysqld} ���饢���������뤳�ȤϤǤ��ޤ���

@code{MySQL 3.22} ���󥹥ȡ���塢�����������Ф򳫻Ϥ��ơ�
@code{mysql_fix_privilege_tables} ������ץȤ�¹Ԥ��٤��Ǥ��������
@code{GRANT} ���ޥ�ɤ���Ѥ��뤿���ɬ�פʸ��¤��ɲä��ޤ��������˺��
��ȡ�@code{ALTER TABLE} �� @code{CREATE/DROP INDEX} ����Ѥ��褦�Ȥ���
���� @code{Access denied} �ˤʤ�ޤ���@strong{MySQL} root �桼�����ѥ��
�ɤ��׵᤹���硢@code{mysql_fix_privilege_tables} �ؤΰ����Ȥ��Ƥ����
Ϳ���Ƥ���������

C API ���󥿥ե����� @code{mysql_real_connect()} ���ѹ�����ޤ���������
�ؿ���ƤӽФ��Ť����饤����ȥץ���������äƤ�����ϡ������� 
@code{db} ������ @code{0} ���֤�(�ޤ��Ϥ��®����³�Τ���� @code{db} ��
�Ǥ�����褦�˥��饤����Ȥ򥳡��ǥ��󥰤��ʤ���)ɬ�פ�����ޤ���
@code{mysql_real_connect()} ��ƤӽФ�����
@code{mysql_init()} ��ƤФʤ��ƤϤʤ�ޤ���
�����ѹ��ϡ�@code{MYSQL} �ι�¤�Τ˥��ץ�������¸���뤿���
������ @code{mysql_options()} �ؿ���ͭ���ˤ��ޤ���

@code{mysqld} �ѿ� @code{key_buffer} �� @code{key_buffer_size} ��̾����
�Ѥ��ޤ��������������ޤ�����̾���⥹�����ȥ��åץե�������ǻ��ѤǤ���
����


@node Upgrading-from-3.20, Upgrading-to-arch, Upgrading-from-3.21, Upgrade
@subsection 3.20 ���� 3.21 �С������ؤΥ��åץ��졼��

���� 3.20.28 ������ΥС�����󤬲�Ư���Ƥ��ơ�3.21.x ���ѹ����������ϡ�
����Ԥʤ�ɬ�פ�����ޤ�:

@code{safe_mysqld --old-protocol} �� @code{mysqld} 3.21 �����Ф�ư����
�С�3.20 ���ۤ���Υ��饤����ȤǤ������ѤǤ��ޤ������ξ�硢��������
�饤����ȴؿ� @code{mysql_errno()} �ϥ����ФΥ��顼�ϲ����֤�����
@code{CR_UNKNOWN_ERROR} �������֤��ޤ� (���������饤����ȤΥ��顼�ˤĤ�
�Ƥ�Ư���ޤ�)�������� �����ФϸŤ� password() �����å��򿷤�����Τ����
��˻��Ѥ��ޤ���

@code{mysqld} �� @code{--old-protocol} ���ץ�����@emph{�Ȥ�ʤ�}��硢
�����ѹ��򤹤�ɬ�פ�����ޤ�:

@itemize @bullet
@item
���ƤΥ��饤����ȥ����ɤϺƥ���ѥ��뤹��ɬ�פ�����ޤ���ODBC ����Ѥ�
�Ƥ�����Ͽ����� @strong{MyODBC} 2.x �ɥ饤�Ф����ꤹ��ɬ�פ�����ޤ���
@item
@code{mysql.user} �ơ��֥���� @code{password} �ե�����ɤ� 
@code{CHAR(16)} ���Ѵ����뤿��ˡ�������ץ� 
@code{scripts/add_long_password} ��¹Ԥ���ɬ�פ�����ޤ���
@item
���ƤΥѥ���ɤ� @code{mysql.user} �ơ��֥���˺����֤���ɬ�פ������
��(31�ӥåȥѥ���ɤ�����ˡ�62�ӥåȤ����뤿���)��
@item
�ơ��֥�������ѹ�����Ƥ��ʤ��Τǡ��ɤΥơ��֥���Ѵ�����ɬ�פϤ���ޤ�
��
@end itemize

@strong{MySQL} 3.20.28 �Ȥ���ʹߤϡ����饤����Ȥ˱ƶ���ڤܤ����ˡ���
���� @code{user} �ơ��֥������������뤳�Ȥ��Ǥ��ޤ���3.20.28 ������� 
@strong{MySQL} �С���������äƤ�����ϡ�@code{user} �ơ��֥���Ѵ�
����ȡ��ѥ���ɤϤ��ξ�ǤϤ⤦Ư���ޤ��󡣰����Τ��ᡢ�ǽ�˾��ʤ���
�� 3.20.28 �˥��åץ��졼�ɤ������줫�� 3.21.x �˥��åץ��졼�ɤ��٤���
����

@cindex Protocol mismatch
���������饤����ȥ����ɤ� 3.20.x @code{mysqld} �����Ф�ư���Τǡ���
�� 3.21.x �����꤬���ä����ϡ����饤����Ȥ�⤦���ٺƥ���ѥ��뤹��ɬ
�פϤʤ����Ť� 3.20.x �����Ф���Ѥ��뤳�Ȥ��Ǥ��ޤ���

@code{mysqld} �� @code{--old-protocol} ���ץ�������Ѥ��ʤ���硢�Ť�
���饤����Ȥϥ��顼��å�������ȯ���ޤ�:

@example
ERROR: Protocol mismatch. Server Version = 10 Client Version = 9
@end example

������ Perl ���󥿥ե����� @code{DBI}/@code{DBD} �ϸŤ� @code{mysqlperl} 
���󥿥ե������⥵�ݡ��Ȥ��ޤ���@code{mysqlperl} ����Ѥ�����˹Ԥ�ɬ
�פΤ����ѹ��ϡ�@code{connect()} �ؿ��ΰ������ѹ������Ǥ���������������:
@code{host}, @code{database}, @code{user}, @code{password} (@code{user} 
�� @code{password} �����ν��֤��ѹ�����ޤ���)��
@xref{Perl DBI Class, , Perl @code{DBI} Class}.

�����ѹ��ϸŤ����ץꥱ�������ǤΥ�����˱ƶ����ޤ�:

@itemize @bullet
@item
@code{HAVING} �ϸ��� @code{ORDER BY} �������ˤʤ���Ф����ޤ���
@item
@code{LOCATE()} �ؤΥѥ�᡼���ϸ򴹤���ޤ�����
@item
������ͽ��줬�����Ĥ�����ޤ����Ǥ����դ��٤��� @code{DATE},
@code{TIME} ������ @code{TIMESTAMP} �Ǥ���
@end itemize

@node Upgrading-to-arch,  , Upgrading-from-3.20, Upgrade
@subsection ¾�Υ������ƥ�����ؤΥ��åץ��졼��

�⤷��@strong{MySQL} 3.23 ����Ѥ��Ƥ���ʤ�С�
�㤦�������ƥ�����Υޥ���ˡ�@code{.frm}, @code{.MYI},@code{.MYD} �ե������
���ԡ����뤳�Ȥ�����ޤ���
��������ξ�Դ֤ǡ�Ʊ����ư�������Υե����ޥåȤ򥵥ݡ��Ȥ��Ƥ�����˸¤�ޤ���
(@strong{MySQL} takes care of any byte swapping issues).

���� @strong{MySQL} �ǡ����ȥ���ǥå����ե����� (@code{ISAM} @file{*.ISD} �� 
@file{*.ISM} �ե�����) �ϥ������ƥ������¸�ǡ������Ĥ��Υ������Ǥ� OS 
��¸�Ǥ������ץꥱ�������򡢸��ߤΥޥ���Ȥϰۤʤ륢�����ƥ�����/OS ��
����¾�Υޥ���˰ܤ��������ϡ�ñ��˥ե������¾�Υޥ���˥��ԡ����뤳
�Ȥǥǡ����١�����ܹԤ��褦�Ȥ��٤��ǤϤ���ޤ���@code{mysqldump} ��
���Ѥ��٤��Ǥ���

�ǥե���ȤǤ� @code{mysqldump} �ϡ������� SQL ���ơ��ȥ��ȥե������
�������ޤ������줫�餽�Υե������¾�Υޥ����ž������@code{mysql} ����
������Ȥؤ����ϤȤ���Ϳ���뤳�Ȥ��Ǥ��ޤ���

ͭ���ʥ��ץ���󤬲����򸫤뤿��ˤϡ�@code{mysqldump --help} ���Ƥ�
���������ǡ����� @strong{MySQL} �Τ�꿷�����С������˰ܤ���硢®����
��ѥ��Ȥʥ���פ����뤿��ˡ���꿷�����С������� @code{mysqldump --opt} 
����Ѥ��٤��Ǥ���

���ĤΥޥ���֤ǥǡ����١������ư����Ǥ��ñ�� (�������Ǥ�®���Ϥʤ�) 
��ˡ�ϡ��ǡ����١������֤���Ƥ���ޥ����Ǽ��Υ��ޥ�ɤ�¹Ԥ��뤳�Ȥ�
��:

@example
shell> mysqladmin -h 'other hostname' create db_name
shell> mysqldump --opt db_name \
        | mysql -h 'other hostname' db_name
@end example

�٤��ͥåȥ����ǥ�⡼�ȥޥ��󤫤�ǡ����١����򥳥ԡ����������ϡ�
������ѤǤ��ޤ�:

@example
shell> mysqladmin create db_name
shell> mysqldump -h 'other hostname' --opt --compress db_name \
        | mysql db_name
@end example

�ե�������η�̤��Ǽ���뤳�Ȥ�Ǥ��ޤ� (������Ǥϰ��̤���Ƥ��ޤ�):

@example
shell> mysqldump --quick db_name | gzip > db_name.contents.gz
@end example

�ǡ����١�������Ȥ�ޤ�Ǥ���ե��������Ū�Υޥ����ž�����ơ����Υ�
�ޥ�ɤ�¹Ԥ��Ƥ�������:

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

@cindex @code{mysqldump}
@cindex @code{mysqlimport}
�ǡ����١���ž����¹Ԥ��뤿��ˡ�@code{mysqldump} �� @code{mysqlimport} 
����ѤǤ��ޤ����礭�ʥơ��֥�Ǥϡ������ñ��� @code{mysqldump} �λ���
����ȤƤ�®���Ǥ������˼������ޥ�ɤǤϡ�@code{DUMPDIR} ��
@code{mysqldump} ����ν��Ϥ��Ǽ���뤿��˻��Ѥ���ǥ��쥯�ȥ�δ�����
�ѥ�̾��ɽ�路�Ƥ��ޤ���

�ޤ������ϥե�����Τ���Υǥ��쥯�ȥ��������ơ��ǡ����١��������פ�
�ޤ�:

@example
shell> mkdir DUMPDIR
shell> mysqldump --tab=DUMPDIR db_name
@end example

���줫�顢@code{DUMPDIR} �ǥ��쥯�ȥ���Υե��������Ū�Υޥ������б�
����ǥ��쥯�ȥ��ž������@strong{MySQL} �˥ե����������ɤ��ޤ�:

@example
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
@end example

@code{mysql} �ǡ����١����Υ��ԡ���˺��ʤ��Ǥ�������������Ͼ�ǧ�ơ���
�� (@code{user}, @code{db}, @code{host}) ����Ǽ����뤿��Ǥ���
@code{mysql} �ǡ����١����򤽤ξ����֤��ޤǡ��������ޥ����Ǥ� 
@strong{MySQL} @code{root} �桼���Ȥ��ƥ��ޥ�ɤ�¹Ԥ���ɬ�פ�����ޤ���

�������ޥ����� @code{mysql} �ǡ����١�����Ƴ�������塢�����Ф���ǧ�ơ�
�֥�����ƥ����ɤ��뤿��ˡ�@code{mysqladmin flush-privileges} ��¹Ԥ��Ƥ���������

@cindex Compatibility, with ANSI SQL
@node Compatibility, Privilege system, Installing, Top
@chapter @strong{MySQL} �ϤɤΤ褦��ɸ��ߴ�����

@menu
* Extensions to ANSI::          @strong{MySQL} �� ANSI SQL92 ���Ф����ĥ
* Ansi mode::                   Runnning @strong{MySQL} in ANSI mode
* Differences from ANSI::       @strong{MySQL} differences compared to ANSI SQL92
* Missing functions::           @strong{MySQL} ��̵����ǽ
* Standards::                   @strong{MySQL} ����򤹤�ɸ��
* Commit-rollback::             @code{COMMIT}/@code{ROLLBACK} �ʤ��Ǥ��ޤ������ˡ
@end menu


@node Extensions to ANSI, Ansi mode, Compatibility, Compatibility
@section @strong{MySQL} �� ANSI SQL92 ���Ф����ĥ

@strong{MySQL} �ϡ�¾�� SQL �ǡ����١�����˸����ʤ��Ǥ������������Ĥ�
�γ�ĥ��ޤ�Ǥ��ޤ������ʤ�����������Ѥ����硢�����ɤ�¾�� SQL ����
�Ф˰ܹԤǤ��ʤ��ʤ�Τ����դ��Ƥ��������������Ĥ��Υ������Ǥϡ����� 
@code{/*! ... */} �Υ����Ȥ���Ѥ��뤳�Ȥǡ�@strong{MySQL} ��ĥ��ޤ�
�ܹԲ�ǽ�����ɤ�񤯤��Ȥ��Ǥ��ޤ������ξ�硢@strong{MySQL} �ϥ�����
��Υ����ɤ�¹Ԥ��ޤ������ۤ���SQL�����С��Ϥ����̵�뤷�ޤ����㤨��:

@example
SELECT /*! STRAIGHT_JOIN */ col_name FROM table1,table2 WHERE ...
@end example

@code{'!'} �θ���˥С�������ֹ���ɲä���ȡ�ʸˡ�� @strong{MySQL} �С�
����󤬻��Ѥ����С�������ֹ�����������礭�����ˤΤ߼¹Ԥ���ޤ�:

@example
CREATE /*!32302 TEMPORARY */ TABLE (a int);
@end example

�嵭�� 3.23.02 ������ʾ�ξ��Ȥ�����̣�ǡ����ΤȤ� @strong{MySQL} �� 
@code{TEMPORARY} ������ɤ���Ѥ��ޤ���

@strong{MySQL} ��ĥ��ʲ��˼����ޤ�:

@itemize @bullet
@item
�ե�����ɷ� @code{MEDIUMINT}, @code{SET}, @code{ENUM} �������͡���
@code{BLOB} �� @code{TEXT} ����

@item
�ե������°�� @code{AUTO_INCREMENT}, @code{BINARY}, @code{NULL}, @code{UNSIGNED} ������ 
@code{ZEROFILL}��

@item
���Ƥ�ʸ������Ӥϥǥե���ȤǤϥ��������¸�ǡ����ߤ�ʸ�����å�(�ǥե�
��ȤǤ� ISO-8859-1 Latin1)�˽��ä������Ƚ�Ǥ�������򹥤ޤʤ����ϡ�
@code{BINARY} °���Ǥ��ʤ��Υե�����ɤ�������٤��Ǥ�������ϡ�@strong{MySQL} 
�����Хۥ��Ȥξ�ǻ��Ѥ���� ASCII ��˽��ä���Ӥ��¹Ԥ����褦�ˤʤ�
�ޤ���

@item
@strong{MySQL} �ϥǡ����١�����@strong{MySQL} �ǡ����ǥ��쥯�ȥ�
�ʲ��Υǥ��쥯�ȥ�ˡ�
�ơ��֥��ǡ����١����ǥ��쥯�ȥ�ʲ��Υե�����̾��
�ޥåפ��ޤ�������ϣ��Ĥδط�������ޤ�:

@itemize @minus
@item
@cindex Database names, case sensitivity
@cindex Table names, case sensitivity
@cindex Case sensitivity, of database names
@cindex Case sensitivity, of table names
��������¸�Υե�����̾����� OS (UNIX�Τ褦��)��� @strong{MySQL} �Ǥϡ�
�ǡ����١���̾�ȥơ��֥�̾�ϥ�������¸�Ǥ���
�ơ��֥�̾�ε��������꤬�����硢��˥ǡ����١����ȥơ��֥��
��ʸ������������Ȥ������ˡ���Ӥ���Ʊ���褦��̿̾����褦�ˤ��ޤ���

@item
�ơ��֥�ΥХå����å�, ��͡���, ��ư, ���, ���ԡ���ɸ�ॷ���ƥॳ�ޥ�
�ɤ���ѤǤ��ޤ����㤨�С��ơ��֥���͡��ह��ˤϡ��ơ��֥���б����� 
@file{.MYD}, @file{.MYI}, @file{.frm} �ե�������͡��ष�Ƥ���������
@end itemize

@item
SQL ʸ�Ǥϡ� @code{db_name.tbl_name} ��ʸ����Ѥ��ư㤦�ǡ����١����Υơ��֥�˥��������Ǥ��ޤ���
�����Ĥ���SQL�����С���Ʊ�ͤε�ǽ���󶡤��ޤ���������� @code{User space} �ǥ����뤷�ޤ���
@strong{MySQL} �ϰʲ��Τ褦�ʥơ��֥륹�ڡ����򥵥ݡ��Ȥ��ޤ���:
@code{create table ralph.my_table...IN my_tablespace}.

@item
���ͥե�����ɾ�Ǥ� @code{LIKE} ��������ޤ���

@item
@code{SELECT} ���ơ��ȥ������ @code{INTO OUTFILE} �� 
@code{STRAIGHT_JOIN} �λ��ѡ�@xref{SELECT, , @code{SELECT}}.

@item
�ɤΤ褦�˥ơ��֥뤬��礵��뤫�ξܺ٤����뤿��� @code{EXPLAIN SELECT}��

@item
����ǥå���̾���ե�����ɤΰ����Υ���ǥå����������� @code{CREATE TABLE} ��
�ơ��ȥ������ @code{INDEX} �ޤ��� @code{KEY} �λ��ѡ�
@xref{CREATE TABLE, , @code{CREATE TABLE}}.

@item
@code{CREATE TABLE} �Ǥ� @code{TEMPORARY} �� @code{IF NOT EXISTS} �λ��ѡ�

@item
'list' ���Ǥ���İʾ�� @code{COUNT(DISTINCT list)} �λ��ѡ�

@item
@code{ALTER TABLE} ���ơ��ȥ������ @code{CHANGE col_name}, @code{DROP col_name},
@code{DROP INDEX} �λ��ѡ�
@xref{ALTER TABLE, ,@code{ALTER TABLE}}.

@item
@code{ALTER TABLE} ���ơ��ȥ������ @code{IGNORE} �λ��ѡ�

@item
@code{ALTER TABLE} ���ơ��ȥ������ʣ���� @code{ADD}, @code{ALTER},
@code{DROP}, @code{CHANGE} ��λ��ѡ�

@item
������� @code{IF EXISTS} �դ��� @code{DROP TABLE} �λ��ѡ�

@item
ʣ���Υơ��֥����� @code{DROP TABLE} ���˴��Ǥ���

@item
@code{DELETE} ���ơ��ȥ��Ȥ� @code{LIMIT} �ᡣ

@item
@code{INSERT} �� @code{REPLACE} ���ơ��ȥ��Ȥ� @code{DELAYED} �ᡣ

@item
@code{INSERT}, @code{REPLACE}, @code{DELETE}, @code{UPDATE} ���ơ��ȥ���
�� @code{LOW_PRIORITY} �ᡣ

@cindex Oracle compatibility
@cindex Compatibility, with Oracle
@item
@code{LOAD DATA INFILE} �λ��ѡ�¿���ξ�硢���ι�ʸ�� ORACLE �� 
@code{LOAD DATA INFILE} �ȸߴ�������ޤ���@xref{LOAD DATA, , @code{LOAD DATA}}.

@item
@code{OPTIMIZE TABLE} ���ơ��ȥ��ȡ�
@xref{OPTIMIZE TABLE, , @code{OPTIMIZE TABLE}}.

@item
@code{SHOW} ���ơ��ȥ��ȡ�
@xref{SHOW, , @code{SHOW}}.

@item
@samp{'} �����Ǥʤ� @samp{"} �ޤ��� @samp{'} �ˤ�ä�ʸ������뤳�Ȥ�
��ǽ��

@item
���������� @samp{\} ʸ���λ��ѡ�

@item
@code{SET OPTION} ���ơ��ȥ��ȡ�@xref{SET OPTION, , @code{SET OPTION}}.

@item
@code{GROUP BY} �������ƤΥե�����ɤ����ɬ�פϤ���ޤ���
This gives better performance for some very specific, but quite normal
queries.
@xref{Group by functions}.

@item
�ۤʤ� SQL �Ķ������褿�桼�����Ф�������ñ�ˤ��뤿�ᡢ@strong{MySQL} 
��¿���δؿ�����̾�򥵥ݡ��Ȥ��Ƥ��ޤ����㤨�С����Ƥ�ʸ����ؿ��� ANSI
SQL �� ODBC ��ʸ��ξ���򥵥ݡ��Ȥ��ޤ���

@item
@strong{MySQL} �� @code{||} �� @code{&&} �黻�Ҥ�C �ץ�����ߥ󥰸���
�Τ褦�ˡ������¤������Ѥ��̣��������򤷤ޤ���@strong{MySQL} �Ǥ� 
@code{||} �� @code{OR}��@code{&&} �� @code{AND} ��Ʊ����Ǥ��������ɤ���
ʸ�Τ��ᡢ@strong{MySQL} �� ANSI SQL ��ʸ������黻�� @code{||} �򥵥ݡ�
�Ȥ��ޤ���@code{CONCAT()} ������˻��Ѥ��Ƥ���������@code{CONCAT()} 
��Ǥ�դο��ΰ�������ѤǤ���Τǡ�@code{||} �黻�Ҥλ��Ѥ� 
@strong{MySQL} ���Ѵ�����Τϴ�ñ�Ǥ���

@item
@code{CREATE DATABASE} �ޤ��� @code{DROP DATABASE}.
@xref{CREATE DATABASE, , @code{CREATE DATABASE}}.

@cindex PostgreSQL compatibility
@cindex Compatibility, with PostgreSQL
@item
@code{MOD()} ��Ʊ���� @code{%}�� @code{N % M} �� @code{MOD(N,M)} �������Ǥ���
@code{%} �� C �ץ�����ޡ��� PostgreSQL �Ȥθߴ��Τ���˥��ݡ��Ȥ���ޤ���

@item
�ե�����ɥ��ơ��ȥ��ȤǤ� @code{=}, @code{<>}, @code{<=} ,@code{<},
@code{>=}, @code{>}, @code{<<}, @code{>>}, @code{<=>},
@code{AND}, @code{OR}, @code{LIKE}��
�㤨�С�

@example
mysql> SELECT col1=1 AND col2=2 FROM tbl_name;
@end example

@item
@code{LAST_INSERT_ID()} �ؿ���
@xref{mysql_insert_id, , @code{mysql_insert_id()}}.

@item
@code{REGEXP} �ޤ��� @code{NOT REGEXP}��

@item
1�Ĥޤ���2�ʾ�ΰ����Ǥ� @code{CONCAT()} �ޤ��� @code{CHAR()}��
@strong{MySQL} �Ǥϡ������δؿ���Ǥ�դο��ΰ������뤳�Ȥ��Ǥ��ޤ���

@item @code{BIT_COUNT()}, @code{CASE}, @code{ELT()},
@code{FROM_DAYS()}, @code{FORMAT()}, @code{IF()}, @code{PASSWORD()},
@code{ENCRYPT()}, @code{md5()}, @code{ENCODE()}, @code{DECODE()},
@code{PERIOD_ADD()}, @code{PERIOD_DIFF()}, @code{TO_DAYS()}, 
@code{WEEKDAY()} �ؿ���

@item
����ʸ����������Τ���� @code{TRIM()} ����ѤǤ��ޤ���ANSI SQL �ϰ�ʸ��
�κ�������򥵥ݡ��Ȥ��ޤ���

@item
@code{GROUP BY} �ؿ� @code{STD()}, @code{BIT_OR()} ������ @code{BIT_AND()}��

@item
@code{DELETE} + @code{INSERT} ������� @code{REPLACE} �λ��ѡ�
@xref{REPLACE, , @code{REPLACE}}.

@item
@code{FLUSH flush_option} ��ʸ��

@item
@code{:=} �ǥ��ơ��ȥ�����Ǥ��ѿ������꤬��ǽ:
@example
SELECT @@a:=SUM(total),@@b=COUNT(*),@@a/@@b AS avg FROM test_table;
SELECT @@t1:=(@@t2:=1)+@@t3:=4,@@t1,@@t2,@@t3;
@end example

@end itemize

@node Ansi mode, Differences from ANSI, Extensions to ANSI, Compatibility
@section ANSI �⡼�ɤǤ� MySQL �μ¹�

@code{--ansi} ���ץ����Ĥ��� mysqld �򳫻Ϥ���ȡ����� @strong{MySQL} ��
���񤤤��Ѥ��ޤ���

@itemize @bullet
@item
@code{||} �� @code{OR} �ǤϤʤ�ʸ������Ǥ���
@item
�ؿ�̾�� '(' �δ֤�Ǥ�դο��Υ��ڡ������֤����Ȥ��Ǥ��ޤ�������Ϥ��٤Ƥ�
�ؿ���ͽ���ˤ��ޤ���
@item
@code{"} ��(@strong{MySQL} @code{`} ����ʸ���˻���)���̻Ұ���ʸ���ˤʤꡢ
ʸ�������ʸ���ǤϤ���ޤ���
@item
@code{REAL} �� @code{DOUBLE} ��Ʊ����ǤϤʤ� @code{FLOAT} ��Ʊ����ˤʤ�
�ޤ���
@end itemize

@node Differences from ANSI, Missing functions, Ansi mode, Compatibility
@section @strong{MySQL} �� ANSI SQL92 �Ȥΰ㤤

�桹�� @strong{MySQL} �� ANSI SQL ɸ��� ODBC SQL ɸ��˽����褦�˻�ߤƤ�
�ޤ����������Ĥ��Υ������� @strong{MySQL} �ϲ����㤤������ޤ�:

@itemize @bullet
@item
@code{--} �϶���³�������������Ȥˤʤ�ޤ���@xref{Missing comments}��
@item
@code{VARCHAR} �ե�����ɤǤϡ��ͤ���Ǽ�������������ζ��򤬺������ޤ���
@xref{Bugs}��
@item
�����Ĥ��Υ������ǡ�@code{CHAR} �ե�����ɤ��ۤä� @code{VARCHAR} �ե�����
�ɤ��ѹ�����ޤ���@xref{Silent column changes}��
@item
�ơ��֥����������ˡ��ơ��֥�ˤĤ��Ƥθ��¤ϼ�ưŪ�ˤ��˴�����ޤ���
�ơ��֥�ˤĤ��Ƥθ��¤��˴�����ˤϡ�����Ū�� @code{REVOKE} ��ȯ�Ԥ���ɬ
�פ�����ޤ���@xref{GRANT, , @code{GRANT}}.
@item
@code{NULL AND FALSE} �� @code{FALSE} �ǤϤʤ� @code{NULL} ��ɾ������ޤ���
���Υ������ǡ�¿����;�פʾ���ɾ������ɬ�פ����뤳�Ȥ��ɤ����ȤǤϤʤ��ȡ�
�桹�Ϲͤ��Ƥ��뤫��Ǥ���
@end itemize

@node Missing functions, Standards, Differences from ANSI, Compatibility
@section @strong{MySQL} ��̵����ǽ

���ε�ǽ�� @strong{MySQL} �θ��ߤΥС������ˤϤ���ޤ��󡣿�������ĥ��
ͥ���٤ˤĤ��Ƥϡ����򻲹ͤˤ��Ƥ�������
@uref{http://www.mysql.com/Manual_chapter/manual_Todo.html, the
@strong{MySQL} TODO list}������Ϥ��Υޥ˥奢����� TODO �ꥹ�Ȥκǿ��С�
�����Ǥ���@xref{TODO}��

@menu
* Missing Sub-selects::         Sub-selects
* Missing SELECT INTO TABLE::   @code{SELECT INTO TABLE}
* Missing Transactions::        �ȥ�󥶥������
* Missing Triggers::            �ȥꥬ
* Missing Foreign Keys::        Foreign Keys
* Missing Views::               �ӥ塼
* Missing comments::            �����ȳ��ϤȤ��Ƥ� @samp{--}
@end menu

@node Missing Sub-selects, Missing SELECT INTO TABLE, Missing functions, Missing functions
@subsection Sub-selects

���� @strong{MySQL} �ǤϤޤ�Ư���ޤ���:

@example
SELECT * FROM table1 WHERE id NOT IN (SELECT id FROM table2);
@end example

������¿���ξ�硢sub select ��Ȥ�ʤ�������˽�ľ�����Ȥ��Ǥ��ޤ�:

@example
SELECT table1.* FROM table1,table2 WHERE table1.id=table2.id;
SELECT table1.* FROM table1 LEFT JOIN table2 ON table1.id=table2.id where table2.id IS NULL
@end example

�����ʣ���ʥ��֥�����Ǥϡ����֥�������ݻ����뤿��˰���ơ��֥�������
���ޤ�����������������ˡ�Ǥ�ư���ʤ���礬����ޤ������Υ������ˤϡ�
@code{DELETE} ���ơ��ȥ��ȤǤ�äȤ����ˤ��������ޤ���@code{DELETE} ���ơ�
�ȥ��ȤǤϡ�ɸ�� SQL �Ǥϡ�sub select ���������ơ�join �򥵥ݡ��Ȥ���
���ޤ��󡣥��֥����꤬ @strong{MySQL} �˥��ݡ��Ȥ����ޤǡ����ξ����ˤϣ�
�Ĥ�����褬����ޤ���

�ǽ�������ϡ���³���ץ�����ߥ󥰸����Perl �� PHP �Τ褦�ʡˤ���Ѥ��ơ�
@code{SELECT} �������ȯ�Ԥ��ƺ�������쥳���ɤΥץ饤�ޥꥭ�����������
���줫�� @code{DELETE} ���ơ��ȥ��ȡ�@code{DELETE FROM ... WHERE
... IN (key1, key2, ...)}�ˤ��ۤ��뤿��ˤ����ͤ���Ѥ��뤳�ȤǤ���

�����ܤ������ϡ����÷� SQL ����Ѥ���@code{DELETE} ���ơ��ȥ��ȤΥ���
�Ȥ��ɸ�� @code{||} ���ڥ졼��������ˡ�@strong{MySQL} ��ĥ 
@code{CONCAT()} ����Ѥ��ơ���ưŪ���Ȥ�Ω�Ƥ뤳�ȤǤ����㤨��:

@example
SELECT CONCAT('DELETE FROM tab1 WHERE pkid = ', tab1.pkid, ';')
  FROM tab1, tab2
 WHERE tab1.col1 = tab2.col2;
@end example

���Υ�����򥹥���ץȥե���������֤������Ϥ� @code{mysql} ���ޥ�ɥ饤��
���󥿥ץ꥿�����ؤ������ν��Ϥ������ܤΥ��󥿥ץ꥿���󥹥��󥹤˥ѥ��פ�
�ޤ�:

@example
prompt> mysql --skip-column-names mydb < myscript.sql | mysql mydb
@end example

@strong{MySQL} �� @code{INSERT ... SELECT ...} �� @code{REPLACE ... 
SELECT ...} �����򥵥ݡ��Ȥ��ޤ�����Ω���� sub-selects �Ϥ����餯 3.24.0
��ͭ���ˤʤ�ޤ�������������¾��ʸ̮��Ǵؿ� @code{IN()} ����ѤǤ��ޤ���

@node Missing SELECT INTO TABLE, Missing Transactions, Missing Sub-selects, Missing functions
@subsection @code{SELECT INTO TABLE}

@strong{MySQL} �Ϥޤ� Oracle SQL extension:
@code{SELECT ... INTO TABLE ...} �򥵥ݡ��Ȥ��ޤ���
@strong{MySQL} �� @code{INSERT INTO ... SELECT ...} �򥵥ݡ��Ȥ��ޤ���
����ϴ���Ū��Ʊ�����ȤǤ���

����ˡ�@code{INSERT INTO ... SELECT ...} �� @code{CREATE
TABLE ... SELECT} �����ѤǤ��ޤ���
@xref{INSERT,  , @code{INSERT}}.

@node Missing Transactions, Missing Triggers, Missing SELECT INTO TABLE, Missing functions
@subsection �ȥ�󥶥������

@strong{MySQL} �ϸ��ߥȥ�󥶥������򥵥ݡ��Ȥ��뤿�ᡢ���ε�������ȥ�
�󥶥����������ơ��֥뷿����Ѥ�����ˤ���ͭ���Ǥ���@xref{COMMIT}��

``�ʤ� @strong{MySQL} �ϥȥ�󥶥������Υǡ����١����Ǥʤ��Τ���'' �Ȥ�
``�ʤ� @strong{MySQL} �ϥȥ�󥶥������򥵥ݡ��Ȥ��ʤ��Τ���''
�Ȥ��ä����䤬���Ф��Фʤ���ޤ���

@strong{MySQL} �ϡ��ǡ����μ�갷�����Ф���¾�Υѥ�����ࡢ
``���ȥߥå������ڥ졼�����''�򥵥ݡ��Ȥ������տޤ��Ʒ��ꤷ�ޤ�����
���ȥߥå������ڥ졼�����Ʊ�������뤤�Ϥ���ɤ��ѥե����ޥ󥹤�
�󶡤���Ȥ����Τ����桹�ηи�������ӹͤ��Ǥ���
����Ǥ⡢�桹�ϥȥ�󥶥������Ū�ǡ����١����ѥ������ȥץ���ɾ������
���򤷤Ƥ��ޤ������ο���꡼���Τ����ˡ��ơ��֥�ñ�̤���ܤˡ��ȥ�󥶥�����
������ơ��֥��Ƴ�����ޤ���
���λ��桹�ϡ��桼��������
���ԡ��ɽŻ�ǥ��ȥߥå������ڥ졼��������Ѥ���Τ������뤤��
���ץꥱ�������ǥȥ�󥶥������ε�ǽ��Ȥ��Τ���
������Ǥ���褦�ˤ��褦�ȹͤ��Ƥ��ޤ���

��̩�� integrity �ݻ�����ˤ� @strong{MySQL} �ε�ǽ��ɤΤ褦�˻��Ѥ����
�Ǥ��礦�� �����ơ��ȥ�󥶥������Ū�ѥ������Ǥ����ε�ǽ��ɤΤ褦��
��Ӥ���ΤǤ��礦��

�ǽ�ˡ��ȥ�󥶥������Υѥ������Ǥϡ�
�⤷�����ʤ��Υ��ץꥱ������� ���ܤȤʤ���ʬ��
``commit'' ������� ``rollback'' �θƤӽФ��˰�¸���Ƥ���ʤ顢
�ȥ�󥶥������Ϥ�������ˤʤ�Ǥ��礦��
���ޤ��ˡ��ȥ�󥶥������ϴ�λ�Ǥ��ʤ��ä�������������򵯤�����
�ǡ��������μ¤˥ǡ����١�������Ͽ����ʤ��褦�ˤǤ��ޤ���
���Υ����С��ˤϡ���ưŪ�� rollback �򤹤뵡��Ϳ����졢
���ʤ��Υǡ����ϼ����Ǥ��礦��

@strong{MySQL} �ϤۤȤ�ɤξ�硢�������δ�ñ�ʥ����å���ޤޤ��뤳�Ȥ��Ǥ����ꡢ
���뤤�ϥǡ����١�����̷��򸡺����Ƽ�ư������ٹ��ɽ����Ԥä��ꤹ��
��ñ�ʥ�����ץȤ�¹Ԥ��뤳�Ȥ��Ǥ���褦�ʡ�
�ݥƥ󥷥��򤢤ʤ����󶡤��ޤ���
@strong{MySQL} �����λ��Ѥ䳰���ؤΥ������ɲä�Ԥä��ꤹ����ǡ�
�̾�ǡ�����������Τ������ơ��֥�����˽����Ǥ��뤳�Ȥ����դ��Ƥ���������

����ˡ�``fatal'' transactional updates �ϥ��ȥߥå��ǽ񤭴����뤳�Ȥ��Ǥ��ޤ���
�ºݡ��ȥ�󥶥�����󤬲�褹�����Ƥ� integrity problems ��
 @code{LOCK TABLES} ��  atomic updates ���֤������뤳�Ȥ����衢
����ˤ���ϡ��ȥ�󥶥������Υǡ����١����ˤ������Ū������Ǥ��롢
�ǡ����١�������μ�ưŪ�����Ǥ����뤳��̵���ˡ���ǽ�ʤϤ��Ǥ���
In fact,we will go so far as to say that all integrity problems
that transactions solve can be done with @code{LOCK TABLES} or atomic updates,
ensuring that you never will get an automatic abort from the database,
which is a common problem with transactional databases.
 
�⤷�����С��������󤹤�Хȥ�󥶥������Ǥ����Ƥ򼺤����Ȥ��˻ߤǤ��ޤ���
���ξ�硢�ȥ�󥶥������Υ����ƥ�Ǥ�ǡ��������Ƽ����Ǥ��礦��
The difference
between different systems lies in just how small the time-lap is where
they could lose data. No system is 100% secure, only ``secure
enough''. Even Oracle, reputed to be the safest of transactional
databases, is reported to sometimes lose data in such situations.

@strong{MySQL} ������ˤ���ˤϡ��Хå����åפ��뤳�Ȥȡ�
����������ͭ���ˤ��뤳�Ȥ����Ǥ���
����ǡ����ʤ���¾�Υȥ�󥶥���������ĥǡ����١����ǹԤäƤ���褦��
�����ʤ���̤Ǥν�������ǽ�Ǥ���
������󡢥Хå����åפ�Ȥ뤳�Ȥϡ��ɤΥǡ����١�������Ѥ��Ƥ��뤫��
�ؤ�餺������ɤ����ȤǤ���

The transactional paradigm has its benefits and its drawbacks. Many
users and application developers depend on the ease with which they can
code around problems where an ``abort'' appears or is necessary, and they
may have to do a little more work with @strong{MySQL} to either think
differently or write more. If you are new to the atomic operations
paradigm, or more familiar or more comfortable with transactions, do not
jump to the conclusion that @strong{MySQL} has not addressed these
issues. Reliability and integrity are foremost in our minds.  Recent
estimates are that there are more than 1,000,000 mysqld servers
currently running, many of which are in production environments.  We
hear very, very seldom from our users that they have lost any data, and
in almost all of those cases user error is involved. This is in our
opinion the best proof of @strong{MySQL}'s stability and reliability.

Lastly, in situations where integrity is of highest importance,
@strong{MySQL}'s current features allow for transaction-level or better
reliability and integrity. If you lock tables with @code{LOCK TABLES}, all
updates will stall until any integrity checks are made.  If you only obtain
a read lock (as opposed to a write lock), then reads and inserts are
still allowed to happen.  The new inserted records will not be seen by
any of the clients that have a READ lock until they relaease their read
locks.  With INSERT DELAYED you can queue insert into a local queue,
until the locks are released, without having to have the client to wait
for the insert to complete.

``Atomic'', in the sense that we mean it is nothing magical, it only means
that you can be sure that while each specific update is running no other
user can interfere with it and that there will never be an automatic
rollback (which can happen on transaction based systems if you are not
very careful).  @strong{MySQL} also guarantees that there will not be
any dirty reads.

We have thought quite a bit about integrity and performance and we
believe that our atomic operations paradigm allows for both high
reliability and extremely high performance, on the order of three to
five times the speed of the fastest and most optimally tuned of
transactional databases. We didn't leave out transactions because they
are hard to do; The main reason we went with atomic operations as
opposed to transactions is that by doing this we could apply many speed
optimizations that would not otherwise have been possible.

Many of our users who have speed foremost in their minds are not at all
concerned about transactions. For them transactions are not an
issue. For those of our users who are concerned with or have wondered
about transactions vis a vis @strong{MySQL}, there is a ``@strong{MySQL}
way'' as we have outlined above. For those where safety is more important
than speed, we recommend them to use the @code{BDB} tables for all their
critical data. @xref{BDB}.

One final note: we are currently working on a safe replication schema
that we believe to be better than any commercial replication system we
know of. This system will work most reliably under the atomic
operations, non-transactional, paradigm. Stay tuned.

@node Missing Triggers, Missing Foreign Keys, Missing Transactions, Missing functions
@subsection ���ȥ��ɥץ�������ȥȥꥬ

���ȥ��ɥץ�������ϡ���������ǥ���ѥ���Ǥ���Ǽ�Ǥ��� SQL ���ޥ�ɤ�
���åȤǤ������٤��줬�Ԥʤ���ȡ����饤����Ȥϥ��������Τκ�ȯ�Ԥ���
������ɬ�פ��ʤ������ȥ��ɥץ�������򻲾ȤǤ��ޤ�������Ϥ���ˤ��®��®�٤���
�����ޤ���������ϰ��٤�����ᤵ�졢��꾯�ʤ��ǡ����������Фȥ��饤����
�ȴ֤���������뤫��Ǥ�����������˴ؿ��饤�֥�����Ĥ��Ȥˤ�공ǰ��
�٥��夲�뤳�Ȥ�Ǥ��ޤ���

�ȥꥬ�����̤ʥ��٥�Ȥ�ȯ���������˸ƤӽФ���륹�ȥ��ɥץ�������Ǥ���
�㤨�С��ȥ�󥶥������ơ��֥뤫��쥳���ɤ����������٤˥ȥꥬ���졢
�ȥ�󥶥�����󤬺�����줿���˼�ưŪ���б�����ܵҤ�ܵҥơ��֥뤫���
������Ȥ������ȥ��ɥץ�������򥤥󥹥ȡ��뤹�뤳�Ȥ��Ǥ��ޤ���

�ײ褵��Ƥ������ι����ϥ��ȥ��ɥץ������������Ǥ���褦�ˤʤ�ޤ�����
�ȥꥬ�Ͻ����ޤ����ȥꥬ���̾����Ƥ򡢤�����ɬ�פȤ��ʤ�������Ǥ�����
�٤����ޤ���

@strong{MySQL} �����ȥ��ɥץ����������������Τ�ˤϡ�@ref{TODO} �򻲾�
���Ƥ���������

@node Missing Foreign Keys, Missing Views, Missing Triggers, Missing functions
@subsection ��������

����: SQL �γ��������ϥơ��֥���礹�뤿��ˤϻ��ѤǤ��ޤ��󤬡��ؼ���
�������θ����Τ�����ɤ����Ѥ���ޤ���@code{SELECT} ���ơ��ȥ��Ȥ�ʣ��
�ơ��֥뤫���̤���������硢�ơ��֥�η��ˤ�äƤ����Ԥʤ��ޤ���

@example
SELECT * from table1,table2 where table1.id = table2.id;
@end example
@xref{JOIN, , @code{JOIN}}. @xref{example-Foreign keys}.

@strong{MySQL} ��Ǥ� @code{FOREIGN KEY} ��ʸ�ϡ�¾�� SQL �٥���� 
@code{CREATE TABLE} ���ޥ�ɤȤθߴ��Τ��������¸�ߤ��ޤ�; ����ϲ����
�ʤ��ޤ���@code{ON DELETE ...} ���ʤ� @code{FOREIGN KEY} ��ʸ�ϡ���Ū
�κ����Τ���˼�˻Ȥ��ޤ��������Ĥ��� ODBC ���ץꥱ�������ϡ���ưŪ
�� @code{WHERE} ����󶡤��뤿��ˡ��������Ѥ��ޤ�����������������̾�
��ñ��̵���ˤǤ��ޤ���@code{FOREIGN KEY} �ϻ������������å��Ȥ��ƻ��Ѥ�
��ޤ������������ơ��֥����������ǹԤ�����������硢���Υ����å��ϼ�
�ݤˤ����פǤ��������Ĥ��Υ��ץꥱ������󤬤��줬¸�ߤ��뤳�Ȥ��׵᤹��
���� @strong{MySQL} �Ϥ�����������򥵥ݡ��Ȥ��ޤ��ʤ��줬ư��뤫��
�����˴ؤ�餺���ˡ�

@strong{MySQL} �Ǥϡ�������������ĥơ��֥뤫��쥳���ɤ����������Ŭ
�ڤ� @code{DELETE} ���ơ��ȥ��Ȥ򥢥ץꥱ���������ɲä��뤳�Ȥǡ�
@code{ON DELETE ...} ����������Ƥ��ʤ��Ȥ�����������Ǥ��ޤ����ºݤ�
�ϡ������®��(�����Ĥ��ξ��Ϥ��®��)�����Ƴ��������λ��Ѥ��⤵���
������������ޤ���

�ᤤ���衢���ʤ��Ȥ������¸���졢������ @code{mysqldump} �� ODBC �ˤ��
�Ƽ��Ф����褦�ˡ��桹�� @code{FOREIGN KEY} �������ĥ���ޤ���

@menu
* Broken Foreign KEY::          ������������Ѥ��ʤ���ͳ
@end menu

@node Broken Foreign KEY,  , Missing Foreign Keys, Missing Foreign Keys
@subsubsection ������������Ѥ��ʤ���ͳ

�桹���ɤ�����Ϥ��Τ��狼��ʤ� @code{FOREIGN KEY} �ˤ�¿�������꤬��
��ޤ�:

@itemize @bullet
@item
���������Ͽ�����ȤƤ�ʣ���ˤ��ޤ���������������ϥǡ����١����˳�Ǽ����
����Фʤ餺������μ����ϰ�ư�����ԡ�������Ǥ���ե��������Ѥ���Ȥ�
�� ``�ɤ����ץ�����'' ���Ƥ��˴����뤫��Ǥ���

@item
@code{INSERT} �� @code{UPDATE} ���ơ��ȥ��Ȥؤ�®�٤αƶ��Ϥ�Τ�������
�����Ƥ��ξ�硢�ۤȤ�����Ƥ� @code{FOREIGN KEY} �����å������Ω���ޤ�
���̾�ϡ��������ơ��֥����������ǥ쥳���ɤ��������뤿��Ǥ���

@item
��ĤΥơ��֥�ι������ˤ�ä�¿���Υơ��֥��ǥ��å����ݻ�����ɬ�פ⤢
��ޤ��������Ѥ��ǡ����١������Τ��̤���ȯ�����뤫��Ǥ����ޤ���ĤΥơ�
�֥뤫��쥳���ɤ������ơ����줫��¾�Υơ��֥뤫�餽����������ۤ�
���ȤƤ�®���Ǥ���

@item
�ơ��֥뤫�鴰���ʺ����ԤʤäƤ������ƤΥ쥳���ɤ�ʿ�������������Х�
�����åפ���˥ꥹ�ȥ����뤳�Ȥˤ�äơ��ơ��֥���������뤳�ȤϤ⤦�Ǥ�
�ޤ���

@item
������������ľ�硢�ơ��֥�Υ���פȥꥹ�ȥ�������ν�˹Ԥʤ�ʤ��Ȥ�
���ޤ���

@item
���� create ���ơ��ȥ��Ȥdzƥơ��֥����������뤳�Ȥ�ơ��֥�ˤǤ�
�ʤ�����褦�� ``�����줿'' ��������Ԥʤ����ȤϤȤƤ��ñ�Ǥ���������
����ư��ƻ��ѤǤ����Ȥ��Ƥ�Ǥ���
@end itemize

�����������ɤ��̤ϡ�ODBC ��¾�Τ����Ĥ��Υ��饤����ȥץ������ˡ��ɤ�
�褦�˥ơ��֥뤬��³����뤫�򸫤뵡ǽ��Ϳ�����������Ѥ�����³�ޤ򼨤���
�������ץꥱ�������μ�����򤹤뤳�Ȥ����Ǥ���

@strong{MySQL} �ϴ֤�ʤ������饤����Ȥ��ɤΤ褦�˥��ꥸ�ʥ���³������
���줿�����䤤��碌���������������褦�� @code{FOREIGN KEY} ������
Ǽ���ޤ������ߤ� @file{.frm} �ե���������ˤϤ�����֤����Ϥ���ޤ���

@node Missing Views, Missing comments, Missing Foreign Keys, Missing functions
@subsection �ӥ塼

@strong{MySQL} �ϥӥ塼�򥵥ݡ��Ȥ��ޤ��󡣤���������� TODO �ˤ���ޤ���

@node Missing comments,  , Missing Views, Missing functions
@subsection �����ȳ��ϤȤ��Ƥ� @samp{--}

¾�Τ����Ĥ��� SQL �ǡ����١����ϡ�@samp{--} �򥳥��Ȥγ��ϤΤ���˻�
�Ѥ��ޤ���@strong{MySQL} �� @samp{#} �򥳥��ȳ���ʸ���Ȥ��ޤ���
@code{mysql} ���ޥ�ɥ饤��ġ��뤬 @samp{--} �ǻϤޤ����ƤιԤ�������
�Ȥ��Ƥ�Ǥ���@strong{MySQL} �Ǥ� C �����ȥ������� @code{/* ����ϥ���
��� */} ����ѤǤ��ޤ���@xref{Comments}��

@strong{MySQL} 3.23.3 �ʾ�� @samp{--} �򥵥ݡ��Ȥ��ޤ���; �����ಽ���������ȥ���
����ϡ����Υ����ɤΤ褦�� @code{!payment!} �� payment ���ͤ�ưŪ����
������褦�ʲ�������Ѥ��Ƽ�ưŪ����������� SQL �������¿����������
������������Ǥ�:

@example
UPDATE tbl_name SET credit=credit-!payment!
@end example

@code{payment} ���ͤ���ξ��˲���������Ȼפ��ޤ�����

@code{1--1} �������� SQL �ʤΤǡ��桹�� @samp{--} �򥳥��ȳ��Ϥȸ��ʤ�
���ȤϤҤɤ����Ȥ��Ȼפ��ޤ���

������ @strong{MySQL} 3.23 �Ǥϼ�����ѤǤ��ޤ�:  @code{1-- ����ϥ�����}

�ʹߤ������Ǥϡ�3.23 �������� @strong{MySQL} �С�������¹Ԥ��Ƥ����
��������оݤǤ�:

�ƥ����ȥե������ SQL �ץ�����ब @samp{--} �����Ȥ�ޤ�Ǥ����硢
������Ѥ��٤��Ǥ�:

@example
shell> replace " --" " #" < text-file-with-funny-comments.sql \
         | mysql database
@end example

�̾�μ��������:

@example
shell> mysql database < text-file-with-funny-comments.sql
@end example

������ˡ�Ǥ⡢���ޥ�ɥե�������� @samp{--} �����Ȥ� @samp{#} �����
�Ȥ��ѹ��Ǥ��ޤ�:

@example
shell> replace " --" " #" -- text-file-with-funny-comments.sql
@end example

�����ϼ��Υ��ޥ�ɤ��ᤷ�Ƥ�������:

@example
shell> replace " #" " --" -- text-file-with-funny-comments.sql
@end example

@node Standards, Commit-rollback, Missing functions, Compatibility
@section @strong{MySQL} ����򤷤Ƥ���ɸ��

Entry level SQL92. ODBC level 0-2.

@node Commit-rollback,  , Standards, Compatibility
@section @code{COMMIT}/@code{ROLLBACK} �ʤ��Ǥ��ޤ������ˡ

The following mostly apply only for @code{ISAM}, @code{MyISAM} and
@code{HEAP} tables; If you only use transaction safe tables (@code{BDB}
tables) in an a update you can do @code{COMMIT} and @code{ROLLBACK} also
with @code{MySQL}.  @xref{COMMIT}.

The problem with handling @code{COMMIT}-@code{ROLLBACK} efficiently with
the above table types would require a completely different table layout
than @strong{MySQL} uses today. 
���η��Υơ��֥�ϡ���ưŪ�˥ơ��֥�򥯥꡼�󥢥åפ����ĥ����åɤ�ɬ��
�Ȥ����ǥ����������̤Ϥ�����礭���ʤ�ޤ��� ����� @strong{MySQL} �򸽺�
���� 2��4 ���٤����Ƥ��ޤ��ޤ���

�����桹�� SQL �����и���(���ȥ��ɥץ�������Τ褦�ʤ��)�μ����ˤ����
�����Ǥ�������ǡ������� @code{COMMIT}-@code{ROLLBACK} ��ɬ�פȤ���Τ�
��ä��ˤ���ޤ��󡣤���Ϥ�����ɤ���ǽ��Ϳ����Ǥ��礦��

�ȥ�󥶥�������ɬ�פȤ���롼�פϡ��̾�� @code{LOCK TABLES} �ν�����
�����ɲ��Ǥ��������� fly ��ǥ쥳���ɤι������ˤϥ��������ɬ�פȤ��ޤ�
��

�桹 TcX ��������ɬ�פȤ��Ƥ���Τϡ�100% ɸ��Υǡ����١����ǤϤʤ��ơ�
������®���ǡ����١����Ǥ���®���㲼�ʤ��Ǥ����ε�ǽ�����������ˡ�򸫤Ĥ���
�Ȥ��ˤϡ��桹�Ϥ����Ԥʤ��Ǥ��礦�����Ф餯�ϹԤʤ��٤�����˽��פʤ�
�Ȥ�¿������ޤ������β桹��ͥ���٤ˤĤ��Ƥ� TODO ������å����Ƥ���������
���٥�Υ��ݡ��Ȥ���ĸܵҤϤ�����Ѥ��뤳�Ȥ��Ǥ����Ƥ�ͥ���̤Ť���
�Ԥʤ��ޤ���

���ߤ�����ϼºݤˤ� @code{ROLLBACK} �Ǥ���@code{ROLLBACK} �ʤ��Ǥ� 
@code{LOCK TABLES} �� @code{COMMIT} ���������Τ����Ĥ��μ����Ԥʤ���
�Ȥ��Ǥ��ޤ���@code{ROLLBACK} �򥵥ݡ��Ȥ��뤿��ˤϡ�������������Ƥθ�
���쥳���ɤ��Ǽ����@code{ROLLBACK} ��ȯ�Ԥ��줿���˳��ϰ��֤����Ƥ���
���褦�ˡ�@strong{MySQL} ���ѹ����ʤ���Фʤ�ޤ���ñ��ʾ��ˤϡ���
���Ԥʤ��ˤ��񤷤�����ޤ���(���ߤ� @code{isamlog} �򤳤���Ū�˻��Ѥ�
�ޤ�)����������@code{ALTER/DROP/CREATE TABLE} �Ǥ� @code{ROLLBACK} �μ�
����Ԥ����ȤϤȤƤ⺤��Ǥ���

@code{ROLLBACK} �λ��Ѥβ���Τ���ˡ�������ˡ����Ѥ��뤳�Ȥ��Ǥ��ޤ�:

@enumerate
@item
@code{LOCK TABLES ...} �򥢥������������ơ��֥�����Ƥ���å����뤿���
���Ѥ��ޤ�
@item
���Υƥ��ȡ�
@item
���� OK �ʤ鹹����
@item
@code{UNLOCK TABLES} ����å��β���˻��Ѥ��ޤ�
@end enumerate

��������̤� @code{ROLLBACK} ��ǽ�ʥȥ�󥶥������λ��Ѥ���®���Ǥ�
������ˤǤϤ���ޤ��󡣤��β򤬽����Ǥ��ʤ������ϡ��������ï���������
�ɤ� kill ����������Ǥ������ξ�硢���ƤΥ��å��ϥ�꡼������ޤ�������
���Ĥ��ι����ϼ¹Ԥ���ޤ���

1��Υ��ڥ졼�������ǥ쥳���ɤ򹹿�����ؿ�����ѤǤ��ޤ������Υƥ��˥å�
�ˤ�äƤȤƤ��ΨŪ�ʥ��ץꥱ�����������뤳�Ȥ��Ǥ��ޤ���

@itemize @bullet
@item
�ե�����ɤ򸽺ߤ��ͤ���Ӥ����ѹ�����

@item
�ºݤ��ѹ����줿�ե�����ɤ����򹹿�����
@end itemize

�㤨�С������Ĥ��θܵҾ���ǹ�����ԤʤäƤ�������桹���ѹ����줿�ܵҥǡ�
�������򹹿������ѹ�����Ƥ��ʤ��ǡ����ϥƥ��Ȥ������ѹ����줿�ǡ����˰�
¸�����ѹ����줿�ǡ��������ꥸ�ʥ�ιԤ���Ӥ���ޤ����ѹ��Υƥ��Ȥ� 
@code{UPDATE} ���ơ��ȥ������ @code{WHERE} ��ǹԤ��ޤ����쥳���ɤ�
��������ʤ��ä����ϡ��桹�ϥ��饤����Ȥ˥�å�����: "Some of the data
you have changed has been changed by another user" ��Ϳ���������Ƥ��줫
��Ť��Ԥȿ������Ԥ򥦥���ɥ����ɽ�����ޤ����桼���ϸܵҥ쥳���ɤΤɤ�
��ΥС���������Ѥ��٤��������Ǥ��ޤ���

����� ``column locking'' �˻�����Τ�桹��Ϳ���ޤ������ºݤˤϽ�ʬ�Ǥ���
�ʤ��ʤ顢�桹�Ϥ����θ��ߤ��ͤ˴�Ϣ�����ͤ���ĥե�����ɤ����򹹿����뤫��
�Ǥ�������ϡ�ŵ��Ū�� @code{UPDATE} ���ơ��ȥ��Ȥ����Τ褦�˸������
�������Ȥ��̣���ޤ�:

@example
UPDATE tablename SET pay_back=pay_back+'relative change';

UPDATE customer
  SET
    customer_date='current_date',
    address='new address',
    phone='new phone',
    money_he_owes_us=money_he_owes_us+'new_money'
  WHERE
    customer_id=id AND address='old address' AND phone='old phone';
@end example

���Ƥ��̤ꡢ¾�Υ��饤����Ȥ� @code{pay_back} �ޤ��� 
@code{money_he_owes_us} �ե�����ɤ��ͤ��ѹ������Ȥ��Ƥ⡢����ϤȤƤ��ΨŪ��
Ư���ޤ���

@findex mysql_insert_id()
@findex LAST_INSERT_ID()
¿���ξ�硢�桼���� @code{ROLLBACK} ������/�ޤ��� @code{LOCK TABLES} ��
�����Ĥ��Υơ��֥�ǥ�ˡ����ʼ��̻Ҥ�������뤳�Ȥ�˾�ߤޤ�������ϡ�
@code{AUTO_INCREMENT} �ե�����ɤ� SQL @code{LAST_INSERT_ID()} �ؿ��� C API ��
�� @code{mysql_insert_id} �λ��Ѥˤ�äơ�����˸�ΨŪ�˽����Ǥ��ޤ���
@xref{mysql_insert_id, , @code{mysql_insert_id()}}.

@cindex row-level locking
TcX �Ǥϡ��桹�Ϥ��ĤǤ⤽�����򤷤ƥ����ɲ�ǽ�ʤΤǡ��桹�Ϲԥ�٥����
����ɬ�פȤ��Ƥ��ޤ��������˹ԥ��å���ɬ�פȤ��륱�����⤢��ޤ�������
������������ˤޤ�Ǥ����ԥ�٥���å���˾��Τʤ顢�ơ��֥���ǥե饰
���ܤ���Ѥ��ơ����Τ褦�ˤ��ƹԤʤ��ޤ�:

@example
UPDATE tbl_name SET row_flag=1 WHERE id=ID;
@end example

�Ԥ����Ĥ��ꡢ���ꥸ�ʥ����� @code{row_flag} ������ 1 �Ǥʤ���硢
@strong{MySQL} �ϱƶ����줿�Կ��Ȥ��� 1 ���֤��ޤ���

@strong{MySQL} ����ҤΥ�����򼡤��ѹ������ȹͤ��뤳�Ȥ���ǽ�Ǥ�:

@example
UPDATE tbl_name SET row_flag=1 WHERE id=ID and row_flag <> 1;
@end example

@node Privilege system, Reference, Compatibility, Top
@chapter @strong{MySQL} �Υ桼�������¤ϤɤΤ褦��ư������

@strong{MySQL} �����Ū����ɸ��Υ������ƥ�/�ø������ƥ����äƤ��ޤ���
�ܾϤǤϤɤΤ褦�ˤ��줬ư������Ҥ٤ޤ���

@menu
* General security::            General security
* Security::                    @strong{MySQL} �򥯥�å������Ф��ư����ˤ�����ˡ
* What Privileges::             �ø������ƥ�ιԤ�����
* User names::                  @strong{MySQL} user names and passwords
* Connecting::                  @strong{MySQL} �����С�����³
* Password security::           Keeping your password secure
* Privileges provided::         @strong{MySQL} ���󶡤��븢��
* Privileges::                  �ø������ƥ�ϤɤΤ褦��ư������
* Connection access::           Access control, stage 1: ��³�ξ�ǧ
* Request access::              Access control, stage 2: �׵�ξ�ǧ
* Privilege changes::           When privilege changes take effect
* Default privileges::          @strong{MySQL} ���µ��Ĥν������
* Adding users::                �������桼�����¤� @strong{MySQL} ���ɲ�
* Passwords::                   �ѥ���ɤ�����ˡ
* Access denied::               ���� @code{Access denied} ���顼�ˤʤ�Τ�
@end menu

@node General security, Security, Privilege system, Privilege system
@section �������ƥ�����

�褯���륻�����ƥ��δְ㤤���򤱤뤿��ˡ����󥿡��ͥåȤ���³���줿����
�ԥ塼����� @strong{MySQL} ����Ѥ���ï�⤬�����Υ����������ɤ�٤��Ǥ���

``�������ƥ�'' �ε����Ǥϡ����٤Ƥγ������륢���å�������
(eavesdropping, altering, playback, Denial of Service)���Ф��ơ����٤ƤΥ���
�Хۥ���(ñ�ʤ� @strong{MySQL} �����ФǤϤʤ�)�δ������ݸ��ɬ�פ�Ĵ����
����We do not cover all aspects of availability and fault tolerance
here.

@strong{MySQL} �ϡ��桼�����¹Ԥ��褦�Ȥ��뤹�٤Ƥ���³�������ꡢ����¾��
���ڥ졼�������Ф��ơ�������������ꥹ��(ACLs: Access Control Lists)������
��ƥ�����Ѥ��ޤ���@strong{MySQL} ���饤����Ȥȥ����Фδ֤� SSL �Ź沽��
³�Υ��ݡ��Ȥ⤤���Ĥ�����ޤ��������ǵ�������륳�󥻥ץȤ�¿���ϡ�
@strong{MySQL} ����ͭ�Τ�ΤǤϤ���ޤ���; Ʊ������Ū�ʥ����ǥ��ϤۤȤ��
���٤ƤΥ��ץꥱ��������Ŭ�Ѥ��ޤ���

@strong{MySQL} �¹Ի�����ǽ�ʸ¤ꤤ�ĤǤ⤳���Υ����ɥ饤��˽��äƤ���
����:

@itemize @bullet
@item
@strong{MySQL} ACL �����ƥ��������ؤ��٤��Ǥ���
@code{GRANT} �� @code{REVOKE} ���ޥ�ɤ� @strong{MySQL} �ؤΥ������������¤��뤿���ʪ�Ǥ���
ɬ�װʾ�θ��¤�ï�ˤ�Ϳ���ʤ��Ǥ���������
���ƤΥۥ��Ȥ��Ф��ơ����������褦�ʵ��Ĥ�Ϳ���ƤϤ����ޤ���

Checklist:
@itemize @bullet
@item
@code{mysql -u root} ��ԤäƤߤޤ���

�ѥ���ɤ�Ҥͤ��뤳��̵���˥����Фؤ���³���Ǥ����硢���꤬����ޤ���
�ɤΥ桼���Ǥ�(root �Ǥʤ��Ƥ�)��@strong{MySQL} �����Ф˴����ʸ��¤���³��
���ޤ��� @code{root} �ѥ���ɤ�����ˤĤ��Ƥι��ܤ����̤����դ�ʧ�ä�
@strong{MySQL} ���󥹥ȡ���������ľ���Ƥ���������

@item
@code{SHOW GRANTS} ����Ѥ������줬�ʤ�Υ�����������Ĥ������å����ޤ���
ɬ�פʤ����¤�@code{REVOKE} ���ޥ�ɤ���Ѥ��ƺ�����Ƥ���������
@end itemize

@item
�����ʤ�ʿʸ�ѥ���ɤ�ǡ����١�������¸���ʤ��褦�ˤ��ޤ���
���ʤ��Υ���ԥ塼�����Ŷ��������������Ԥϥѥ���ɤδ����ʥꥹ�Ȥ����ơ�
��������ѤǤ��ޤ�������� @code{MD5()} ��¾�� one-way hashing �ؿ���
���Ѥ��Ƥ���������
@item
����ˤΤäƤ���ñ���ѥ���ɤ˻��Ѥ��ƤϤ����ޤ��� �������ˤ�
�ץ�����ब����ΤǤ��� ``xfish98'' �Τ褦�ʥѥ���ɤϰ�����Ǥ���
������� ``duag98'' �������褤�Ǥ��礦�� ����� "fish" ���Ǥĺݤˡ�
�������Ĥ��Ĥ��餷����ΤǤ��� ¾����ˡ�Ȥ��Ƥϡ� "Mhall" �������
"Mary had a little lamb" �Ȥ���ʸ��Ƭʸ�������󤷤���ΤǤ���
������ΤäƤ���ʪ�ˤ��Ǥ��䤹���ѥ���ɤǤ������Τ�ʤ��ԤˤȤäƤϡ�
��䤹�뤳�Ȥ��񤷤��ѥ���ɤǤ���
@item
�ե����������������Ƴ�����ޤ���This protects from at least 50% of all types of
 exploits in any software.
@strong{MySQL} ��ե���������������Ǽ��줿�����֤�����
DMZ (�˾�����, ����������) ���֤��ޤ���

Checklist:
@itemize @bullet
@item
���󥿡��ͥåȤ��� @code{nmap} �Τ褦�ʥġ������Ѥ��ơ�
���ʤ��Υޥ���Υݡ��Ȥ򥹥���󤷤Ƥߤޤ���
@strong{MySQL} �ϥǥե���Ȥ� 3306 �֤���Ѥ��Ƥ��ޤ���
���Υݡ��Ȥˤϡ��ۤȤ�ɤξ�硢���������Ǥ��ʤ��褦�ˤ��٤��Ǥ���

@strong{MySQL} �ݡ��Ȥ������ץ󤷤Ƥ��뤫�ɤ���������å�����¾�δ�ñ����
ˡ�ϡ������Ĥ��Υ�⡼�ȥޥ��󤫤� @code{telnet server_host 3306} ��¹Ԥ�
�뤳�ȤǤ��������� @code{server_host} �Ϥ��ʤ��� @strong{MySQL} �����ФΥ�
����̾�Ǥ�����³���������Ĥ��Υ���ʸ��������줿��硢�ݡ��Ȥϥ����ץ󤷤�
���ޤ�������򥪡��ץ󤷤Ƥ�����������ͳ�������ˤʤ��¤ꡢ�ե�������������
���롼���ǥ����������٤��Ǥ���@code{telnet} ���ϥ󥰤����硢���٤� 
OK �Ǥ����ݡ��Ȥϥ֥��å�����Ƥ��ޤ���
@end itemize

@item
�桼�����������Ϥ��줿�ǡ����Ͽ��ꤷ�ʤ��Dz�������
�桼�����ϡ�Web�Υե����ࡢURL�����뤤�Ϥ��ʤ��Υ�������ץ�����फ��
�����ʸ��������뤳�Ȥ���ǽ�Ǥ��� �⤷�桼�������ե������
@code{; DROP ALL DATABASES ;} �Τ褦��ʸ�������Ϥ��Ƥ⡢
���ʤ��Υ��ץꥱ�������ϰ����Ǥ�����
����϶�ü����Ǥ������������Ф��ƽ������ʤ���硢�����褦�ʥƥ��˥å���
���Ѥ���ϥå����η�̤Ȥ��ơ��礭�ʥ������ƥ��꡼���ȥǡ����Ӽ���ȯ����
���ޤ���

���ͥǡ����Υ����å���˺��ʤ��Ǥ����������褯����ְ㤤��ʸ���󤷤��ݸ
�ʤ����ȤǤ����������ͤϥǡ����١������ݸ���ɬ�פΤʤ�����ͭ���ʥǡ���
������ޤ�Ǥ��뤫�ɤ�����ͤ��ޤ�������ϴְ㤤�Ǥ������ʤ��Ȥ⡢
Denial-of-Service �����פΥ����å��Ϥ��Τ褦�ʥǡ����١����Ǥ�¹Ԥ���ޤ���
���Υ����פΥ����å������ݸ���äȤ��ñ����ˡ�ϡ���������β��˥���
���ȥ��ե�����Ѥ��뤳�ȤǤ�: @code{SELECT * FROM table WHERE ID=234} ����
���� @code{SELECT * FROM table WHERE ID='234'}��@strong{MySQL} �ϼ�ưŪ
�ˤ���ʸ�������ͤ��Ѵ������������餹�٤Ƥ�����ͥ���ܥ��������ޤ���

�����å��ꥹ��:
@itemize @bullet
@item
���٤Ƥ� WWW ���ץꥱ�������:
@itemize @bullet
@item
���ʤ��� WWW �����ƤΥե�����ˡ�@samp{'} �� @samp{"} �����Ϥ��뤳�Ȥ��ߤƤ���������
�⤷�ʤ�餫�� @strong{MySQL} ���顼���Ǥ��顢���ʤ��Υ����Ȥ���ߤ����ۤ���
�褤�Ǥ��礦��
@item
���ʤ��� URL �� @code{%22} (@samp{"}), @code{%23} (@samp{#}) , @code{%27} (@samp{'}) ��Ĥ��Ƥߤơ�ưŪURL��
���������ѹ����ƻ�ƤߤƤ���������
@item
ưŪ URL �Υǡ��������פ���ͤ����Ҥ����ʸ����ޤ�ʸ����˽������Ƥߤ�
�������������ץꥱ�������Ϥ���Ȼ����褦�ʥ����å����Ф��ư����Ǥ���٤�
�Ǥ���
@item
���ͥե�����ɤ��Ф��ơ�ʸ�������ڡ������ü�ʸ�������Ϥ��ߤƤ���������
���ץꥱ�������ϡ������� @strong{MySQL} ���������˼���������
���뤤�ϥ��顼��Ф��٤��Ǥ��� �������ʤ��ͤ� @strong{MySQL} �����뤳�Ȥϴ����Ǥ���
@item
@strong{MySQL} �˥ǡ������������ˡ����Υ�����������å����ޤ���
@item
���ʤ��Υ��ץꥱ������󤬡�������Ū�Ǥ��ʤ������Ѥ���ΤȰۤʤ�桼��̾��
���Ѥ��ƥǡ����١�������³���뤳�Ȥ��θ���Ƥ���������ɬ�װʾ�Υ���������
�򥢥ץꥱ��������Ϳ���ʤ��Dz�������
@end itemize
@item
PHP �桼��:
@itemize @bullet
@item
@code{addslashes()} �ؿ���Ĵ�٤ޤ���
@end itemize
@item
@strong{MySQL} C API �桼��:
@itemize @bullet
@item
@code{mysql_escape()} API �����뤬���뤫Ĵ�٤ޤ�.
@end itemize
@item
@strong{MySQL}++ �桼��:
@itemize @bullet
@item
Check out the @code{escape} and @code{quote} modifiers for query streams.
@end itemize
@item
Perl DBI �桼��:
@itemize @bullet
@item
Check out the @code{escape} and @code{quote} modifiers (?) for query streams.
@item
Check out the @code{quote()} method.
@end itemize
@end itemize

@item
���Υǡ���(�Ź沽����Ƥ��ʤ��ǡ���)�򥤥󥿡��ͥåȱۤ������äƤϤ����ޤ���
This data is accessible to
everyone who have interest to trap this information and reuse it
somewhere. �⤷����ɬ�פ�����ʤ顢SSL �Τ褦�ʰŹ沽���줿�̿���
���Ѥ��٤��Ǥ���
@strong{MySQL} supports internal SSL connections beginning from
version 3.23.9.
SSH port-forwarding can be used to create an encrypted (and compressed)
tunnel for the communication.
@item
"tcpdump", "strings" �桼�ƥ���ƥ���Ȥ����Ȥ�ؤ�Dz�����.
�ʲ��Υ��ޥ�ɤǡ��ۤȤ�ɤξ�硢�Ź沽����Ƥ��ʤ�
@strong{MySQL} �Υǡ�����������Ǥ��礦��
@example
shell> tcpdump -l -i eth0 -w - src or dst port 3306 | strings
@end example
(������� Linux �Τ�ΤǤ���¾�Υ����ƥ�ǤϾ����㤦�Ǥ��礦).
 Warning: If you do not see data this doesn't actually
always mean that it is encrypted. If you need high security you should
consult with security expert.
@end itemize


@node Security, What Privileges, General security, Privilege system
@section @strong{MySQL} �򥯥�å������Ф��ư����ˤ�����ˡ

@strong{MySQL} �����С�����³����Ȥ��ϡ��ѥ���ɤ���Ѥ��٤��Ǥ���
�ѥ���ɤϥ��ͥ������֤ǡ��٤��ƥ����ȤǤ�ή��ޤ���

����¾�����Ƥξ���ϥƥ����Ȥ�ž�����졢
�������³���������Ȥ������ͤ��ɤޤ�ޤ���
�⤷������ۤ���ʤ顢���̥ץ��ȥ���(@strong{MySQL} 3.22 �ʾ�)��
���Ѥ��뤳�Ȥ�����ޤ����������ˤ�������硢
@code{ssh} (@uref{http://www.cs.hut.fi/ssh}) �򥤥󥹥ȡ��뤹�٤��Ǥ���
�������Ѥ���С�@strong{MySQL} �����С��� @strong{MySQL} ���饤�����
�֤� TCP/IP ���ͥ����������ưŹ沽����ޤ���
 
@strong{MySQL} �����ƥ������ˤ��뤿��ˤϡ����Τ��Ȥ�ͤ���٤��Ǥ�:

@itemize @bullet
@item
���Ƥ� @strong{MySQL} �桼���˥ѥ���ɤ���Ѥ��٤��Ǥ���
@code{other_user} �˥ѥ���ɤ����ꤵ��Ƥ��ʤ���硢
ï�Ǥ� @code{mysql -u other_user db_name} �Ȥ��ƴ�ñ��¾�οͤȤ��ƥ�������Ǥ�
�뤳�Ȥ�Ф��Ƥ�����������������ƤΥ��饤����ȡ������Х��ץꥱ�������
�ǰ���Ū�ʿ����񤤤Ǥ������ƤΥ桼���Υѥ���ɤϡ�
@code{mysql_install_db} ������ץȤ�¹������Խ����뤳�Ȥǡ��ޤ��� 
@strong{MySQL} @code{root} �桼�������ϼ��Τ褦�ˤ����ѹ����뤳�Ȥ��Ǥ��ޤ���

@example
shell> mysql -u root mysql
mysql> UPDATE user SET Password=PASSWORD('new_password')
           WHERE user='root';
@end example

@item
@strong{MySQL} �ǡ����� Unix �� @code{root} �桼�����Ǽ¹Ԥ��ʤ��Ǥ���������
It is very dangerous as any user with @code{FILE} privileges will be able to
create files
as @code{root} (e.g. @code{~root/.bashrc}). To prevent this
@code{mysqld} will refuse to run as @code{root} unless it is specified
directly via @code{--user=root} option.

@code{mysqld} ��Ǥ�դΥ桼���Ǽ¹ԤǤ��ޤ���
�������ˤ��뤿�ᡢ������ Unix �桼�� @code{mysql} ���ɲä��뤳�Ȥ�Ǥ��ޤ���
@code{mysqld} �� ¾�� Unix �桼�����ǵ�ư�����Ȥ��Ƥ⡢
@strong{MySQL} �� @code{user} �ơ��֥�� @code{root} �桼������̾�����ѹ�����ɬ�פϤ���ޤ���
�ʤ��ʤ顢 @strong{MySQL} �桼������̾���� Unix �Υ桼����̾�ȤϤʤ�δط���ʤ�����Ǥ���
root �桼��̾���ѹ�����ɬ�פϤ���ޤ���
@code{mysqld} ��¾�� Unix �桼���ǵ�ư���뤿��ˡ�@code{mysql.server} �Խ����Ƥ�褤�Ǥ��礦��
�̾����� @code{su} ���ޥ�ɤǹԤ��ޤ���
���ܤ�������� �� @ref{Changing MySQL user, , Changing @strong{MySQL} user}.

@item
@code{mysql.server} ������ץ���� Unix @code{root} �桼�����Τ���˥ѥ���ɤ�
�񤤤���硢���Υ�����ץȤ� @code{root} �������ɤ��褦�ˤ��ʤ��Ƥ�
�ʤ�ޤ���

@item
�ǡ����١����ǥ��쥯�ȥ�� @code{mysqld} ��¹Ԥ��Ƥ��� Unix �桼��������
�ɤ߹��ߡ��񤭹��߲�ǽ�ʤ��Ȥ�����å����Ƥ���������

@item
On Unix platforms, do not run @code{mysqld} as root unless you really
need to. Consider creating a user named @code{mysql} for that purpose.

@item
@strong{process} ���¤����ƤΥ桼����Ϳ���ʤ��Ǥ������������ε��Ĥ�����ͤ�ï�Ǥ�
@code{mysqladmin processlist} ���ޥ�ɤǼ¹Ԥ���Ƥ��륯���꡼����Ȥ򸫤뤳�Ȥ��Ǥ��ޤ���
�⤷ï������@code{UPDATE user SET password=PASSWORD('not_secure')} �����꡼��
�¹Ԥ��Ƥ����Ȥ��ơ����줬�����Ƥ��ޤ��ޤ���

@code{mysqld} �� @strong{process} ���¤���ĥ桼�����Ф������̤���³��ꥶ���֤��ޤ���
���Τ��ᡢ���Ȥ����Ƥ��̾���³���Ȥ�줿�Ȥ��Ƥ⡢@strong{MySQL} @code{root} �桼�������ϡ�
��������Ǥ����������������å��Ǥ��ޤ���

@item
@strong{file} �����ƤΥ桼����Ϳ���ʤ��Ǥ����������桼�������θ��¤���ľ�
�硢@code{mysqld} �ǡ�����¹Ԥ��Ƥ��� Unix �桼�����θ��¤�
�ե����륷���ƥ���Τɤ��ˤǤ�ե������񤭹��ळ�Ȥ��Ǥ��ޤ���
����򾯤������ˤ��뤿��ˡ�@code{SELECT ... INTO OUTFILE} �Ǻ�����������ƤΥե������
�������ɤ߹��߲�ǽ���������졢��¸�Υե�����ˤϾ�񤭤Ǥ��ޤ���

@tindex /etc/passwd
@strong{file} ���¤ϥ����С������餻�Ƥ��� UNIX �桼���������������Ǥ���
���ƤΥե�������ɤि��˻��Ѥ��줫�⤷��ޤ���
�㤨�С� @file{/etc/passwd} ��ơ��֥�˼����ि��� @code{LOAD DATA} ��
���Ѥ����ȡ� @code{SELECT} �Ǥ������Ƥ��ɤ�뤳�Ȥˤʤ�ޤ���

@item
���ʤ��� DNS ���Ѥ��ʤ���硢���¥ơ��֥���ˤϥۥ���̾������� IP 
����Ѥ��٤��Ǥ���@code{mysqld} �ؤ� @code{--secure} ���ץ����ϸ�����ϥۥ���̾���
���ˤ��ޤ����ɤ�ʾ��Ǥ⡢�磻��ɥ����ɤ�ޤ���ۥ���̾�򡢵��ĥơ��֥����Ͽ����
�������������տ������٤��Ǥ���

@end itemize

@code{mysqld} �ؤμ��Υ��ץ����ϥ������ƥ��˱ƶ����ޤ�:

@table @code
@item --secure
@code{gethostbyname()} �����֤���� ip �����ꥸ�ʥ�Υۥ���̾���᤻�뤫��
����������å����ޤ�������ϡ�����ï����¾�Υۥ��Ȥ򿿻��ƥ�������������
���Ȥ��񤷤����ޤ������Υ��ץ����Ϥ����Ĥ����������ۥ���̾�����å�����
�ä��ޤ�������ϡ����˥����å���Ĺ�����֤������뤿�ᡢ@strong{MySQL} 3.21
�Ǥϥǥե���ȤǤϥ��դˤ���Ƥ��ޤ���@strong{MySQL} 3.22 �ǤϤ��Υ��ץ�����
�ǥե���Ȥ�ͭ���ˤʤäƤ��ޤ������ۥ���̾�򥭥�å��夹��褦�ˤʤäƤ��ޤ���

@item --skip-grant-tables
�ø������ƥ���������Ѥ��ޤ��󡣤�������������ƤΥǡ����١����ؤ� 
@emph{�����ʥ�������} ��Ϳ���ޤ���
(@code{mysqladmin flush-privileges} �� @code{mysqladmin reload} ��¹Ԥ��뤳�Ȥǡ�
��ư���Ƥ��륵���С����ø������ƥ����Ѥ���褦�ˤʤ�ޤ���)

@item --skip-name-resolve
�ۥ���̾����Ϥ��ޤ��󡣸��¥ơ��֥�������Ƥ� @code{Host}�ե�����ɤ� IP ���ɥ쥹��
@code{localhost} �Ǥʤ���Фʤ�ޤ���

@item --skip-networking
�ͥåȥ�� (TCP/IP) ��ͳ����³����Ĥ��ޤ���@code{mysqld} �ؤ����Ƥ���³�ϡ�
Unix �����åȤǹԤ��ޤ���MIT-pthreads �� Unix �����åȤ򥵥ݡ��Ȥ��ʤ�
���ᡢ���Υ��ץ����� MIT-pthreads ����Ѥ��륷���ƥ��Ǥϡ����ޤ�ư���ޤ���
@end table


@node What Privileges, User names, Security, Privilege system
@section �ø������ƥ�ιԤ�����

@strong{MySQL} �ø������ƥ�δ��ܵ�ǽ�ϡ�Ϳ����줿�ۥ��Ȥ�����³����
�桼����ǧ�ڤ��뤳�ȡ������ƥǡ����١������Ф���
 @strong{select}, @strong{insert}, @strong{update}, @strong{delete} ���θ��¤�Ϳ���뤳�ȤǤ���

��ĥ��ǽ��ƿ̾�桼������ǽ�Ϥ�ޤߡ�@code{LOAD DATA INFILE} �Τ褦�� 
@strong{MySQL} ��ͭ�ε�ǽ����Ѥ�����Ĥ�Ϳ���ޤ���


@node User names, Connecting, What Privileges, Privilege system
@section @strong{MySQL} �桼��̾�ȥѥ����

@strong{MySQL} �ˤ�äƻ��Ѥ����桼����̾�ȥѥ���ɤλ��ѤΤ������ȡ�
UNIX, Windows �ǻ��Ѥ������ˡ�Ȥϡ������Ĥ��ۤʤ���������ޤ���

@itemize @bullet
@item
@strong{MySQL} �ǡ����١����Υ�������ǧ�ڤ˻��Ѥ���桼����̾�ϡ�
UNIX �Υ�������桼����Windows�Υ桼����̾�ǹԤ����ȤϤ���ޤ���(���פ��Ƥ��ޤ���)��
��������Ϥ��뤿�ᡢ¿���� @strong{MySQL} ���饤����Ȥϸ��ߤΥ������󤷤Ƥ���桼��̾��
@strong{MySQL}�Υ桼����̾�Ȥ��ƥ���������ߤޤ���
����������� @code{-u} �� @code{--user} �����å����ѹ��Ǥ��ޤ���
����ϡ����ƤΥ桼�����Ф��ѥ���ɤ����ꤷ�Ƥ����ʤ��ȡ�
�����ǡ����١���������ˤǤ��ʤ����Ȥ��̣���ޤ���
�⤷�ѥ���ɤ����桼���������ꤷ�Ƥ����ʤ��ȡ����Υ桼����̾��ǧ�ڤʤ��˥����С�����³�Ǥ��ޤ���

@item
@strong{MySQL} �Υ桼����̾�� 16ʸ���ޤ�(�ѿ�Ⱦ��)���ѤǤ��ޤ���
UNIX�Ϥ�������8ʸ���Ǥ�����(8ʸ���򤳤��륷���ƥ�⤢��)

@item
@strong{MySQL} �桼�����Υѥ���ɤϡ�Unix �Υѥ���ɤȰ㤤�ޤ���
��äơ������Υޥ����� Unix �Υ�������ѥ���ɤ�
�ǡ����١����Υѥ���ɤ�Ʊ���ˤ���ɬ�פϤ���ޤ���

@item
@strong{MySQL} �� Unix �Υ�������ѥ���ɤȤ������㤦��
�ȼ��ΰŹ沽���줿�ѥ���ɤ�������Ѥ��ޤ���
@code{PASSWORD()} �� @code{ENCRYPT()} �ؿ��������򻲾� �� @ref{Miscellaneous
functions}.
@end itemize

@node Connecting, Password security, User names, Privilege system
@section @strong{MySQL} �����С�����³

@strong{MySQL} ���饤����ȥץ������ϡ����̤η�ޤä�����������ޤ���
��³�������ۥ���̾����³�桼����̾�������ƥѥ���ɤǤ���
�㤨�С�@code{mysql} ���ޥ�ɤϰʲ��Τ褦�ʰ���������ޤ�
(���ץ����ΰ����� @samp{[} �� @samp{]} �ǰϤޤ�Ƥ�����ʬ�Ǥ�)

@example
shell> mysql [-h host_name] [-u user_name] [-pyour_pass]
@end example

@code{-h}, @code{-u}, @code{-p} ���ץ����ϰʲ��������Ǥ���
@code{--host=host_name}, @code{--user=user_name}, @code{--password=your_pass}
@code{-p} �ȥѥ���ɤδ֤ˤϥ��ڡ������ʤ����Ȥ�����

@strong{����:} ���ޥ�ɥ饤��˥ѥ���ɤ�Ϳ����Τϰ����ǤϤ���ޤ���
�����ƥ�����äƤ���ǡ���ʤ�桼������ @code{ps auxww} �Τ褦�ʥ��ޥ�ɤ�
���Ѥ�����ǥѥ���ɤ��դ�������Ǥ��ޤ�
@xref{Option files}.

@code{mysql} ���ޥ�ɤϥ��ޥ�ɥ饤��˰������ʤ������³�˥ǥե�����ͤ��Ѥ��ޤ���

@itemize @bullet
@item
�ǥե���ȤΥۥ���̾�� @code{localhost}, �桼����̾�� Unix �Υ�������̾�Ǥ���

@item
(@code{-p} �����ꤵ��Ƥ��ʤ���Хѥ���ɤ�Ϳ�����ޤ���)
@end itemize

Unix �Υ�������桼������ @code{joe} �ξ�硢�ʲ��Υ��ޥ�ɤ������Ǥ���

@example
shell> mysql -h localhost -u joe
shell> mysql -h localhost
shell> mysql -u joe
shell> mysql
@end example

¾�� @strong{MySQL} ���饤����Ȥ�Ʊ���褦��ư��ޤ���

Unix �����ƥ�Ǥϡ������ͤ�ǥե�����ͤˤ�����³�˻��Ѥ��뤳�Ȥ��Ǥ��ޤ���
�������뤳�Ȥˤ��ꡢ�����󥳥ޥ�ɥ饤��˰�����Ϳ���ʤ��Ƥ���褦�ˤʤ�ޤ���

@itemize @bullet
@item
@tindex .my.cnf file
��ʬ�Υۡ���ǥ��쥯�ȥ�� @file{.my.cnf} ���ꡢ���Υե���������
@code{[client]} ������������³�ѤΥѥ�᥿���򵭽ҤǤ��ޤ���
���ε��Ҥϰʲ��Τ褦�Ǥ���

@example
[client]
host=host_name
user=user_name
password=your_pass
@end example

@xref{Option files}.

@item
@tindex MYSQL_HOST environment variable
@tindex Environment variable, MYSQL_HOST
@tindex MYSQL_PWD environment variable
@tindex Environment variable, MYSQL_PWD
@tindex USER environment variable
@tindex Environment variable, USER
��³�Υѥ�᥿���˴Ķ��ѿ�����Ѥ��뤳�Ȥ�Ǥ��ޤ���
�ۥ���̾�� @code{MYSQL_HOST} �Ķ��ѿ�����Ѥ��ޤ���
@strong{MySQL} �Υ桼����̾�� @code{USER} (����� Windows �Τ�) �����ꤵ�줿�ͤ���Ѥ��ޤ���
�ѥ���ɤ� @code{MYSQL_PWD} �Ķ��ѿ��򸫤ޤ���������ϴ����Ǥ���(�����Ỳ��)
@xref{Environment variables}.
@end itemize


@node Password security, Privileges provided, Connecting, Privilege system
@subsection �ѥ���ɤ�����ˤ���

��ʬ�Υѥ���ɤ�¾�ͤˤ��餱�Ф��Τϴ�����뤳�ȤǤϤ���ޤ���
���줾�����ˡ�˱���������٤˱������ʲ��˼�����ˡ�ǥ��饤����ȥץ�������
���ʤ��Υѥ���ɤ򤢤��������餻�뤳�Ȥ��Ǥ��ޤ���

@itemize @bullet
@item
@code{-pyour_pass} �� @code{--password=your_pass} ���ץ����򥳥ޥ�ɥ饤��ǻ��Ѥ��ޤ���
����������Ǥ��������ǤϤ���ޤ��󡣤��ʤ��Υѥ���ɤ� (@code{ps} ���ޥ�ɤΤ褦��)
�����ƥ�ξ��֤򸫤륳�ޥ�ɤˤƸ��뤳�Ȥ��Ǥ��ޤ���
(@strong{MySQL} ���饤����ȤϽ���������ˤ����ƥ��ޥ�ɥ饤��ΰ����򥼥��Ǿ�񤭤���
�����ʤ��褦�ˤ��Ƥ���ΤǤ������ִ֤Ǥ����ͤ������Ƥ��ޤ��ΤǤ�)

@item
@code{-p} ���뤤�� @code{--password} ���ץ����� @code{your_pass} ��Ϳ���ʤ��ǻ��Ѥ��ޤ���
���ξ�硢���饤����ȥץ������ϥ����ߥʥ���̤��ƥѥ���ɤ����Ϥ�¥���Ƥ��ޤ�:

@example
shell> mysql -u user_name -p
Enter password: ********
@end example

���饤����ȤϤ��ʤ������Ϥ����ѥ���ɤ� @samp{*} ʸ����ü�����֤��Ƥ��ޤ��Τǡ�
���̤�Τ������ޤ줿�Ȥ��Ƥ�ѥ���ɤϤ狼��ޤ���

����ϥ��ޥ�ɥ饤��˥ѥ���ɤ���ꤹ��������Ǥ���¾�Υ桼�����ˤϸ����ޤ��󤫤顣
���������Υѥ���ɤ�����������ˡ�����ü��Υץ�������¹Ԥ���������˻��ѤǤ����Ǥ���
�⤷�����ü��Υ�����ץȤ��饯�饤����ȥץ�������ư��������硢
�ѥ���ɤ�ü����������뵡�񤬤���ޤ���
On some systems, you may even find that the first line of your
script is read and interpreted (incorrectly) as your password!
 
@item
@tindex .my.cnf file
����ե�����˥ѥ���ɤ�񤤤Ƥ������Ȥ�Ǥ��ޤ���
�㤨�С���ʬ�Υۡ���ǥ��쥯�ȥ꡼�ˤ��� @file{.my.cnf} �ե������ @code{[client]}
���������ˡ��ʲ��Τ褦�ʷ��ǽ񤭤ޤ���

@example
[client]
password=your_pass
@end example

�⤷ @file{.my.cnf} �ե�����˥ѥ���ɤ�񤤤Ƥ���ʤ顢�ե�����ϥ��롼�פ�
����¾�Υ桼�������ɤ߽񤭤Ǥ��ʤ��褦�ˤ��٤��Ǥ����ե�����Υ⡼�ɤ� @code{400}
�� @code{600} �ˤ��ޤ���

@xref{Option files}.
@item
@code{MYSQL_PWD} �Ķ��ѿ��˥ѥ���ɤ����ꤹ�뤳�Ȥ�Ǥ��ޤ���������������ˡ��
�����ƴ����Ǥ���Τǡ����Ѥ��٤��ǤϤ���ޤ���
@code{ps} �Τ���С������Ǥϡ��¹���Υץ������δĶ��ѿ���ɽ�����륪�ץ���󤬤���ޤ���
�⤷ @code{MYSQL_PWD} �Ķ��ѿ��˥ѥ���ɤ����ꤷ�Ƥ�������Ƥ٤��Ǹ���ޤ���
���ΥС������� @code{ps} ����äƤ��ʤ������ƥ���Ȥ��Ƥ⡢�ץ������δĶ��ѿ���Ĵ�٤�
��ˡ���ʤ��ȤϤ����ʤ��Τǡ�������ˡ�Ϥ��ޤꤤ����ˡ�ǤϤ���ޤ���
@xref{Environment variables}.
@end itemize

�ޤȤ��ȡ�����������ˡ�ϡ�
�ѥ���ɥץ���ץȤ��֤����饤����ȥץ�������¹Ԥ��뤫��
Ŭ�ڤʥѡ��ߥå����򤫤��� @file{.my.cnf} �ե�����˥ѥ���ɤ�񤯤�
�Ǥ���


@node Privileges provided, Privileges, Password security, Privilege system
@section @strong{MySQL} ���󶡤��븢��

���¤������ @code{mysql} �ǡ����١����� @code{user}, @code{db}, @code{host},
 @code{tables_priv}, @code{columns_priv} �ǹԤ��ޤ���
(@code{mysql} �ϥǡ����١�����̾���Ǥ�)
@strong{MySQL} �����С��ϡ������С��ε�ư����
 @ref{Privilege changes} ����������Ƥ�����ˡ�ˤ�ꡢ
�����Υơ��֥뤫�鸢�¤�������ɤ߹��ߤޤ���

@strong{MySQL} ���󶡤��븢�¤�̾�Τ�,
�ܥޥ˥奢��Ǥϰʲ���ɽ��̾�Τ��Ѥ��ޤ���
����ɽ�ι���̾�����줾��ε��Ĥ���븢�¤Ȥ����������б����Ƥ��ޤ���

@multitable @columnfractions .15 .25 .6
@item @strong{Privilege}  @tab @strong{Column}       @tab @strong{Context}
@item @strong{select}      @tab @code{Select_priv}   @tab tables
@item @strong{insert}      @tab @code{Insert_priv}   @tab tables
@item @strong{update}      @tab @code{Update_priv}   @tab tables
@item @strong{delete}      @tab @code{Delete_priv}   @tab tables
@item @strong{index}       @tab @code{Index_priv}    @tab tables
@item @strong{alter}       @tab @code{Alter_priv}    @tab tables
@item @strong{create}      @tab @code{Create_priv}   @tab databases, tables or indexes
@item @strong{drop}        @tab @code{Drop_priv}     @tab databases or tables
@item @strong{grant}       @tab @code{Grant_priv}    @tab databases or tables
@item @strong{references}   @tab @code{References_priv} @tab databases or tables
@item @strong{reload}      @tab @code{Reload_priv}   @tab server administration
@item @strong{shutdown}    @tab @code{Shutdown_priv} @tab server administration
@item @strong{process}     @tab @code{Process_priv}  @tab server administration
@item @strong{file}        @tab @code{File_priv}     @tab file access on server
@end multitable

@strong{select}, @strong{insert}, @strong{update}, @strong{delete} �θ��¤ϡ�
¸�ߤ��Ƥ���ǡ����١����Υơ��֥���Ф��Ƶ��Ĥ���ޤ���

�⤷�ơ��֥뤫��Ԥ���Ф������ʤ顢@code{SELECT} ��ʸ��¹Ԥ��뤿��ˤ�
 @strong{select} ���¤�������Ф��ޤ��ޤ���
�����Ǥʤ��������С��ΤɤΥǡ����١����˥�����������Ĥ���Ƥ��ʤ����Ǥ⡢
������ @code{SELECT} �ϼ¹Ԥ��뤳�Ȥ��Ǥ��ޤ���
�㤨�С���ñ�ʷ׻��� @code{mysql} ���饤����ȤǹԤ����Ǥ���

@example
mysql> SELECT 1+1;
mysql> SELECT PI()*2;
@end example

@strong{index} ���¤ϥ���ǥå����κ������˴�(���)����Ĥ��ޤ���

@strong{alter} ���¤� @code{ALTER TABLE} �μ¹Ԥ���Ĥ��ޤ���

@strong{create} �� @strong{drop} ���¤ϡ��������ǡ����١�����ơ��֥�κ�����
���뤤�ϴ���¸�ߤ���ǡ����١������ơ��֥���˴�(���)����Ĥ��ޤ���

���ա� @code{mysql} �ǡ����١�������Ͽ����Ƥ���桼������ @strong{drop} ���¤�Ϳ����ȡ�
���Υ桼������ @strong{MySQL} �Υ����������¤���Ǽ����Ƥ���ǡ����١������˴��Ǥ��ޤ���

@strong{grant} ���¤ϡ����ʤ���¾�Υ桼�������Ф��Ƽ�ʬ�θ��¤�������������Ĥ��ޤ���

 @strong{file} �θ��¤�Ϳ����ȡ�@code{LOAD DATA INFILE} �� @code{SELECT ... INTO OUTFILE} ��ʸ����Ѥ��ơ������С��Υե�������ɤ߽񤭤�������Ǥ��ޤ���
 @strong{MySQL} �����С������ɤ߽񤭤Ǥ���ե�������Ф��ơ����θ��¤�Ϳ����줿�桼�����ϥե�������ɤ߽񤭤Ǥ��ޤ���

�Ĥ�θ��¤ϥ��ɥߥ����˴ؤ�����Ĥǡ�@code{mysqladmin} ���ޥ�ɤ���Ѥ��Ƽ¹Ԥ��ޤ���
����ɽ�� @code{mysqladmin} ���ޥ�ɤΤɤ줬���ɤθ��¤��б����Ƥ��뤫�򼨤��ޤ���

@multitable @columnfractions .15 .85
@item @strong{Privilege}  @tab @strong{Commands permitted to privilege holders}
@item @strong{reload}     @tab @code{reload}, @code{refresh},
@code{flush-privileges},
@code{flush-hosts}, @code{flush-logs}, @code{flush-tables}
@item @strong{shutdown}   @tab @code{shutdown}
@item @strong{process}    @tab @code{processlist}, @code{kill}
@end multitable

@code{reload} ���ޥ�ɤϥ����С��˸��¤��������ɹ�������褦�������ޤ���
@code{refresh} ���ޥ�ɤ����ƤΥơ��֥��ե�å��夷�������ե�����򳫤�ľ���ޤ���
@code{flush-privileges} �� @code{reload} ��Ʊ���Ǥ���
����¾�� @code{flush-*} ���ޥ�ɤ� @code{refresh} ��ư��Ȥ褯���Ƥ��ޤ�����
Ŭ���ϰϤ�ʤäƤ��ꡢ����äȤ�������ͭ���Ǥ���
�㤨�С������ե����������ե�å��夷������硢
@code{refresh} ��Ԥ����� @code{flush-logs} �������Ǥ���

@code{shutdown} ���ޥ�ɤϡ������С��򥷥�åȥ����󤷤ޤ���

@code{processlist} ���ޥ�ɤϥ����С����¹Ԥ��Ƥ��륹��åɤξ����ɽ�����ޤ���
 @code{kill} ���ޥ�ɤϥ����С��Υ���åɤ�kill���ޤ���
��ʬ�Υ���åɤϾ��ɽ����kill�Ǥ��ޤ�����¾�ͤΥ���åɤ򤽤�����ˤ� @strong{process} ���¤�ɬ�פǤ���

���븢�¤��ߤ�����桼���������ˤ��θ��¤���Ĥ���ΤϤ褤�ͤ��Ǥ�����
���¤�Ϳ����Ȥ��ˤϡ�����λ������Τ��Ƥ��ʤ���Фʤ�ޤ���

@itemize @bullet
@item
@strong{grant} ���¤���Ĥ��줿�桼�����ϡ�¾�Υ桼�����θ��¤��Ѥ�������Ǥ��ޤ���
��ͤΥ桼�����֤ǰ�äƤ��븢�¤� @code{grant} ���¤����촹���뤳�Ȥ��Ǥ��ޤ���

@item
@strong{alter} ���¤ϡ��ơ��֥�̾���ѹ���Ԥ����Ȥˤ���ø������ƥ���ˤ뤿���
���Ѥ���뤫�⤷��ޤ���

@item
@strong{file} ���¤ϡ������С���ˤ������Ƥ��ɤ߹��߲�ǽ�ʥե������
�ǡ����١����˼����ळ�Ȥ��Ǥ�������� @code{SELECT} ʸ�ǥ��������Ǥ��ޤ���
This includes the contents of all databases
hosted by the server!

@item
@strong{shutdown} ���¤ϡ�¾�Υ桼�������Ф��륵���ӥ��򡢥����С���
��ߤ��뤳�Ȥˤ�äơ����ݤ���褦�ˤǤ��ޤ���

@item
@strong{process} ���¤ϼ¹Ԥ���Ƥ��륯���꡼��ץ졼��ƥ����ȤǸ��뤳�Ȥ˻Ȥ��ޤ���
�ѥ���ɤ����ꡢ�ѹ��Υ����꡼��ޤߤޤ���

@item
 @code{mysql} �ǡ����١������Ф��Ƥθ��¤ϡ��ѥ���ɤ��ѹ���¾�θ��¤�������ѹ����Ǥ��ޤ���
�ѥ���ɤϰŹ沽�������Ͽ����Ƥ��ꡢ���դΤ���桼�����Ǥ�
ñ����ɤळ�ȤϤǤ��ޤ��󤬡����θ��¤���Ĥ��줿���Υ桼�����ϡ�
�ѥ���ɤ�㤦��Τ��Ѥ��뤳�Ȥ��Ǥ��ޤ���
@end itemize

�ʲ��� @strong{MySQL} ���ø������ƥ�ǹԤ���ΤǤϤ���ޤ���

@itemize @bullet
@item
������������ݤ���桼���������ꤷ�����ꤹ�뤳�ȤϤǤ��ޤ���
�����˰��פ����桼�����������³����ݤǤ��ޤ���

@item
�ǡ����١�����Υơ��֥�κ������˴��θ��¤���Ĥ���
�ǡ����١������Τ�Τ�������˴��Ǥ��롢���Τ褦�ʥ桼����������Ǥ��ޤ���
@end itemize


@node Privileges, Connection access, Privileges provided, Privilege system
@section �ø������ƥ�ϤɤΤ褦��ư������

@strong{MySQL} ���ø������ƥ�ϡ����ƤΥ桼������Ϳ����줿���Ĥ��ϰ����ư�������ݾڤ��ޤ���
@strong{MySQL} �����С�����³����Ȥ����ܿͤοȸ��ϡ�@strong{��³���Υۥ���} ��
 @strong{��³�˻��Ѥ���桼����̾} �ˤ�äƳ�ǧ����ޤ���
���Υ����ƥ�ϡ����ʤ��οȸ���@strong{���ʤ����׵᤹�뤳�Ȥ�����} �ˤ�äơ����¤�Ϳ���ޤ���

@strong{MySQL} �Ϥ��ʤ��Υۥ���̾�ȥ桼����̾��ξ���򤢤碌�ƥ����å����ޤ���
����ϥ��󥿡��ͥåȾ��Ʊ��̾���Υ桼�������ɤ����ˤ��뤫�⤷��ʤ��Ȥ������Ȥ��餽�����Ƥ��ޤ���
�㤨�С�@code{whitehouse.gov} ������³���Ƥ��� @code{bill} �ȡ�
 @code{microsoft.com} ������³���Ƥ��� @code{bill} ��Ʊ���ʪ�Ǥ���ɬ�פϤ���ޤ���
@strong{MySQL} �Ϥ��ΰ㤦�ۥ��Ȥ�����³���Ƥ���Ʊ̾�Υ桼������ʲ��Τ褦�ˤ��ư����ޤ���
 @code{whitehouse.gov} ������³���� @code{bill} �ˤ�����Ĥ򤢤�����
����Ȥϰ㤦���Ĥ� @code{microsoft.com} ������³���Ƥ��� @code{bill} ��Ϳ���ޤ���

@strong{MySQL} �Υ�����������ȥ�����ϰʲ�����Ĥ���ʤ�ޤ���

@itemize @bullet
@item
Stage 1: �����С�����³���Ĥ����뤫�ɤ���������å����ޤ���

@item
Stage 2: ��³���ĸ塢�����С��Ϥ��줾��Υꥯ�����Ȥ�����å����ޤ���
���ʤ����׵ᤷ�Ƥ��������򡢤��ʤ����¹ԤǤ��뤫�ɤ���������å����ޤ���
�㤨�С�����ǡ����١����Υơ��֥�ιԤμ��Ф���ơ��֥���˴��򤢤ʤ���̿�ᤷ����硢
�����С��ϡ����ʤ��ˤ��Υơ��֥���Ф��� @strong{select} ���Ĥ�����Τ���
�ǡ����١������Ф��� @strong{drop} ������Ĥ�Ϳ�����Ƥ���Τ������ǧ���ޤ���
@end itemize

�����С��� @code{mysql} �ǡ����١����� @code{user}, @code{db}, @code{host} ���ĤΥơ��֥뤫�顢
���Σ��ĤΥ����������¤���ꤷ�ޤ���
���Υơ��֥�Υե�����ɤϰʲ��Τ褦�ˤʤäƤ��ޤ���

@multitable @columnfractions .2 .25 .25 .25
@item @strong{Table name} @tab @code{user} @tab @code{db} @tab @code{host}

@item @strong{Scope fields} @tab @code{Host}          @tab @code{Host}        @tab @code{Host}
@item @tab @code{User}          @tab @code{Db}          @tab @code{Db}
@item @tab @code{Password}      @tab @code{User}        @tab

@item @strong{Privilege fields} @tab @code{Select_priv} @tab @code{Select_priv} @tab @code{Select_priv}
@item @tab @code{Insert_priv}   @tab @code{Insert_priv} @tab @code{Insert_priv}
@item @tab @code{Update_priv}   @tab @code{Update_priv} @tab @code{Update_priv}
@item @tab @code{Delete_priv}   @tab @code{Delete_priv} @tab @code{Delete_priv}
@item @tab @code{Index_priv}    @tab @code{Index_priv}  @tab @code{Index_priv}
@item @tab @code{Alter_priv}    @tab @code{Alter_priv}  @tab @code{Alter_priv}
@item @tab @code{Create_priv}   @tab @code{Create_priv} @tab @code{Create_priv}
@item @tab @code{Drop_priv}     @tab @code{Drop_priv}   @tab @code{Drop_priv}
@item @tab @code{Grant_priv}    @tab @code{Grant_priv}  @tab @code{Grant_priv}
@item @tab @code{References_priv} @tab                  @tab
@item @tab @code{Reload_priv}   @tab                    @tab
@item @tab @code{Shutdown_priv} @tab                    @tab
@item @tab @code{Process_priv}  @tab                    @tab
@item @tab @code{File_priv}     @tab                    @tab
@end multitable

��������������ȥ��������2�ʳ�(�׵᾵ǧ)�Τ���ˡ������С��Ϥ���� 3 �Ĥ�
�ơ��֥�ˤ�äƷ���줿���Ĥ���ܤȤ��ޤ������⤷�ơ��֥���Ф����׵��
����ʤ�С�@code{tables_priv} �� @code{columns_priv} �ơ��֥��
�����Ĵ�٤ޤ��������Υơ��֥�Υե�����ɤϰʲ��Τ褦�ˤʤäƤ��ޤ���

@multitable @columnfractions .2 .25 .25
@item @strong{Table name}   @tab @code{tables_priv} @tab @code{columns_priv}

@item @strong{Scope fields} @tab @code{Host}        @tab @code{Host}
@item                       @tab @code{Db}          @tab @code{Db}
@item                       @tab @code{User}        @tab @code{User}
@item                       @tab @code{Table_name}  @tab @code{Table_name}
@item                       @tab                    @tab @code{Column_name}

@item @strong{Privilege fields} @tab @code{Table_priv}   @tab @code{Type}
@item                           @tab @code{Column_priv}  @tab

@item @strong{Other fields} @tab @code{Timestamp}   @tab @code{Timestamp}
@item                       @tab @code{Grantor}     @tab
@end multitable

���ơ��֥�γƥե�����ɤ�ʬ�ह��ȡ�������ˤ狼��ޤ���
Ŭ���ϰϤ���ꤹ��ե������(�ʲ����������ץե������)�ȵ��Ĥ��������ե������(�ʲ������¥ե������)�Ǥ���

���������ץե�����ɤϡ����¥ơ��֥����Ͽ���Ȥˡ�����Ŭ���ϰϤ���ޤ���
�㤨�С� @code{user} �ơ��֥�� @code{Host} �� @code{User} ��
 @code{'thomas.loc.gov'} �� @code{'bob'} ����Ͽ����Ƥ����硢
�����С��ؤ���³�� �ۥ��� @code{thomas.loc.gov} �����褿 @code{'bob'} �˵��Ĥ���ޤ���
Ʊ�ͤˡ�@code{db} �ơ��֥��  @code{Host}, @code{User}, @code{Db} ��
 @code{'thomas.loc.gov'}, @code{'bob'}, @code{'reports'} ����Ͽ����Ƥ���ȡ�
�ۥ��� @code{thomas.loc.gov} �����褿 @code{bob} ���Ф� @code{reports} �ǡ����١����ؤ���³��������ޤ���
@code{tables_priv} �� @code{columns_priv} �ơ��֥�ϡ�
�ơ��֥뤫���ơ��֥�ȥե�����ɤ��Фˤ����������ץե�����ɤ�ޤߤޤ���

@cindex Case sensitivity, in access checking
�����������Υ����å��ϡ�@code{Host} ���ͤϥ��������¸����Ӥ���ޤ���
@code{User}, @code{Password}, @code{Db}, @code{Table_name} ���ͤϥ�������¸����Ӥ���ޤ���
@code{Column_name} ���ͤ� @strong{MySQL} 3.22.12 �ʾ�Ǥϥ��������¸����Ӥ���ޤ���
(3.22.11 �ޤǤ� ��������¸�Ǥ�)

���¥ե�����ɤϡ��ơ��֥����Ͽ����뤳�Ȥˤ��ͭ���ˤʤä����Ĥ򤷤ᤷ��
����Ϥɤ����¹ԤǤ��뤫�򼨤��ޤ���
�����С��ϵ��ĥơ��֥�ξ����桼�����θ��¤����뤿��ˤޤȤ�ޤ���
���Υ桼�����θ��µ��Ĥ���Ф���ˡ�� @ref{Request access} �˽Ҥ٤Ƥ����ޤ���

�������ץե�����ɤ�ʸ����������졢�ǥե�����ͤ϶�ʸ���ˤʤäƤ��ޤ���

@multitable @columnfractions .15 .15 .7
@item @strong{Field name} @tab @strong{Type}
@item @code{Host}         @tab @code{CHAR(60)}
@item @code{User}         @tab @code{CHAR(16)}
@item @code{Password}     @tab @code{CHAR(16)}
@item @code{Db}           @tab @code{CHAR(64)} @tab (@code{CHAR(60)} for the
@code{tables_priv} and @code{columns_priv} tables)
@item @code{Table_name}   @tab @code{CHAR(60)}
@item @code{Column_name}  @tab @code{CHAR(60)}
@end multitable

@code{user}, @code{db}, @code{host} �ơ��֥�Ǥϡ�
���Ƥθ��¥ե�����ɤ� @code{ENUM('N','Y')} ���������ޤ���
�����ͤ� @code{'N'} �� @code{'Y'} �Τɤ��餫�ǡ��ǥե�����ͤ� @code{'N'} �Ǥ���

@code{tables_priv} �� @code{columns_priv} �ơ��֥�Ǥϡ�
���¥ե�����ɤ� @code{SET} �ե�����ɤȤ����������ޤ���

@multitable @columnfractions .2 .2 .6
@item @strong{Table name} @tab @strong{Field name} @tab @strong{Possible set elements}
@item @code{tables_priv} @tab @code{Table_priv} @tab @code{'Select', 'Insert',
'Update', 'Delete', 'Create', 'Drop', 'Grant', 'References', 'Index', 'Alter'}
@item @code{tables_priv} @tab @code{Column_priv} @tab @code{'Select', 'Insert',
'Update', 'References'}
@item @code{columns_priv} @tab @code{column_priv} @tab @code{'Select', 'Insert',
'Update', 'References'}
@end multitable

�����С��ϰʲ��Τ褦�˵��ĥơ��֥����Ѥ��ޤ���

@itemize @bullet
@item
@code{user} �ơ��֥�Υ������ץե�����ɤϡ���³�׵���������뤫���ݤ��뤫����ꤷ�ޤ���
For allowed connections, any privileges granted in
the @code{user} table indicate the user's global (superuser) privileges.
These privileges apply to @strong{all} databases on the server.
(������
�㤨�С�@code{user} �ơ��֥� �θ��¤� @code{'Y'} �ˤ�����硢
�ɤ�ʤ� @code{Db} �� @code{Host} �� @code{'N'} �ˤ����Ȥ��Ƥ� @code{'Y'} �ΤޤޤǤ��롣
�褦�� @code{user} �ơ��֥�θ��µ��� @code{'Y'} �����Ƥ�ȿ�Ǥ���Ƥ��ޤ��Ȥ�������
@code{user} �ơ��֥�ˤϺ���¤ε��Ĥ�Ϳ����褦�ˤ���
@code{Db} �� @code{Host} ���Ȥˡ����줾��θ��µ��Ĥ������������̵��
)

@item
@code{db} �� @code{host} �ơ��֥�ϰ��˻��Ѥ���ޤ���

@itemize @minus
@item
@code{db} �ơ��֥�Υ������ץե�����ɤϤɤΥۥ��Ȥ���ɤΥǡ����١����Υ��������Ǥ��뤫����ꤷ�ޤ���
���¥ե�����ɤϡ��ɤ����ä����Ǥ��뤫������ޤ���

@item
@code{host} �ơ��֥�ϡ�@code{db} �ơ��֥����Ͽ�ˤ˥ۥ��Ȥ�Ϳ�������ˡ�
@code{db} �ơ��֥�γ�ĥ�Ȥ��ƻ��Ѥ���ޤ���
�㤨�С��ͥåȥ����θ��ꤷ���ޥ��󤫤�ǡ����١�������Ѥ�������硢
@code{db} �ơ��֥�� @code{Host} ���ͤ϶��ˤ��Ƥ����ޤ���
������ @code{host} �ơ��֥�ˤ��줾��Υۥ��ȤˤĤ��Ƥ���Ͽ��Ԥ��ޤ���
���ε����ϡ� @ref{Request access} �Ǿܺ٤˽Ҥ٤��Ƥ��ޤ���
@end itemize

@item
@code{tables_priv} �� @code{columns_priv} �ơ��֥�� @code{db} �ơ��֥�˻��Ƥ��ޤ�����
�����Ϥ��٤�������Ǥ��ޤ���
�ǡ����١�����٥�ǤϤʤ����ơ��֥�ȥե�����ɤΥ�٥��Ϳ���ޤ���
@end itemize

�����Ը��� (@strong{reload}, @strong{shutdown},�ʤ�) �� @code{user} �ơ��֥�ˤ����������褦�ˡ�
����ϡ����������ϥǡ����١����ǤϤʤ������С��ؤ����Ǥ��ꡢ
¾�ε��ĥơ��֥�ˤ���ɬ�פ��ʤ�����Ǥ���
�ޤ��������Ƥ����ȡ����������ε��Ĥϡ�@code{user} �ơ��֥�����������
����Ф狼��褦�ˤʤ�ޤ���

@strong{file} ���θ��¤� @code{user} �ơ��֥�ˤ����������褦�ˡ�
����ϴ��������ǤϤ���ޤ��󤬡������������Ƥ���ǡ����١����ˤ�����餺��
�����С���Υե�������ɤ߽񤭤Ǥ���ΤǤ���

@code{mysqld} �����С��ϵ�ư���ˤ����Υơ��֥���ɤ߹��ߤޤ���
���ĥơ��֥���ѹ���ȿ�Ǥ�������ˡ�Ϥ�����򻲾ȤΤ��� �� @ref{Privilege changes}

�����Υơ��֥����Ͽ���ѹ�������硢�פä��Ȥ���θ��¾��֤ˤʤäƤ�������ǧ���뤳�ȤϤ������ȤǤ���
����β��ˤ�, @ref{Access denied}.  �������ƥ��˴ؤ��륢�ɥХ�����
@ref{Security}.

�����ʥġ���Ȥ��� @code{mysqlaccess} ������ץ�( Yves Carlier ��)�� @strong{MySQL} �����ۤ˴ޤޤ�Ƥ��ޤ���
@code{mysqlaccess} ��  @code{--help} ���ץ����ǵ�ư����ȥإ�פ�ɽ������ޤ���
@code{mysqlaccess} �� @code{user},@code{db} and @code{host} �ơ��֥��������
�������ޤ��󡣥ơ��֥��٥�θ��¡��ե�����ɥ�٥�θ��¤�Ĵ�٤ޤ���


@node Connection access, Request access, Privileges, Privilege system
@section Access control, stage 1: ��³�ξ�ǧ

@strong{MySQL} �����С�����³����ȡ����ʤ����ѥ����ǧ�ڤ�����³���Ƥ��褦�����ޤ�����
�����С��Ϥ��ʤ��οȸ��ˤ����³�ε��ĵ��ݤ�Ԥ��ޤ���
�⤷�ȸ������פ��ʤ������³����ݤ�����³���Ĥ�����硢�����С��� stage 2 �ؤȿʤߡ��׵���Ԥ��ޤ���

�ȸ�����ĤΤ�Τ˴�Ť��Ƴ�ǧ����ޤ���

@itemize @bullet
@item
���ʤ�����³���褦�Ȥ��Ƥ���ۥ���

@item
���ʤ��� @strong{MySQL} �桼����̾
@end itemize

�ȸ��γ�ǧ�� @code{user} �ơ��֥�Υ������ץե������(@code{Host}, @code{User}, @code{Password}) ����Ѥ��ƹԤ��ޤ���
�����С��� @code{user} �ơ��֥����Ͽ�˰��פ��Ƥ���ۥ���̾�ȥ桼����̾�˸¤���³����Ĥ������θ塢�ѥ���ɤ��׵ᤷ�ޤ���

@code{user} �ơ��֥�Υ������ץե�����ɤ���Ͽ�ϰʲ��Τ褦�ˤʤ�ޤ���

@itemize @bullet
@item
@code{Host} ���ͤϥۥ���̾�� IP ���ɥ쥹�� @code{'localhost'}(��������ۥ���) �Ǥ���

@item
@cindex Wildcards, in @code{mysql.user} table
@code{Host} �ˤϥ磻��ɥ�����ʸ�� @samp{%} �� @samp{_} ����ѤǤ��ޤ���

@item
@code{Host} �� @code{'%'} �����ꤹ��ȡ����ƤΥۥ��Ȥ˥ޥå����ޤ���
@code{Host} ����ˤ���ȡ�@code{'%'} ��Ʊ���ˤʤ�ޤ���
�������ͤϡ�@emph{�ɤ�ʥۥ��Ȥ⥵���С�����³�Ǥ���}�Ȥ������Ȥˤʤ�ޤ���

@cindex Netmask notation, in @code{mysql.user} table
@item
As of MySQL 3.23, for @code{Host} values specified as IP numbers, you
can specify a netmask indicating how many address bits to use for the
network number. For example:

@example
GRANT ALL PRIVILEGES on db.* to david@'192.58.197.0/255.255.255.0';
@end example

This will allow everyone to connect from an IP where the following is true:

@example
user_ip & netmask = host_ip.
@end example

In the above example all IP:s in the interval 192.58.197.0 -
192.58.197.255 can connect to the @strong{MySQL} server.
 
@item
@cindex Anonymous user
�磻��ɥ�����ʸ���� @code{User} �ե�����ɤˤ�����Ǥ��ޤ��󤬡�
@code{User} �ե�����ɤ�֥��(��)�ˤ��뤳�ȤϤǤ��ޤ����֥�󥯤����Ƥ�̾���˥ޥå����ޤ���
����ϥ桼����̾���ʤ����֤���³���Ƥ�����Τ�Ŭ�Ѥ��졢
���饤����Ȥ��桼����̾���������ʤ��¤ꡢƿ̾�桼����(̾�����֥��)�Ȥ��ư����ޤ���
���ƤΥ��������Υ����å��˥֥�󥯤Υ桼����̾�����Ѥ��������̣���ޤ���(that is, during stage 2)

@item
@code{Password} �ե�����ɤ϶��ˤǤ��ޤ������ξ�硢�ѥ���ɤʤ�����³�Ǥ��뤳�Ȥˤʤ�ޤ���
@end itemize

@findex PASSWORD()
��֥�󥯤� @code{Password} �ͤϥѥ���ɤ�Ź沽������ΤǤ���
@strong{MySQL} �Ϥ���⤬�����褦�˥ѥ���ɤ�ʿʸ�Ǥ���¸���ޤ���
��³���ߤ褦�Ȥ��Ƥ���桼�����Υѥ���ɤ⡢(@code{PASSWORD()} �ؿ���)
�Ź沽���졢@code{user} �ơ��֥����¸����Ƥ���Ź沽�ѥ���ɤ�
��Ӥ��ޤ����⤷���פ����ʤ顢�ѥ���ɤ��������Ȥ������ȤǤ���

�ʲ���ɽ�ϡ���³�׵���Ф���Ϳ���롢
@code{user} �ơ��֥�� @code{Host} ��  @code{User} ��������Ǥ���

@multitable @columnfractions .25 .15 .60
@item @code{Host} @strong{value} @tab @code{User} @strong{value} @tab @strong{Connections matched by entry}
@item @code{'thomas.loc.gov'} @tab @code{'fred'} @tab @code{fred}, @code{thomas.loc.gov} ������³
@item @code{'thomas.loc.gov'} @tab @code{''} @tab @code{thomas.loc.gov} ������³���Ƥ������ƤΥ桼����
@item  @code{'%'} @tab @code{'fred'} @tab @code{fred}, ���ƤΥۥ��Ȥ�����³
@item @code{'%'} @tab  @code{''} @tab ���ƤΥۥ��Ȥ�����³���Ƥ������桼����
@item @code{'%.loc.gov'} @tab @code{'fred'} @tab @code{fred}, @code{loc.gov} �ɥᥤ��������ƤΥۥ��Ȥ������³
@item @code{'x.y.%'} @tab @code{'fred'} @tab @code{fred}, @code{x.y.net}, @code{x.y.com},@code{x.y.edu}, �ʤɤ������³. (���ޤ�ͭ���ʻȤ����ǤϤʤ��Ǥ�)
@item @code{'144.155.166.177'} @tab @code{'fred'} @tab @code{fred}, IP address �� @code{144.155.166.177} �Υۥ��Ȥ������³
@item @code{'144.155.166.%'} @tab @code{'fred'} @tab @code{fred}, @code{144.155.166} class C subnet ������ƤΥۥ��Ȥ������³
@item @code{'144.155.166.0/24'} @tab @code{'fred'} @tab Same as previous example
@end multitable

@code{Host} �� IP �Υ磻��ɥ�����(�㤨�� @code{'144.155.166.%'} ��
���֥ͥåȤ����ƤΥۥ��Ȥ˥ޥå�) ����Ѥ��뤳�Ȥ��Ǥ��ޤ���
�������ξ�硢 @code{144.155.166.somewhere.com} �Ȥ����ۥ���̾��
���줫����³���褦�Ȥ��Ƥ��뤫�⤷��ޤ���
���Τ褦�ʹ�����Ф���@strong{MySQL} �Ͽ�����ɥåȤǻϤޤ�ۥ���̾����ݤ��Ƥ��ޤ���
�⤷ @code{1.2.foo.com} �Τ褦��̾���Υۥ��Ȥ���äƤ����硢
���ĥơ��֥�� @code{Host} �ˤ����Ф˥ޥå����ޤ���
IP���ɥ쥹�Τߡ�IP �Υ磻��ɥ����ɤ˥ޥå�������ˤʤ�ޤ���

�����С��������³�ϡ�@code{user} �ơ��֥������Ͽ�ˣ��İʾ�
�ޥå����뤫�⤷��ޤ���
�㤨��, @code{thomas.loc.gov} �� @code{fred} �������³�ϡ���˼����줿
��Ͽ�Τ����Τ����Ĥ��˥ޥå�����Ǥ��礦��
�����С��ϡ�ʣ������Ͽ�˥ޥå�������硢�ɤΤ褦�ˤ��Ƥ����椫��
���Ѥ�����Ͽ�����֤ΤǤ��礦��
�����С��ϵ�ư��� @code{user} �ơ��֥�򥽡��Ȥ����¤Ӵ�����줿���
��Ͽ�򸡺����뤳�Ȥˤ�ꡢ����������褷�ޤ���
�ǽ�˥ޥå�������Ͽ�����Ѥ���ޤ���

@code{user} �ơ��֥뤬�ʲ��Τ褦�˥����Ȥ���Ƥ�����硧

@example
+-----------+----------+-
| Host      | User     | ...
+-----------+----------+-
| %         | root     | ...
| %         | jeffrey  | ...
| localhost | root     | ...
| localhost |          | ...
+-----------+----------+-
@end example

�����С������Υơ��֥���ɤ�ȡ�@code{Host} ���ͤ��Ǥ�μ¤�����Ǥ���ۥ��Ȥ���ꤷ�Ƥ��륨��ȥ�򡢺ǽ�˻��Ȥ��ޤ���
(@code{Host} ��� @code{'%'} �� ``���٤ƤΥۥ���'' ���̣�����ۥ���̾��Ϥä�������ꤷ�Ƥ����ΤǤϤ���ޤ���)

@code{Host} ���ͤ�Ʊ������ȥ꤬���ä���硢��äȤ����Τ� @code{User} ���ͤ��桼��������ꤷ�Ƥ��륨��ȥ��ǽ�˻��Ȥ��ޤ���(@code{User} ���ͤ����ξ�硢``����Ǥ�'' ���̣���ޤ�)
���η�̡�@code{user} �ơ��֥�ϰʲ��Τ褦�˥����Ȥ���ޤ���

@example
+-----------+----------+-
| Host      | User     | ...
+-----------+----------+-
| localhost | root     | ...
| localhost |          | ...
| %         | jeffrey  | ...
| %         | root     | ...
+-----------+----------+-
@end example

@cindex Grant tables, sorting
@cindex Sorting, grant tables
@cindex @code{user} table, sorting
��³����ߤ�줿��硢�����С����¤Ӵ�����줿��Ͽ��õ�����ǽ�˸��Ĥ�����Τ�
���Ѥ��ޤ���
@code{'localhost'} �� @code{jeffrey} �������³�ϡ��ޤ��ǽ�� @code{Host} �� @code{localhost} �����ꤷ�Ƥ��륨��ȥ�˥ޥå����ޤ���
�桼����̾�����Υ���ȥ�ϡ��ۥ���̾�ȥ桼����̾��ξ������ꤷ����³�ˤ�ޥå����ޤ���
( @code{'%'/'jeffrey'} ����ȥ��ޥå����ޤ�����������Ϻǽ�ˤϥޥå����ޤ���)

�⤦���㡣@code{user} ���ʲ�������Ȳ��ꤷ�ޤ���

@example
+----------------+----------+-
| Host           | User     | ...
+----------------+----------+-
| %              | jeffrey  | ...
| thomas.loc.gov |          | ...
+----------------+----------+-
@end example

����ϼ��Τ褦�˥����Ȥ���ޤ���

@example
+----------------+----------+-
| Host           | User     | ...
+----------------+----------+-
| thomas.loc.gov |          | ...
| %              | jeffrey  | ...
+----------------+----------+-
@end example

@code{thomas.loc.gov} �� @code{jeffrey} �������³�ϡ��ǽ�Υ���ȥ�˥ޥå�����
@code{whitehouse.gov} �� @code{jeffrey} �������³�ϡ�����ܤΥ���ȥ�˥ޥå����ޤ���

�ǽ�˥����Ф�,��³�Τ���Υޥå��򸫤Ĥ���Τ��ߤ�Ȥ�,���̤θ����Ϳ����줿
�桼��̾�����餫�ˤ��Υ桼����̿̾���뤹�٤ƤΥ���ȥ꤬���Ѥ����Ȼפ����ȤǤ�.
�����ñ�������ǤϤ���ޤ���. jeffrey�ˤ��thomas.loc.gov�������³���ǽ��
����ȥ�ˤ�äƥ桼��ʬ���ͤȤ��ơ�jeffrey'��ޤޤʤ�������Υ���ȥ�ˤ�äƤ���
��������,������Ϥ����桼��̾�ʤ����㼨���ޤ�!

�褯����ͤ��㤤�ϡ��桼����̾��Ϳ������硢
�����С�����³�˥ޥå������Τ�õ���ݤˡ�
���Υ桼��������Ͽ����Ƥ������ƤΥ롼�뤬��
�ǽ�˻��Ѥ����������ȹͤ��뤳�ȤǤ������������������ޤ���
������Ǥ���򼨤��ޤ�������@code{thomas.loc.gov} �� @code{jeffrey} �������³��
�ǽ�˥ޥå�����Τϡ� @code{User} �ե�����ɤ��ͤ� @code{'jeffrey'} ��
�ʤäƤ��륨��ȥ�ǤϤʤ����桼����̾�ʤ�(�����Ǥ�) �Υ���ȥ������
��˥ޥå����ޤ���

�⤷�����С��ؤ���³�����ޤ��Ԥ��ʤ���硢 @code{user} �ơ��֥��ɽ������
�ޥ˥奢��ǥ����Ȥ��Ƥߤơ��ɤΥ���ȥ�˺ǽ�˥ޥå����뤫õ���Ƥ���������


@node Request access, Privilege changes, Connection access, Privilege system
@section Access control, stage 2: �׵�ξ�ǧ

������³����Ω�����ȡ������С��ϥ��ơ������˰ܤ�ޤ���
���Υ��ơ����Ǥϡ������С��Ϥ�����³������뤽�줾����׵᤬���Ĥ���Ƥ��뤫�ɤ���������å����ޤ���
�����å��ϼ¹Ԥ��褦�Ȥ��Ƥ������Υ����פˤ��Ԥ��ޤ���
���������ĥơ��֥�Τɤθ��¥ե�����ɤ����ƤϤޤ뤫�򸫤ޤ���
����鸢�¤�  @code{user}, @code{db},@code{host}, @code{tables_priv} �� @code{columns_priv} �ơ��֥���Ƴ�Ф���ޤ���
���ĥơ��֥�� @code{GRANT} ���ޥ�ɤ����ޤ���
@xref{GRANT, , @code{GRANT}}.
(You may find it helpful to refer to the table shown earlier that lists
the fields present in each of the grant tables; see @ref{Privileges}.)

@code{user} �ơ��֥�����Ƥ��Ф��ƴ��ܤȤʤ븢�¤�桼�����˳�����Ƥޤ���
���Ȥ������ȤΥǡ����١��������Ĥ�Ϳ���Ƥ��ʤ��Ƥ⡢@code{user} �ơ��֥�����꤬ͭ���ˤʤ�ޤ���
�㤨�С�@code{user} �ơ��֥�� @strong{delete} ����Ĥ�����硢
�����С��ˤ���ɤ�ʥǡ����١����ιԤ����Ǥ���ΤǤ��� 
�����ʤ�С�@code{user} �ơ��֥�θ��¤ϥ����ѡ��桼�����θ��¤ȸ��äƤ⤤���Ǥ��礦��
���θ��¤ϥ����ѡ��桼����(�����С���ǡ������١���������)�Τߤ�Ϳ���Ƥ������������Ǥ���
¾�Υ桼�����ϡ�@code{user} �ơ��֥�θ��¤������ @code{'N'} �Τޤޤˤ��Ƥ����٤��Ǥ�����
�ޤ���@code{db} �ơ��֥�� @code{host} �ơ��֥�����Ѥ��ơ�
�ǡ����١�������ꤷ����ǥ桼�����˸��¤���Ĥ��٤��Ǥ���

@cindex Anonymous user
@cindex Wildcards, in @code{mysql.db} table
@cindex Wildcards, in @code{mysql.host} table
@code{db} �ơ��֥�� @code{host} �ơ��֥������Υǡ����١������Ф��븢�µ��Ĥ�Ԥ��ޤ���
Values in the scope fields may be specified as follows:

@itemize @bullet
@item
�磻��ɥ�����ʸ�� @samp{%} �� @samp{_} �� @code{Db} �ơ��֥�� @code{Host} �ե�����ɤ����˻��ѤǤ��ޤ���

@item 
@code{'%'} @code{Host} �ͤ� ``������ۥ���'' ���̣���ޤ���
@code{db} �ơ��֥�� @code{Host} �˶������ꤹ��ȡ�``����� @code{host} �ơ��֥�˵��ľ����õ���ˤ���''
�Ȥʤ�ޤ���

@item
@code{'%'} �� ���ͤ� @code{Host} �ơ��֥�����ꤹ��ȡ������ ``������ۥ���'' �Ȥʤ�ޤ���

@item
@code{'%'} �� ���ͤ� @code{host} �ơ��֥�� @code{Db} �ե�����ɤ����ꤹ��ȡ�
����� ``������ǡ����١���'' �Ȥʤ�ޤ���

@item
@code{User} ����ͤˤ���ȡ�ƿ̾�桼�����˥ޥå����ޤ���
@end itemize

@cindex Grant tables, sorting
@cindex Sorting, grant tables
@cindex @code{db} table, sorting
@cindex @code{host} table, sorting
�����С���ư���ˡ�@code{db} �ơ��֥�� @code{host} �ơ��֥�ϥ����С����ɤ߹��ޤ�ޤ���
(@code{user} �ơ��֥�⤳�λ���Ʊ�����ɤޤ�ޤ�)
@code{db} �ơ��֥�� @code{Host}, @code{Db}, @code{User} �Υե�����ɤǥ����Ȥ��졢
@code{host} �ơ��֥�� @code{Host}, @code{Db} �ե�����ɤǥ����Ȥ���ޤ���
@code{user} �ơ��֥�ϡ���������Ǥ��륨��ȥ��ǽ�ˡ���������Ǥ��ʤ���Τ�Ǹ�˥����Ȥ��ޤ���
�����С��ϥ����Ȥ��줿��Τ��椫�顢�ǽ�˥ޥå�������Τ���Ѥ��ޤ���

@cindex Wildcards, in mysql.tables_priv table
@cindex Wildcards, in mysql.columns_priv table
@code{tables_priv} �� @code{columns_priv} �ơ��֥�ϡ�
����Υơ��֥�ȥե�����ɤ��Ф��븢�¤���Ĥ��ޤ���
�������ץե�����ɤ��ͤϡ������ˤ��äƵ��Ҥ���ޤ���

@itemize @bullet
@item
�磻��ɥ�����ʸ�� @samp{%} �� @samp{_} �Ϥɤ��餫�Υơ��֥��
@code{Host} �ե�����ɤ˻��ѤǤ��ޤ���

@item
�ɤ��餫�Υơ��֥�� @code{Host} �ͤ� @code{'%'} ���֥�󥯤ˤ���ȡ�
``any host.'' ���̣���ޤ���

@item
@code{Db}, @code{Table_name}, @code{Column_name} �ե�����ɤϤɤΥơ��֥�ˤ�
�磻��ɥ����ɤ�֥�󥯤ϻ��ѤǤ��ޤ���
@end itemize

@code{tables_priv} �� @code{columns_priv} �ơ��֥��
@code{Host}, @code{Db}, @code{User} �ե�����ɤ��¤Ӵ������ޤ���
����� @code{db} �ơ��֥�Υ����Ȥ˻��Ƥ��ޤ����� @code{Host} �ե�����ɤ�����
�磻��ɥ����ɤ�ޤ�Τǡ������ȤϤ��ñ��ʤ�Τˤʤ�ޤ���

�����׵�ξ�ǧ�ϼ��Τ褦�ˤ��ƹԤ��ޤ���
�⤷����������ǧ����ꤹ����ʬ�Υ����������ɤ�����Ǥ���ʤ顢
����ä��Ѥ�ä����르�ꥺ��Ǿ�ǧ�η����ԤäƤ�����˵��Ť��Ǥ��礦��

�����Ԥ��׵�(@strong{shutdown}, @strong{reload}, etc.)�ˤĤ��Ƥϡ������С���
 @code{user} �ơ��֥�����򻲾Ȥ��ޤ���(@code{user} �ơ��֥�����������Ը��¤Υե�����ɤ����)��
����ȥ�˵�����Ͽ����Ƥ������ϼ��������졢����ʳ��ϵ��ݤ���ޤ���
�㤨�С�@code{mysqladmin shutdown} ��¹Ԥ��褦�Ȥ��Ƥ⡢@code{user} �ơ��֥�� @strong{shutdown} ���¤�������Ƥ��ʤ���м¹ԤǤ��ޤ��󡣤��λ���@code{db} �� @code{host} �ơ��֥�ϥ����å�����ޤ���(�����Υơ��֥�ˤ� @code{Shutdown_priv} �ե�����ɤ�̵������Ǥ�)

�ǡ����١����ؤ��׵� (@strong{insert}, @strong{update}, etc.) �ˤ����ơ������С��Ϥޤ��ǽ�ˡ��桼�����Υ������Х�ʸ���(�����ѡ��桼����)�� @code{user} ���椫��õ�������ޤ���
�⤷���Ĥ�Ϳ�����Ƥ���С������������������ޤ���

@code{user} �ơ��֥�Υ������Х�ʸ��¤����꤬�Խ�ʬ�Ǥ���ʤ顢�����С��ϥ桼�����Υǡ����١������Ф��븢�¤� @code{db} �ơ��֥�� @code{host} �ơ��֥뤫����ꤷ�ޤ���

@enumerate
@item
�����С��� @code{db} �ơ��֥�� @code{Host},@code{Db},@code{User}�ե�����ɤ򻲾Ȥ��ޤ���
@code{Host} �� @code{User} �ե�����ɤϥ桼��������³���Υۥ���̾�� @strong{MySQL} �桼����̾�˥ޥå����ޤ���
@code{Db} �ե�����ɤϥ桼���������������������ǡ����١���̾�˥ޥå����ޤ���
@code{Host} �� @code{User} �˥ޥå������Τ�̵���ä���硢���������ϵ��ݤ���ޤ���

@item
@code{db} �ơ��֥���� @code{Host} �ե�����ɤ����Ǥʤ�����ȥ�˥ޥå�������硢
�桼�����λ��ꤵ��Ƥ���ǡ����١������Ф��븢�¤��������ޤ���

@item
@code{Host} �ե�����ɤ����ͤ� @code{db} �ơ��֥�Υ���ȥ�˥ޥå�������硢
�ɤΥۥ��Ȥ����Υǡ����١����إ��������Ǥ��뤫�� @code{host} �ơ��֥뤫��õ���Ф��ޤ���
���ξ�硢@code{host} �ơ��֥� �� @code{Host}, @code{Db} �ե�����ɤȥޥå������Τ�õ���Ф��ޤ���
@code{host} �ơ��֥�˥���ȥ꤬�ʤ��ä���硢���������ϵ��ݤ���ޤ���
�⤷�ޥå�����ȡ��桼����������ǡ����١������Ф��븢�¤ϡ�
@code{host} �ơ��֥�� @code{db} �ơ��֥�ξ���ˤޤ����ä����¤�����Ф���ޤ���
�����ʤ��ξ���Ȥ� @code{'Y'} �Ǥ��븢�¡�
(������ˡ����Ѥ���ȡ��ޤ� @code{db} �ơ��֥�Υ���ȥ����ޤ��ʸ��¤����ꤷ�Ƥ�����
���줫�� @code{host} �ơ��֥�Υ���ȥ����Ѥ��ơ��ۥ��Ⱦ����Ȥ˸��¤���ꤷ�Ƥ����Ȥ��������Ǥ��ޤ�)
@end enumerate

����ǡ����١������Ф��븢�¤� @code{db} �ơ��֥�� @code{host} �ơ��֥�Υ���ȥ꤫����ꤵ�줿�塢
�����С��Ϥ��γ��Ф��줿���¤��Ф���@code{user} �ơ��֥�����ꤵ��Ƥ��븢�¤�ä��ޤ���
���η�̤�������줿���¤˥ޥå������׵�ϼ���������ޤ���
�����Ǥʤ���С������С��ϥ桼�����Υơ��֥롢�ե�����ɤ��Ф�����Ĥ�
 @code{tables_priv} �� @code{columns_priv} ���õ���ޤ���
���������Ϥ��η�̤ˤ�ꡢ���ġ����ݤ���ޤ���

��Υ桼�����θ��¤��׻��������ˡ�ε��Ҥϡ�boolean ɽ���Ǽ����ʤ�С�
�ʲ��Τ褦�ˤʤ�Ǥ��礦��

@example
global privileges
OR (database privileges AND host privileges)
OR table privileges
OR column privileges
@end example

����Ͼ���ʬ����ˤ������⤷��ޤ��󡣤⤷�������Х�� @code{user} ����ȥ�
���µ��Ĥ����ꥯ�����Ȥ��줿���ڥ졼�����ˤ��Խ�ʬ���Ⱥǽ��ʬ���ä��ݡ�
�����С��������θ��¤� database-, table-, column-��ͭ�θ��¤�
��ˡ��ʤ����ɲä��Ƥ��ޤ��Τ���
 ������ͳ�ϡ��ꥯ�����Ȥ�1�İʾ�θ��¤��׵᤹��������Ȥ������ȤǤ���
�㤨�С��⤷���ʤ��� @code{INSERT ...  SELECT} ��ʸ��¹Ԥ���ʤ顢
���ʤ��ˤ� @strong{insert} �� @strong{select} ���Ĥ�ɬ�פǤ���
���ʤ��θ��¤��� @code{user} �ơ��֥륨��ȥ�ǰ�Ĥθ��¤����Ĥ��졢
 @code{db} �ơ��֥�ǡ����Τۤ��θ��¤����Ĥ���Ƥ����Ȥ��ޤ���
���ξ�硢���ʤ��ϡ����Υꥯ�����Ȥ�¹Ԥ��뤿��ˡ�ɬ�פʸ��¤���äƤ��ޤ���
�������������С��Ϥɤ���Υơ��֥롢����ñ�Τ���Ǥϡ����¤����뤳�Ȥ�����ޤ���
���¤ϡ�ξ���Υ���ȥ꡼���碌�ʤ��ƤϤʤ�ʤ��ΤǤ���

@code{host} �ơ��֥�� ``������'' �ۥ��ȤΥꥹ�Ȥ�ݻ����뤿��˻��ѤǤ��ޤ���
TcX �Ǥϡ�@code{host} �ơ��֥�ˤϥ�������ͥåȾ�����ƤΥۥ��Ȥ���Ͽ����Ƥ��ޤ���
�����Υۥ��Ȥ����Ƥθ��¤����Ĥ���Ƥ��ޤ���

�դ� @code{host} table �ǰ���@emph{�ǤϤʤ�}�ۥ��Ȥ���ꤹ�뤳�Ȥ�Ǥ��ޤ���
 @code{public.your.domain} �Ȥ����ޥ��󤬰����ǤϤʤ�����������Ƥ�����ˤ���Ȥ��ޤ���
���ξ��ʲ��Τ褦�ˤ��ơ����θ����ޥ���ʳ��Υͥåȥ����Υۥ��Ȥ��Ф��ơ�������������Ĥ��뤳�Ȥ��Ǥ��ޤ���

@example
+--------------------+----+-
| Host               | Db | ...
+--------------------+----+-
| public.your.domain | %  | ... (all privileges set to 'N')
| %.your.domain      | %  | ... (all privileges set to 'Y')
+--------------------+----+-
@end example

���¤Υơ��֥�����ϡ����ʤ��λפ��̤�˵��Ĥ�������Τ������(@code{mysqlaccess}������Ѥ���)�����å����٤��Ǥ���


@node Privilege changes, Default privileges, Request access, Privilege system
@section ���ĸ��¤��ѹ���ȿ�Ǥ���뤫

@code{mysqld} �ε�ư�������Ƥε��ĥơ��֥�ϥ��꡼���ɤ߹��ޤ졢
���λ�����ͭ���ˤʤ�ޤ���

@code{GRANT}, @code{REVOKE}, @code{SET PASSWORD} ����Ѥ��Ƶ��ĥơ��֥��
�ѹ�������硢ľ�˥����Ф����Τ���ޤ���

�⤷��ư�ǵ��ĥơ��֥���ѹ��������(@code{INSERT}, @code{UPDATE} �ʤɤ�)��
@code{FLUSH PRIVILEGES} ��ʸ�� @code{mysqladmin flush-privileges} ���ޥ��
�� @code{mysqladmin reload} ���ޥ�ɤ�¹Ԥ��ơ�
�����С��˵��ĥơ��֥���ɤ߹��ߤ�ؼ����ʤ���Фʤ�ޤ���
�������ʤ���С������С���Ƶ�ư������ޤǡ��ѹ���@emph{ȿ�Ǥ���ޤ���}��
If you change the grant tables manually
but forget to reload the privileges, you will be wondering why your changes
don't seem to make any difference!

�����С������ĥơ��֥���ѹ������Τ�����硢������³���Ƥ���
���饤����Ȥϡ��ʲ��Τ褦�ʱƶ�������ޤ���

@itemize @bullet
@item
�ơ��֥�ȥե�����ɤε��Ĥ��ѹ��ϡ����Υ��饤����Ȥ��׵ᤫ��ȿ�Ǥ���ޤ���

@item
�ǡ����١������Ф�����Ĥ��ѹ��ϼ��� @code{USE db_name} ���ޥ�ɰʹߤ���
ͭ���ˤʤ�ޤ���

@end itemize

�������Х븢�¤ȥѥ���ɤ��ѹ��ϡ����Υ��饤����Ȥ���³������ȿ�Ǥ���ޤ���


@node Default privileges, Adding users, Privilege changes, Privilege system
@section @strong{MySQL} ���µ��Ĥν������

@strong{MySQL} ���󥹥ȡ���塢@code{scripts/mysql_install_db} ��¹Ԥ��Ƹ��¤Υ����������Ĥ��������ޤ���
@xref{Quick install}.
@code{mysql_install_db} ������ץȤ� @code{mysqld} �����С���ư����
�ʲ��Τ褦�˸��¤��������ƥơ��֥����Ͽ���ޤ���

@itemize @bullet
@item
@strong{MySQL} @code{root} �桼�����ϥ����ѡ��桼�����Ȥ�����Ͽ���졢
���Ƥ����Ǥ��ޤ���
localhost���餷����³�Ǥ��ޤ���

@strong{����:}
@code{root} �Υѥ���ɤν���ͤ϶��Ǥ���
���Ƥοͤ� @emph{�ѥ���ɤʤ���} @code{root} �ˤʤ졢���Ƥθ��µ��Ĥ����뤳�Ȥ��Ǥ��ޤ���

@item
@cindex Anonymous user
@code{'test'} ���뤤�� @code{'test_'} ��̾�����Ϥ��ޤäƤ���ǡ����١������Ф��ơ�
ƿ̾�桼�����Ǥ�ʤ�Ǥ�Ǥ���褦�˵��Ĥ�Ϳ�����ޤ���
����� ��������ۥ��Ȥ�������ƤΥ桼������ �ѥ����̵������³���Ǥ���
ƿ̾�桼�����Ȥ��ư�����Ȥ������ȤǤ���

@item
����¾���׵�ϵ��ݤ���ޤ����㤨�С����̥桼������ @code{mysqladmin shutdown} �� @code{mysqladmin processlist} ��¹ԤǤ��ޤ���
@end itemize

@strong{����:} �ǥե���Ȥθ��¤� Win32 �Ǥϰ㤤�ޤ���
@xref{Win32 running}.

������󥹥ȡ���ξ��֤ǤϤ��ʤꥢ����������������Ƥ���Τǡ�
���󥹥ȡ����ǽ�ˤ��뤳�Ȥϡ�@strong{MySQL} @code{root} �桼�����˥ѥ���ɤ����ꤹ�뤳�ȤǤ���
�ʲ��Τ褦�ˤ��ޤ�(�ѥ���ɤ� @code{PASSWORD()} �ؿ�����Ѥ��뤳�Ȥ�˺��ʤ�)��

@example
shell> mysql -u root mysql
mysql> UPDATE user SET Password=PASSWORD('new_password')
           WHERE user='root';
mysql> FLUSH PRIVILEGES;
@end example

@strong{MySQL} 3.22 �ʾ�Ǥϡ�@code{SET PASSWORD} ��ʸ����ѤǤ��ޤ�:

@example
shell> mysql -u root mysql
mysql> SET PASSWORD FOR root=PASSWORD('new_password');
@end example

password �򥻥åȤ���¾����ˡ�Ȥ��ơ�@code{mysqladmin} ���ޥ�ɤ���ѤǤ��ޤ���

@example
shell> mysqladmin -u root password new_password
@end example

�⤷�ǽ����ˡ�� @code{user} �ơ��֥�Υѥ���ɤ�ľ�ܹ��������ʤ顢
�����С��˵��ĥơ��֥�κ��ɤ߹��ߤ�Ԥ碌�ʤ���Фʤ�ޤ���(@code{FLUSH PRIVILEGES} ����Ѥ���)��

���� @code{root} �Υѥ���ɤ����ꤷ���ʤ顢@code{root} �ǥ����С�����³�������
��˥ѥ���ɤ�Ϳ���ʤ���Фʤ�ޤ���

�ɲ������ƥ��Ȥ򤷤Ƥ��뤿��ѥ���ɤ����줿���ʤ���硢
@code{root} �ѥ���ɤ�֥�󥯤Τޤޤˤ��Ƥ������ȹͤ��뤫���Τ�ޤ��󤬡�
�²�Ư���������ˤ�ɬ�����ꤷ�Ƥ���������

�ɤΤ褦�˥ǥե���Ȥθ��¤����ꤷ�Ƥ��뤫��@code{scripts/mysql_install_db} ���ƤߤƤ���������
�����¾�Υ桼���������ꤹ��Ȥ��˻Ȥ���Ǥ��礦��

�⤷���¤ν�����֤�㤦��Τˤ��ƽ�����������ʤ顢
@code{mysql_install_db} ��¹Ԥ��������Խ����Ƥ�褤�Ǥ��礦��

�⤷�ơ��֥�����˺��ľ�������ʤ顢@code{mysql} �ǡ����١����Υǥ��쥯�ȥ��¸�ߤ���
���Ƥ� @file{*.frm}, @file{*.MYI}, @file{*.MYD} �ե�����������ޤ���
(���Υǥ��쥯�ȥ꡼�ϥǡ����١����ǥ��쥯�ȥ꡼�β��� @code{mysql} �Ȥ���̾����¸�ߤ��ޤ���
@code{mysqld --help} �Ȥ���Хǡ����١����Υǥ��쥯�ȥ꡼��ɽ������ޤ���)
�����ƹ��ߤε��ľ��֤� @code{mysql_install_db} ���Խ����Ƥ���¹Ԥ��ޤ���

@strong{����:} @strong{MySQL} 3.22.10 �����ΥС������Ǥ�, 
@file{*.frm} �ե������ä��ƤϤ����ޤ���.  �⤷���ä���ä��Ƥ��ޤä���硢
@code{mysql_install_db} ��¹Ԥ������ˡ� @strong{MySQL} ���ۤ��饳�ԡ����ʤ���
�ʤ��ƤϤʤ�ޤ���


@node Adding users, Passwords, Default privileges, Privilege system
@section �������桼�����¤� @strong{MySQL} ���ɲ�

�桼�����ϣ��Ĥΰ�ä���ˡ���ɲäǤ��ޤ���
@code{GRANT} ��ʸ����Ѥ��ƹԤ���ˡ�ȡ�
@strong{MySQL} �ε��ĥơ��֥��ľ��������ˡ�ȤǤ���
@code{GRANT} ��ʸ�λ��Ѥ򤪴��ᤷ�ޤ���

�ʲ�����Ǥϡ������ˤ��� @code{mysql} ���饤����Ȥ���Ѥ��ƿ����˥桼��������Ͽ���뤫�򼨤��ޤ���
�ʲ�����Ǥϡ����¤�����ǽҤ٤��ǥե�����ͤˤʤäƤ���Ȥ��ޤ���
��ä��ѹ���Ԥ�����ˤϡ����ʤ��� @code{mysqld} �����äƤ���ޥ����˥������󤷤Ƥ��ʤ��ƤϤʤ�ޤ��󤷡�
���ġ�@strong{MySQL} @code{root} �桼��������³���Ƥ��ʤ���Фʤ�ޤ���
����� @strong{MySQL} @code{root} �桼�����ˤ�
 @code{mysql} �ǡ����١������Ф��� @strong{insert} ���¤������
@strong{reload} �Υ��ɥߥ˥��ȥ졼�������¤���äƤ��ʤ���Фʤ�ޤ���
�⤷ @code{root} �桼�����Υѥ���ɤ��Ѥ��Ƥ����ʤ�С�
 @code{mysql} ���ޥ�ɤ˥ѥ���ɻ����Ϳ���ʤ��ƤϤʤ�ޤ���

@example
shell> mysql --user=root mysql
mysql> GRANT ALL PRIVILEGES ON *.* TO monty@@localhost
           IDENTIFIED BY 'some_pass' WITH GRANT OPTION;
mysql> GRANT ALL PRIVILEGES ON *.* TO monty@@"%"
           IDENTIFIED BY 'some_pass' WITH GRANT OPTION;
mysql> GRANT RELOAD,PROCESS ON *.* TO admin@@localhost;
mysql> GRANT USAGE ON *.* TO dummy@@localhost;
@end example

����� @code{GRANT} ��ʸ�Ǥ�3�Ĥο������桼������ޤ�:

@table @code
@item monty
�ɤ�����Ǥ⥵���С�����³�Ǥ��봰���ʥ����ѡ��桼����
��������@strong{MySQL} ����Ѥ�����ˤϥѥ���� @code{'some_pass'} ��
���Ѥ���ɬ�פ�����ޤ���
@code{monty@@localhost} �� @code{monty@@"%"} ��ξ���� @code{GRANT} ��ʸ��
ȯ�Ԥ��ʤ��ƤϤʤ�ʤ��������դ��Ƥ���������
�⤷ @code{localhost} ����ε��Ĥ򤷤���Ͽ���ʤ��ȡ�@code{localhost} ������³��������
@code{mysql_install_db} ����ư�Ǻ������� @code{localhost} �ؤ�ƿ̾�桼������ͥ�褵��ޤ���
�ʤ��ʤ顢 @code{Host} �ե�����ɤ��ͤ�(�֥�󥯤���ɥ����ɰʳ���)��������Ƥ��ꡢ
������Ͽ�� MySQL �����ǥ����Ȥ������˽��֤���˥����Ȥ���뤫��Ǥ���

@item admin
@code{localhost} ����ѥ���ɤʤ�����³�Ǥ��ޤ�����@code{reload}, @code{process} �λ��Ѥ�����������ޤ���
����ϡ�@code{mysqladmin reload}, @code{mysqladmin refresh}, @code{mysqladmin flush-*} ������
 @code{mysqladmin processlist} ���ޥ�ɤμ¹Ԥ����Υ桼�����˵��Ĥ���ޤ���
�ǡ����١����ؤΥ��������ϵ��Ĥ���Ƥ��ޤ���
����������ϸ�ǥơ��֥� @code{GRANT} ��ʸ��ȯ�Ԥ���С�
�ġ��Υǡ����١����ؤΥ����������¤�����Ǥ��ޤ���

@item dummy
�ѥ���ɤʤ��� localhost ����Τߡ���³�Ǥ���桼������
�������Х�ʸ��¤����� @code{'N'} �����ꤵ��ޤ���
@code{USAGE} ���¤ϸ���̵���桼�������������Ĥ�����ˤʤ�ޤ���
����ϡ�����ǡ������١������Ф��Ƥε��Ĥ�夫��Ϳ����������ꤷ�Ƥ��ޤ���
@end table

Ʊ�������������Ĥ� @code{INSERT} ��ʸ����Ѥ���ľ������Ǥ��ޤ���
�����С��˵��ĥơ��֥�κ��ɤ߹��ߤ�ؼ����ޤ���

@example
shell> mysql --user=root mysql
mysql> INSERT INTO user VALUES('localhost','monty',PASSWORD('some_pass'),
                'Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y')
mysql> INSERT INTO user VALUES('%','monty',PASSWORD('some_pass'),
                'Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y')
mysql> INSERT INTO user SET Host='localhost',User='admin',
                 Reload_priv='Y', Process_priv='Y';
mysql> INSERT INTO user (Host,User,Password)
                        VALUES('localhost','dummy','');
mysql> FLUSH PRIVILEGES;
@end example

@strong{MySQL} �ΥС������ˤ�ꡢ��� @code{'Y'} �ο����㤦�������դ��Ƥ���������
(3.22.11 �����ΥС������ǤϹ��ܿ������ʤ��ʤ�ޤ�).
@code{admin} �桼��������Ͽ�ǻ��Ѥ��Ƥ��� @code{INSERT} �γ�ĥ�� 3.22.11 �ʾ�Dz�ǽ�Ǥ���

�����ѡ��桼������������뤿��ˤϡ�@code{user} �ơ��֥�ε��ĥե�����ɤ�
@code{'Y'} �ˤ�������Ǥ��ޤ��ޤ���
@code{db} �� @code{host} �ơ��֥����Ͽ��ɬ��̵���ΤǤ���

@code{user} �ơ��֥�ε��ĥե�����ɤϺǸ�� @code{INSERT} ʸ��(@code{dummy} �桼�����Τ����)
�����ꤵ��Ƥ��ޤ��󡣤����Υե�����ɤϥǥե�����ͤ� @code{'N'} �ˤʤ�ޤ���
����� @code{GRANT USAGE} ���Ԥ��Τ�Ʊ����ΤǤ���

�ʲ��ϡ�@code{localhost}, @code{server.domain}, @code{whitehouse.gov} ������³����ǽ��
 @code{custom} �桼�������ɲ���Ǥ���
 @code{custom} �桼������ @code{bankaccount} �ǡ������١����ˤ� @code{localhost} �������³�Τߤ���Ĥ��졢
@code{expenses} �ǡ����١����ˤ� @code{whitehouse.gov} ����Τ���³�����Ĥ��졢
@code{customer} �ǡ����١����ˤ����ƤΥۥ��Ȥ�����³�Ǥ��ޤ���
@code{custom} �桼�����ϡ� @code{stupid} �Ȥ����ѥ���ɤ����ƤΥۥ��Ȥǻ��Ѥ������Ȥ��ޤ���

���Υ桼�����ε��Ĥ� @code{GRANT} ��ʸ���������ˤϡ��ʲ��Τ褦�ˤ��ޤ���

@example
shell> mysql --user=root mysql
mysql> GRANT SELECT,INSERT,UPDATE,DELETE,CREATE,DROP
           ON bankaccount.*
           TO custom@@localhost
           IDENTIFIED BY 'stupid';
mysql> GRANT SELECT,INSERT,UPDATE,DELETE,CREATE,DROP
           ON expenses.*
           TO custom@@whitehouse.gov
           IDENTIFIED BY 'stupid';
mysql> GRANT SELECT,INSERT,UPDATE,DELETE,CREATE,DROP
           ON customer.*
           TO custom@@'%'
           IDENTIFIED BY 'stupid';
@end example

���ĥơ��֥��ľ���ѹ����Ƥ��Υ桼�����θ��¤����ꤹ��ˤϤ����Τ褦�ˤ��ޤ�
(@code{FLUSH PRIVILEGES} ��Ǹ�˼¹Ԥ��Ƥ����������)��

@example
shell> mysql --user=root mysql
mysql> INSERT INTO user (Host,User,Password)
       VALUES('localhost','custom',PASSWORD('stupid'));
mysql> INSERT INTO user (Host,User,Password)
       VALUES('server.domain','custom',PASSWORD('stupid'));
mysql> INSERT INTO user (Host,User,Password)
       VALUES('whitehouse.gov','custom',PASSWORD('stupid'));
mysql> INSERT INTO db
       (Host,Db,User,Select_priv,Insert_priv,Update_priv,Delete_priv,
        Create_priv,Drop_priv)
       VALUES
       ('localhost','bankaccount','custom','Y','Y','Y','Y','Y','Y');
mysql> INSERT INTO db
       (Host,Db,User,Select_priv,Insert_priv,Update_priv,Delete_priv,
        Create_priv,Drop_priv)
       VALUES
       ('whitehouse.gov','expenses','custom','Y','Y','Y','Y','Y','Y');
mysql> INSERT INTO db
       (Host,Db,User,Select_priv,Insert_priv,Update_priv,Delete_priv,
        Create_priv,Drop_priv)
       VALUES('%','customer','custom','Y','Y','Y','Y','Y','Y');
mysql> FLUSH PRIVILEGES;
@end example

�ǽ�Σ��Ĥ� @code{INSERT} ʸ�ϡ� @code{custom} �桼���������줾��Υۥ��Ȥ���
�ѥ���ɤĤ�����³�Ǥ���褦�� @code{user} �ơ��֥���ɲä��Ƥ��ޤ���
�����������Ǥϸ��¤ϣ��Ĥ�Ϳ�����Ƥ��ޤ���(���¤Υǥե�����ͤ� @code{'N'} �Ǥ�)��
���λ��Ĥ� @code{INSERT} ʸ�ϡ�@code{bankaccount}, @code{expenses}, @code{customer}
 �ǡ����١������Ф��볺���ۥ��Ȥ���Υ����������Ĥ� @code{custom} �桼������Ϳ����褦�ˡ�
@code{db} �ơ��֥���ɲä��Ƥ��ޤ���
���ĥơ��֥뤬ľ���ѹ����줿��硢�����򥵡��С���ȿ�Ǥ����뤿��ˡ����ĥơ��֥��
���ɤ߹��ߤ�(@code{FLUSH PRIVILEGES}��) �����С��ˤĤ��ʤ���Фʤ�ޤ���

�⤷������ɥᥤ������ƤΥޥ������³����Ĥ�������硢
�ʲ��Τ褦�� @code{GRANT} ��ʸ��ȯ�Ԥ��ޤ���

@example
mysql> GRANT ...
           ON *.*
           TO myusername@@"%.mydomainname.com"
           IDENTIFIED BY 'mypassword';
@end example

���ĥơ��֥��ľ���ѹ�����ˤϰʲ��Τ褦�ˤ��ޤ���

@example
mysql> INSERT INTO user VALUES ('%.mydomainname.com', 'myusername', 
           PASSWORD('mypassword'),...);
mysql> FLUSH PRIVILEGES;
@end example
�������@code{xmysqladmin}, @code{mysql_webadmin}, ������ @code{xmysql} ��Ȥä�
�⡢���¥ơ��֥�ؤ��ͤ�����/�ѹ�/�������Ǥ��ޤ��������Υ桼�ƥ���ƥ��� 
@uref{http://www.mysql.com/Contrib/,Contrib directory of the @strong{MySQL}
Website}.
�˸��Ĥ��뤳�Ȥ��Ǥ��ޤ���


@node Passwords, Access denied, Adding users, Privilege system
@section �ѥ���ɤ�����ˡ
@cindex Passwords, setting
@findex PASSWORD()

�������ǽҤ٤����ȤƤ���פʴ��ܸ�§��

@code{INSERT} �� @code{UPDATE} �Ƕ��ǤϤʤ��ѥ���ɤ����ꤹ���硢
�Ź沽���뤿��� @code{PASSWORD()} �ؿ�����Ѥ��ʤ��ƤϤʤ�ޤ���
����� @code{user} �ơ��֥�ϥץ졼��ƥ����ȤǤʤ����Ź沽���줿�ѥ���ɤǤ��뤳�Ȥ��׵ᤷ�Ƥ��뤫��Ǥ���
���θ�§��˺��Ƥ��ޤä���硢�ʲ��Τ褦�ˤ��ƥѥ���ɤ򥻥åȤ��Ƥ��ޤ����⤷��ޤ���

@example
shell> mysql -u root mysql
mysql> INSERT INTO user (Host,User,Password)
       VALUES('%','jeffrey','biscuit');
mysql> FLUSH PRIVILEGES;
@end example

����� @code{user} �ơ��֥�˥ץ졼��ƥ����Ȥ� @code{'biscuit'} ��ѥ���ɤȤ�����Ͽ���Ƥ��ޤ��ޤ���
@code{jeffrey} �桼�����Ǥ��Υѥ���ɤ���Ѥ��ƥ����С�����³���褦�Ȥ���ȡ�
 @code{mysql} ���饤����ȤϰŹ沽�����ѥ���ɤ򥵡��С�������ޤ���
�����С��ϰŹ沽���줿�ѥ����(@code{'biscuit'} �Ǥ�@emph{����ޤ���}) ��
 @code{user} �ơ��֥����Ͽ���줿��(@code{'biscuit'}) ����Ӥ��ޤ���
���η�̡���Ӥϼ��Ԥ��������С�����³����ݤ��ޤ���

@example
shell> mysql -u jeffrey -pbiscuit test
Access denied
@end example

 @code{user} �ơ��֥����Ͽ�����ѥ���ɤϰŹ沽���줿��ΤǤʤ��ƤϤʤ�ޤ���
@code{INSERT} ��ʸ�ϰʲ��Τ褦�ˤ��ƻ��Ѥ��ʤ��ƤϤʤ�ޤ���

@example
mysql> INSERT INTO user (Host,User,Password)
       VALUES('%','jeffrey',PASSWORD('biscuit'));
@end example

@code{SET PASSWORD} ��ʸ����Ѥ�����ϡ��ʲ��Τ褦�ˤ��ʤ��ƤϤʤ�ޤ���

@example
mysql> SET PASSWORD FOR jeffrey@@"%" = PASSWORD('biscuit');
@end example

�⤷ @code{GRANT ... IDENTIFIED BY} ��ʸ�� @code{mysqladmin password} ���ޥ��
�ǥѥ���ɤ����ꤷ����硢@code{PASSWORD()} �ؿ���ɬ�פ���ޤ���
ξ���Ȥ⡢�ѥ���ɤ�Ź沽���Ƥ���ޤ��Τǡ�
�ʲ��Τ褦��@code{'biscuit'}��Ϳ���ޤ���

@example
mysql> GRANT USAGE ON *.* TO jeffrey@@"%" IDENTIFIED BY 'biscuit';

shell> mysqladmin -u jeffrey password biscuit
@end example

@strong{����}�� @code{PASSWORD()} ���ѥ���ɤ�Ź沽���뤳�Ȥ����դ��Ƥ���������
���ΰŹ沽�� UNIX �Υѥ���ɤǻ��Ѥ���Ƥ���Ź沽�Ȱ㤦���Ȥˤ�α�դ��Ƥ���������
UNIX �ѥ���ɥե�����˵�Ͽ����Ƥ���Ź�� @code{PASSWORD()} ���Ź沽����ʪ��Ʊ���Ǥ⡢
Ʊ���ѥ���ɤǤ���Ȥϻפ�ʤ��Ǥ���������
@xref{User names}.

@node Access denied,  , Passwords, Privilege system
@section ���� @code{Access denied} ���顼�ˤʤ�Τ�

�⤷��@strong{MySQL} �����С�����³���褦�Ȥ��� @code{Access denied} ���顼��
�������Ƥ��ޤä��顢�ʲ��˵������Ȥ�����β��Τ���λ�ɸ�Ȥʤ�Ǥ��礦:

@itemize @bullet
@item
@strong{MySQL} �򥤥󥹥ȡ��뤷����ˡ�������ץ� @code{mysql_install_db} ��¹Ԥ���
���ĥơ��֥���������ޤ�������
���Ƥ��ʤ���м¹Ԥ��Ƥ���������@xref{Default privileges}
���µ��ĤΥơ��֥뤬���������Ƥ��뤫���ˤϰʲ��Τ褦�ˤ��ޤ���

@example
shell> mysql -u root test
@end example

��������̤ϥ��顼�ʤ�����³�Ǥ��ޤ���
@strong{MySQL} �ǡ����١����ǥ��쥯�ȥ���� @file{user.MYD} �ե����뤬���뤫�ɤ����Ǥ�����å����ޤ���
(���̤� @file{PATH/var/mysql/user.MYD} �Ǥ��������� @code{PATH} �� @strong{MySQL} �򥤥󥹥ȡ��뤷���ǥ��쥯�ȥ꡼�ѥ��򼨤��ޤ���)

@item
���ƥ��󥹥ȡ��뤷����ϡ��ʲ��Τ褦�ˤ��ƥ����С�����³���ƥ桼�����ȥ��������������ꤷ�ʤ��ƤϤʤ�ޤ���

@example
shell> mysql -u root mysql
@end example

������֤Ǥϡ�@strong{MySQL} �� @code{root} �桼������ѥ���ɤʤ�����Ͽ���Ƥ���Τǡ�
����ʤ���³�Ǥ���Ϥ��Ǥ���
����������ϥ������ƥ�������ʾ��֤ʤΤǡ�
¾�� @strong{MySQL} �桼��������Ͽ���Ƥ�����ˡ�
@code{root} �Υѥ���ɤ����ꤷ�Ƥ����Ƥ���������

�⤷ @code{root} ����³���褦�Ȥ��ưʲ��Υ��顼���Ф���硧

@example
Access denied for user: '@@unknown' to database mysql
@end example

����� @code{user} �ơ��֥�ˡ� @code{User} �ե������ = @code{root} ����
@code{mysqld} ���꥾��֤Ǥ��ʤ��ä��ۥ���̾�ǡ����饤����Ȥ���Ͽ����Ƥ��ʤ�����Ǥ���
���ξ�硢 @file{/etc/hosts} �ե����뤢�뤤�� @file{\windows\hosts} �ե�������Խ�����
�ۥ���̾���ɲä���@code{--skip-grant-tables} ���ץ����ǥ����С���ꥹ�����Ȥ��ޤ���

@cindex @code{mysql_fix_privilege_tables}
�⤷ 3.22.11 ������� @strong{MySQL} ���� 3.22.11 �ʾ�˥С�����󥢥åפ����ʤ顢
@code{mysql_fix_privilege_tables} ������ץȤ�¹Ԥ��ޤ�������
�¹Ԥ��Ƥ��ʤ��ʤ顢���Υ��顼�ˤʤ�ޤ���
���ĥơ��֥�ι�¤�� @strong{MySQL} 3.22.11 �����ѹ����졢
@code{GRANT} ��ʸ����ǽ���Ƥ��ޤ���

@item
�⤷���ĥơ��֥��ľ���Ѥ���(@code{INSERT} �� @code{UPDATE} ��ʸ��)��
�ѹ���̵�뤵��Ƥ���褦�ʤ�С������С��˥ơ��֥����ɤ߹��ߤ����뤿��ˡ�
@code{FLUSH PRIVILEGES} ��ʸ�� @code{mysqladmin flush-privileges} ���ޥ�ɤ�
�¹Ԥ������פ��Ф��Ƥ���������
�����¹Ԥ��ʤ��ä���硢�ѹ��ϼ��Υ����С��Υꥹ�����Ȥޤ�ȿ�Ǥ���ޤ���
@code{root} �桼�����Υѥ���ɤ����ꤷ�����ȤǤ⡢
���¾������ɤ߹��ߤ���ޤǤϿ������ѥ���ɤ����פǤ���
�ʤ��ʤ顢�����С��Ͽ������ѥ���ɤ�ޤ��Τ�ʤ�����Ǥ���

@code{mysqladmin reload} ��ԤäƤ⡢���¤�ͭ���ʤΤϡ�
���Υ��ޥ��ȯ�Ը�˿�������³�������饤����Ȥ��Ф��Ƥ����Ǥ���
(¿���θ��¾��󤬥����С��˥���å��夵��Ƥ��뤿��Ǥ�)

@item
�⤷���ʤ��θ��¤����å�����������ѹ����줿�褦�˻פä��ʤ顢�����
�����ѡ��桼���������¤��Ѥ����Τ����Τ�ޤ��󡣵��ĥơ��֥�κ��ɤ߹��ߤ�
���������饤����Ȥ���³����ȿ�Ǥ���ޤ��������Ǥ���³���Ƥ�����Ǥ�
@ref{Privilege changes}. �˼�����ﲼ�Ǥϱƶ�������ޤ���

@item
�ƥ��ȤΤ���ˤϡ�@code{mysqld} �ǡ����� @code{--skip-grant-tables} ���ץ���
��dz��Ϥ��٤��Ǥ������������ @strong{MySQL} ��ǧ�ơ��֥���ѹ��Ǥ����������
�� @code{mysqlaccess} �򡢤��ʤ��ξ�ǧ��Ư�����ɤ����Υ����å��Τ���˻�
�ѤǤ��ޤ���
@code{mysqladmin flush-privileges} �� @code{mysqld} �ǡ����˿�������ǧ�ơ��֥��
���Ѥ򳫻Ϥ���褦���Τ餻�ޤ�������� @code{--skip-grant-tables} ���ץ������񤭤��ޤ���
�桼�����ε��ĥơ��֥���ɤ߹��ޤ���Τˡ������С������Ω���夲ľ��ɬ�פϤ���ޤ���

@item
Perl, PHP, Python �ޤ��� ODBC �ǥ������������꤬���ä����⡢��� 
@code{mysql -u user_name db_name} �ޤ��� @code{mysql -u user_name -pyour_pass db_name} �ǡ�
���¤������ƥ��Ȥ��Ƥ���������(@code{-p} �� password �δ֤ˤ϶�
�򤬤ʤ����Ȥ����դ��Ƥ���������@code{--password=your_password} ��ʸ�Ǥ�
�ѥ���ɤ�Ϳ�����ޤ�)
@code{mysql} ���饤����Ȥ���³�Ǥ���ʤ顢���������θ��¤����������ǤϤʤ���
�ץ�����������Ǥ���

@item
�⤷���ʤ��Υѥ���ɤ�Ư���ʤ��ΤǤ���С�
@code{INSERT}, @code{UPDATE}, @code{SET PASSWORD} ��ʸ�ǥѥ���ɤ����ꤹ��Ȥ�
 @code{PASSWORD()} �ؿ�����Ѥ��ʤ���Фʤ�ʤ����Ȥ�פ��Ф��Ƥ���������
������ @code{PASSWORD()} �ؿ��ϡ�@code{GRANT ... INDENTIFIED BY} ��ʸ��
@code{mysqladmin password} ���ޥ�ɤǤ����פǤ���
@xref{Passwords}.

@item
@code{localhost} �ϥ�������Υۥ���̾�Ǥ���
�⤷���饤����Ȥ��ۥ��Ȥ���ꤻ������³���Ƥ�����硢@code{localhost} ���ǥե���Ȥǻ��Ѥ���ޤ���
�������� MIT-pthreads ����Ѥ��Ƥ����硢@code{localhost} �ؤ���³�ϼ��Ԥ��ޤ���
(@code{localhost} �ؤ���³�ϡ�Unix�����åȤ���Ѥ��ޤ����� MIT-pthreads �� �����å���³�򥵥ݡ��Ȥ��Ƥ��ʤ�����Ǥ���)
�������꤬�����륷���ƥ�Ǥϡ������С�̾����ꤹ�뤿��� @code{--host} ���ץ�������Ѥ��٤��Ǥ���
����� TCP/IP ��³����Ѥ��� @code{mysqld} �����С�����³���ޤ���
���ξ�硢@code{user} �ơ��֥�ˡ������С��μ¥ۥ���̾����Ͽ���Ƥ����ʤ��ƤϤʤ�ޤ���
(����ϥ��饤����ȥץ������򥵡��С���Ʊ���ۥ��Ⱦ��ư�����Ƥ����翿�Ȥʤ�ޤ�)

@item
@code{mysql -u user_name db_name} ����Ѥ��ƥǡ����١�������³���Ƥ���Ȥ���
 @code{Access denied} ���顼��ȯ��������硢@code{user} �ơ��֥������㤤���ͤ����ޤ���
@code{mysql -u root mysql} ��¹Ԥ����ʲ��� SQL ʸ���Ƥ���������

@example
mysql> SELECT * FROM user;
@end example

@code{Host} �� @code{User} �ˤ��ʤ��Υ���ԥ塼��̾�� @strong{MySQL} �桼����̾�˥ޥå�������Ͽ���ʤ���Ƥ��ʤ���Фʤ�ޤ���

@item
@code{Access denied} ���顼�ϡ��ɤΥ桼��������³���Ƥ��������ɤΥۥ��Ȥ�����³���褦�Ȥ��Ƥ��뤫���ѥ���ɤ���Ѥ��Ƥ���Τ����å������˽��Ϥ��ޤ���
�̾���顼�ˤʤäƤ���ۥ���̾�ȥ桼����̾���ޥå����륨��ȥ꤬ @code{user} �ơ��֥�˰�ĤϤʤ���Фʤ�ޤ���

@item
¾�Υۥ��Ȥ��� @strong{MySQL} �����С�����³���ߤ����˰ʲ��Υ��顼���Ф���硢
@code{user} �ơ��֥�ˤ��ʤ��������������Ƥ���ۥ��Ȥ˥ޥå�����Ԥ�����ޤ���

@example
Host ... is not allowed to connect to this MySQL server
@end example

@code{mysql} ���ޥ�ɤ򥵡��С��Υۥ��Ⱦ�ǻ��Ѥ��ơ�
@code{user}, @code{db}, @code{host} �ơ��֥�ˡ���³���褦�Ȥ��Ƥ��� �桼����̾���ۥ���̾ ��
�ä���в��Ǥ���Ǥ��礦��
�⤷�����С��� @strong{MySQL} 3.22 �ǤϤʤ�����³���褦�Ȥ��Ƥ���ۥ��Ȥ� IP ��ۥ���̾��狼��ʤ���硢
@code{user} �ơ��֥�� @code{Host} �ե�����ɤ� @code{'%'} �����ꤷ��
@code{mysqld} �� @code{--log} ���ץ����ǺƵ�ư���Ƥ���������
�����ƥ��饤����ȥۥ��Ȥ�����³����С�@strong{MySQL} �Υ����ե������
���Υۥ��Ȥξ��󤬵�Ͽ����Ƥ���Ϥ��Ǥ���
���줬�狼��С�������ꤷ�� @code{user} �ơ��֥�� @code{Host} �ե�����ɤ� @code{'%'} ��
�����˵�Ͽ���줿�ۥ���̾���֤������ޤ���(����������ϥ����ƥ������ˤ��餷�ޤ�)

@item
@code{mysql -u root test} ��ư������Τ� @code{mysql -h your_hostname -u root test} ��
 @code{Access denied} ���֤�����硢
@code{user} �ơ��֥���������ۥ���̾�����Ѥ���Ƥ��ʤ��Ȼפ��ޤ���
@code{user} �ơ��֥�� @code{Host} �ե�����ɤ˥ۥ���̾�����Ǥ�����ǻ��ꤷ�Ƥ��ʤ�����
���Ѥ��Ƥ��륷���ƥ�Υ꥾��֤� FQDN (or vice-versa) ���֤��Ƥ��뤫���Ȼפ��ޤ���
�㤨�С�@code{user} �ơ��֥�� @code{'tcx'} �ۥ��Ȥ���������ä��Ȥ��ơ�
DNS �� @strong{MySQL} �� @code{'tcx.subnet.se'} ��ۥ���̾�Ȥ����֤�����硢
�����ư���ޤ���
@code{user} �ơ��֥�� @code{Host} �ե�����ɤ��ͤˡ����ʤ��Υۥ��Ȥ� IP �ֹ��ä��Ƥ���������
(@code{user} �ơ��֥�� @code{Host} ���ͤ˥磻��ɥ����ɤ���Ѥ��뤳�Ȥ��Ǥ��ޤ���@code{'tcx.%'} �Τ褦�ˡ�
�������ۥ���̾���ͤ� @samp{%} ʸ���ǽ���餻������ϡ�@emph{�����ǤϤʤ�}��@emph{�侩����ޤ���})

@item
�⤷ @code{mysql -u user_name test} ��ư� @code{mysql -u user_name other_db_name} ��
ư��ʤ����ϡ�@code{db} �ơ��֥�� @code{other_db_name} �Υ���ȥ꤬
��Ͽ����Ƥ��ޤ���

@item
@code{mysql -u user_name db_name} �ϥ����С���Ǥ�ư��뤬��
@code{mysql -u host_name -u user_name db_name} �����饤����ȥۥ��Ⱦ��ư��ʤ���硢
@code{user} �ơ��֥뤫 @code{db} �ơ��֥�˥��饤����ȥۥ��Ȥ�̾������Ͽ����Ƥ��ޤ���

@item
@code{Access denied} �θ������⤷�嵭�����ƤϤޤ�ʤ����ϡ�
@code{user} �ơ��֥뤫�� @code{Host} �˥磻��ɥ����ɤ���Ѥ��Ƥ��륨��ȥ�����ƾõ�ƤߤƤ���������(@samp{%} �� @samp{_} ��ޤ��ͤǤ�)
�褯����ְ㤤�ϡ�@code{localhost} ���Ф��� @code{localhost} ��Ʊ���ޥ���夫��
����³����Ĥ���ȹͤ���
@code{Host}=@code{'%'} �� @code{User}=@code{'some user'} ����Ͽ���뤳�ȤǤ���
�����ư���ޤ��󡣤ʤ��ʤ顢�ǥե���Ȥθ��¤�
@code{Host}=@code{'localhost'} �� @code{User}=@code{''} ���ޤޤ�Ƥ��뤫��Ǥ���
@code{Host} ���ͤ� @code{'localhost'} �ξ�硢����� @code{'%'} ����
����Ū�˻��ꤵ��Ƥ���Τǡ�@code{localhost} �������³�ˤϤ����������
���Ѥ����ΤǤ��� ����������λ����ϡ������ܤ���Ͽ�Ȥ���
@code{Host}=@code{'localhost'} �� @code{User}=@code{'some_user'} ���ɲä��뤫��
���뤤�ϡ�@code{Host}=@code{'localhost'} �� @code{User}=@code{''} �������뤳�ȤǤ���

@item
�⤷�ʲ��Υ��顼���Ф����
@code{db} �� @code{host} �ơ��֥�����꤬����Τ��⤷��ޤ��󡣡�

@example
Access to database denied
@end example

�⤷ @code{db} �ơ��֥�� @code{Host} �ե�����ɤ�������Ͽ��������ˤϡ�
@code{host} �ơ��֥���ˡ�@code{db} �ơ��֥����Ͽ����Ƥ���
�ۥ��Ȥ���������ʪ����İʾ夢�뤫�ɤ������ǧ���Ƥ���������

�⤷ @code{SELECT ... INTO OUTFILE} �� @code{LOAD DATA INFILE} SQL ʸ��
���Ѥ��Ƥ�����ˤ��Υ��顼���Ф��硢
@code{user} �ơ��֥�Τ��ʤ�����Ͽ�� @strong{file} ���¤�
���Ĥ���Ƥ��ʤ��Ȼפ��ޤ���

@item
@cindex Configuration files
@cindex Environment variables
@tindex .my.cnf file
���饤����ȥץ���������³�˺ݤ��ơ�
����ե���������ꤵ�줿�ͤ��Ķ��ѿ����ͤ���Ѥ��뤳�Ȥ����դ��Ƥ���������
�⤷���饤����ȥץ�����ब���ä��ͤ���³�˻��Ѥ��Ƥ���褦�ʤ顢
�Ķ��ѿ��ȥۡ���ǥ��쥯�ȥ�ˤ��� @file{.my.cnf} �ե�������ǧ���Ƥ���������
������󥷥��ƥ�磻�ɤ� @strong{MySQL} ����ե�����⡢�ѥ�᥿�������Ҥ���Ƥ��ʤ�����
�����å����ƤߤƤ���������@xref{Option files}.
�⤷���饤����Ȥ򥪥ץ����ʤ��ǵ�ư���Ƥ��� @code{Access denied} ���Ǥ�ʤ顢
���ץ����ե�����˸Ť��ѥ���ɤ��񤫤�Ƥ��뤫��ǧ���Ƥ���������
@xref{Option files}.

@item
�⤷���Ƽ��Ԥ���ʤ顢@code{mysqld} �ǡ�����ǥХå����ץ����ǵ�ư���Ƥ���������
�㤨�С�@code{--debug=d,general,query}������ϥ��ͥ������˻�ߤ��ۥ��Ȥ�桼�����ξ���
�ޤ��¹Ԥ������ޥ�ɤ�ɽ�����ޤ��� @xref{Debugging server}.

@item
�⤷ @strong{MySQL} �θ��µ��ĤˤĤ��Ƥ���¾�����꤬�����ꡢ
�᡼��󥰡��ꥹ�Ȥ������ݥ��Ȥ��ʤ��ƤϤ����ʤ��ȴ�����С�
���Ĥ� @strong{MySQL} ���ĥơ��֥�Υ���פ��󶡤��Ʋ�������
@code{mysqldump mysql} ���ޥ�ɤǥ���פǤ��ޤ���
���Ĥ�Τ褦�ˡ� @code{mysqlbug} ������ץȤǥݥ��Ȥ��Ƥ���������@xref{Bug reports}. 
�Ȥ��ˤϤϡ� @code{mysqldump} ��¹Ԥ��뤿��ˡ�
@code{mysqld} �� @code{--skip-grant-tables} ���ץ����Ǽ¹Ԥ��ʤ���
�����ʤ����⤷��ޤ���
@end itemize


@node Reference, Table types, Privilege system, Top
@chapter @strong{MySQL} �����ե����

@menu
* Literals::                 ��ƥ��:ʸ����ȿ��ͤ�ɤΤ褦�˽񤯤���
* Variables::                   �桼���ѿ�
* Column types::                �ե�����ɷ�
* Functions::                   �ؿ�
* CREATE DATABASE::             @code{CREATE DATABASE} ��ʸ
* DROP DATABASE::               @code{DROP DATABASE} ��ʸ
* CREATE TABLE::                @code{CREATE TABLE} ��ʸ
* ALTER TABLE::                 @code{ALTER TABLE} ��ʸ
* DROP TABLE::                  @code{DROP TABLE} ��ʸ
* OPTIMIZE TABLE::              @code{OPTIMIZE TABLE} ��ʸ
* CHECK TABLE::                 @code{CHECK TABLE} syntax
* REPAIR TABLE::                @code{REPAIR TABLE} syntax
* DELETE::                      @code{DELETE} ��ʸ
* SELECT::                      @code{SELECT} ��ʸ
* JOIN::                        @code{JOIN} ��ʸ
* INSERT::                      @code{INSERT} ��ʸ
* REPLACE::                     @code{REPLACE} ��ʸ
* LOAD DATA::                   @code{LOAD DATA INFILE} ��ʸ
* UPDATE::                      @code{UPDATE} ��ʸ
* USE::                         @code{USE} ��ʸ
* FLUSH::                       @code{Flush} ��ʸ (����å���Υ��ꥢ)
* KILL::                        @code{KILL} ��ʸ
* SHOW::                        @code{SHOW} ��ʸ (�ơ��֥��ե�����ɤʤɤˤĤ��Ƥξ��������)
* EXPLAIN::                     @code{EXPLAIN} ��ʸ (@code{SELECT}�ˤĤ��Ƥξ�������� )
* DESCRIBE::                    @code{DESCRIBE} ��ʸ (�ե������̾�ˤĤ��Ƥξ��������)
* COMMIT::
* LOCK TABLES::                 @code{LOCK TABLES/UNLOCK TABLES} ��ʸ
* SET OPTION::                  @code{SET OPTION} ��ʸ
* GRANT::                       @code{GRANT} �� @code{REVOKE} ��ʸ
* CREATE INDEX::                @code{CREATE INDEX} ��ʸ
* DROP INDEX::                  @code{DROP INDEX} ��ʸ
* Comments::                    Comment ��ʸ
* CREATE FUNCTION::             @code{CREATE FUNCTION} ��ʸ
* Reserved words::              Is @strong{MySQL} picky about reserved words?
@end menu


@cindex Strings
@cindex Strings, escaping characters
@node Literals, Variables, Reference, Reference
@section ��ƥ��:ʸ����ȿ��ͤ�ɤΤ褦�˽񤯤���

@menu
* String syntax::               Strings
* Number syntax::               Numbers
* Hexadecimal values::
* NULL values::                 @code{NULL} values
* Legal names::                 Database, table, index, column and alias names
@end menu

@node String syntax, Number syntax, Literals, Literals
@subsection ʸ����

ʸ�����ʸ�����¤ӤǤ���������(@samp{'})�ޤ�����Ű�����(@samp{"})�dz��
��ޤ�(��Ԥ� ANSI �⡼�ɤǼ¹Ԥ��Ƥ��ʤ����Τ�)�� �㡧

@example
'a string'
"another string"
@end example

ʸ������Ǥϡ������Ĥ��Υ������󥹤����̤ʰ�̣������ޤ��������Υ�����
�󥹤Τ��줾���@emph{����������ʸ��}�Ȥ����Τ���Хå�����å���
(@samp{\})�ǻϤޤ�ޤ���@strong{MySQL} �ϼ��Υ��������ץ������󥹤�ǧ��
���ޤ���

@c these aren't really functions, but that's probably the most reasonable index
@table @code
@findex \0 (ASCII 0)
@findex NUL
@item \0
ASCII 0 (@code{NUL}) ʸ����

@findex \n (newline)
@findex newline (\n)
@item \n
����ʸ����

@findex \t (tab)
@findex tab (\t)
@item \t
����ʸ����

@findex \r (carriage return)
@findex return (\r)
@findex carriage return (\r)
@item \r
�꥿����ʸ����

@findex \b (backspace)
@findex backspace (\b)
@item \b
�Хå����ڡ���ʸ����

@findex \' (single quote)
@findex single quote (\')
@item \'
������(@samp{'})��

@findex \" (double quote)
@findex double quote (\")
@item \"
�������(@samp{"})��

@findex \\ (escape)
@findex escape (\\)
@item \\
�Хå�����å���(@samp{\})ʸ����

@findex % (wildcard character)
@findex Wildcard character (%)
@item \%
@samp{%} ʸ��������� @samp{%} ���磻��ɥ�����ʸ���Ȥ��Ʋ�ᤵ���ʸ̮
�ǡ�@samp{%} ���Τ�Τ򸡺����뤿��˻��Ѥ���ޤ���
@xref{String comparison functions}.

@findex _ (wildcard character)
@findex Wildcard character (_)
@item \_
@code{_} ʸ��������� @samp{_} ���磻��ɥ�����ʸ���Ȥ��Ʋ�ᤵ���ʸ̮
�ǡ�@code{_} ���Τ�Τ򸡺����뤿��˻��Ѥ���ޤ���
@xref{String comparison functions}.
@end table

�����Ĥ���ʸ����ʸ̮�� @samp{\%} �ޤ��� @samp{\_} ����Ѥ���ȡ�������ʸ
���� @samp{%} �� @samp{_} �ǤϤʤ���@samp{\%} �� @samp{\_} ���֤��ޤ���

@noindent
ʸ������˰������ޤ����ˡ�Ϥ����Ĥ�����ޤ�:

@itemize @bullet
@item
@samp{'} �dz����ʸ������� @samp{'} �� @samp{''} �Ȥ��ƽ񤯤��Ȥ��Ǥ�
�ޤ���

@item
@samp{"} �dz����ʸ������� @samp{"} �� @samp{""} �Ȥ��ƽ񤯤��Ȥ��Ǥ�
�ޤ���

@item
����������˥���������ʸ�� (@samp{\}) ���֤����Ȥ��Ǥ��ޤ���

@item
@samp{"} �dz��줿ʸ������� @samp{'} �����̰�����ɬ�פϤʤ�����Ťˤ�
���ꡢ���������פ���ɬ�פϤ���ޤ���Ʊ���褦�ˡ�@samp{'} �dz��줿ʸ
������� @samp{"} �����̰�����ɬ�פϤ���ޤ���
@end itemize

���� @code{SELECT} ���ơ��ȥ��Ȥϡ��������Ȥȥ��������פ��ɤΤ褦��Ư
�����򼨤��ޤ�:

@example
mysql> SELECT 'hello', '"hello"', '""hello""', 'hel''lo', '\'hello';
+-------+---------+-----------+--------+--------+
| hello | "hello" | ""hello"" | hel'lo | 'hello |
+-------+---------+-----------+--------+--------+

mysql> SELECT "hello", "'hello'", "''hello''", "hel""lo", "\"hello";
+-------+---------+-----------+--------+--------+
| hello | 'hello' | ''hello'' | hel"lo | "hello |
+-------+---------+-----------+--------+--------+

mysql> SELECT "This\nIs\nFour\nlines";
+--------------------+
| This
Is
Four
lines |
+--------------------+
@end example

@cindex Quoting binary data

�Х��ʥ�ǡ����� @code{BLOB} �ե�����ɤ�������������硢����ʸ���򥨥�������
�������󥹤�ɽ��ɬ�פ�����ޤ�:
@table @code
@item NUL
ASCII 0��@samp{\0} (�Хå�����å���� ASCII @samp{0} ʸ��) ���֤�������
�٤��Ǥ���
@item \
ASCII 92, �Хå�����å��塣@samp{\\} ��ɽ�����Ƥ���������
@item '
ASCII 39, �����䡣@samp{\'} ��ɽ�����Ƥ���������
@item "
ASCII 34, ��Ű����䡣@samp{\"} ��ɽ�����Ƥ���������
@end table

@cindex Quoting
@cindex @code{BLOB}, inserting binary data
@findex mysql_escape_string()
@findex DBI->quote
C �����ɤ�񤯾�硢@code{INSERT} ���ʸ���򥨥������פ��뤿��ˡ�C API 
�ؿ� @code{mysql_escape_string()} ����ѤǤ��ޤ���@xref{C API function
overview}.  Perl �Ǥϡ�@code{DBI} �ѥå������� @code{quote} �᥽�åɤ��
�Ѥ��ơ��ü�ʸ����Ŭ���ʥ��������ץ������󥹤��Ѵ��Ǥ��ޤ���@xref{Perl
DBI Class, , Perl @code{DBI} Class}.

�嵭���ü�ʸ���Τɤ줫��ޤ��ǽ���Τ������Ƥ�ʸ����ˤĤ��ơ�����������
�ؿ�����Ѥ��٤��Ǥ���

@node Number syntax, Hexadecimal values, String syntax, Literals
@subsection ����

�����Ͽ������¤Ӥ�ɽ������ޤ���
��ư�������� @samp{.} �Ǿ�����ʬ�䤷�ޤ���
�ɤ���η��������ɽ������� @samp{-} �����ˤĤ��ޤ���

�����ʿ��ͤ���:

@example
1221
0
-32
@end example

ͭ������ư���������㡧

@example
294.42
-32032.6809e+10
148.00
@end example

��������ư��������ʸ̮�ǻ��Ѥ���뤫�⤷��ޤ��� ���ξ�硢��ư��������
�Ѵ�����ޤ���

@tindex Hexadecimal values
@node Hexadecimal values, NULL values, Number syntax, Literals
@subsection 16��ˡ����

@strong{MySQL} ��16��ˡ���ͤ򥵥ݡ��Ȥ��ޤ���
���ͤ�ʸ̮�Ǥϡ�����������(64�ӥå�����)�Τ褦�˿����񤤤ޤ���
ʸ�����ʸ̮�Ǥϡ�hex�η�Τ��줾��Υڥ���ʸ�����Ѵ����줿
�Х��ʥ꡼ʸ���Τ褦�˿����񤤤ޤ���

@example
mysql> SELECT 0xa+0
       -> 10
mysql> select 0x5061756c;
       -> Paul
@end example

16�ʿ�ɽ���ϡ�ODBC �ˤ����� BLOB ���ͤ�Ϳ���뤿��ˤ��Ф��л��Ѥ���ޤ���

@tindex NULL value
@node NULL values, Legal names, Hexadecimal values, Literals
@subsection @code{NULL} ��

@code{NULL} �� ``no data'' ���̣�������ͷ��� @code{0} ��ʸ���󷿤ζ�ʸ
����Ȥϰۤʤ뤳�Ȥ����դ��Ƥ���������
@xref{Problems with NULL, , Problems with @code{NULL}}.

�ƥ����ȥե�������ɤ߹��ߤ�񤭽Ф����ˡ�@code{NULL} �� @code{\N} ��
ɽ������ޤ��� (@code{LOAD DATA INFILE}, @code{SELECT ... INTO OUTFILE}).
@xref{LOAD DATA, , @code{LOAD DATA}}.
@node Legal names,  , NULL values, Literals
@subsection �ǡ����١���̾���ơ��֥�̾������ǥå���̾���ե������̾�������ꥢ��̾

@menu
* Name case sensitivity::       Case sensitivity in names
@end menu

�ǡ����١���̾���ơ��֥�̾������ǥå���̾���ե������̾�������ꥢ��̾��
@strong{MySQL} �Ǥ�����Ʊ����§�˴�Ť��ޤ�:

@tindex Quoting of identifiers
@tindex `
@tindex "
����: ��§�� @strong{MySQL} 3.23.6 ���ѹ�����ޤ���������ϼ��̻�(�ǡ����١�
��̾���ơ��֥�̾���ե������̾)�� @code{`} �ǤΥ������Ȥ�Ƴ���������Ǥ�
(ANSI �⡼�ɤǼ¹Ԥ�����ϡ�@code{"} �⼱�̻Ҥ򥯥����Ȥ��뤿���Ư����
��)��

@multitable @columnfractions .15 .7 .78
@item @strong{���̻�} @tab @strong{����Ĺ} @tab @strong{�������ʸ��}
@item �ǡ����١��� @tab 64 @tab �ǥ��쥯�ȥ�̾�Ȥ��Ƶ�����뤹�٤Ƥ�ʸ����@code{/} �������
@item �ơ��֥� @tab 64 @tab �ե�����̾�Ȥ��Ƶ�����뤹�٤Ƥ�ʸ����@code{/} �� @code{.} �������
@item �ե������ @tab 64 @tab ���٤Ƥ�ʸ��
@item �����ꥢ�� @tab 255 @tab ���٤Ƥ�ʸ��
@end multitable

����: �嵭�˲ä������̻���ˤ� ASCII(0) �� ASCII(255) ����Ƥޤ���

����: ���̻Ҥ����¤��줿ñ��Ǥ��ä����ü�ʸ����ޤ���ϡ��������Ѥ���
���ˤϾ�� @code{`} �ǥ������Ȥ���ɬ�פ�����ޤ�:

@example
SELECT * from `select` where `select`.id > 100;
@end example

@strong{MySQL} �����ΥС������Ǥϡ�̾���ε�§�ϼ��˽����ޤ�:

@itemize @bullet
@item
̾���ϡ����ߤ�ʸ�����åȤΥ���ե��٥åȤȿ���ʸ���������ꡢ@samp{_} �� 
@samp{$} ��ޤߤޤ����ǥե����ʸ�����åȤ� ISO-8859-1 Latin1 �Ǥ�����
����� @code{mysqld} �� @code{--default-character-set} ���ץ�����
Ϳ���뤳�Ȥ��ѹ��Ǥ��ޤ�. (3.23.14 �ʾ�ξ��Τߡ�
��������ΥС������Ǥ� @strong{MySQL} �ƥ���ѥ��뤬ɬ��)
@xref{Character sets}.

@item
̾���ϡ�̾���Ȥ���������Ǥ�դ�ʸ���ǻϤ�뤳�Ȥ��Ǥ��ޤ����äˡ�̾���Ͽ�
���ǻϤ�뤳�Ȥ��Ǥ��ޤ�(�����¾��¿���Υ����ƥ�Ȱۤʤ�ޤ���)����������
����@emph{����}��̾���ˤ�����ϤǤ��ޤ���

@item
̾������� @samp{.} ʸ������Ѥ��뤳�ȤϤǤ��ޤ��󡣥ե�����ɤ򻲾ȤǤ���褦
�˷������ĥ���뤿��˻��Ѥ���뤿��Ǥ�(���)��
@end itemize

@code{1e} �Τ褦��̾���ϻ��Ѥ��ʤ����Ȥ򴫤�ޤ���@code{1e+1} �Τ褦�ʼ���
�����ޤ�������Ǥ�������ϡ��� @code{1e + 1} �Ȥ��ơ��ޤ��Ͽ��� 
@code{1e+1} �Ȥ��Ʋ�ᤵ��ޤ���

@strong{MySQL} �Ǥϼ��η����Τ����줫����Ѥ��ƥե�����ɤ򻲾ȤǤ��ޤ�:

@multitable @columnfractions .35 .65
@item @strong{�ե�����ɤλ�����ˡ} @tab @strong{��̣}
@item @code{col_name} @tab ��������ǻ��Ѥ����ơ��֥����¸�ߤ��Ƥ��� @code{col_name} �Ȥ���̾���Υե������
@item @code{tbl_name.col_name} @tab ���ߤΥǡ����١����Υơ��֥� @code{tbl_name} ��Υե������ @code{col_name}
@item @code{db_name.tbl_name.col_name} @tab �ǡ����١��� @code{db_name} 
�Υơ��֥� @code{tbl_name} ��Υե������ @code{col_name}�����η����� 3.22 �ʹ�
��ͭ���Ǥ���
@item
@code{`column_name`} @tab ������ɤǤ��ä����ü�ʸ����ޤ�ե�����ɡ�
@end multitable

���Ȥ�ۣ��Ǥʤ��ʤ�С����ơ��ȥ�����Υե�����ɻ��Ȥ����� @code{tbl_name} 
�ޤ��� @code{db_name.tbl_name} �򵭽Ҥ���ɬ�פϤ���ޤ����㤨�С��ơ�
�֥� @code{t1} �� @code{t2} �����줾��ե������ @code{c} ��ޤߡ�@code{t1} �� 
@code{t2} ��ξ������Ѥ��� @code{SELECT} ���ơ��ȥ��Ȥ� @code{c} ���
��Ф��Ȥ��ޤ������ξ�硢@code{c} �ϥ��ơ��ȥ��Ȥǻ��Ѥ����ơ��֥�
�֤�ͣ��Ǥʤ��Τ�ۣ��Ǥ������Τ��ᡢ@code{t1.c} �ޤ��� @code{t2.c} ��
���Ҥ��뤳��ˤ��ɤ���Υơ��֥���̣���뤫�򼨤�ɬ�פ�����ޤ���Ʊ��
�ˡ��ǡ����١��� @code{db1} �Υơ��֥� @code{t} �ȥǡ����١��� 
@code{db2} �Υơ��֥� @code{t} ������Ф���硢�����Υơ��֥���ι�
�ܤϡ�@code{db1.t.col_name} �� @code{db2.t.col_name} �Ȥ��ƻ��Ȥ���ɬ��
������ޤ���

@cindex ODBC compatibility
@cindex Compatibility, with ODBC
��ʸ @code{.tbl_name} �ϸ��ߤΥǡ����١�����Υơ��֥� @code{tbl_name} 
���̣���ޤ������ι�ʸ�Ϥ����Ĥ��� ODBC �� @samp{.} ʸ����ơ��֥�̾����
���֤�����˵�����Ƥ��ޤ���

@node Name case sensitivity,  , Legal names, Legal names
@subsubsection ̾���Υ�������¸��
@cindex Database names, case sensitivity
@cindex Table names, case sensitivity
@cindex Column names, case sensitivity
@cindex Alias names, case sensitivity
@cindex Case sensitivity, of database names
@cindex Case sensitivity, of table names
@cindex Case sensitivity, of column names
@cindex Case sensitivity, of alias names

@strong{MySQL} �Ǥϡ��ǡ����١����ȥơ��֥�ϡ��ǥ��쥯�ȥ��
���Υǥ��쥯�ȥ���Υե�������б����ޤ������Τ��ᡢ����ư��륪�ڥ졼
�ƥ��󥰥����ƥ�Υ�������¸���ϡ��ǡ����١����ȥơ��֥�̾�Υ�������¸������ꤷ�ޤ���
�ǡ����١���̾�ȥơ��֥�̾�� Unix �Ǥϥ�������¸�ǡ�Win32 �Ǥϥ��������
¸�Ǥ���

@strong{����:} Win32 �Ǥϥǡ����١���̾�ȥե�����̾�ϥ��������¸�Ǥ�����
Ʊ����������ǡ��ǡ����١�����ơ��֥��ۤʤ륱��������Ѥ��ƻ��Ȥ��٤�
�ǤϤ���ޤ���
�ʲ��Υ������ư���ޤ��󡣤ʤ��ʤ� @code{my_table} �� @code{MY_TABLE} ��ξ����
���Ȥ��Ƥ��뤫��Ǥ���

@example
mysql> SELECT * FROM my_table WHERE MY_TABLE.col=1;
@end example

�ե������̾�����Ƥξ��ǥ��������¸�Ǥ���

�ơ��֥����̾�ϥ�������¸�Ǥ���
�ʲ��Υ������ư���ޤ��󡣤ʤ��ʤ� @code{a} �� @code{A} �Υ����ꥢ����ξ��
���Ȥ��Ƥ��뤫��Ǥ���

@example
mysql> SELECT col_name FROM tbl_name AS a
           WHERE a.col_name = 1 OR A.col_name = 2;
@end example

�ե�����ɤΥ����ꥢ��̾�ϥ��������¸�Ǥ���


@node Variables, Column types, Literals, Reference
@section �桼�����ѿ�

@strong{MySQL} �ϡ�@code{@@variablename} ��ʸ�ǥ���åɸ�ͭ���ѿ��򥵥ݡ�
�Ȥ��ޤ����ѿ�̾�ϸ��ߤ�ʸ�����åȤΥ���ե��٥åȤȿ���������� 
@samp{_}��@samp{$}��@samp{.} ʸ������ʤ�ޤ����ǥե����ʸ�����åȤ� 
ISO-8859-1 Latin1 �Ǥ���
����� @code{mysqld} �� @code{--default-character-set} ���ץ�����
Ϳ���뤳�Ȥ��ѹ��Ǥ��ޤ�. (3.23.14 �ʾ�ξ��Τߡ�
��������ΥС������Ǥ� @strong{MySQL} �ƥ���ѥ��뤬ɬ��)
@xref{Character sets}��

�ѿ��Ͻ��������ɬ�פϤ���ޤ��󡣥ǥե���ȤǤ� @code{NULL} �Ǥ��ꡢ����
�͡��¿��͡�ʸ�����ͤ��Ǽ�Ǥ��ޤ������٤ƤΥ���å��ѿ��ϡ�����åɤ���λ
����ȼ�ưŪ�˲�������ޤ���

@code{SET} ��ʸ���ѿ�������Ǥ��ޤ�:

@example
SET @@variable= @{ integer expression | real expression | string expression @}
[,@@variable= ...].
@end example

@code{@@variable:=expr} ��ʸ�ǡ�������ѿ������ꤹ�뤳�Ȥ��ǽ�Ǥ�:

@example
select @@t1:=(@@t2:=1)+@@t3:=4,@@t1,@@t2,@@t3;
+----------------------+------+------+------+
| @@t1:=(@@t2:=1)+@@t3:=4 | @@t1  | @@t2  | @@t3  |
+----------------------+------+------+------+
|                    5 |    5 |    1 |    4 |
+----------------------+------+------+------+
@end example

(�桹�� @code{:=} ��ʸ����Ѥ���ɬ�פ�����ޤ�����@code{=} ����ӤΤ����
ͽ�󤵤�Ƥ�������Ǥ���)

�桼�����ѿ��ϼ������������ǻ��ѤǤ��ޤ�������: ����ϸ��ߡ�
@code{SELECT} ���ơ��ȥ��Ȥ� @code{LIMIT} �ᡢ@code{LOAD DATA} ���ơ���
���Ȥ� @code{IGNORE number LINES} ��Τ褦�ˡ����ͤ�����Ū���׵ᤵ���ʸ
̮�Ǥλ��Ѥ�ޤߤޤ���

@strong{����:} @code{SELECT} ���ơ��ȥ��ȤǤϡ����줾��μ��ϥ��饤����
�Ȥ�����줿���ˤ���ɾ������ޤ�������ϡ�@code{SELECT} �������ꤵ�줿�ѿ�
��ɬ�פȤ��뼰�򻲾Ȥ��� @code{HAVING}, @code{GROUP BY}, @code{ORDER BY} 
�᤬�Ǥ��ʤ����Ȥ��̣���ޤ����㤨�С����Υ��ơ��ȥ��Ȥϴ����̤�ˤ�ư��
���ޤ���:

@example
SELECT (@@aa:=id) AS a, (@@aa+3) AS b FROM table_name HAVING b=5;
@end example

������ͳ�ϡ�@code{@@aa} �����ߤΥ쥳���ɤ��ͤǤϤʤ������˼�����ä��쥳��
�ɤ� @code{id} ���ͤˤʤ뤫��Ǥ���

@node Column types, Functions, Variables, Reference
@section �ե�����ɷ�

@strong{MySQL}��¿���Υե�����ɷ��򥵥ݡ��Ȥ��Ƥ��ꡢ�����ϣ��ĤΥ��ƥ���˥��롼�ײ�����ޤ�: ���ͷ������յڤӻ��ַ���������ʸ����(ʸ��)����
���ξϤǤϤޤ������ѤǤ��뷿�γ��פ���Ϥޤꡢ���줫��ƥ��ƥ���γƥե�����ɷ��ν��׵������̤�����ȡ�����°���ˤĤ��ƤΤ��ܺ٤ʾ�����󶡤��ޤ���
���פϰտ�Ū�˴ʷ�ˤޤȤ�Ƥ��ޤ����ͤȤ��ƻ���Ǥ���񼰤Τ褦�ʥե�����ɷ���ͭ���ղþ���ϡ��ܺ٤��������ˤ�Ĵ�٤Ʋ�������

@strong{MySQL}�ǥ��ݡ��Ȥ����ե�����ɷ��ϰʲ��˼����̤�Ǥ������³��ʸ���ΰ�̣�������Τ���˻Ȥ��ޤ�:

@table @code
@item M
����ɽ�����������̣���ޤ��������ɽ������� 255.

@item D
��ư������������Ŭ�Ѥ��졢�������ʲ��η����ɽ���ޤ���
������ͤ� 30 �Ǥ���������� @code{M}-2 ����礭���ʤäƤϤ����ޤ���
@end table

�楫�å�(@samp{[}�ڤ�@samp{]})�Ϸ�����ΰ����Ǥ��ꡢ���줬���ץ����Ǥ��뤳�Ȥ�ɽ���ޤ���

@tindex Types

@c The @w{-number} stuff keeps a linebreak from occurring between
@c the - and number.

�⤷����ե�����ɤ� @code{ZEROFILL} ����ꤷ����硢
 @strong{MySQL} �ϼ�ư�� @code{UNSIGNED} °���򤽤Υե�����ɤ�
�ɲä��ޤ���

@table @code
@tindex TINYINT
@item TINYINT[(M)] [UNSIGNED] [ZEROFILL]

�ȤƤ⾮�������������Ĥ����ϰϤ� @code{-128}��@code{127}�����ʤ����ϰϤ� @code{0}��@code{255}��

@tindex SMALLINT
@item SMALLINT[(M)] [UNSIGNED] [ZEROFILL]

���������������Ĥ����ϰϤ� @code{-32768}��@code{32767}�����ʤ����ϰϤ� @code{0}��@code{65535}��

@tindex MEDIUMINT
@item MEDIUMINT[(M)] [UNSIGNED] [ZEROFILL]

��֤���������椢����ϰϤ� @code{-8388608}��@code{8388607}�����ʤ����ϰϤ� @code{0}��@code{16777215}

@tindex INT
@item INT[(M)] [UNSIGNED] [ZEROFILL]

�̾����������椢����ϰϤ� @code{-2147483648}��@code{2147483647}�����ʤ����ϰϤ� @code{0}��@code{4294967295}

@tindex INTEGER
@item INTEGER[(M)] [UNSIGNED] [ZEROFILL]

����ϡ�@code{INT}��Ʊ����Ǥ���

@tindex BIGINT
@item BIGINT[(M)] [UNSIGNED] [ZEROFILL]

�礭����������椢����ϰϤ� @code{-9223372036854775808}��@code{9223372036854775807}��
���ʤ����ϰϤ� @code{0}��@code{18446744073709551615}��
���Ƥα黻������դ� @code{BIGINT} �ޤ��� @code{DOUBLE} �ǹԤ��뤿�ᡢ
���̵���� @code{9223372036854775807} (63 bits) �����礭��������
�ӥåȴؿ��ʳ��ǻ��Ѥ��٤��ǤϤ���ޤ���
@code{-}��@code{+}�ڤ�@code{*}�ϡ�ξ���ΰ�����@code{INTEGER}�ͤλ���@code{BIGINT}�黻��Ȥ����Ȥ����դ��Ʋ�����������ϡ����Ĥ��礭�������Τ�������Ԥʤ�(�����������֤��ؿ��η�̤��礭�������Ǥ���)������̤�@code{9223372036854775807}�����礭������ͽ�����ʤ���̤������뤳�Ȥ�����Ȥ������Ȥ��̣���Ƥ��ޤ���

@tindex FLOAT(precision)
@item FLOAT(precision) [ZEROFILL]

��ư�������������ʤ��ˤϤǤ��ޤ���ñ������ư���������Ǥ� 
@code{precision} �� @code{<=24} �ǡ���������ư���������Ǥ� 25��53 �δ֤Ǥ���
�����η��ϼ��ǽҤ٤�@code{FLOAT}��@code{DOUBLE}���˻��Ƥ��ޤ���
@code{FLOAT(X)}�ϡ�@code{FLOAT}�ڤ�@code{DOUBLE}���˰��פ���Ʊ���ϰϤ���äƤ��ޤ�����
ɽ���������侮�����ʲ�������������ޤ���

@strong{MySQL} 3.23 �Ǥϡ��������������ư�������Ǥ������� 
@strong{MySQL} �С������Ǥ�, @code{FLOAT(precision)} �Ͼ�˾�������2���
������

@cindex ODBC compatibility
@cindex Compatibility, with ODBC
���ι�ʸ�� ODBC �ߴ��Ǥ���

@tindex FLOAT
@tindex FLOAT(M,D)
@item FLOAT[(M,D)] [ZEROFILL]

��������ư�������������ʤ��ˤϤǤ��ޤ���
�ϰϤ� @code{@w{-3.402823466E+38}}��@code{@w{-1.175494351E-38}}�� @code{0}��
@code{@w{1.175494351E-38}}��@code{3.402823466E+38}�Ǥ���
M ��ɽ������ D �Ͼ���������Ǥ���������̵����������24�ʲ��� @code{FLOAT} 
��ñ������ư�����������̣���ޤ���

@tindex DOUBLE
@tindex FLOAT(precision)
@item DOUBLE[(M,D)] [ZEROFILL]

�̾����ư�������������ʤ��ˤϤǤ��ޤ���
�ϰϤ� @code{@w{-1.7976931348623157E+308}}��@code{@w{-2.2250738585072014E-308}}�� @code{0}��@code{2.2250738585072014E-308}��@code{1.7976931348623157E+308}�Ǥ���
M ��ɽ������ D �Ͼ���������Ǥ���������̵���� @code{DOUBLE} ����25 <= X
<= 53 �Ǥ��� @code{FLOAT(X)} ����������ư�����������̣���ޤ���

@tindex DOUBLE PRECISION
@tindex REAL
@item DOUBLE PRECISION[(M,D)] [ZEROFILL]
@itemx REAL[(M,D)] [ZEROFILL]

������@code{DOUBLE}��Ʊ����Ǥ���

@tindex DECIMAL
@item DECIMAL[(M[,D])] [ZEROFILL]

�ѥå�̵����ư�������������ʤ��ˤϤǤ��ޤ���@code{CHAR}�ե�����ɤΤ褦�˿��񤤤ޤ���`�ѥå�̵��'�ϡ����ͤ�ʸ����Ȥ��Ƴ�Ǽ����뤳�Ȥ��̣�������ͤΤ��줾��η塢���������ڤ�����Ǥ�@samp{-}���ˣ�ʸ�����Ѥ��ޤ���
@code{D}��0�λ����ͤϾ������侮����������ޤ���@code{DECIMAL}�ͤκ����ϰϤ�@code{DOUBLE}��Ʊ���Ǥ������ºݤ��ϰϤ�@code{DECIMAL}�ե�����ɤ�Ϳ����줿@code{M}�ڤ�@code{D}������˶�������ޤ���

@code{D} ���ά�������� 0 �����ꤵ�줤�ޤ���@code{M} ���ά�������� 
10 �����ꤵ��ޤ���

@strong{MySQL} 3.22 �Ǥϡ� @code{M} ���������侮������ޤߤޤ��� 

@tindex NUMERIC
@item NUMERIC(M,D) [ZEROFILL]

@code{DECIMAL}��Ʊ����

@tindex DATE
@item DATE

���ա����ݡ��Ȥ�����ϰϤ�@code{'1000-01-01'}����@code{'9999-12-31'}�ޤǡ�
@strong{MySQL}��@code{'YYYY-MM-DD'}�ν񼰤�@code{DATE}�ͤ�ɽ�����ޤ�����@code{DATE}�ե�����ɤؤ��ͤγ����Ƥϡ�ʸ����⤷���Ͽ��ͤΤ����줫�λ��Ѥ�������ޤ���

@tindex DATETIME
@item DATETIME

���դȻ�����Ȥ߹�碌�����ݡ��Ȥ�����ϰϤ�@code{'1000-01-01 00:00:00'}��@code{'9999-12-31 23:59:59'}�Ǥ���@strong{MySQL}��@code{DATETIME}�ͤ�@code{'YYYY-MM-DD HH:MM:SS'}�Ȥ����񼰤�ɽ�����ޤ�����@code{DATETIME}�ե�����ɤؤ��ͤγ����Ƥϡ�ʸ����⤷���Ͽ��ͤΤ����줫�λ��Ѥ�������ޤ���

@tindex TIMESTAMP
@item TIMESTAMP[(M)]

�����ॹ����ס��ϰϤ�@code{'1970-01-01 00:00:00'}��@code{2106}ǯ���ޤǤǤ���@strong{MySQL}��@code{TIMESTAMP}�ͤ�@code{YYYYMMDDHHMMSS}��@code{YYMMDDHHMMSS}��@code{YYYYMMDD}����@code{YYMMDD}�Ȥ����񼰤�ɽ�����������@code{M}��@code{14}(�⤷���ϸ��äƤ���ʾ���ͤ���ꤷ����)��@code{12}��@code{8}����@code{6}�Τ����줬���ꤵ�줿���˰�¸���ޤ����������ʤ���@code{TIMESTAMP}�ե�����ɤؤ��ͤγ����Ƥϡ�ʸ����⤷���Ͽ��ͤΤ����줫�λ��Ѥ�������ޤ���
@code{TIMESTAMP}�ե�����ɤϡ��Ǹ�����줿�����ưŪ�����ꤹ��Τǡ�@code{INSERT}��@code{UPDATE}���λ����Ͽ����Τ���Ω���ޤ���
@code{NULL}�ͤ�Ϳ���뤳�Ȥˤ�äƤ⡢���߻��������Ǥ��ޤ���
@xref{Date and time types}��

@tindex TIME
@item TIME

���֡��ϰϤ�@code{'-838:59:59'}��@code{'838:59:59'}�Ǥ���
@strong{MySQL}��@code{TIME}�ͤ�@code{'HH:MM:SS'}�Ȥ����񼰤�ɽ�����ޤ�����@code{TIME}�ե�����ɤؤ��ͤγ����Ƥϡ�ʸ����⤷���Ͽ��ͤΤ����줫�λ��Ѥ�������ޤ���

@tindex YEAR
@item YEAR[(2|4)]

ǯ��2��ޤ���4�����(�ǥե���Ȥ�4��)����������ͤϡ�4������Ǥ� 
@code{1901}��@code{2155}, @code{0000} �ǡ�2�����(70��69)�Ǥ� 1970��2069 
�Ǥ���@strong{MySQL} �� @code{YEAR} �ͤ� @code{YYYY} ������ɽ�����ޤ�����
@code{YEAR} �ե�����ɤؤ��ͤγ�����Ƥ�ʸ����ȿ����Τɤ���Ǥ���ѤǤ���
����(@code{YEAR} �� @strong{MySQL} 3.22 �Ǥο��������Ǥ���)

@tindex NATIONAL CHAR
@tindex NCHAR
@tindex CHAR
@tindex CHARACTER
@item [NATIONAL] CHAR(M) [BINARY]

����Ĺʸ����ǡ���Ǽ���ˤ�ɬ�����ꤵ�줿Ĺ���ޤDZ�¦�˶�������ޤ���
@code{M}���ϰϤ� 1 ���� 255 ʸ���Ǥ�����³�ζ�����ͤμ��Ф����˺������
�ޤ���@code{BINARY} ������ɤ�Ϳ�����ʤ���硢@code{CHAR} �ͤΥ����Ȥ�
��Ӥϡ��ǥե����ʸ�����åȤ˽��äƥ��������¸����ˡ�ǹԤʤ��ޤ���

@code{NATIONAL CHAR} (û�������� @code{NCHAR}) �ϡ�ANSI SQL �ǡ�CHAR �ե���
��ɤ��ǥե����ʸ�����åȤ���Ѥ��뤳�Ȥ����������ˡ�Ǥ�������� 
@code{MySQL} �Ǥϥǥե���ȤǤ���

@code{CHAR} �� @code{CHARACTER} ��ά���Ǥ���

@strong{MySQL} �� @code{CHAR(0)} ���Υե�����ɤ�����������ޤ�������ϼ�
�ˡ��ºݤˤϤ⤦�ͤ��Ȥ��Ƥ��ʤ��ե�����ɤ�¸�ߤ��뤳�Ȥ˰�¸���Ƥ����
���ʤ����Ĥ��θŤ����ץꥱ���������б�����ɬ�פ�������������Ǥ������Ĥ�
�ͤ������뤳�Ȥ��Ǥ���ե�����ɤ�ɬ�פȤ�����ˤ�ȤƤ��ɤ����ȤǤ�:
@code{NOT NULL} �Ȥ����������Ƥ��ʤ� @code{CHAR(0)} ��1�ӥåȤ�������ͭ
�������Ĥ��ͤ������뤳�Ȥ��Ǥ��ޤ�: @code{NULL} �ޤ��� @code{""}��

@tindex CHARACTER VARYING
@tindex CHAR VARYING
@tindex VARCHAR
@item [NATIONAL] VARCHAR(M) [BINARY]

����Ĺʸ����  ����:
��³�ζ���ϳ�Ǽ���˺������ޤ�(����� ANSI SQL ���ͤȰۤʤ�ޤ�)��
@code{M}���ϰϤ� 1 ���� 255 ʸ���Ǥ���
@code{BINARY} ������ɤ�Ϳ�����ʤ���硢�����Ȥ���Ӥϥ������˰�¸���ޤ���
@xref{Silent column changes}.

@code{VARCHAR} �� @code{CHARACTER VARYING} ��ά���Ǥ���

@tindex TINYBLOB
@tindex TINYTEXT
@item TINYBLOB
@itemx TINYTEXT

����Ĺ 255 (2^8 - 1) ʸ���� @code{TEXT}/@code{BLOB}��@xref{Silent column changes}.

@tindex BLOB
@tindex TEXT
@item BLOB
@itemx TEXT

����Ĺ 65535 (2^16 - 1) ʸ���� @code{TEXT}/@code{BLOB}��@xref{Silent column changes}.

@tindex MEDIUMBLOB
@tindex MEDIUMTEXT
@item MEDIUMBLOB
@itemx MEDIUMTEXT

����Ĺ 16777215 (2^24 - 1) ʸ���� @code{TEXT}/@code{BLOB}��@xref{Silent column changes}.

@tindex LONGBLOB
@tindex LONGTEXT
@item LONGBLOB
@itemx LONGTEXT

����Ĺ 4294967295 (2^32 - 1) ʸ���� @code{TEXT}/@code{BLOB}��@xref{Silent column changes}.

@tindex ENUM
@item ENUM('value1','value2',...)

���
�оݤȤʤ�ʸ����ϡ��ͤ��Ĥ����������ͥꥹ��@code{'value1', 'value2',...}(����@code{NULL})�������Ф�ޤ���@code{ENUM}�Ϻ���65535�Ĥθ�ͭ�ͤ���Ĥ��Ȥ��Ǥ��ޤ���

@tindex SET
@item SET('value1','value2',...)

�ȡ�
�оݤȤʤ�ʸ�����0�ʾ���ͤ���������줾���ͥꥹ��@code{'value1', 'value2',...}�������Ф�ʤ���Фʤ�ޤ���
@code{SET}�ϡ����� 64�Ĥ����Ǥ���Ĥ��Ȥ��Ǥ��ޤ���
@end table

@menu
* Storage requirements::        Column type storage requirements
* Numeric types::               Numeric types
* Date and time types::         Date and time types
* String types::                String types
* Casts::                       Cast operators
* Choosing types::              Choosing the right type for a column
* Indexes::                     Column indexes
* Multiple-column indexes::     Multiple-column indexes
* Other-vendor column types::   Using column types from other database engines
@end menu

@cindex Storage requirements
@node Storage requirements, Numeric types, Column types, Column types
@subsection �ե�����ɥ����פν�������

@strong{MySQL}�����ݡ��Ȥ���ƥե�����ɥ�������ν������̤򡢥��ƥ����̤˰ʲ��˵��Ҥ��ޤ���

@subheading ���ͥ�����

@multitable @columnfractions .35 .65
@item @strong{�ե�����ɥ�����} @tab @strong{��������}
@item @code{TINYINT}       @tab 1 byte
@item @code{SMALLINT}      @tab 2 bytes
@item @code{MEDIUMINT}     @tab 3 bytes
@item @code{INT}           @tab 4 bytes
@item @code{INTEGER}       @tab 4 bytes
@item @code{BIGINT}        @tab 8 bytes
@item @code{FLOAT(X)}      @tab X <= 24 �� 4��25 <= X <= 53 �� 8
@item @code{FLOAT}         @tab 4 bytes
@item @code{DOUBLE}        @tab 8 bytes
@item @code{DOUBLE PRECISION} @tab 8 bytes
@item @code{REAL}         @tab 8 bytes
@item @code{DECIMAL(M,D)} @tab @code{M} bytes (@code{M < D} �� @code{D}+2)
@item @code{NUMERIC(M,D)} @tab @code{M} bytes (@code{M < D} �� @code{D}+2)
@end multitable

@subheading ���դȻ��֥�����

@multitable @columnfractions .35 .65
@item @strong{�ե�����ɥ�����} @tab @strong{��������}
@item @code{DATE}          @tab 3 bytes
@item @code{DATETIME}      @tab 8 bytes
@item @code{TIMESTAMP}     @tab 4 bytes
@item @code{TIME}          @tab 3 bytes
@item @code{YEAR}          @tab 1 byte
@end multitable

@subheading ʸ���󥿥���

@multitable @columnfractions .35 .65
@item @strong{�ե�����ɥ�����} @tab @strong{��������}
@item @code{CHAR(M)} @tab @code{M} bytes, @code{1 <= M <= 255}
@item @code{VARCHAR(M)} @tab @code{L}+1 bytes, where @code{L <= M} and
@code{1 <= M <= 255}
@item @code{TINYBLOB}, @code{TINYTEXT} @tab @code{L}+1 bytes,
where @code{L} < 2^8
@item @code{BLOB}, @code{TEXT} @tab @code{L}+2 bytes,
where @code{L} < 2^16
@item @code{MEDIUMBLOB}, @code{MEDIUMTEXT} @tab @code{L}+3 bytes,
where @code{L} < 2^24
@item @code{LONGBLOB}, @code{LONGTEXT} @tab @code{L}+4 bytes,
where @code{L} < 2^32
@item @code{ENUM('value1','value2',...)} @tab 1 or 2 bytes, ����ͤο��˰�¸ (�����ͤ� 65535 )
@item @code{SET('value1','value2',...)} @tab 1, 2, 3, 4 or 8 bytes, ���Ǥο��˰�¸ (�������� 64 )
@end multitable

@code{VARCHAR}��@code{BLOB}���ڤ�@code{TEXT}���ϲ���Ĺ���Ǥ��ꡢ�������̤ϡ��ե�����ɤΤȤ�������祵�����Ȥ������Ϥष���ե�������ͤμºݤ�Ĺ���˰�¸���ޤ�(����ɽ��@code{L}��ɽ���ޤ���)��
�㤨�С�@code{VARCHAR(10)}�ե�����ɤϡ�����10ʸ��ʬ��Ĺ����ʸ������ݻ����뤳�Ȥ�����ޤ����ºݤν������̤ϡ�ʸ�����Ĺ��(@code{L})�ȡ�����Ĺ����Ͽ���뤿��Σ��Х��Ȥ�ä��ޤ���ʸ����@code{'abcd'}�ˤ����Ƥϡ�@code{L}�ϣ��ǡ��������̤ϣ��Х��ȤǤ���

@code{BLOB}��@code{TEXT}���ϡ��ե�������ͤ�Ĺ����Ͽ����Τˡ����������������ϣ��Х���ɬ�פȤ������ΤȤ���������Ĺ���˰�¸���ޤ���

�ơ��֥뤬����Ĺ�ե�����ɷ���ޤ��硢���Υ쥳���ɥե����ޥåȤ�ޤ�����Ĺ�Ȥʤ�Ǥ��礦��
�ơ��֥뤬�������줿����@strong{MySQL}�ϳΤ��ʾ��β����ե�����ɤ����Ĺ�����פ������Ĺ�����פ��ѹ����������Ѥ򵯤������Ȥ����դ��Ʋ�������

@code{ENUM}���֥������ȤΥ������ϡ��ۤʤ�����ͤο��ˤ�äƷ����ޤ���
��󤹤����255����Ǥϡ����Х��Ȥ����Ѥ���ޤ���
��󤹤����65535����Ǥϡ����Х��Ȥ����Ѥ���ޤ���

@code{SET}���֥������ȤΥ������ϡ��ۤʤ����Ǥο��ˤ�äƷ����ޤ���
�ȤΥ�������@code{N}�Ȥ���ȡ����֥������Ȥ�@code{(N+7)/8}�Х��Ȥ���ͭ���������������������ϣ��Х��Ȥ��ھ夲���ޤ���
���Ĥ�@code{SET}�ϡ����磶�����Ǥ���Ĥ��Ȥ��Ǥ��ޤ���

@node Numeric types, Date and time types, Storage requirements, Column types
@subsection ���ͷ�

@strong{MySQL} �� ANSI/ISO SQL92 ���ͷ��򤹤٤ƥ��ݡ��Ȥ��ޤ��������η�
�����Τʿ��ͥǡ�����(@code{NUMERIC}, @code{DECIMAL}, @code{INTEGER},
@code{SMALLINT})��������ͷ�(@code{FLOAT}, @code{REAL}, @code{DOUBLE
PRECISION})��ޤߤޤ���������� @code{INT} �� @code{INTEGER} ��Ʊ����ǡ�
@code{DEC}�� @code{DECIMAL} ��Ʊ����Ǥ���

@strong{MySQL} �Ǥ� @code{NUMERIC} �� @code{DECIMAL} ���ϡ�SQL92 ɸ��ǵ�
����Ƥ���褦��Ʊ�����Ȥ��Ƽ�������Ƥ��ޤ������������Τ����٤�ݻ�����
���Ȥ����פ���(�㤨�ж����ǡ���)�˻��Ѥ���ޤ��������η��ΰ�ĤΥե�����
�ɤ��������������٤��礭��������Ǥ��ޤ�(�̾�Ϥ������ޤ�); �㤨��:

@example
    salary DECIMAL(9,2)
@end example

������Ǥϡ�@code{9} (@code{precisoin}) ���ͤ��Ǽ������פʿ��ͤη����ɽ
���ޤ��������� @code{2} (@code{scale}) �Ͼ�������³���Ƴ�Ǽ���������ɽ
���ޤ������äơ����ξ�� @code{salary} �ե�����ɤ˳�Ǽ���뤳�Ȥ��Ǥ�����
���ϰϤϡ�@code{-9999999.99} ���� @code{9999999.99} �Ǥ���ANSI/ISO SQL92 
�Ǥϡ���ʸ @code{DECIMAL(p)} �� @code{DECIMAL(p,0)} ���������Ǥ���Ʊ�ͤˡ�
��ʸ @code{DECIMAL} �� @code{DECIMAL(p,0)} ���������Ǥ��������� @code{p} 
���ͤη���ϼ����˵�����Ƥޤ���@code{DECIMAL}/@code{NUMERIC} �ǡ������Τ�
���ΰۤʤ�����ϡ�@strong{MySQL} �ϸ��ߥ��ݡ��Ȥ��Ƥ��ޤ��󡣤��η��μ�
�����פ����٤��礭����ξ��������Ū�����椹�뵡ǽ��������Ф����Τǡ�����
���̾�������ǤϤ���ޤ���

@code{DECIMAL} �� @code{NUMERIC} �ͤϡ��ͤξ��������٤�ݻ����뤿�ᡢ�Х�
�ʥ���ư���������Ȥ��ƤǤϤʤ���ʸ����Ȥ��Ƴ�Ǽ����ޤ���1ʸ�����ͤΤ���
����η�(@code{scale} > 0 �ξ��)�� @samp{-} ����(����ξ��)�˻��Ѥ����
����@code{scale} �� 0 �ξ�硢@code{DECIMAL} �� @code{NUMERIC} �ͤϾ�����
�Ⱦ�������ޤߤޤ���

@code{DECIMAL} �� @code{NUMERIC} �ͤκ����ϰϤ� @code{DOUBLE} ��Ʊ���Ǥ���
������ @code{DECIMAL} �� @code{NUMERIC} �ե�����ɤ�Ϳ������ºݤ��ϰϤ�
�ե�����ɤ�Ϳ����줿 @code{precision} �� @code{scale} �ˤ�äƶ��������
�������Υե�����ɤˡ����ꤵ�줿 @code{scale} �ǵ���������¿����ξ���
������Ŀ��ͤ�������Ƥ�줿��硢�ͤϤ��� @code{scale} �˴ݤ���ޤ���
@code{DECIMAL} �� @code{NUMERIC} �ե�����ɤˡ����ꤵ�줿(�ޤ��ϥǥե����
��) @code{precision} �� @code{scale} �Ǽ����줿�ϰϤ�Ķ�����礭�����ͤ��
�����Ƥ�����@strong{MySQL} �Ϥ����ϰϤ��б���������ͤ�ɽ���ͤ��Ǽ���ޤ���

ANSI/ISO SQL92 ɸ����Ф����ĥ�Ȥ��ơ����ɽ�˥ꥹ�Ȥ����褦�ˡ�
@strong{MySQL} �������� @code{TINYINT}, @code{MEDIUMINT}, @code{BIGINT} ��
���ݡ��Ȥ��ޤ���@strong{MySQL} �ˤ�äƥ��ݡ��Ȥ����¾�γ�ĥ�Ȥ��ơ�����
�����ǡ����δ��ܥ�����ɤ�³���Ƴ����˻��ꤹ�������ͤ�ɽ����(�㤨�� 
@code{INT(4)})������ޤ������Υ��ץ�����������ϡ��ե�����ɤ˻��ꤵ�줿
�����⾯�ʤ������ͤ�ɽ���κ�¦�����뤿��˻��Ѥ���ޤ����������ե�����
�ɤ˳�Ǽ���뤳�Ȥ��Ǥ����ͤ��ϰϤ䡢�ե�����ɤ˻��ꤵ�줿����Ķ����������
�ˤĤ���ɽ��������������󤵤�ޤ��󡣥��ץ����γ�ĥ°�� 
@code{ZEROFILL} ����ꤷ�ƻ��Ѥ��줿��硢�ǥե���Ȥ����������� 0 
���֤��������ޤ����㤨�С�@code{INT(5) ZEROFILL} �Ȥ���������줿�ե���
��ɤǤϡ��� @code{4} �� @code{0004} �Ȥ��Ƽ��Ф���ޤ�������: �����ե���
������ɽ���������礭���ͤ��Ǽ�����硢@strong{MySQL} ��ʣ���� join 
�Τ���˰���ơ��֥������������ˡ�������θ�����Ǥ��礦�����ξ�� 
@strong{MySQL} �ϥǡ��������ꥸ�ʥ�Υե���������˹�äƤ��뤳�Ȥ��Ѥ�
�뤿��Ǥ���

���٤Ƥ��������ϥ��ץ�����(��ɸ��)°�� @code{UNSIGNED} ����Ĥ��Ȥ��Ǥ�
�ޤ������̵�����ͤϥե������������ο���������Ĥ������ơ��ե�����ɤ���
���ƾ����礭�����ͤ��ϰϤ�ɬ�פʻ��˻��ѤǤ��ޤ���

@code{FLOAT} ���϶�����ǡ�������ɽ������˻��Ѥ���ޤ���ANSI/ISO SQL92 ɸ
��ϡ�@code{FLOAT} ������ɤ�³�������˥��ץ���������(�ؿ����ϰϤǤ�
�ʤ�)�λ��������Ƥ��ޤ���@strong{MySQL} �����Ϥ��Υ��ץ��������ٻ����
���ݡ��Ȥ��Ƥ��ޤ���������� @code{FLOAT} �����٤λ���̵���ǥե�����ɷ�
�Ȥ��ƻ��Ѥ��줿���ϡ�@strong{MySQL} ���ͤ��Ǽ���뤿���4�Х��Ȥ���Ѥ���
����@code{FLOAT} ������ɤ�³��������2�Ĥο��ͤ�Ϳ���빽ʸ�⥵�ݡ��Ȥ�
��ޤ������Υ��ץ����ǤΡ��ǽ�ο��ͤ��ͤ�ɬ�פ����̤�Х��Ȥ�ɽ���ޤ���
2���ܤο��ͤϡ���Ǽ��ɽ������뾮�����η������ꤷ�ޤ�(@code{DECIMAL} �� 
@code{NUMERIC} ��Ʊ��)��@strong{MySQL} ���ե�����ɤ˻��ꤵ�줿�����礭
���������η������Ŀ��ͤ򤳤Υե�����ɤ˳�Ǽ��������ͤγ�Ǽ����;�פʷ�
��������褦���ͤ��ݤ���ޤ���

@code{REAL} �� @code{DOUBLE PRECISION} �������ٻ��������ޤ���
ANSI/ISO SQL92 ɸ����Ф����ĥ�Ȥ��ơ�@strong{MySQL} �� @code{DOUBLE} �� 
@code{DOUBLE PRECISION} ����Ʊ����Ȥ���ǧ�����ޤ���@code{REAL} �����٤� 
@code{DOUBLE PRECISION} �λ�����⾮�������Ȥ��׵᤹��ɸ��Ȱۤʤꡢ
@strong{MySQL} �Ϥɤ����8�Х��Ȥ������پ��������ͤȤ��Ƽ������Ƥ��ޤ�
("ANSI �⡼��"�Ǽ¹Ԥ��Ƥ��ʤ����)���ܿ��������ˤ��뤿��ˤϡ��������
�ǡ����ͤγ�Ǽ���׵᤹�륳���ɤϡ����٤侮��������λ���̵���� 
@code{FLOAT} �� @code{DOUBLE PRECISION} ����Ѥ��٤��Ǥ���

�ե�����ɤη����ͤε����ϰϤ�Ķ�������ͤ��������褦�Ȥ���ȡ�@strong{MySQL} ��
�����ͤ�����ϰϤ��äѤ����ڤ�ͤᡢ���η�̤�������������ޤ���

�㤨�С� @code{INT} �ե�����ɤ��ϰϤ� @code{-2147483648} ���� @code{2147483647} �Ǥ���
�⤷ @code{-9999999999} �� @code{INT} �ե�����ɤ��������褦�Ȥ���ȡ��ͤ��ϰϤκ����ͤ�
�������졢 @code{-2147483648} ���������������ޤ���Ʊ�ͤˡ�@code{9999999999} �ξ�硢
 @code{2147483647} ���������������ޤ���

�����ơ�@code{INT} �ե�����ɤ����̵���ξ�硢�ե�����ɤ��ϰϤ��礭����
Ʊ���Ǥ������³��ͤ� @code{0} ��@code{4294967296} �ˤʤ�ޤ���
�⤷ @code{-9999999999} �� @code{9999999999} ���������褦�Ȥ���ȡ�
�ͤ� @code{0} �� @code{4294967296} �Ȥ�����������ޤ���

@code{ALTER TABLE}, @code{LOAD DATA INFILE}, @code{UPDATE} �ޤ���
 multi-row @code{INSERT} �����������Ѵ��� `�ٹ�' �Ȥ��������ޤ���


@cindex Types, Date and Time
@cindex Date and Time types
@node Date and time types, String types, Numeric types, Column types
@subsection ���դȻ��֤η�

@menu
* Y2K issues::                  Y2K issues and date types
* DATETIME::                    The @code{DATETIME}, @code{DATE} and @code{TIMESTAMP} types
* TIME::                        The @code{TIME} type
* YEAR::                        The @code{YEAR} type
@end menu

���դȻ��֤η��� @code{DATETIME}, @code{DATE}, @code{TIMESTAMP},
@code{TIME}, @code{YEAR} �Ǥ�.  �����Ϥ��줾���ͤ�Ŭ�����ϰϤ����ꡢ
``zero'' �Ϥ��ʤ����ְ�ä��ͤ���ꤷ�������Ѥ����ޤ�������: @strong{MySQL} ��
�μ¤� '��̩�Ǥʤ�' ���������դ��͡��㤨�� @code{1999-11-31} ���Ǽ���뤳
�Ȥ��Ǥ��ޤ���������ͳ�ϡ����դ�����å������������Ǥ�ϥ��ץꥱ��������
���ꡢSQL �����ФˤϤʤ��ȹͤ��Ƥ��뤫��Ǥ������դ�'®��'�����å����뤿��
�ˡ�@strong{MySQL} �Ϸ 0��12 ���ϰϤǤ��뤫������ 0��31 ���ϰϤǤ��뤫
����������å����ޤ�����Ҥ��ϰϤϡ�@strong{MySQL} �� @code{DATE} �ޤ��� 
@code{DATETIME} �ե�����ɤˡ����ޤ��Ϸ����� 0 �Ǥ������դ��Ǽ�Ǥ��뤿��
���������Ƥ��ޤ�������ϡ����Τ����դ��Τ�ʤ�����������Ͽ����ɬ�פ�����
���ץꥱ������������ͭ�ѤǤ������ξ�硢@code{1999-00-00} �� 
@code{1999-01-00} �Τ褦�����դ�ñ�����Ͽ�Ǥ��ޤ�(������󡢤��Τ褦����
�դ� @code{DATE_SUB()} �� @code{DATE_ADD} �Τ褦�ʴؿ��ǻ��Ѥ��ơ���������
���֤뤳�Ȥϴ��ԤǤ��ޤ���)��

����ϡ����դȻ��ַ��Ǻ�Ȥ�����ˡ�����Ū�˹�θ���ʤ���Фʤ�ʤ����ȤǤ�:

@itemize @bullet
@item
@strong{MySQL}�ϡ�ɸ�������Ϳ����줿���դ���֤����ͤ���Ф��ޤ�����Ϳ����줿¿�ͤʷ�������(�㤨�С����ꤵ�줿�ͤ����դ���ַ��˳�����Ƥ��ꡢ��Ӥ�����)���ᤷ�褦�Ȼ�ߤޤ���
����Ǥ⡢����ǽҤ٤�������������ݡ��Ȥ���ޤ���
����ϡ��������ͤ�Ϳ�����뤳�Ȥ���Ԥ���¾�η������ͤ���Ѥ����褦�ʻ��֤�������ȡ��ɤΤ褦�ʷ�̤Ȥʤ뤫ͽ�ۤǤ��ޤ���

@item
@strong{MySQL} �Ϥ����Ĥ��η������ͤ��Ѥ��Ƥ���ޤ�����
���ǯ����ʬ�����ˤ�����ʬ�Ϻ�����Ϳ�����Ƥ���ȴ��Ԥ��Ƥ��ޤ���
���դ� ǯ-��-�� �ν�(�㤨�С�@code{'98-09-04'})�Ǥʤ��ƤϤʤ�ޤ���
��-��-ǯ �� ��-��-ǯ ���ͤʤɤ��Ǥ�Ȥ��Ƥ���褦�ʷ��Ǥ��äƤϤʤ�ޤ���
(�㤨�С�@code{'09-04-98'}��@code{'04-09-98'}).

@item
@strong{MySQL} �ϡ��⤷���ͤ�ʸ̮�����դȻ��֤η������Ѥ����ȡ�
��ưŪ�����դȻ��֤���ͤ�ľ���ޤ����դ�Ԥ��ޤ���

@item
@strong{MySQL} ���ϰϳ��θ��ä��ͤ����դȻ��ַ��Ȥ��Ƽ�����ä����
(���Υ��������κǽ��ߤƤ�������)�������ͤ� ``����'' ���Ѵ�����ޤ���
(�㳰�ϡ��ϰϳ���@code{TIME}�ͤ�Ŭ�ڤ�@code{TIME}���ϰϤθ³��ͤ��ڤ�ͤ���뤳�ȤǤ���)
�ʲ��ˡ����줾��η��� `����' �η����򼨤��ޤ���

@multitable @columnfractions .3 .7
@item @strong{�ե�����ɥ�����} @tab @strong{`����'��}
@item @code{DATETIME}      @tab @code{'0000-00-00 00:00:00'}
@item @code{DATE}          @tab @code{'0000-00-00'}
@item @code{TIMESTAMP}     @tab @code{00000000000000} (length depends on display size)
@item @code{TIME}          @tab @code{'00:00:00'}
@item @code{YEAR}          @tab @code{0000}
@end multitable

@item
`����'�ͤ����̤Ǥ�����ɽ�˼����줿�ͤ�����Ū�˻��Ѥ��ơ���Ǽ�����껲�Ȥ�����Ǥ��ޤ���
�����ͤϡ� @code{'0'} ���� @code{0} ����Ѥ��뤳�Ȥˤ�ꡢ���ʷ�˽񤯤��Ȥ�Ǥ��ޤ���

@item
@strong{MyODBC} ��ǻ��Ѥ���Ƥ��� `����' �����դȻ��֤ϡ�
@strong{MyODBC} 2.50.12 �ʾ�Ǥϼ�ưŪ�� @code{NULL} ���Ѵ�����ޤ���
����� ODBC ���������ͤ򰷤��ʤ�����Ǥ���
@end itemize

@cindex Year 2000 issues
@node Y2K issues, DATETIME, Date and time types, Date and time types
@subsubsection ���񣲣�����ǯ����ȥǡ�����

@strong{MySQL} ���Τ�2000ǯ������Ф��ư����Ǥ�(@pxref{Year 2000 compliance})����
 @strong{MySQL} ���󼨤���������ͤ˴ؤ��ƤϤ����ǤϤ���ޤ���2���
ǯ�����Ϥϲ������ʤΤ��狼��ʤ��Τ�����ۣ��Ǥ������Τ褦���ͤ� @strong{MySQL}
��������ǯ��4���ȤäƤ��뤳�Ȥ���4��η������Ѵ�����Ƥ��ޤ��ޤ���

 @strong{MySQL} ��ۣ������դ� @code{DATETIME}, @code{DATE}, @code{TIMESTAMP} 
����� @code{YEAR} ���˴ؤ��ơ��ʲ���
�롼��˽��äƲ�ᤷ�ޤ���

@itemize @bullet
@item
@code{00-69} ���ϰϤ�ǯ�� @code{2000-2069} ���Ѵ���

@item
@code{70-99} ���ϰϤ�ǯ�� @code{1970-1999} ���Ѵ���
@end itemize

�����Υ롼��ϥǡ����������̣���Ƥ��뤫���Ф��������ʿ����Ϳ�����
�᤮�ʤ����Ȥ����դ��Ƥ������������� @strong{MySQL} ȯ��Ū��ˡ���������ͤ�������
�ʤ�����ۣ��Ǥʤ�4���ǯ��ޤ����Ϥ�Ϳ����٤��Ǥ���

@code{ORDER BY} ��2��� @code{YEAR/DATE/DATETIME} ���������������Ȥ���ޤ���

����: @code{MIN()} �� @code{MAX()} �Τ褦�ʤ����Ĥ��δؿ��� @code{TIMESTAMP/DATE} �����
���Ѵ����ޤ��������ǯ��2��Υ����ॹ����פϤ����δؿ���������ư���
�����Ȥ��̣���ޤ������ξ��ν����ϡ�@code{TIMESTAMP/DATE} ��4���ǯ�η�
�����Ѵ����뤫��@code{MIN(DATE_ADD(timestamp,INTERVAL 0 DAYS))} �Τ褦�ʲ�
������Ѥ��뤳�ȤǤ���

@tindex DATETIME
@tindex DATE
@tindex TIMESTAMP
@node DATETIME, TIME, Y2K issues, Date and time types
@subsubsection @code{DATETIME}, @code{DATE}, @code{TIMESTAMP} ��

@code{DATETIME}, @code{DATE}, @code{TIMESTAMP}���Ϥ��ߤ��˴�Ϣ���Ƥ��ޤ������Υ���������
�Ϥ�������ħ�ȡ����줾�줬�ɤ�Ʊ���Ǥɤ��㤦���򼨤��ޤ���

@code{DATETIME} �������դȻ���ξ����ޤ��ͤ�ɬ�פʾ��˻Ȥ��ޤ���@strong{MySQL} ��
 @code{DATETIME} �ͤ� @code{'YYYY-MM-DD HH:MM:SS'} �Υե����ޥåȤǼ��Ф���ɽ�����ޤ���
���ݡ��Ȥ�����ϰϤ� @code{'1000-01-01 00:00:00'} ���� @code{'9999-12-31 23:59:59'} �Ǥ���
(�֥��ݡ��Ȥ����פȤϤ���˲����ͤǤ�ư�������Τ�ޤ����ݾڤθ¤�ǤϤʤ��Ȥ�����̣�Ǥ�)

@code{DATE} ���ϻ������ʬ�ʤ������դ��ͤΤߤ�ɬ�פʾ��˻Ȥ��ޤ���@strong{MySQL} ��
 @code{DATE} �ͤ�@code{'YYYY-MM-DD'} �Υե����ޥåȤǼ��Ф���ɽ�����ޤ������ݡ��Ȥ���
���ϰϤ� @code{'1000-01-01'} ���� @code{'9999-12-31'} �Ǥ���

@code{TIMESTAMP} �����פ� @code{INSERT} �� @code{UPDATE} ���˼�ưŪ��
���ߤ����դȻ����ޡ�����������󶡤���뷿�Ǥ���
�⤷ʣ���� @code{TIMESTAMP} �ե�����ɤ�������ˤϺǽ�
�ΰ�Ĥ�������ưŪ�˹�������ޤ���

�ǽ�� @code{TIMESTAMP} �ե�����ɤμ�ư�����ϰʲ��Τ����줫�ξ��ǵ�����ޤ���

@itemize @bullet
@item
���Υե�����ɤ�����Ū�� @code{INSERT} �ޤ��� @code{LOAD DATA INFILE} ʸ�ǻ��ꤵ��Ƥ��ʤ��Ȥ���
@item
���Υե�����ɤ�����Ū�� @code{UPDATE} ʸ�ǻ��ꤵ�줺�����ġ�¾�Υե�����ɤ��ͤ��Ѥ�ä���硣
(��Ȥ�ȥե�����ɤ����äƤ����ͤ�Ʊ���ͤ˹������褦�Ȥ��� @code{UPDATE} ʸ�� @code{TIMESTAMP}
�ե�����ɤ򹹿����ʤ����Ȥ����ա��ʤ��ʤ餢��ե�����ɤ򸽺ߤ�Ʊ���ͤ��Ѥ��褦�Ȥ��Ƥ�
@strong{MySQL} �ϸ�Ψ�Τ���ˤ����̵�뤹�뤫��Ǥ���)
@item
����Ū�� @code{TIMESTAMP} �ե�����ɤ� @code{NULL} �ˤ�����硣
@end itemize

�ǽ�ʳ��� @code{TIMESTAMP} �ե�����ɤ⸽�ߤ����դȻ���ˤ��뤳�Ȥ��Ǥ��ޤ��������Υե�����ɤ�
@code{NULL} �ޤ��� @code{NOW()} �ˤ��뤳�ȤǤ���

�ɤ� @code{TIMESTAMP} �ե�����ɤ�����Ū��˾���ͤ򥻥åȤ��뤳�ȤǸ��ߤ������Ǥʤ��ͤ�
���뤳�Ȥ��Ǥ��ޤ�������Ϻǽ�� @code{TIMESTAMP} �ե�����ɤˤĤ��Ƥ�Ʊ���Ǥ���������
�����㤨�� @code{TIMESTAMP} �ե�����ɤ򤢤�쥳���ɤ��������줿�Ȥ��������ˤ������θ夽�ι�
����������Ƥ��Ѳ����ʤ��褦�ˤ������Ȥ����褦�ʤȤ��˻Ȥ��ޤ���

@itemize @bullet
@item
@strong{MySQL} �˥쥳���ɤ��������줿�Ȥ��ˤ��Υե�����ɤ򥻥åȤ����롣����Ǹ��������˽�
��������롣

@item
�ʹߤ�¾�Υե�����ɤ��Ф��빹������ @code{TIMESTAMP} �ե�����ɤ򤽤켫�Τ������äƤ����ͤ�
����Ū�˹������롣
@end itemize

���������μ�ˡ�� @code{DATATIME} �ե�����ɤ���������� @code{NOW()} �ǽ���������ʹߤι�������
�����ۤ��äƤ����Τ�Ʊ���褦�˴�ñ�Ǥ���Ȥ狼��Ǥ��礦��

@code{TIMESTAMP} ���ͤ� @code{1970} ǯ�κǽ餫�� @code{2037} ǯ�Τɤ����λ����ޤǤ��ϰϤ�ͭ���ǡ�
1�äλ���ʬ��ǽ������ޤ����ͤϿ��ͤȤ���ɽ������ޤ���

@strong{MySQL} �� @code{TIMESTAMP} �ͤ���Ф�����ɽ������Τ˻Ȥ��ե����ޥåȤϰʲ���ɽ
�˼����褦�ˤ���ɽ���������˰�¸���ޤ������ܰ��դΡ� @code{TIMESTAMP} �ե����ޥ�
�Ȥ�14��Ǥ����� @code{TIMESTAMP} �ե�����ɤϤ��û��ɽ�����������������뤳�Ȥ�Ǥ��ޤ���

@multitable @columnfractions .3 .7
@item @strong{�ե�����ɷ�}  @tab @strong{ɽ���ե����ޥå�}
@item @code{TIMESTAMP(14)}  @tab @code{YYYYMMDDHHMMSS}
@item @code{TIMESTAMP(12)}  @tab @code{YYMMDDHHMMSS}
@item @code{TIMESTAMP(10)}  @tab @code{YYMMDDHHMM}
@item @code{TIMESTAMP(8)}   @tab @code{YYYYMMDD}
@item @code{TIMESTAMP(6)}   @tab @code{YYMMDD}
@item @code{TIMESTAMP(4)}   @tab @code{YYMM}
@item @code{TIMESTAMP(2)}   @tab @code{YY}
@end multitable

���Ƥ� @code{TIMESTAMP} �ե�����ɤ�ɽ���������˴ط��ʤ�Ʊ����Ǽ������������ޤ������
�Ȥ����Ū��ɽ���������� 6 , 8 , 12 ����� 14 �Ǥ���ɽ���������ϥơ��֥�������
��Ǥ�դ��ͤ˻���Ǥ��ޤ����� 0 ����� 14 �ʾ���ͤ϶���Ū�� 14 �ˤʤ�ޤ���1
���� 13 �ޤǤδ���Υ������϶���Ū�˰���礭�������ˤʤ�ޤ���

@code{DATETIME}, @code{DATE}, @code{TIMESTAMP} �ͤϰʲ��ζ��̥ե����ޥåȥ��åȤΤ����줫��
�Ȥäƻ���Ǥ��ޤ���

@itemize @bullet
@item
ʸ����� @code{'YYYY-MM-DD HH:MM:SS'} �� @code{'YY-MM-DD HH:MM:SS'} �η�����
"�����"����������Ƥ��ޤ� -- ���դ����ζ��ڤ�ʸ���Ȥ��ơ������ʤ���ɵ���
����ѤǤ��ޤ����㤨�С�@code{'98-12-31 11:30:45'}, @code{'98.12.31 11+30+45'},
@code{'98/12/31 11*30*45'}, @code{'98@@12@@31 11^30^45'} �������Ǥ���

@item
ʸ����� @code{'YYYY-MM-DD'} �� @code{'YY-MM-DD'} �η�����
�����"�����"�������Ǥ��ޤ���
�㤨��, @code{'98-12-31'},@code{'98.12.31'}, @code{'98/12/31'}, @code{'98@@12@@31'} ��
�����Ǥ���

@item
ʸ���� @code{'YYYYMMDDHHMMSS'} �ޤ��� @code{'YYMMDDHHMMSS'} �ե����ޥåȡ�
�ִˤ䤫�ʡ�ʸˡ��ǧ����Ƥ��ơ����ɵ�������ա�������ʬ�ζ��ڤ�
�Ȥ��ƻȤ��ޤ����㤨�� @code{'98-12-31 11:30:45'},  @code{'98.12.31 11+30+45'},
 @code{'98/12/31 11*:30*:45'},  @code{'98@@12@@31 11^30^45'} �����������Ǥ���

@item
ʸ���� @code{'YYYY-MM-DD'} �ޤ��� @code{'YY-MM-DD'} �ե����ޥåȡ������ִˤ䤫�ʡ�ʸˡ
��ǧ����Ƥ��ޤ����㤨�� @code{'98-12-31'},  @code{'98.12.31'},  @code{'98/12/31'}, @code{'98@@12@@31'}
�����������Ǥ���

@item
���ڤ�ʸ���ʤ���ʸ���� @code{'YYYYMMDDHHMMSS'} �ޤ��� @code{'YYMMDDHHMMSS'} �ե����ޥ�
�Ȥ������Ȥ��ư�̣�Τ����Ρ��㤨�� @code{'19970523091528'} ����� @code{'970523091528'} 
�� @code{'1997-05-23 09:15:28'} �Ȳ�ᤵ��ޤ��������� @code{'971122129015'} ��̵����
(����ʬ����ʬ����������)�� @code{'0000-00-00 00:00:00'} �ˤʤ�ޤ���

@item
���ڤ�ʸ���ʤ���ʸ���� @code{'YYYYMMDD'} �ޤ��� @code{'YYMMDD'} �ե����ޥåȤǡ����դ�
���ư�̣�Τ����Ρ��㤨�� @code{'19970523'} ����� @code{'970523'} �� @code{'1997-05-23'} �Ȳ��
����ޤ��������� @code{'971332'} ��̵����(���������ʬ����������)�� @code{'0000-00-00'} 
�ˤʤ�ޤ���

@item
 @code{YYYYMMDDHHMMSS} �ޤ��� @code{YYMMDDHHMMSS} �Υե����ޥåȤο��ͤǡ������Ȥ��ư�
̣�Τ����Ρ��㤨�� @code{19830905132800} ����� @code{830905132800} ��
 @code{'1983-09-05 13:28:00'} �Ȳ�ᤵ��ޤ���

@item
 @code{YYYYMMDD} �ޤ��� @code{YYMDD} �Υե����ޥåȤο��ͤ����դȤ��ư�̣�Τ����Ρ�
�㤨�� @code{19830905} ����� @code{830905} �� @code{'1983-09-05'} �Ȥ��Ʋ�ᤵ��ޤ���

@item
 @code{NOW()} �� @code{CURRENT_DATE} �Τ褦��
 @code{DATETIME} , @code{DATE} , @code{TIMESTAMP} �Υ���ƥ����Ȥ�
����������ǽ���ͤ��֤��ؿ��η�̡�
@end itemize

̵���� @code{DATETIME} , @code{DATE} , @code{TIMESTAMP} ���ͤ�Ŭ�ڤʡ֥������ͤ��Ѵ�����ޤ�(
 @code{'0000-00-00 00:00:00'} , @code{'0000-00-00'} �ޤ��� @code{00000000000000} )��

��������ʬ�˶��ڤ�����ʸ����ǻ��ꤵ����ͤǡ�������ͤ�10̤���ξ�
���2��ǻ��ꤷ�ʤ��Ƥ⤫�ޤ��ޤ��� @code{'1979-6-9'} �� @code{'1979-06-09'} ��������
����Ʊ�ͤ˻������ʬ�˶��ڤ�����ʸ����ǻ��ꤵ����ͤǡ�����ʬ���ä�
 @code{10} ̤���ξ���2��ǻ��ꤷ�ʤ��Ƥ⤫�ޤ��ޤ��� @code{'1979-10-30 1:2:3'} ��
 @code{'1979-10-30 01:02:03'} �������Ǥ���

���ͤǤ��Ƥ�������ͤ� 6, 8, 12 �ޤ��� 14 ��Ǥ���ɬ�פ�����ޤ����⤷���ο�
�ͤ� 8 �ޤ��� 14 ���Ĺ���λ��Ϥ��줾�� @code{YYYYMMDD} ����� @code{YYYYMMDDHHMMSS} �ե���
�ޥåȤǡ��ǽ�� 4 ���ǯ��Ϳ�������ΤȲ��ꤵ��ޤ����⤷���ο��ͤ� 6
�ޤ���12���Ĺ���λ��� @code{YYMMDD} ����� @code{YYMMDDHHMMSS} �ե����ޥåȤǺǽ��2���
ǯ��Ϳ�������ΤȲ��ꤵ��ޤ��������ʳ���Ĺ���ο��ͤϤ��Ȥ� @code{0} ���ɲ�
����Ƥ����Τ����Τ�äȤ�ᤤĹ���Τ�ΤȲ�ᤵ��ޤ���

���ڤ�ʤ���ʸ�����Ϳ�������ͤϤ��켫�Ȥ�Ĺ����ȤäƲ�ᤵ��ޤ���
�⤷ʸ����8�ޤ���14ʸ���ʤ��ǯ�Ϻǽ��4ʸ����Ϳ������Ȳ��ꤵ���
���������Ǥʤ���кǽ��2ʸ����Ϳ������Ȳ��ꤵ��ޤ���ʸ����Ϻ���
�鱦��ǯ�����������ʬ���ä�ʸ�������ɽ������Ƥ���ʬ������˲�ᤵ
��ޤ����Ĥޤ�6ʸ���ʲ���ʸ����ϻȤäƤϤ����ʤ��Ȥ������ȤǤ����㤨
��1999ǯ3�����ꤹ��Ĥ��� @code{'9903'} ����ꤷ����硢 @strong{MySQL} �ϡ֥���������
��ơ��֥���������ޤ��������ǯ�ȷ����ʬ�� @code{99} �� @code{03} �Ǥ���������ʬ���礱
�Ƥ���(����)������ͤ�ͭ�������դǤʤ�����˵�����ޤ���

@code{TIMESTAMP} �ե�����ɤ�ͭ�����ͤ�ɽ���������˴ط��ʤ����ꤵ�줿�ͤ�ǹ����٤�
����ʬ��ǽ�dz�Ǽ���ޤ������Τ��ȤϤ����Ĥ��ΰ�̣�礤������ޤ���

ǯ���ͤ����ǻ��ꤵ�줿��硢��������ʬ���ʤ��Τ�ۣ����ͤȤʤ�ޤ���
@strong{MySQL} ������ǯ���ͤ�ʲ��˼�����§�ˤ��ä��Ѵ����ޤ���

@itemize @bullet
@item
��η���TIMESTAMP(4)�Ǥ��äƤ�TIMESTAMP(2)�Ǥ��äƤ���ǯ���������
���뤳�ȡ������Ǥʤ�����ͤ�̵����0����Ǽ����ޤ���

@item
�⤷û�������� @code{TIMESTAMP} �� @code{ALTER TABLE} ��ȤäƳ�ĥ���褦�Ȥ�����硢��
ĥ���ˤϡֱ���Ƥ����׾��󤬸���ޤ���

@item
Ʊ�ͤ� @code{TIMESTAMP} �ե�����ɤ�̤᤿���⡢�ͤ�ɽ�����줿���ˤ�꾯�ʤ�����
������ʤ��Ȥ�����������ơ�����ϼ����ޤ���

@item
 @code{TIMESTAMP} �ͤϺǹ����٤λ���ʬ��ǽ�dz�Ǽ����ޤ���������Ū�˳�Ǽ����
���ͤ�ľ�����Ǥ���ؿ��� @code{UNIX_TIMESTAMP()} �ΤߤǤ���¾�δؿ��ϥե����ޥ�
�Ȥ���Ƽ��Ф��줿�ͤˤĤ������ޤ����Ĥޤꡢ @code{HOUR()} �� @code{SECOND()} �ʤ�
�δؿ��� @code{TIMESTAMP} �ͤ��б�������ʬ���ե����ޥåȤ��줿�ͤǴޤޤ�ʤ���
�Ȥ����Ȥ��Ǥ��ޤ����㤨�� @code{TIMESTAMP} ��� @code{HH} ����ʬ��ɽ�������������ʤ�
�Ȥ�10�ʾ�ʤ���ɽ������ʤ��Τǡ�������û�� @code{TIMESTAMP} �ͤ� @code{HOUR()} ����
���ԤäƤ�̵��̣���ͤ��������ޤ���
@end itemize

�������շ���¾�����շ��Υ��֥������Ȥ˳�ĥ���ƻ��ꤹ�뤳�Ȥ��Ǥ��ޤ���
������������ͤ��Ѳ������η���򵯤�����ǽ��������ޤ���

@itemize @bullet
@item
@code{DATE} ���ͤ� @code{DATETIME} �� @code{TIMESTAMP} ��ʪ��Ϳ������硢
�������ʬ�� @code{'00:00:00'} �ˤʤ�ޤ�������� @code{DATE} �ͤ�
����ξ������äƤ��ʤ�����Ǥ���

@item
@code{DATETIME} �� @code{TIMESTAMP} ���ͤ� @code{DATE} ��ʪ��Ϳ������硢
�������ʬ�Ϻ���ޤ�������� @code{DATE} �ͤ�
����ξ������äƤ��ʤ�����Ǥ���

@item
 @code{DATETIME}, @code{DATE}, @code{TIMESTAMP} �ͤ�Ʊ���ե����ޥåȤΥ��åȤ�Ȥä�ɽ����
���ޤ������ɤη���Ʊ���ͤ��ϰϤ���äƤ���櫓�ǤϤʤ����Ȥ�Ф��Ƥ���
�Ƥ����������㤨�� @code{TIMESTAMP} �ͤ� @code{1970} ǯ������� @code{2037} ǯ������ͤˤϤǤ�
�ޤ��󡣤Ĥޤ� @code{'1968-01-01'} �Ȥ����ͤ� @code{DATETIME} �� @code{DATE} ���ͤȤ��Ƥ�ͭ���Ǥ�
�� @code{TIMESTAMP} ���ͤȤ��Ƥ�̵���ǡ����Τ褦�ʥ��֥������Ȥ���ꤷ������
 @code{0} ���Ѵ�����ޤ���
@end itemize

���դ��ͤ���ꤹ��Ȥ�����Ȥ�������դ��Ƥ�������:

@itemize @bullet
@item
ʸ����Ȥ��ƻ��ꤵ����ͤν���ʥե����ޥåȤ��٤���ʤ��褦���㤨
�� @code{'10:11:12'} �� @samp{':'} ����ڤ�ʸ���Ȥ������Τ褦�˸����ޤ��������դΥ���
�ƥ����ȤǻȤ���Ȥ���� @code{'2010-11-12'} �Ȳ�ᤵ��ޤ���@code{'10:45:15'} �� @code{'45'} 
��ͭ���ʷ�ǤϤʤ��Τ� @code{'0000-00-00'} ���Ѵ�����ޤ���

@item
2���ɽ�����ǯ����������ʬ�������ʤΤ�ۣ��Ǥ��� @strong{MySQL} �ϰʲ��Υ롼��
��2���ǯ���ᤷ�ޤ���

@itemize @minus
@item
@code{00-69} ���ϰϤˤ���ǯ���ͤ� @code{2000-2069} ǯ�Ȥ��롣

@item
@code{70-99} ���ϰϤˤ���ǯ���ͤ� @code{1970-1999} ǯ�Ȥ��롣
@end itemize
@end itemize

@tindex TIME
@node TIME, YEAR, DATETIME, Date and time types
@subsubsection @code{TIME} ��

@strong{MySQL} �� @code{TIME} ���ͤ� @code{'HH:MM:SS'}
 (������ʬ���礭������ @code{'HHH:MM:SS'})
�Ȥ����ե����ޥåȤǰ������ޤ�ɽ�����ޤ���
(������ʬ���礭������ @code{'HHH:MM:SS'})��
@code{TIME} �ͤ��ϰϤ� @code{'-838:59:59'} ���� @code{'838:59:59'} ���ϰϤǤ���
������ʬ������ʤ��礭���Τϡ�@code{TIME} ���ϰ������ʤ��24���ְ���
�λ����ɽ������Τ��Ѥ���������ǤϤʤ��в���֤���Ĥλ��ݤδֳ�
(�ɤ���⣲�����֤�ۤ����ꡢ��ο��ˤʤ���⤢��ޤ�)��ɽ�����뤳��
�⤢�뤫��Ǥ���

@code{TIME} �ͤ��͡��ʥե����ޥåȤǻ����ǽ�Ǥ���

@itemize @bullet
@item
ʸ����� @code{'D HH:MM:SS.fraction'} �Ȥ����ե����ޥåȡ�
(@strong{MySQL}�Ϥޤ����� fraction �� time �ե�����ɤ���¸�Ǥ��ޤ���)��
�ʲ��� ``�����'' ʸˡ�����ѤǤ��ޤ���

@code{HH:MM:SS.fraction}, @code{HH:MM:SS}, @code{HH:MM}, @code{D HH:MM:SS},
@code{D HH:MM}, @code{D HH} or @code{SS}.  Here @code{D} is days between 0-33.

@item
ʸ����� @code{'HHMMSS'} �Ȥ����褦�˶��ڤ�Τʤ��ե����ޥåȤǻ���Ȥ���ͭ��
�ʤ�Ρ��㤨�� @code{'101112'} �� @code{'10:11:12'} �Ȳ�ᤵ��ޤ��� @code{'109712'} ��̵����(ʬ
����ʬ��̵��̣) @code{'00:00:00'} �ˤʤ�ޤ���

@item
���ͤ� @code{HHMMSS} �Υե����ޥåȤǻ���Ȥ���ͭ���ʤ�Ρ�
�㤨�� @code{101112} �� @code{'10:11:12'} �Ȳ�ᤵ��ޤ���
�����̤η�������Ǥ��ޤ�: @code{SS}, @code{MMSS},@code{HHMMSS},
@code{HHMMSS.fraction}������: @strong{MySQL} �Ϥޤ� fraction ������¸�Ǥ�
�ޤ���

@item
�㤨�� @code{CURRENT_TIME} �Τ褦�� @code{TIME} �Υ���ƥ����ȤǼ����դ������ͤ��֤�
�ؿ��η�̡�
@end itemize

ʸ����ǻ���γ����ζ��ڤ��ޤ� @code{TIME} ���ͤˤĤ��Ƥϡ�����ʬ���ä� @code{10} �ʲ�
�ξ�硢����ο�������ꤹ��ɬ�פϤ���ޤ���@code{'8:3:2'} �� @code{'08:03:02'} ��Ʊ
���Ǥ���

��û���� @code{TIME} �ͤ� @code{TIME} �ե�����ɤȤ��ƻ��ꤹ����������դǤ���
@strong{MySQL} �Ϥ����ͤ��äȤⱦü�η���ä�ɽ���Ȳ��ꤷ�Ʋ�ᤷ�ޤ�
(@strong{MySQL} �� @code{TIME} ���ͤ������
�����λ���Ȥ��Ƥ��в���֤Ȥ��Ʋ�ᤷ�ޤ�)���㤨�� @code{'11:12'},@code{'1112'},
 @code{1112} �� @code{'00:11:12'} (11��12ʬ)��ɽ���Ƥ���Ĥ��Ǥ��Ƥ⡢
@strong{MySQL} �Ϥ����� @code{'00:00:12'} (11ʬ12��)�Ȥ��Ʋ�ᤷ�ޤ���
Ʊ�ͤ� @code{'12'} ����� @code{12} �� @code{'00:00:12'} �Ȳ�ᤷ�ޤ���

@code{TIME} ���ϰϳ��ˤ����ͤ��Ͱʳ�����������Τ��ϰϤ�ü���ͤ�Ŭ�������˥����
�פ���ޤ����㤨�� @code{'-850:00:00'} ����� @code{'850:00:00'} ��
���줾�� @code{'-838:59:59'} ����� @code{'838:59:59'} �ˤʤ�ޤ���

̵���� @code{TIME} �ͤ� @code{'00:00:00'} ���Ѵ�����ޤ���
������ @code{'00:00:00'} ���Τ�ͭ���� @code{TIME} �ͤʤΤǡ�
�ơ��֥������¸���줿'00:00:00'�Ȥ����ͤ��餽�줬��Ȥ�
�� @code{'00:00:00'} �Ȼ��ꤵ�줿�ͤʤΤ�̵���ʤ�����Ѵ����줿��̤ʤΤ����
�̤�����ˡ�Ϥʤ����Ȥ����դ��Ƥ���������


@tindex YEAR
@node YEAR,  , TIME, Date and time types
@subsubsection @code{YEAR} ��

@code{YEAR} ����ǯ��ɽ������Τ˻Ȥ���1�Х��Ȥ��ͤǤ���

@strong{MySQL} �� @code{YEAR} ���ͤ� @code{YYYY} �Ȥ����ե����ޥåȤǰ�����
�ޤ�ɽ�����ޤ����ϰϤ� @code{1901} ���� @code{2155} �Ǥ���

@code{YEAR} �����͡��ʥե����ޥåȤǻ����ǽ�Ǥ���

@itemize @bullet
@item
@code{'1901'} ���� @code{'2155'} ���ϰϤˤ���4���ʸ����

@item
@code{1901} ���� @code{2155} ���ϰϤˤ���4��ο��͡�

@item
@code{'00'} ���� @code{'99'} ���ϰϤˤ���2���ʸ����
@code{'00'} ���� @code{'69'} �ޤǤ���� @code{'70'} ����
@code{'99'} �ޤǤ��ϰϤϤ��줾�� @code{2000} ���� @code{2069} �ޤ�
����� @code{1970} ���� @code{1999} �ޤǤ��ϰϤ�
YEAR�����Ѵ�����ޤ���

@item
@code{1} ���� @code{99} ���ϰϤˤ���2��ο��͡�@code{1} ���� @code{69} �ޤ�
����� @code{70} ���� @code{99} �ޤǤ��ϰϤ�
���줾�� @code{2001} ���� @code{2069} �ޤǤ���� @code{1970} ���� @code{1999} �ޤ�
���ϰϤ� @code{YEAR} �����Ѵ�����ޤ���
2��ο��ͤξ���2���ʸ����ξ��ȼ㴳�ۤʤäƤ����������դ���
�����������ʤ��ʤ�0����ͤȤ��ƻ��ꤷ�������2000ǯ�Ȥ��Ʋ�ᤵ���뤳
�Ȥ��Ǥ��ʤ�����Ǥ������ξ���ʸ����� @code{'0'} �ޤ��� @code{'00'} ��@emph{���ꤷ�ʤ����
�ʤ�ޤ���}�������Ǥʤ���п���0��̵����YEAR�ͤ򼨤� @code{0000} ���Ѵ�����ޤ���

@item
�㤨�� @code{NOW()} �Τ褦�� @code{YEAR} ����ƥ����ȤǼ�����������ͤ��֤��ؿ��η�
�̡�
@end itemize

̵���� @code{YEAR} �ͤ� @code{0000} ���Ѵ�����ޤ���


@node String types, Choosing types, Date and time types, Column types
@subsection ʸ����

ʸ���󷿤�  @code{CHAR}, @code{VARCHAR}, @code{BLOB}, @code{TEXT},
@code{ENUM} ����� @code{SET} �Ǥ���

@tindex CHAR
@tindex VARCHAR
@menu
* CHAR::                        The @code{CHAR} and @code{VARCHAR} types
* BLOB::                        The @code{BLOB} and @code{TEXT} types
* ENUM::                        The @code{ENUM} type
* SET::                         The @code{SET} type
@end menu

@node CHAR, BLOB, String types, String types
@subsubsection @code{CHAR} ���� @code{VARCHAR} ��

@code{CHAR} ���� @code{VARCHAR} ���Ϥ褯���Ƥ��ޤ�����Ǽ�����Ф��μ��˰㤤������ޤ���

@code{CHAR} �ե�����ɤ�Ĺ���ϥơ��֥����������Ȥ����������Ĺ���˸��ꤵ��ޤ���Ĺ��
�� 1 ���� 255 �ޤǤ��ͤ���ޤ���@code{CHAR} ����Ǽ�����Ȥ��ˤϻ��ꤵ�줿Ĺ����
�ʤ�褦�˱�¦�˶��򤬵ͤ���ޤ���@code{CHAR} ���ͤ����Ф��줿���ˤϱ�¦
(��³)�ζ���ϼ�������ޤ���

@code{VARCHAR} �ե�����ɤ��ͤϲ���Ĺʸ����Ǥ���
@code{VARCHAR} �ե�����ɤ� @code{CHAR} �ե������
��Ʊ���� 1 ���� 255 �ޤǤ�Ĺ��������Ǥ��ޤ���
(@strong{MySQL} 3.23 �Ǥ�, @code{CHAR} ��Ĺ���� 0 ���� 255 �ޤǵ�����Ƥ��ޤ�.)
������ @code{CHAR} ���Ȱۤʤ� @code{VARCHAR} �����ͤ�ɬ�פ�ʸ������ʬ��
Ĺ����Ͽ����1 �Х��Ȥ�­�����ΰ�˳�Ǽ����ޤ����ͤˤϷ��碌�Τ���ζ���ϤĤ����
�ޤ��󡣸�³�ζ�����ͤγ�Ǽ���˼�������ޤ���(���ζ���ν���� ANSI
SQL���ͤȤϰ�äƤ��ޤ���)

�⤷ @code{CHAR} �ޤ��� @code{VARCHAR} �ե�����ɤˡ��ե�����ɤκ���Ĺ��
�ۤ���Ĺ�����ͤ�Ϳ�������ϡ�Ŭ�礹��褦���ڤ�ͤ���ޤ���

�ʲ���ɽ�Ϥ�������ĤΥե�����ɷ��ΰ㤤��@code{CHAR(4)} ����� @code{VARCHAR(4)} ���͡�
��ʸ�����ͤ��Ǽ������̤򼨤����Ȥ�ɽ���Ƥ��ޤ���

@c Need to use @(space) to make sure second column values retain spacing
@c in output for table below.

@multitable @columnfractions .2 .15 .2 .2 .25
@item @strong{��}  @tab @code{CHAR(4)}     @tab @strong{ɬ�פʳ�Ǽ��} @tab @code{VARCHAR(4)} @tab @strong{ɬ�פʳ�Ǽ��}
@item @code{''}       @tab @code{'@ @ @ @ '} @tab 4 ���� @tab @code{''} @tab 1 ����
@item @code{'ab'}     @tab @code{'ab@ @ '}   @tab 4 ���� @tab @code{'ab'} @tab 3 ����
@item @code{'abcd'}   @tab @code{'abcd'}     @tab 4 ���� @tab @code{'abcd'} @tab 5 ����
@item @code{'abcdefgh'} @tab @code{'abcd'}     @tab 4 ���� @tab @code{'abcd'} @tab 5 ����
@end multitable

@code{CHAR(4)} �ե�����ɤθ�³�ζ���ϼ��Ф����ˤȤ�Τ������Τǡ�CHAR(4)�����
@code{VARCHAR(4)} ������Ф�����ͤϤɤξ��Ǥ�Ʊ���Ǥ���

@code{CHAR} ����� @code{VARCHAR} �ե�����ɤ��ͤϥơ��֥���������� @code{BINARY} °����
�Ĥ����ʤ��¤ꡢ��ʸ���Ⱦ�ʸ������̤��ʤ��ǥ����ȡ���Ӥ���ޤ���@code{BINARY} °���Ϥ���
����ͤ���ʸ������ʸ������̤��ơ�MySQL�����Ф�¹Ԥ��Ƥ���ޥ����
ASCII��˥����ȡ���Ӥ���뤳�Ȥ��̣���ޤ���

@code{BINARY} °���ϡָ���Ū�פǤ����Ĥޤꡢ�⤷ @code{BINARY} �Ǥ���Ȼ��ꤵ�줿
�ե�����ɤ�������ˤ���ȼ����Τ� @code{BINARY} ���ͤȤ�����Ӥ����ΤǤ���

@strong{MySQL} �ϥơ��֥��������˲����Ǥ餺��@code{CHAR} �ޤ��� @code{VARCHAR} ����
�ե�����ɤ��ѹ������������ޤ���
@xref{Silent column changes}.

@tindex BLOB
@tindex TEXT
@node BLOB, ENUM, CHAR, String types
@subsubsection @code{BLOB} �� @code{TEXT} ��

@code{BLOB} ���礭�ʥХ��ʥ귿�Υ��֥������Ȥǡ�����Ĺ�Υǡ������ݻ��Ǥ��ޤ���
4 �Ĥ� @code{BLOB} �������ʤ�� @code{TINYBLOB}, @code{BLOB},
@code{MEDIUMBLOB} �� @code{LONGBLOB} ���ݻ��Ǥ���ǡ����κ���Ĺ���㤦�����Ǥ���
@xref{Storage requirements}.

4 �Ĥ� @code{TEXT} �������ʤ�� @code{TINYTEXT}, @code{TEXT}, @code{MEDIUMTEXT}
�� @code{LONGTEXT} �� 4 �Ĥ� @code{BLOB} �����б�����Ʊ������Ĺ��
��Ǽ������äƤ��ޤ��� @code{TEXT} �� @code{BLOB} �ΰ㤤�ϡ�
@code{TEXT} �ϥ������˰�¸���ʤ��ǥ����Ȥ���Ӥ��졢
@code{BLOB} �ϥ������˰�¸����(ʸ�������ɤ�)��Ӥ���뤳�Ȥ����Ǥ���
�����ʤ�С�@code{TEXT} �ϡ��������˰�¸���ʤ� @code{BLOB} �Ǥ���

�⤷ @code{BLOB} �� @code{TEXT} �ե�����ɤˤ����κ���Ĺ�ʾ���ͤ�Ϳ����줿��硢
�����ͤϤ��ä�����ޤ�褦���ڤ���Ȥ���ޤ���

�ۤȤ�ɤ����ǡ�@code{TEXT} �ե�����ɤ� @code{VARCHAR} ���礭��ʪ�ȸ��ʤ����Ȥ�����ޤ���
Ʊ�ͤˡ�@code{BLOB} �ե�����ɤ� @code{VARCHAR BINARY} �ե�����ɤ��礭���ʤä�ʪ�Ǥ���
�㤤�ϡ�

@itemize @bullet
@item
@strong{MySQL} 3.23.2 �ʾ�Ǥϡ�@code{BLOB} �� @code{TEXT} ���
����ǥå�������Ĥ��Ȥ�����ޤ�����������ΥС������Ǥ�
����ǥå������Ĥ��Ȥ�����ޤ���

@item
@code{VARCHAR} �ե�����ɤǹԤäƤ���褦�ˤϡ�@code{BLOB} �� @code{TEXT} �ե�����ɤ�
�ͤθ���ˤĤ��Ƥ���Ϣ³��������ʸ�����ڤ���Ȥ���ޤ���

@item
@cindex Default values, @code{BLOB} and @code{TEXT} columns
@cindex @code{BLOB} columns, default values
@cindex @code{TEXT} columns, default values
@code{BLOB} �� @code{TEXT} ��� @code{DEFAULT} �ͤ���Ĥ��Ȥ�����ޤ���
@end itemize

@code{MyODBC} �� @code{BLOB} �� @code{LONGVARBINARY} �Ȥ��ơ� 
@code{TEXT} �� @code{LONGVARCHAR} �Ȥ���������ޤ���

@code{BLOB} �� @code{TEXT} �ե�����ɤ϶�ü��Ĺ���Τǡ���������Ѥ���ݤˤϡ�
�����Ĥ��κ��ä����ˤǤ��魯���⤷��ޤ���

@itemize @bullet
@item
�⤷ @code{GROUP BY} �� @code{ORDER BY} �� @code{BLOB} �ե�����ɤ� @code{TEXT} �ե������
�ǻ��Ѥ������ʤ顢�ե�����ɤ��ͤ����Ĺ�Τ�Τ��Ѵ����ʤ��ƤϤʤ�ޤ���
ɸ��Ū����ˡ�ϡ� @code{SUBSTRING} �ؿ�����Ѥ��뤳�ȤǤ���
���Ȥ��С�

@example
mysql> select comment from tbl_name,substring(comment,20) as substr
       ORDER BY substr;
@end example

�⤷����򤷤ʤ���硢�ե�����ɤκǽ�� @code{max_sort_length} �Х��Ȥ�
�����Ȼ��˻��Ѥ���ޤ��� @code{max_sort_length} �Υǥե�����ͤ� 1024; 
�����ͤ� @code{mysqld} �����С���ư���� @code{-O} ���ץ�������Ѥ��뤳�Ȥ�
�ѹ��Ǥ��ޤ���
�ե�����ɤΰ��֤���ꤹ�뤳�Ȥˤ�äƤ��������ꥢ������Ѥ��뤳�Ȥˤ�äơ�
 @code{BLOB} �� @code{TEXT} ���ͤ� group ���Ǥ��ޤ���

@example
mysql> select id,substring(blob_col,1,100) from tbl_name
           GROUP BY 2;
mysql> select id,substring(blob_col,1,100) as b from tbl_name
           GROUP BY b;
@end example

@item
@code{BLOB} �ޤ��� @code{TEXT} ���֥������Ȥκ���Ĺ�Ϥ��η��ˤ����ꤵ��ޤ�����
���ʤ������饤����Ȥȥ����Фδ֤Ǽºݤ����뤳�Ȥ��Ǥ���Ϻ���Ĺ�ϡ�
���Ѳ�ǽ�ʥ����̤ȥ��ߥ�˥��������Хåե��Υ������ˤ�äƷ��ꤵ��ޤ���
��å������Хåե����������Ѥ��뤳�Ȥ��Ǥ��ޤ��������ξ�硢�����С��ȥ��饤����ȡ�
ξ�������ѹ����ʤ���Фʤ�ޤ���@xref{Server parameters}.
@end itemize

���줾��� @code{BLOB}, @code{TEXT} �ե�����ɤϡ���դΥ��������Ȥ��줿���֥������Ȥˤ�äơ�
�����Ǥ�ɽ����뤳�Ȥ����դ��Ƥ�������.��
����ϥơ��֥뤬�������Ȥ��˰��٤������������Ȥ����¾�Υե�����ɤȤ��о�Ū�Ǥ���

@tindex ENUM
@node ENUM, SET, BLOB, String types
@subsubsection @code{ENUM} ��

@code{ENUM} �ϥ��ȥ�󥰥��֥������Ȥǡ�
�����ͤϡ��̾�ơ��֥�������Υե�������������󤵤줿�ͤ��椫�����Ф�ޤ���

�ͤϤ���������Ǥ� ��ʸ�� (@code{""}) �� @code{NULL} ���뤳�Ȥ�����ޤ���

@itemize @bullet
@item
�⤷ @code{ENUM} ��̵������ (��󤵤�Ƥ����ͤ���˴ޤޤ�ʤ�ʸ��) ��
����������硢 ���Υ��顼�ˤʤ�ʸ��������˶�ʸ������������ޤ���

@item
�⤷ @code{ENUM} �� @code{NULL} ��������줿���, @code{NULL} �Ϥ��Υե�����ɤ�
���Ĥ�����ͤȤʤꡢ�ǥե�����ͤ� @code{NULL} �ˤʤ�ޤ���
 �⤷ @code{ENUM} �� @code{NOT NULL} ��������줿�ʤ�С� �ǥե�����ͤϡ�
���ꥹ�Ȥκǽ���ͤˤʤ�ޤ���
@end itemize

��󤵤줿���줾����ͤϥ���ǥå���������ޤ���

@itemize @bullet
@item
���ꥹ�Ȥ����Ǥ� 1 �������֤���ޤ���

@item
��ʸ�����顼�Υ���ǥå����ͤ� 0 ��
 ����������� @code{ENUM} �ͤ�Ϳ�����Ƥ���쥳���ɤ򸫤Ĥ��뤿���
�ʲ��Τ褦�� @code{SELECT} ��ʸ�����ѤǤ��뤳�Ȥ��̣���ޤ���

@example
mysql> SELECT * FROM tbl_name WHERE enum_col=0;
@end example

@item
@code{NULL} �Υ���ǥå����ͤ� @code{NULL}.
@end itemize

���Ȥ��С��ե�����ɤ� @code{ENUM("one", "two", "three")} ��������줿�ʤ顢
�ʲ��˼����ͤ�Ȥ�ޤ��� ���줾��Υ���ǥå����ͤ⼨���ޤ���

@multitable @columnfractions .2 .8
@item @strong{��} @tab @strong{����ǥå���}
@item @code{NULL}    @tab @code{NULL}
@item @code{""}      @tab 0
@item @code{"one"}   @tab 1
@item @code{"two"}   @tab 2
@item @code{"three"} @tab 3
@end multitable

���Ϻ��� 65535 �Ĥ����ǤޤDz�ǽ�Ǥ���

@code{ENUM} �ե�����ɤ��ͤ�Ϳ���������ʸ����ʸ����̵�ط��Ǥ���
����������ǥե�����ɤ��鸡��������ͤϡ���ʸ����ʸ�������ޤ���
����ϥơ��֥��������Ϳ����줿�ꥹ�Ȥ��ͤǤ���

�⤷ @code{ENUM} ����ͤ�ʸ̮�Ǹ���������硢���Υ��С��������������
���ν��֤����ͤ��֤äƤ��ޤ���
�⤷ @code{ENUM} �˿��ͤ��������褦�Ȥ�����硢���ο��ͤΰ��֤ˤ���
���С�����������ޤ���
(������������� @code{LOAD DATA} �Ǥ�Ư���ޤ��󡣤���Ϥ��٤Ƥ����Ϥ�ʸ��
��Ȥ��ư����ޤ���)

@code{ENUM} �ͤ������Ф��ե�����ɻ���˥ꥹ�Ȥ��줿��˽��äƥ����Ȥ�
��ޤ���
(�Ĥޤꡢ@code{ENUM} �ͤϥ���ǥå����ͤ˽��äƥ����Ȥ���ޤ���)
�㤨�С�@code{ENUM("a", "b")} �ʤ�� @code{"a"} �� @code{"b"} �����˥����Ȥ��졢
@code{ENUM("b", "a")} �ʤ�� @code{"b"} �� @code{"a"} �����˥����Ȥ���ޤ���
��ʸ����϶��ǤϤʤ�ʸ�������˥����Ȥ��졢
@code{NULL} ��¾�����������¤Ӥޤ���

@code{ENUM} �ե�����ɤǻ����ǽ���ͤΥꥹ�Ȥ����Ƽ�ꤿ���ʤ�С�
���Τ褦�ˤ��ޤ���
@code{SHOW COLUMNS FROM table_name LIKE enum_column_name}
�����������ܤΥե�����ɤ� @code{ENUM} �����ʬ�Ϥ��ޤ���

@tindex SET
@node SET,  , ENUM, String types
@subsubsection @code{SET} ��

@code{SET} ��ʸ�������֥������Ȥǥ���������ʾ���ͻ����ޤ���
�ơ��֥�������ˤϡ����줾����ͤϥꥹ�Ȥ������Ф��٤��Ǥ���
@code{SET} ���Υե�����ɤ��ͤϡ������(@samp{,})
���ڤ���¤٤�줿ʣ���Υ��С��ǹ�������Ƥ��ޤ��� 
����ϡ� @code{SET} ���С�������˥���ޤ�ޤळ�Ȥ�����ʤ���
�Ȥ������ȤǤ���

�㤨�С�
@code{SET("one", "two") NOT NULL} �Ȼ��ꤵ�줿�ե�����ɤϰʲ����ͤ�Ȥ�ޤ���

@example
""
"one"
"two"
"one,two"
@end example

@code{SET} �Ϻ��� 64 �Ĥΰۤʤä����С�����Ƥޤ���

@strong{MySQL} �� @code{SET} ���ͤ���ͤȤ����������ޤ����������줿
�ͤκDz��̤ΥӥåȤ��ǽ�Υ��С����б����ޤ����⤷ @code{SET} �ͤ�
���ͤ�ʸ̮�Ǹ���������硢����������ͤϥե�����ɤ��ͤ��б����ޤ���
�⤷���С��� @code{SET} �ե�����ɤ��������줿��硢
��ʿ���ɽ�������ͤ������С��ο��ͤȤ��Ʒ��ꤵ��ޤ���
@code{SET("a","b","c","d")} �ȥե�����ɤ�������줿�Ȥ��ޤ���
���С��ϰʲ��Σ��ʿ����ͤ�����ޤ���

@multitable @columnfractions .2 .2 .6
@item @code{SET} @strong{member} @tab @strong{10�ʿ�} @tab @strong{���ʿ���}
@item @code{a} @tab @code{1} @tab @code{0001}
@item @code{b} @tab @code{2} @tab @code{0010}
@item @code{c} @tab @code{4} @tab @code{0100}
@item @code{d} @tab @code{8} @tab @code{1000}
@end multitable

�⤷���Υե�����ɤ� @code{9} ��Ϳ������硢����ϣ��ʿ��� @code{1001} �Ǥ����顢
1 ���ܤ� 4 ���ܤ� @code{SET} ���С��Ǥ��� @code{"a"} �� @code{"d"} ��
���򤵤졢��̡� @code{"a,d"} �Ȥʤ�ޤ���

1�İʾ�� @code{SET} ���Ǥ�ޤ��ͤˤ����Ƥ�,���ʤ����ͤ���������Ȥ�,���Ǥ��ɤ��
����ǵ��ܤ���Ƥ���Τ��Ͻ��פǤϤ���ޤ���. �ޤ�,�������Ǥ�Ϳ����줿�Τ���
���פǤϤ���ޤ���. ����ͤ����������Ȥ�, �ͤ���Τ��줾������Ǥ�
����������ɽ��ޤ������ΤȤ����ơ��֥��������Ϳ����줿������Ǥ��¤Ӥޤ���
�㤨�С��ե�����ɤ� @code{SET("a","b","c","d")} �����ꤵ��Ƥ����ʤ顢
@code{"a,d"}, @code{"d,a"}, @code{"d,a,a,d,d"} �ϸ��������� @code{"a,d"} ��
�ʤ�ޤ���

@code{SET} �ͤϿ��ͤȤ�����������ޤ���
@code{NULL} �ͤ��� @code{NULL} @code{SET} �ͤ����˥����Ȥ���ޤ���

�̾@code{LIKE} �� @code{FIND_IN_SET()} ����Ѥ��� @code{SET} �ե������
�� @code{SELECT} ��Ԥ��ޤ���

@example
mysql> SELECT * FROM tbl_name WHERE set_col LIKE '%value%';
mysql> SELECT * FROM tbl_name WHERE FIND_IN_SET('value',set_col)>0;
@end example

���������ʲ���ư��ޤ���

@example
mysql> SELECT * FROM tbl_name WHERE set_col = 'val1,val2';
mysql> SELECT * FROM tbl_name WHERE set_col & 1;
@end example

�ǽ��ʸ�ϴ������פ����Τ�õ���ޤ���
����ܤ�������ܤΥ��С���ޤ��ͤ�õ���ޤ���

�⤷ @code{SET} �ե�����ɤ������ǽ�ʤ��٤ƤΥ��С����Τꤿ����硧
 @code{SHOW COLUMNS FROM table_name LIKE set_column_name} �Ȥ���
�����ܤˤ���蘆��� @code{SET} �����ʬ�Ϥ��ޤ���

@cindex Types, choosing
@cindex Choosing types
@node Choosing types, Indexes, String types, Column types
@subsection �������ե�����ɷ�������

��äȤ��Ψ�褯��Ǽ����ˤϡ����Ƥˤ����ư������Τʷ�����Ѥ��뤳�ȤǤ���
�㤨�С�@code{1}-@code{99999} ������
�ˤϡ�@code{MEDIUMINT UNSIGNED} �����ɤη��Ǥ���

�ɤ���������ϡ���ʾ���ͤ����Τ�ɽ���Ǥ���@strong{MySQL} �Ǥ� 
@code{DECIMAL} ������Ѥ��٤��Ǥ��������ʸ����Ȥ��Ƴ�Ǽ�������Τ��Υ�
����ȯ�����ޤ������Τ������פǤʤ����� @code{DOUBLE} ���Ǥ⽽ʬ�ɤ�
�Ǥ���

�����٤Τ��ᡢ��� @code{BITINT} �˳�Ǽ�������꾮���������Ѵ��Ǥ��ޤ���
����ϡ����Ƥη׻��������ǹԤʤ��褦�ˤ�����̤�������ư���������Ѵ�����
�ᤷ�ޤ���

@cindex Indexes
@cindex Keys
@node Indexes, Multiple-column indexes, Choosing types, Column types
@subsection �ե�����ɥ���ǥå���

@strong{MySQL} �����ƤΥե�����ɤϥ���ǥå�������Ĥ��Ȥ��Ǥ��ޤ���
Ŭ�ڤʥե�����ɤǤΥ���ǥå����λ��Ѥϡ�@code{SELECT} ��
��ǽ����夹����ɤ���ˡ�Ǥ���

��ĤΥơ��֥�ˤϺ���16�ĤΥ���ǥå�����������ޤ���
����ǥå����κ���Ĺ��256�Х��Ȥǡ�
����� @strong{MySQL} ����ѥ�������ѹ��Ǥ��ޤ���

@code{CHAR} �� @code{VARCHAR} �ե�����ɤˤ���Ƭ���˥���ǥå�������Ĥ��Ȥ��Ǥ��ޤ���
�ե���������Τ򥤥�ǥå����������ꡢ
����ϤϤ뤫���᤯�����ʤ��ǥ��������̤ǤǤ��ޤ���

@code{CREATE TABLE} ��ʸ�ǥե�����ɤ˥���ǥå�������ˤϡ�
�ʲ��Τ褦�ˤ��ޤ���

@example
KEY index_name (col_name(length))
@end example

�ʲ������ @code{name} �ե�����ɤκǽ��10ʸ���˥���ǥå������Ϥ�Ф��ޤ�:

@example
mysql> CREATE TABLE test (
          name CHAR(200) NOT NULL,
          KEY index_name (name(10)));
@end example

 @code{BLOB} �� @code{TEXT} �ե�����ɤǤϡ����Υե�����ɤ�Ƭ����ʬ��
����ǥå�����ĥ��ʤ��ƤϤʤ�ޤ��� �ե�����ɤ����Τ˥���ǥå�����ĥ��ޤ���


@node Multiple-column indexes, Other-vendor column types, Indexes, Column types
@subsection ʣ���ե�����ɥ���ǥå���

@strong{MySQL} �ϰۤʤ�ե�����ɤΥ��åȤ˰�ĤΥ���ǥå�������Ĥ��Ȥ��Ǥ��ޤ���
����ǥå����Ϻ���15�ĤΥ����ޤǵ�����ޤ���
(@code{CHAR} �� @code{VARCHAR} �ե�����ɤ���Ƭ���򥤥�ǥå����Ȥ��ƻ��ѤǤ��ޤ�)

ʣ���ե�����ɥ���ǥå����ϡ�
�����Ȥ��줿����(����ǥå��������줿�ե�����ɤ��ͤ���礵��Ƥ�������)
���򰷤����Ȥ��Ǥ��ޤ���

����ǥå��������줿�������Ф��ơ����Τ��ͤ� @code{WHERE} ��ǻ��ꤷ������
���Ȥ�¾�Υե�����ɤ��ͤ���ꤷ�ʤ��Ȥ⡢
@strong{MySQL} ��ʣ���ե�����ɥ���ǥå�������Ѥ��ޤ���

�ʲ��Υơ��֥뤬����Ȳ��ꤷ�Ƥ���������

@example
mysql> CREATE TABLE test (
           id INT NOT NULL,
           last_name CHAR(30) NOT NULL,
           first_name CHAR(30) NOT NULL,
           PRIMARY KEY (id),
           INDEX name (last_name,first_name));
@end example

@code{name} ����ǥå����ϡ�@code{last_name} �� @code{first_name} �ˤޤ����륤��ǥå����Ǥ���
���Υ���ǥå����ϡ�@code{last_name} ���Ф��륯����䡢
@code{name} ����ǥå����ϰʲ��Υ�����ǻȤ��ޤ���

@example
mysql> SELECT * FROM test WHERE last_name="Widenius";

mysql> SELECT * FROM test WHERE last_name="Widenius"
                          AND first_name="Michael";

mysql> SELECT * FROM test WHERE last_name="Widenius"
                          AND (first_name="Michael" OR first_name="Monty");

mysql> SELECT * FROM test WHERE last_name="Widenius"
                          AND first_name >="M" AND first_name < "N";
@end example

������ @code{name} ����ǥå����ϰʲ��Υ�����Ǥϻ��Ѥ���ޤ���:

@example
mysql> SELECT * FROM test WHERE first_name="Michael";

mysql> SELECT * FROM test WHERE last_name="Widenius"
������������������������OR first_name="Michael";
@end example

@strong{MySQL} �����������ǽ��夲�뤿��ˤɤ�����ǥå�������Ѥ��Ƥ��뤫��
���ܤ�������Ϥ����顧 @ref{MySQL indexes, , @strong{MySQL} indexes}.


@cindex Type portability
@node Other-vendor column types,  , Multiple-column indexes, Column types
@subsection ¾�Υǡ����١������󥸥�Υե�����ɷ��λ���

�ۤ��Υ٥��������SQL���ñ�˽񤱤��褦�ˡ� @strong{MySQL} �ϰʲ���ɽ��
���᤹�ե�����ɷ��򥵥ݡ��Ȥ��ޤ��������ϡ��ơ��֥�������
¾�Υǡ����١������󥸥󤫤� @strong{MySQL} �˴�ñ�˰ܹԤ����Ƥ���ޤ���

@multitable @columnfractions .4 .6
@item @strong{Other vendor type}        @tab @strong{MySQL type}
@item @code{BINARY(NUM)}		@tab @code{CHAR(NUM) BINARY}
@item @code{CHAR VARYING(NUM)}		@tab @code{VARCHAR(NUM)}
@item @code{FLOAT4}			@tab @code{FLOAT}
@item @code{FLOAT8}			@tab @code{DOUBLE}
@item @code{INT1}			@tab @code{TINYINT}
@item @code{INT2}			@tab @code{SMALLINT}
@item @code{INT3}			@tab @code{MEDIUMINT}
@item @code{INT4}			@tab @code{INT}
@item @code{INT8}			@tab @code{BIGINT}
@item @code{LONG VARBINARY}		@tab @code{MEDIUMBLOB}
@item @code{LONG VARCHAR}		@tab @code{MEDIUMTEXT}
@item @code{MIDDLEINT}			@tab @code{MEDIUMINT}
@item @code{VARBINARY(NUM)}		@tab @code{VARCHAR(NUM) BINARY}
@end multitable

�⤷¾�Υ٥�����η�����Ѥ��ƥơ��֥�������Ȥ���ȡ�
�ơ��֥�������Υե�����ɤη��Υޥåԥ󥰤�ȯ������
@code{DESCRIBE tbl_name} ��ʸ��ȯ�Ԥ��ޤ���
������ @strong{MySQL} �ϡ����Ѥ��줿���������� @strong{MySQL} �η����Ѥ���
�ơ��֥�����������Ȥ�𤲤ޤ���

@cindex Functions for @code{SELECT} and @code{WHERE} clauses
@node Functions, CREATE DATABASE, Column types, Reference
@section @code{SELECT} �� @code{WHERE} ��ǻ��Ѥ���ؿ�

SQL ���ơ��ȥ������ @code{select_expression} �ޤ��� 
@code{where_definition} �ϸ�Ҥδؿ�����Ѥ���Ǥ�դμ�����ʤ�ޤ���

�黻�ȴؿ��򼰤���ǸƤֻ����ܥɥ�����Ȥ˼����Ƥ����ΰʳ��Ρ�
@code{NULL} ��ޤ༰�Ͼ�� @code{NULL} �ͤ��������ޤ�

@strong{����:} �ؿ�̾�Ȥ����³�����δ֤ˤϡ�����Ϥ���ޤ���
����ϴؿ��θƤӽФ��ȡ��ؿ���Ʊ̾�Υơ��֥�(���ե������)�λ��Ȥ�
 @strong{MySQL} �ѡ��������̤���Τ�����ޤ���

@need 2000
������Ǥϡ�@code{mysql} �ץ������ν��Ϥ�û���ʤäƤ��ޤ����Ĥޤ�:

@example
mysql> select MOD(29,9);
1 rows in set (0.00 sec)

+-----------+
| mod(29,9) |
+-----------+
|         2 |
+-----------+
@end example

����ϼ����Ѵ�����Ƥ��ޤ�:

@example
mysql> select MOD(29,9);
        -> 2
@end example

@menu
* Grouping functions::          Grouping functions
* Arithmetic functions::        Normal arithmetic operations
* Bit functions::               Bit functions
* Logical functions::           Logical operations
* Comparison functions::        Comparison operators
* String comparison functions::  String comparison functions
* Control flow functions::      Control flow functions
* Casts::                       Cast operators
* Mathematical functions::      Mathematical functions
* String functions::            String functions
* Date and time functions::     Date and time functions
* Miscellaneous functions::     Miscellaneous functions
* Group by functions::          Functions for @code{GROUP BY} clause
@end menu

@node Grouping functions, Arithmetic functions, Functions, Functions
@subsection ���롼�ײ��ؿ�
@cindex Grouping of expressions
@table @code

@findex () (parentheses)
@findex parentheses ( and )
@item ( ... )
�ݤ��ä��� ����ɾ����ͥ���٤������뤿��˻��Ѥ��ޤ���
@example
mysql> select 1+2*3;
        -> 7
mysql> select (1+2)*3;
        -> 9
@end example
@end table

@node Arithmetic functions, Bit functions, Grouping functions, Functions
@subsection �̾�λ��ѱ黻

���̤λ��ѱ黻��ͭ���Ǥ���
@code{-}, @code{+}, @code{*} �ϡ���Ĥΰ����������ʤ��
 @code{BIGINT} (64bit����) �Ƿ׻�����뤳�Ȥ����դ��Ƥ���������

@cindex Arithmetic expressions
@table @code
@findex + (addition)
@findex addition (+)
@item +
­����
@example
mysql> select 3+5;
        -> 8
@end example

@findex - (subtraction)
@findex subtraction (-)
@item -
������
@example
mysql> select 3-5;
        -> -2
@end example

@findex * (multiplication)
@findex multiplication (*)
@item *
�ݤ���
@example
mysql> select 3*5;
        -> 15
mysql> select 18014398509481984*18014398509481984.0;
        -> 324518553658426726783156020576256.0
mysql> select 18014398509481984*18014398509481984;
        -> 0
@end example

�Ǹ�μ��η�̤������Ǥ����ʤ��ʤ��̤� 64 �ӥåȤ�Ķ��������������Ǥ���

@findex / (division)
@findex division (/)
@item /
��껻��
@example
mysql> select 3/5;
        -> 0.60
@end example

0 �dz�ä���硢@code{NULL} �ˤʤ�ޤ���

@example
mysql> select 102/(1-1);
        -> NULL
@end example

�黻��̤������ˤʤ���ˤ����� @code{BIGINT} ���Ѥ��Ƴ�껻�Ϸ׻�����ޤ���
@end table

@findex Arithmetic functions
@findex Bit functions
@findex Functions, arithmetic
@findex Functions, bit
@node Bit functions, Logical functions, Arithmetic functions, Functions
@subsection �ӥåȴؿ�

�����Ϻ��� 64 �ӥåȤ��ϰϤ�����ޤ���@strong{MySQL} �� @code{BIGINT} (64-bit) �黻����Ѥ��뤿��Ǥ���

@table @code
@findex | (bitwise OR)
@findex OR, bitwise
@item |
�ӥåȱ黻 OR
@example
mysql> select 29 | 15;
        -> 31
@end example

@findex & (bitwise AND)
@findex AND, bitwise
@item &
�ӥåȱ黻 AND
@example
mysql> select 29 & 15;
        -> 13
@end example

@findex << (left shift)
@item <<
���� longlong (@code{BIGINT}) number ʬ���ӥåȤ򥷥եȤ��ޤ�
@example
mysql> select 1 << 2
        -> 4
@end example

@findex >> (right shift)
@item >>
���� longlong (@code{BIGINT}) number ʬ���ӥåȤ򥷥եȤ��ޤ�
@example
mysql> select 4 >> 2
        -> 1
@end example

@findex ~
@item ~
Invert all bits.
@example
mysql> select 5 & ~1
        -> 4
@end example

@findex BIT_COUNT()
@item BIT_COUNT(N)
���� @code{N} �������ĥӥåȤ���äƤ��뤫(���ʿ�ɽ�������Ȥ��Σ��ο�)
@example
mysql> select BIT_COUNT(29);
        -> 4
@end example
@end table

@findex Logical functions
@node Logical functions, Comparison functions, Bit functions, Functions
@subsection �����黻

���Ƥ������ؿ��� @code{1} (TRUE) or @code{0} (FALSE) ���֤��ޤ���

@table @code
@findex NOT, logical
@findex ! (logical NOT)
@item NOT
@itemx !
�������ꡣ������ @code{0} �ʤ� @code{1} ���֤��������Ǥʤ���� @code{0} ���֤��ޤ���
�㳰: @code{NOT NULL} �� @code{NULL} ���֤��ޤ�.
@example
mysql> select NOT 1;
        -> 0
mysql> select NOT NULL;
        -> NULL
mysql> select ! (1+1);
        -> 0
mysql> select ! 1+1;
        -> 1
@end example
�Ǹ����� @code{1} ���֤��ޤ����ʤ��ʤ顢����ɾ����
 @code{(!1)+1} ��Ʊ��������Ǥ���

@findex OR, logical
@findex || (logical OR)
@item OR
@itemx ||
�����¡������Τɤ줫�� @code{0} �ޤ��� @code{NULL} �Ǥʤ���� @code{1} ���֤��ޤ���
@example
mysql> select 1 || 0;
        -> 1
mysql> select 0 || 0;
        -> 0
mysql> select 1 || NULL;
        -> 1

@end example

@findex AND, logical
@findex && (logical AND)
@item AND
@itemx &&
�����ѡ����Ƥΰ����� @code{0} �ޤ��� @code{NULL} �Ǥʤ���� @code{1} ���֤��ޤ���
@example
mysql> select 1 && NULL;
        -> 0
mysql> select 1 && 0;
        -> 0
@end example
@end table

@cindex Casts
@cindex Type conversions
@findex Comparison operators
@node Comparison functions, String comparison functions, Logical functions, Functions
@subsection ��ӱ黻��

@code{1} (TRUE), @code{0} (FALSE) �ޤ��� @code{NULL} ���֤��ޤ���
�����δؿ��Ͽ��ͤ�ʸ�����ξ����Ư���ޤ���
ɬ�פʤ�С�ʸ���ϼ�ưŪ�˿������Ѵ����졢������ʸ�����Ѵ�����ޤ���
(Perl�������ʤäƤ���ߤ�����)

@strong{MySQL} �ϰʲ��ε�§����Ӥ�Ԥ��ޤ���

@itemize @bullet
@item
�ɤ��餫�ޤ���ξ���ΰ����� @code{NULL} �ξ��ϡ���ӷ�̤� @code{NULL} 
�Ǥ���@code{<=>} �黻�Ҥ�����ޤ���

@item
�������ξ���ΰ�����ʸ����ξ�硢ʸ����Ȥ�����Ӥ���ޤ���

@item
ξ���ΰ����������ξ�硢�����Ȥ�����Ӥ���ޤ���

@item
16�ʿ����ͤϡ��⤷���ͤ���Ӥ���ʤ��ΤǤ���С�ʸ����Ȥ��ư����ޤ���

@item
@cindex ODBC compatibility
@cindex Compatibility, with ODBC
�����ΰ����� @code{TIMESTAMP} �ޤ��� @code{DATETIME} �ե�����ɤǡ�¾�ΰ�����
����ξ��ϡ������������� timestamp ���Ѵ�����ޤ�������Ϥ�� ODBC 
�ե��ɥ�ˤ��뤿��Ǥ���

@item
¾�ξ���������ư������(real)�Ȥ�����Ӥ���ޤ���
@end itemize

ʸ�������Ӥϡ��������˰�¸������ɸ��Υ���饯�������åȤ˽��ä�
�Ԥ��ޤ���(ISO-8859-1 Latin1 ���ǥե���ȤǤ�������� English �Ǥ�)

�ʲ��ϡ���ӤΤ����ʸ�������ͤ��Ѵ�����Ƥ�����Ǥ���

@example
mysql> SELECT 1 > '6x';
         -> 0
mysql> SELECT 7 > '6x';
         -> 1
mysql> SELECT 0 > 'x6';
         -> 0
mysql> SELECT 0 = 'x6';
         -> 1
@end example

@table @code
@findex = (equal)
@findex equal (=)
@item =
������
@example
mysql> select 1 = 0;
        -> 0
mysql> select '0' = 0;
        -> 1
mysql> select '0.0' = 0;
        -> 1
mysql> select '0.01' = 0;
        -> 0
mysql> select '.01' = 0.01;
        -> 1
@end example

@findex <> (not equal)
@findex not equal (<>)
@findex != (not equal)
@findex not equal (!=)
@item <>
@itemx !=
�������ʤ�
@example
mysql> select '.01' <> '0.01';
        -> 1
mysql> select .01 <> '0.01';
        -> 0
mysql> select 'zapp' <> 'zappp';
        -> 1
@end example

@findex <= (less than or equal)
@findex less than or equal (<=)
@item <=
��꾮������������
@example
mysql> select 0.1 <= 2;
        -> 1
@end example

@findex < (less than)
@findex less than (<)
@item <
��꾮����
@example
mysql> select 2 <= 2;
        -> 1
@end example

@findex >= (greater than or equal)
@findex greater than or equal (>=)
@item >=
����礭����������
@example
mysql> select 2 >= 2;
        -> 1
@end example

@findex > (greater than)
@findex greater than (>)
@item >
����礭��
@example
mysql> select 2 > 2;
        -> 0
@end example

@findex <=> (Equal to)
@item <=>
������(NULL ����)
@example
mysql> select 1 <=> 1, NULL <=> NULL, 1 <=> NULL;
        -> 1 1 0
@end example

@findex IS NULL
@findex IS NOT NULL
@item IS NULL
@itemx IS NOT NULL
�ͤ� @code{NULL} �ȤǤ��뤫�ɤ����Υƥ���
@example
mysql> select 1 IS NULL, 0 IS NULL, NULL IS NULL:
        -> 0 0 1
mysql> select 1 IS NOT NULL, 0 IS NOT NULL, NULL IS NOT NULL;
        -> 1 1 0
@end example

@findex BETWEEN ... AND
@item expr BETWEEN min AND max
�⤷ @code{expr} �� @code{min} �ʾ塢 @code{max} �ʲ��ʤ� @code{1}���֤��ޤ���
�����Ǥʤ��ʤ� @code{0} ���֤��ޤ���
����� ���Ƥΰ�����Ʊ�����ʤ�С�@code{(min <= expr AND expr <= max)} ��Ʊ���Ǥ���
 �ǽ�ΰ��� (@code{expr}) �Ϥ����Τ褦�������ˡ����ꤷ�ޤ���

@itemize @bullet
@item
�⤷ @code{exor} �� @code{TIMESTAMP}, @code{DATE}, @code{DATETIME} �ե���
��ɤʤ顢�Ǿ��Ⱥ���Ϥ���餬����ξ���Ʊ���ե����ޥåȤˤʤ�ޤ���
@item
�⤷ @code{expr} ��ʸ�����ʤ顢���������¸����Ӥ��Ԥ��ޤ���
@item
�⤷ @code{expr} ���Х��ʥ�ʸ���ʤ顢��������¸����Ӥ��Ԥ��ޤ���
@item
�⤷ @code{expr} �������ʤ顢��������Ӥ��Ԥ��ޤ���
@item
����¾����ư������(�¿�)����Ӥ���ޤ���
@end itemize

@example
mysql> select 1 BETWEEN 2 AND 3;
        -> 0
mysql> select 'b' BETWEEN 'a' AND 'c';
        -> 1
mysql> select 2 BETWEEN 2 AND '3';
        -> 1
mysql> select 2 BETWEEN 2 AND 'x-3';
        -> 0
@end example

@findex IN
@item expr IN (value,...)
�⤷ @code{expr} �� @code{IN} �ꥹ�Ȥˤ����ͤΤɤ줫�ʤ�С�@code{1} ���֤��ޤ���
�����Ǥʤ���� @code{0} ���֤��ޤ���
�⤷���Ƥ��ͤ�����ʤ顢���٤Ƥ��ͤ� @code{expr} �η��˽��ä�ɾ�����졢
�����Ȥ���ޤ������θ����ˤϥХ��ʥꥵ���������Ѥ���ޤ���
����� @code{IN} �ꥹ�Ȥ������Ϳ������硢@code{IN} ��®���ʤ뤳�Ȥ��̣���ޤ���
�⤷ @code{expr} ����������¸��ʸ�����ʤ顢��������¸�Τ��������Ӥ���ޤ���
@example
mysql> select 2 IN (0,3,5,'wefwf');
        -> 0
mysql> select 'wefwf' IN (0,3,5,'wefwf');
        -> 1
@end example

@findex NOT IN
@item expr NOT IN (value,...)
@code{NOT (expr IN (value,...))} ��Ʊ����

@findex ISNULL()
@item ISNULL(expr)
@code{expr} �� @code{NULL} �ʤ� @code{1} �򡢤����Ǥʤ���� @code{0} ���֤��ޤ���
@example
mysql> select ISNULL(1+1);
        -> 0
mysql> select ISNULL(1/0);
        -> 1
@end example

@code{NULL} ���ͤ� @code{=} ����Ѥ�����Ӥ������Ͼ�˵�(false) �Ȥʤ뤳�Ȥ�
���դ��Ƥ���������

@findex COALESCE()
@item COALESCE(list)
list ��Ρ��ǽ�˸��줿 ��-@code{NULL} ���Ǥ��֤��ޤ���

@example
mysql> select COALESCE(NULL,1);
        -> 1
mysql> select COALESCE(NULL,NULL,NULL);
        -> NULL
@end example

@findex INTERVAL()
@item INTERVAL(N,N1,N2,N3,...)
�⤷ @code{N} < @code{N1} �ʤ� @code{0} ���֤��ޤ���
�⤷ @code{N} < @code{N2} �ʤ� @code{1} ���֤��ޤ���
���Ƥΰ����������Ȥ��ư����ޤ���
����� @code{N1} < @code{N2} < @code{N3} < @code{...} < @code{Nn}��������ư����뤿���
ɬ�פʤ��ȤǤ�������ϥХ��ʥ긡�������Ѥ���ޤ�(®���Ǥ�)

@example
mysql> select INTERVAL(23, 1, 15, 17, 30, 44, 200);
        -> 3
mysql> select INTERVAL(10, 1, 10, 100, 1000);
        -> 2
mysql> select INTERVAL(22, 23, 30, 44, 200);
        -> 0
@end example
@end table

@findex String comparison functions
@findex Functions, string comparison
@node String comparison functions, Casts, Comparison functions, Functions
@subsection ʸ������Ӵؿ�

@cindex Case sensitivity, in string comparisons
@cindex String comparisons, case sensitivity
�̾��Ӥ����ɽ������������¸�Ǥʤ���硢��Ӥϥ��������¸�ǹԤ��ޤ���

@table @code
@findex LIKE
@item expr LIKE pat [ESCAPE 'escape-char']
SQL �δ�ñ������ɽ����ӤǤ���@code{1} (TRUE) �ޤ��� @code{0} (FALSE) ���֤��ޤ���
@code{LIKE} �ˤ�2�ĤΥ磻��ɥ����ɤ�����ޤ�:

@multitable @columnfractions .1 .9
@item @code{%} @tab Ǥ�դο���ʸ��(0ʸ����ޤ�)��Ŭ�礷�ޤ���
@item @code{_} @tab ��̩��1�Ĥ�ʸ����Ŭ�礷�ޤ���
@end multitable

@example
mysql> select 'David!' LIKE 'David_';
        -> 1
mysql> select 'David!' LIKE '%D%v%';
        -> 1
@end example

�磻��ɥ�����ʸ���Υƥ��Ȥ򤹤뤿��ˤϡ�����������ʸ�������Ԥ��Ƥ����ʤä�
����������
@code{ESCAPE} ����ꤷ�ʤ����ϡ�ʸ�� @code{'\'} ���Ȥ��ޤ�:

@multitable @columnfractions .1 .9
@item @code{\%} @tab 1�Ĥ� @code{%} ��Ŭ�礷�ޤ���
@item @code{\_} @tab 1�Ĥ� @code{_} ��Ŭ�礷�ޤ���
@end multitable

@example
mysql> select 'David!' LIKE 'David\_';
        -> 0
mysql> select 'David_' LIKE 'David\_';
        -> 1
@end example

�㤦����������ʸ������ꤹ��ˤϡ� @code{ESCAPE} �����Ѥ��ޤ�:

@example
mysql> select 'David_' LIKE 'David|_' ESCAPE '|';
        -> 1
@end example

@code{LIKE} �Ͽ���ɽ���Ǥ������ޤ���
(����� @strong{MySQL} �Ρ�ANSI SQL @code{LIKE} ���Ф����ĥ�Ǥ�)

���ա� @strong{MySQL} ��ʸ������� C �Υ���������ʸ������Ѥ��Ƥ���Τ�(e.g.,
@samp{\n}),  @code{LIKE} �λ���ʸ����Ȥ��ƻ��Ѥ���ˤ� @samp{\} ��
���ܤ��ʤ��ƤϤʤ�ޤ��� �㤨�С� @samp{\n} ��õ���ˤϡ�@samp{\\n} ��
���Ҥ��ޤ��� @samp{\} ��õ���ˤϡ�  @samp{\\\\} (�Хå�����å���ϡ�
��Ĥϥѡ������˼������졢�ѥ�����ޥå����Ԥ���ݤˤ⤦�ҤȤ�
�������졢���פ�õ������˻Ĥä���ĤΥХå�����å��夬���Ѥ���ޤ�)

@findex NOT LIKE
@item expr NOT LIKE pat [ESCAPE 'escape-char']
@code{NOT (expr LIKE pat [ESCAPE 'escape-char'])} ��Ʊ��

@example
mysql> select 10 LIKE '1%';
        -> 1
@end example

@cindex mSQL compatibility
@cindex Compatibility, with mSQL
@findex REGEXP
@findex RLIKE
@item expr REGEXP pat
@itemx expr RLIKE pat
�ѥ����� @code{pat} ���Ф���ʸ���� @code{expr} �Υѥ�����ޥå���Ԥ��ޤ���
�ѥ����� @code{pat} ������ɽ���γ�ĥ�����ѤǤ��ޤ���@xref{Regexp}.
�⤷ @code{expr} �� @code{pat} �˥ޥå�����ʤ� @code{1} ���֤���
�Ǥʤ���� @code{0} ���֤��ޤ���
@code{RLIKE} �� @code{REGEXP} ��Ʊ���ǡ�@code{mSQL} �ߴ����󶡤��ޤ���
����: @strong{MySQL} �� C ���������׹�ʸ��ʸ����˻��Ѥ��Ƥ���(@code{\n})��
 @code{REGEXP} ��ǻ��Ѥ���� @code{'\'} ʸ���Ϥ��٤ơ���Ť˽񤫤ʤ����
�ʤ�ޤ���
@code{MySQL} 3.23.4 @code{REGEXP} �ϡ����̤�ʸ�� (not binary) �ϥ��������¸�Ǥ���

@example
mysql> select 'Monty!' REGEXP 'm%y%%';
        -> 0
mysql> select 'Monty!' REGEXP '.*';
        -> 1
mysql> select 'new*\n*line' REGEXP 'new\\*.\\*line';
        -> 1
mysql> select "a" REGEXP "A", "a" REGEXP BINARY "A";
        -> 1  0
@end example

@item
@code{REGEXP} and @code{RLIKE} �ϡ�ʸ���η�����ꤹ���硢
�����ȤΥ���饯�������åȤ���Ѥ��ޤ���
(ISO-8859-1 Latin1 ���ǥե����)

@findex NOT REGEXP
@item expr NOT REGEXP pat
@itemx expr NOT RLIKE pat
@code{NOT (expr REGEXP pat)} ��Ʊ��.

@findex STRCMP()
@item STRCMP(expr1,expr2)
ʸ����Ʊ���ʤ� @code{0} ���֤��ޤ��������Ǥʤ���С��ǽ�ΰ����������Ƚ�Ǿ�
������� @code{-1} ���֤��ޤ��������Ǥʤ���� @code{1} ���֤��ޤ���

@example
mysql> select STRCMP('text', 'text2');
        -> -1
mysql> select STRCMP('text2', 'text');
        -> 1
mysql> select STRCMP('text', 'text');
        -> 0
@end example
@end table

@findex Casts
@node Casts, Control flow functions, String comparison functions, Functions
@subsection Cast operators

@table @code
@findex BINARY
@item @code{BINARY}
@code{BINARY} �黻�Ҥϡ�����ʹߤ�³��ʸ����Х��ʥ�˥��㥹�Ȥ��ޤ���
����Ϥ��Ȥ��ե�����ɤ� @code{BINARY} �� @code{BLOB} ����Ǥʤ��Ƥ⡢
��������¸�ǥե�����ɤ���Ӥ��뤳�Ȥ�������ñ����ˡ�Ǥ���
@example
mysql> select "a" = "A";
        -> 1
mysql> select BINARY "a" = "A";
        -> 0
@end example

@code{BINARY} �� @strong{MySQL} 3.23.0 ���о줷�ޤ�����
@end table

@findex Control flow functions
@findex Functions, control flow
@node Control flow functions, Mathematical functions, Casts, Functions
@subsection �ե�������ؿ�

@table @code
@findex IFNULL()
@item IFNULL(expr1,expr2)
@code{expr1} �� @code{NULL} �Ǥʤ����� @code{expr1} �򡢤����Ǥʤ���� 
@code{expr2} ���֤��ޤ���
@code{IFNULL()} �Ϥɤ�ʸ̮�ǻ��Ѥ��줿���ˤ����ͤ�ʸ�����֤��ޤ���
@example
mysql> select IFNULL(1,0);
        -> 1
mysql> select IFNULL(0,10);
        -> 0
mysql> select IFNULL(1/0,10);
        -> 10
mysql> select IFNULL(1/0,'yes');
        -> 'yes'
@end example

@findex NULLIF()
@item NULLIF(expr1,expr2)
@code{expr1 = expr2} �����ʤ顢@code{expr1} ���֤��������Ǥʤ���� 
@code{NULL} ���֤��ޤ���
@example
mysql> select NULLIF(1,1);
        -> 1
mysql> select NULLIF(1,2);
        -> NULL
@end example

����: ��������������硢@code{expr1} �� @strong{MySQL} �Ǥ�2��ɾ������ޤ���

@findex IF()
@item IF(expr1,expr2,expr3)
@code{expr1} ���� (@code{expr1 <> 0} and @code{expr1 <> NULL}) ��
 @code{expr2} ���֤��������Ǥʤ���� @code{expr3} ���֤��ޤ���
@code{IF()} �Ϥɤ�ʸ̮�ǻ��Ѥ��줿���ˤ����ͤ�ʸ�����֤��ޤ���

@example
mysql> select IF(1>2,2,3);
        -> 3
mysql> select IF(1<2,'yes','no');
        -> 'yes'
mysql> select IF(strcmp('test','test1'),'no','yes');
        -> 'no'
@end example

@code{expr1} �� @code{INTEGER} �Ȥ���ɾ������ޤ����������ư����������Ѥ����硢
��ӱ黻����Ѥ��٤��Ǥ��뤳�Ȥ��̣���ޤ���

@example
mysql> select IF(0.1,1,0);
        -> 0
mysql> select IF(0.1<>0,1,0);
        -> 1
@end example

��κǽ����Ǥϡ� @code{IF(0.1)} �� @code{0} ���֤��ޤ����ʤ��ʤ� @code{0.1} ��
�����ͤȤ����Ѵ����� @code{IF(0)} �ˤʤꡢ������Ȥˤ����ƥ��ȷ�̤�
�֤뤫��Ǥ��� ����Ϥ��ʤ��δ��Ԥ�ź��ʤ����⤷��ޤ���
 �����ܤξ�硢 ��Ӥϡ�������ư�������ͤ��󥼥����ɤ����ƥ��Ȥ��ޤ���
��ӷ�̤������Ȥ��ƻ��Ѥ���ޤ���

@code{IF()} �Υǥե���Ȥ�����ͷ�(����ơ��֥�˳�Ǽ������������Ȥʤ�
�ޤ�)�� @strong{MySQL} 3.23 �Ǥϼ��Τ褦�˷׻�����ޤ�:

@multitable @columnfractions .7 .3
@item expr2 �ޤ��� expr3 ��ʸ������֤� @tab ʸ����
@item expr2 �ޤ��� expr3 ����ư�������ͤ��֤� @tab ��ư������
@item expr2 �ޤ��� expr3 ���������֤� @tab ����
@end multitable

@findex CASE
@item CASE value WHEN [compare-value] THEN result [WHEN [compare-value] THEN result ...] [ELSE result] END
@item CASE WHEN [condition] THEN result [WHEN [condition] THEN result ...] [ELSE result] END

�ǽ�μ��� @code{value=compare-value} �ʤ�� @code{result} ���֤��ޤ���
����ܤμ��Ǥϡ��ǽ�ξ��[condition] �����ʤ�С� @code{result} ���֤��ޤ���
�⤷�ޥå����� result ���ͤ��ʤ���С� @code{ELSE} �ʲ��� result ���֤�ޤ���
�⤷ @code{ELSE} ��ʬ���ʤ���С� @code{NULL} ���֤�ޤ���

@example
mysql> SELECT CASE 1 WHEN 1 THEN "one" WHEN 2 THEN "two" ELSE "more" END;
       -> "one"
mysql> SELECT CASE WHEN 1>0 THEN "true" ELSE "false" END;
       -> "true"
mysql> SELECT CASE BINARY "B" when "a" then 1 when "b" then 2 END;
       -> NULL
@end example
@end table

@findex Mathematical functions
@findex Functions, mathematical
@node Mathematical functions, String functions, Control flow functions, Functions
@subsection ���شؿ�
���٤Ƥο��شؿ��ϥ��顼�ξ�� @code{NULL} ���֤��ޤ���

@table @code
@findex - (unary minus)
@findex minus, unary (-)
@findex unary minus (-)
@item -
��档�����������ѹ����ޤ���
@example
mysql> select - 2;
        -> -2
@end example

���Υ��ڥ졼������ @code{BIGINT} �ȤȤ�˻��Ѥ��줿��硢
�֤��ͤ� @code{BIGINT} �Ǥ��뤳�Ȥ����դ��Ƥ�������!  ����� @code{-2^63} ���ͤ�
���Ĥ��⤷��ʤ������� @code{-} �ǻ��Ѥ��ƤϤʤ�ʤ����Ȥ��̣���ޤ���

@findex ABS()
@item ABS(X)
Returns the absolute value of @code{X}.
@example
mysql> select ABS(2);
        -> 2
mysql> select ABS(-32);
        -> 32
@end example

���δؿ��� @code{BIGINT} �ͤȤȤ�˻��Ѥ����Ȱ����Ǥ���

@findex SIGN()
@item SIGN(X)
@code{X} ������������������ˤ�äơ� @code{-1}, @code{0} or @code{1} ��
�֤��ޤ���
@example
mysql> select SIGN(-32);
        -> -1
mysql> select SIGN(0);
        -> 0
mysql> select SIGN(234);
        -> 1
@end example

@findex MOD()
@findex % (modulo)
@findex modulo (%)
@item MOD(N,M)
@itemx %
��; ( C �� @code{%} �黻�ҤΤ褦�� ).
@code{N} �� @code{M} �dz�ä��Ȥ���;�꤬�֤�ޤ���
@example
mysql> select MOD(234, 10);
        -> 4
mysql> select 253 % 7;
        -> 1
mysql> select MOD(29,9);
        -> 2
@end example

���δؿ��� @code{BIGINT} �ͤǤ�����˻��ѤǤ��ޤ���

@findex FLOOR()
@item FLOOR(X)
@code{X} ����礭���ʤ�ʤ������Τ���������������ͤ��֤��ޤ�.
@example
mysql> select FLOOR(1.23);
        -> 1
mysql> select FLOOR(-1.23);
        -> -2
@end example

�֤��ͤ� @code{BIGINT} ���Ѵ�����Ƥ��뤳�Ȥ�����!

@findex CEILING()
@item CEILING(X)
@code{X} ��꾮�����ʤ�ʤ������Τ������Ǿ��������ͤ��֤��ޤ�.
@example
mysql> select CEILING(1.23);
        -> 2
mysql> select CEILING(-1.23);
        -> -1
@end example

�֤��ͤ� @code{BIGINT} ���Ѵ�����Ƥ��뤳�Ȥ�����!

@findex ROUND()
@item ROUND(X)
@code{X} �������˴ݤ᤿��(�ͼθ���)���֤��ޤ���
@example
mysql> select ROUND(-1.23);
        -> -1
mysql> select ROUND(-1.58);
        -> -2
mysql> select ROUND(1.58);
        -> 2
@end example

�֤��ͤ� @code{BIGINT} ���Ѵ�����Ƥ��뤳�Ȥ�����!

@findex ROUND()
@item ROUND(X,D)
@code{X} �� @code{D} �ǻ��ꤷ��������˴ݤ᤿��(�ͼθ���)���֤��ޤ���
�⤷ @code{D} �� @code{0} �ʤ�, ��̤Ͼ�����̵���ˤʤ뤫
������ʬ�ˤʤ�Ǥ��礦��
@example
mysql> select ROUND(1.298, 0);
        -> 1
@end example

@findex EXP()
@item EXP(X)
�ؿ��ؿ� : @code{e} (�����п�����) �� @code{X} �衣
@example
mysql> select EXP(2);
        -> 7.389056
mysql> select EXP(-2);
        -> 0.135335
@end example
@findex LOG()
@item LOG(X)
�����п� @code{X}
@example
mysql> select LOG(2);
        -> 0.693147
mysql> select LOG(-2);
        -> NULL
@end example
If you want the log of a number @code{X} to some arbitary base @code{B}, use
the formula @code{LOG(X)/LOG(B)}.

@findex LOG10()
@item LOG10(X)
�����п�(10����Ȥ����п�) @code{X}
@example
mysql> select LOG10(2);
        -> 0.301030
mysql> select LOG10(100);
        -> 2.000000
mysql> select LOG10(-100);
        -> NULL
@end example

@findex POW()
@findex POWER()
@item POW(X,Y)
@itemx POWER(X,Y)
@code{X} �� @code{Y} �衣
@example
mysql> select POW(2,2);
        -> 4.000000
mysql> select POW(2,-2);
        -> 0.250000
@end example

@findex SQRT()
@item SQRT(X)
@code{X} �������ʿ�������֤��ޤ���
@example
mysql> select SQRT(4);
        -> 2.000000
mysql> select SQRT(20);
        -> 4.472136
@end example

@findex PI()
@item PI()
��
@example
mysql> select PI();
        -> 3.141593
@end example

@findex COS()
@item COS(X)
�������� @code{X}��@code{X} �ϥ饸����
@example
mysql> select COS(PI());
        -> -1.000000
@end example

@findex SIN()
@item SIN(X)
������ @code{X}��@code{X} �ϥ饸����
@example
mysql> select SIN(PI());
        -> 0.000000
@end example

@findex TAN()
@item TAN(X)
���󥸥���� @code{X}��@code{X} �ϥ饸����
@example
mysql> select TAN(PI()+1);
        -> 1.557408
@end example

@findex ACOS()
@item ACOS(X)
@code{X} �Υ���������������֤��ޤ�������ϥ������� @code{X} �Ǥ����ͤ�
����@code{X} �� @code{-1} ���� @code{1} ���ϰϤˤʤ����� @code{NULL} ��
�֤��ޤ���
@example
mysql> select ACOS(1);
        -> 0.000000
mysql> select ACOS(1.0001);
        -> NULL
mysql> select ACOS(0);
        -> 1.570796
@end example

@findex ASIN()
@item ASIN(X)
@code{X} �Υ�������������֤��ޤ�������ϥ����� @code{X} �Ǥ����ͤǤ���
@code{X} �� @code{-1} ���� @code{1} ���ϰϤˤʤ����� @code{NULL} ���֤�
�ޤ���
@example
mysql> select ASIN(0.2);
        -> 0.201358
mysql> select ASIN('foo');
        -> 0.000000
@end example

@findex ATAN()
@item ATAN(X)
@code{X} �Υ��������󥸥���Ȥ��֤��ޤ�������ϥ��󥸥���Ȥ� @code{X} ��
�����ͤǤ���
@example
mysql> select ATAN(2);
        -> 1.107149
mysql> select ATAN(-2);
        -> -1.107149
@end example

@findex ATAN2()
@item ATAN2(X,Y)
���Ĥ��ѿ� @code{X} �� @code{Y} �Υ��������󥸥���Ȥ��֤��ޤ���ξ���ΰ���
����椬��̤ξݸ¤���ꤹ�뤿��˻��Ѥ���뤳�Ȥ�����ơ�@code{Y / X} ��
���������󥸥���Ȥη׻���Ʊ�ͤǤ���
@example
mysql> select ATAN(-2,2);
        -> -0.785398
mysql> select ATAN(PI(),0);
        -> 1.570796
@end example

@findex COT()
@item COT(X)
@code{X} �Υ����󥸥���Ȥ��֤��ޤ���
@example
mysql> select COT(12);
        -> -1.57267341
mysql> select COT(0);
        -> NULL
@end example

@findex RAND()
@item RAND()
@itemx RAND(N)
@code{0} ���� @code{1.0} �֤Υ��������ư���������ͤ��֤��ޤ���
�⤷ @code{N} ��������Ϳ������硢�����ɤȤ��Ƥ����ͤ����Ѥ���ޤ���
@example
mysql> select RAND();
        -> 0.5925
mysql> select RAND(20);
        -> 0.1811
mysql> select RAND(20);
        -> 0.1811
mysql> select RAND();
        -> 0.2079
mysql> select RAND();
        -> 0.7888
@end example
@code{RAND()} �ͤ���ĥե�����ɤ� @code{ORDER BY} ��ǻ��ѤǤ��ޤ���
@code{ORDER BY} �ϥե�����ɤ�ʣ����ɾ�����뤿��Ǥ���

������ @strong{MySQL} 3.23 �Ǥ�, ������ǽ�Ǥ�:
@code{SELECT * FROM table_name ORDER BY RAND()}

����� @code{SELECT * FROM table1,table2 WHERE a=b AND c<d ORDER BY
RAND() LIMIT 1000} �Υ��åȤ��������ʥ���ץ������Τ������Ǥ���

����: @code{WHERE} ��� @code{RAND()} �� @code{WHERE} ���¹Ԥ����٤˺�ɾ��
����ޤ���

@findex LEAST()
@item LEAST(X,Y,...)
��İʾ�ΰ������ꡢ�����桢�Ǿ����ͤ��֤��ޤ���
�����ϰʲ��ε�§�˽��ä���Ӥ���ޤ���

@itemize @bullet
@item
�ͤ� @code{INTEGER} ����Ѥ��Ƥ���ʤ顢���뤤�ϡ����Ƥΰ�����
�����ͤʤ�С������Ȥ�����Ӥ��ޤ���

@item
�ͤ� @code{REAL} �Ȥ��ƻ��Ѥ���Ƥ��뤫�����Ƥΰ������¿��ʤ�С�
�¿��Ȥ�����Ӥ��ޤ���

@item
�����ʤ�����⥱������¸��ʸ���ʤ�С������ϥ�������¸ʸ���Ȥ�����Ӥ���ޤ���

@item
���Τۤ��ξ�硢�����ϥ��������¸ʸ���Ȥ�����Ӥ���ޤ���
@end itemize

@example
mysql> select LEAST(2,0);
        -> 0
mysql> select LEAST(34.0,3.0,5.0,767.0);
        -> 3.0
mysql> select LEAST("B","A","C");
        -> "A"
@end example
3.22.5 ������ @strong{MySQL} �Ǥϡ�@code{MIN()} �� @code{LEAST} ������˻��ѤǤ��ޤ���

@findex GREATEST()
@item GREATEST(X,Y,...)
��İʾ�ΰ������ꡢ�����桢������ͤ��֤��ޤ���
������ @code{LEAST} �λ���Ʊ���褦����Ӥ���ޤ���

@example
mysql> select GREATEST(2,0);
        -> 2
mysql> select GREATEST(34.0,3.0,5.0,767.0);
        -> 767.0
mysql> select GREATEST("B","A","C");
        -> "C"
@end example

3.22.5 ������ @strong{MySQL} �Ǥϡ�@code{MAX()} �� @code{GREATEST} ������˻��ѤǤ��ޤ���

@findex DEGREES()
@item DEGREES(X)
���� @code{X} ��饸���󤫤��٤��Ѵ������֤��ޤ���
@example
mysql> select DEGREES(PI());
        -> 180.000000
@end example

@findex RADIANS()
@item RADIANS(X)
���� @code{X} ���٤���饸������Ѵ������֤��ޤ���
@example
mysql> select RADIANS(90);
        -> 1.570796
@end example

@findex TRUNCATE()
@item TRUNCATE(X,D)
�������ʲ� @code{D} ��� @code{X} ���ڤ�ΤƤ��ͤ��֤��ޤ���
@code{D} �� @code{0} �ξ�硢��̤Ͼ�������������������ޤ���
@example
mysql> select TRUNCATE(1.223,1);
        -> 1.2
mysql> select TRUNCATE(1.999,1);
        -> 1.9
mysql> select TRUNCATE(1.999,0);
        -> 1
@end example
@end table

@findex String functions
@findex Functions, string
@node String functions, Date and time functions, Mathematical functions, Functions
@subsection ʸ����ؿ�

�����С�¦�Υѥ�᥿�� @code{max_allowed_packet} �����̤�Ĺ�����礭����硢
ʸ����ؿ��� @code{NULL} ���֤��ޤ��� @xref{Server parameters}.

ʸ���ΰ��֤򰷤��ؿ��ˤ����Ƥϡ����ֺǽ�ΰ��֤Ͽ����� 1 �Ǥ���

@table @code
@findex ASCII()
@item ASCII(str)
@code{str} �κ�ü��ʸ���� ASCII �������ͤ��֤��ޤ���
@code{str} ����ʸ���ξ��� @code{0} ���֤��ޤ���
@code{str} �� @code{NULL} �ξ��� @code{NULL} ���֤��ޤ���

@example
mysql> select ASCII('2');
        -> 50
mysql> select ASCII(2);
        -> 50
mysql> select ASCII('dx');
        -> 100
@end example

See also the @code{ORD()} function.

@findex ORD()
@item ORD(str)
ʸ���� str �κ�ü��ʸ�����ޥ���Х���ʸ���ξ�硢ʸ����ASCII �������ͤ�
�η������֤����Ȥˤ�ꡢ�ޥ���Х���ʸ���Υ����ɤ��֤��ޤ�:
@code{((first byte ASCII code)*256+(second byte ASCII code))[*256+third byte ASCII code...]}.
��ü��ʸ�����ޥ���Х���ʸ���Ǥʤ����ϡ�@code{ASCII()} �ؿ���Ʊ���ͤ���
���ޤ���

@example
mysql> select ORD('2');
        -> 50
@end example

@findex CONV()
@item CONV(N,from_base, to_base)
�����򡢿ʿ��ΰ㤦�������Ѵ����ޤ���
�� @code{N} �� @code{from_base} �ʿ����� @code{to_base} �ʿ���
�Ѵ��������Ρ�ʸ��ɽ�����֤��ޤ���
�⤷������ @code{NULL} �ʤ� @code{NULL} ���֤��ޤ���
���� @code{N} �������Ȥ��Ʋ�ᤵ��ޤ�����������ʸ����ǻ��ꤷ�ޤ���
�Ǿ��οʿ��� @code{2} �ǡ������ @code{36} �Ǥ���
@code{to_base} ������ʤ顢@code{N} ������դ��ο��ˤʤ�ޤ���
@code{CONV} �� 64-bit ���٤�ư��ޤ���

@example
mysql> select CONV("a",16,2);
        -> '1010'
mysql> select CONV("6E",18,8);
        -> '172'
mysql> select CONV(-17,10,-18);
        -> '-H'
mysql> select CONV(10+"10"+'10'+0xa,10,10);
        -> '40'
@end example

@findex BIN()
@item BIN(N)
@code{N} ����ʿ��ˤ����ͤ��֤��ޤ���@code{N} �� longlong ���ͤǤ���
����� @code{CONV(N,10,2)} ��Ʊ���Ǥ���
@code{N} �� @code{NULL} �ʤ� @code{NULL} ���֤��ޤ�.

@example
mysql> select BIN(12);
        -> '1100'
@end example

@findex OCT()
@item OCT(N)
@code{N} ��8�ʿ��ͤ�ɽ��ʸ������֤��ޤ���@code{N} �� longlong ���ͤǤ���
����� @code{CONV(N,10,8)} ��Ʊ���Ǥ���@code{N} �� @code{NULL} �ξ��� 
@code{NULL} ���֤��ޤ���

@example
mysql> select OCT(12);
        -> '14'
@end example

@findex HEX()
@item HEX(N)
@code{N} ��16�ʿ��ͤ�ɽ��ʸ������֤��ޤ���@code{N} �� 
longlong(@code{BIGINT}) ���ͤǤ�������� @code{CONV(N,10,16)} ��Ʊ���Ǥ���
@code{N} �� @code{NULL} �ξ��� @code{NULL} ���֤��ޤ���

@example
mysql> select HEX(255);
        -> 'FF'
@end example

@findex CHAR()
@item CHAR(N,...)
������ ASCII �������ͤˤ�ä�Ϳ����줿ʸ������ʤ�ʸ������֤��ޤ���
@code{NULL} �����Ф���ޤ���

@example
mysql> select CHAR(77,121,83,81,'76');
        -> 'MySQL'
mysql> select CHAR(77,77.3,'77.3');
        -> 'MMM'
@end example

@findex CONCAT()
@item CONCAT(str1,str2,...)
�������礷����̤��֤��ޤ��������� @code{NULL} �ʤ� @code{NULL} ���֤��ޤ�.
2�İʾ�ΰ�����ɬ�פȤ��ޤ���
���ͤΰ�����������ʸ����������Ѵ�����ޤ���
@example
mysql> select CONCAT('My', 'S', 'QL');
        -> 'MySQL'
mysql> select CONCAT('My', NULL, 'QL');
        -> NULL
mysql> select CONCAT(14.3);
        -> '14.3'
@end example

@findex CONCAT_WS()
@item CONCAT_WS(separator, str1, str2,...)

@code{CONCAT_WS()} �϶��ڤ�ʸ���Ĥ� CONCAT (CONCAT With Separator) ���̣
����@code{CONCAT()} ���ü�ʷ����Ǥ����ǽ�ΰ����ϡ��Ĥ�ΰ����ζ��ڤ�ʸ��
�Ǥ������ڤ�ʸ���ϻĤ�ΰ�����Ʊ���褦��ʸ����Ǥ������ڤ�ʸ���� 
@code{NULL} �ξ�硢��̤� @code{NULL} �ˤʤ�ޤ����ؿ��϶��ڤ�ʸ������
�� @code{NULL} �ȶ�ʸ��������Ф��ޤ������ڤ�ʸ���Ϸ�礵���ʸ����δ֤�
�ɲä���ޤ���
@example
mysql> select CONCAT_WS(",","First name","Second name","Last Name");
       -> 'First name,Second name,Last Name'
mysql> select CONCAT_WS(",","First name",NULL,"Last Name");
       -> 'First name,Last Name'
@end example

@findex LENGTH()
@findex OCTET_LENGTH()
@findex CHAR_LENGTH()
@findex CHARACTER_LENGTH()
@item LENGTH(str)
@itemx OCTET_LENGTH(str)
@itemx CHAR_LENGTH(str)
@itemx CHARACTER_LENGTH(str)
ʸ���� @code{str} ��Ĺ����
@example
mysql> select LENGTH('text');
        -> 4
mysql> select OCTET_LENGTH('text');
        -> 4
@end example

����: @code{CHAR_LENGTH()} �ˤĤ��Ƥϡ��ޥ���Х���ʸ���ϰ��٤�����������
��Ȥ���ޤ���

@findex LOCATE()
@findex POSITION()
@item LOCATE(substr,str)
@itemx POSITION(substr IN str)
@code{str} ��ˤ��� @code{substr} ʸ����ΰ��֤��֤��ޤ����ǽ�ΰ��֤� 1 �Ǥ���
@code{str} ��� @code{substr} ���ʤ����� @code{0} ���֤��ޤ���
@example
mysql> select LOCATE('bar', 'foobarbar');
        -> 4
mysql> select LOCATE('xbar', 'foobar');
        -> 0
@end example

���δؿ��ϥޥ���Х��ȤǤ�����Ǥ���

@findex LOCATE()
@item LOCATE(substr,str,pos)
ʸ���� @code{str} ��˺ǽ�˸��줿 @code{substr} ʸ���ΰ��֤��֤��ޤ���
@code{pos} �ϸ����򳫻Ϥ�����֤Ǥ���
@code{str} �� @code{substr} ���ʤ���� @code{0} ���֤��ޤ���
@example
mysql> select LOCATE('bar', 'foobarbar',5);
        -> 7
@end example

���δؿ��ϥޥ���Х��ȤǤ�����Ǥ���

@findex INSTR()
@item INSTR(str,substr)
ʸ���� @code{str} ��κǽ��ʸ���� @code{substr} �ΰ��֤��֤��ޤ���
����ϰ����������ؤ�äƤ��뤳�Ȥ�Τ����ơ�
2�Ĥΰ�����Ϳ���� @code{LOCATE} ��Ʊ���Ǥ���

@example
mysql> select INSTR('foobarbar', 'bar');
        -> 4
mysql> select INSTR('xbar', 'foobar');
        -> 0
@end example

���δؿ��ϥޥ���Х��ȤǤ�����Ǥ���

@findex LPAD()
@item LPAD(str,len,padstr)
@code{str} ��Ĺ���� @code{len} �ˤʤ�ޤ�ʸ���� @code{str} �λϤ�� @code{padstr} �����ޤ���
@example
mysql> select LPAD('hi',4,'??');
        -> '??hi'
@end example

@findex RPAD()
@item RPAD(str,len,padstr)
@code{str} ��Ĺ���� @code{len} �ˤʤ�ޤ�ʸ���� @code{str} �ν����� @code{padstr} �����ޤ���
@example
mysql> select RPAD('hi',5,'?');
        -> 'hi???'
@end example

@findex LEFT()
@item LEFT(str,len)
ʸ���� @code{str} �κǽ餫�� @code{len} �Ĥ�ʸ�������ޤ���

@example
mysql> select LEFT('foobarbar', 5);
        -> 'fooba'
@end example

���δؿ��ϥޥ���Х��ȤǤ�����Ǥ���

@findex RIGHT()
@item RIGHT(str,len)
ʸ���� @code{str} �κǸ夫�� @code{len} �Ĥ�ʸ�������ޤ���

@example
mysql> select RIGHT('foobarbar', 4);
        -> 'rbar'
@end example

���δؿ��ϥޥ���Х��ȤǤ�����Ǥ���

@findex SUBSTRING()
@findex MID()
@item SUBSTRING(str,pos,len)
@itemx SUBSTRING(str FROM pos FOR len)
@itemx MID(str,pos,len)
@code{str} �� @code{pos} ���֤��� @code{len} ʸ����ʬ��ʸ������֤��ޤ���
@code{FROM} �ΰ㤤�� ANSI SQL 92 ��ʸ�Ǥ���

@example
mysql> select SUBSTRING('Quadratically',5,6);
        -> 'ratica'
@end example

���δؿ��ϥޥ���Х��ȤǤ�����Ǥ���

@findex SUBSTRING()
@item SUBSTRING(str,pos)
@item SUBSTRING(str FROM pos)
ʸ���� @code{str} �� ���� @code{pos} �ʹߤ�ʸ�����֤��ޤ���

@example
mysql> select SUBSTRING('Quadratically',5);
        -> 'ratically'
mysql> select SUBSTRING('foobarbar' FROM 4);
        -> 'rbar'
@end example

���δؿ��ϥޥ���Х��ȤǤ�����Ǥ���

@findex SUBSTRING_INDEX()
@item SUBSTRING_INDEX(str,delim,count)
@code{str} ���顢���ڤ�ʸ�� @code{delim} �� @code{count} �ĸ��줿���֤�������
ʸ������֤��ޤ���@code{count} �����ξ���ʸ����Ϻ����鸡�����졢
@code{count} ����ξ���ʸ����ϱ����鸡������ޤ���

@example
mysql> select SUBSTRING_INDEX('www.mysql.com', '.', 2);
        -> 'www.mysql'
mysql> select SUBSTRING_INDEX('www.mysql.com', '.', -2);
        -> 'mysql.com'
@end example

���δؿ��ϥޥ���Х��ȤǤ�����Ǥ���

@findex LTRIM()
@item LTRIM(str)
ʸ���� @code{str} �κǽ餫�����ʸ���������ޤ���
@example
mysql> select LTRIM('  barbar');
        -> 'barbar'
@end example

@findex RTRIM()
@item RTRIM(str)
ʸ���� @code{str} �κǸ夫�����ʸ���������ޤ���
@example
mysql> select RTRIM('barbar   ');
        -> 'barbar'
@end example

@findex TRIM()
@item TRIM([[BOTH | LEADING | TRAILING] [remstr] FROM] str)
���Ƥ� @code{remstr} �ץ�ե��å����ޤ��ϥ��ե��å�����  @code{str} ����������
ʸ������֤��ޤ���@code{BOTH}, @code{LEADING} ������ @code{TRAILING} ��
���Ѥ���ʤ���硢@code{BOTH} ��Ŭ�Ѥ���ޤ���@code{remstr} ��Ϳ�����ʤ��ȡ�
���򤬺������ޤ���
@example
mysql> select TRIM('  bar   ');
        -> 'bar'
mysql> select TRIM(LEADING 'x' FROM 'xxxbarxxx');
        -> 'barxxx'
mysql> select TRIM(BOTH 'x' FROM 'xxxbarxxx');
        -> 'bar'
mysql> select TRIM(TRAILING 'xyz' FROM 'barxxyz');
        -> 'barx'
@end example

���δؿ��ϥޥ���Х��ȤǤ�����Ǥ���

@findex SOUNDEX()
@item SOUNDEX(str)
@code{str} ����� soundex ʸ������֤��ޤ���ȯ����``����Ʊ��''���Ĥ�ʸ����
��Ʊ�� soundex ʸ���������ޤ���``ɸ���'' soundex ʸ�����4ʸ��Ĺ�Ǥ�����
@code{SOUNDEX()} �ؿ���Ǥ�դ�Ĺ����ʸ������֤��ޤ���@code{SUBSTRING()} ��
��̤˻��Ѥ��ơ�``ɸ���'' soundex ʸ��������뤳�Ȥ��Ǥ��ޤ���Ϳ����줿
ʸ��������󥢥�ե��٥å�ʸ����̵�뤵��ޤ���A-Z ��Ⱦ�ʳ��Τ��٤Ƥι��Ū
�ʥ���ե��٥å�ʸ�����첻�Ȥߤʤ���ޤ���

@example
mysql> select SOUNDEX('Hello');
        -> 'H400'
mysql> select SOUNDEX('Quadratically');
        -> 'Q36324'
@end example

@findex SPACE()
@item SPACE(N)
@code{N} �Ĥζ���ʸ�����֤��ޤ���
@example
mysql> select SPACE(6);
        -> '      '
@end example

@findex REPLACE()
@item REPLACE(str,from_str,to_str)
ʸ���� @code{str} ������Ƥ�ʸ���� @code{from_str} �� @code{to_str} ��
�֤������ޤ���

@example
mysql> select REPLACE('www.mysql.com', 'w', 'Ww');
        -> 'WwWwWw.mysql.com'
@end example

���δؿ��ϥޥ���Х��ȤǤ�����Ǥ���

@findex REPEAT()
@item REPEAT(str,count)
@code{str} �� @code{count} �󷫤��֤��ޤ���@code{count <= 0} �ξ���
����ʸ������֤��ޤ���@code{str} �ޤ��� @code{count} �� @code{NULL} 
�ޤ��ϡ�@code{LENGTH(str)*count > max_allowed_packet} �ξ��� 
@code{NULL} ���֤��ޤ���

@example
mysql> select REPEAT('MySQL', 3);
        -> 'MySQLMySQLMySQL'
@end example

@findex REVERSE()
@item REVERSE(str)
ʸ���� @code{str} ��ȿž���ޤ���
@example
mysql> select REVERSE('abc');
        -> 'cba'
@end example

���δؿ��ϥޥ���Х��ȤǤ�����Ǥ���

@findex INSERT()
@item INSERT(str,pos,len,newstr)
@code{str} ��� @code{pos} ���֤��� @code{len} Ĺ��ʸ����� 
@code{newstr} ���֤������ޤ���@code{str} ��κǽ�ΰ��֤�1�Ǥ���

@example
mysql> select INSERT('Quadratic', 3, 4, 'What');
        -> 'QuWhattic'
@end example

���δؿ��ϥޥ���Х��ȤǤ�����Ǥ���

@findex ELT()
@item ELT(N,str1,str2,str3...)
@code{N} = @code{1} �ʤ� @code{str1} ��@code{N} = @code{2} �ʤ� @code{str2} ���֤��ޤ���
@code{N} �� @code{1} ��꾮������硢�ޤ��ϰ����ο�����礭������ @code{NULL} 
���֤���ޤ���
@code{ELT()} �� @code{FIELD()} �εդǤ���

@example
mysql> select ELT(1, 'ej', 'Heja', 'hej', 'foo');
        -> 'ej'
mysql> select ELT(4, 'ej', 'Heja', 'hej', 'foo');
        -> 'foo'
@end example

@findex FIELD()
@item FIELD(str,str1,str2,str3,...)
@code{str1}, @code{str2}, @code{str3}, @code{...} �ꥹ����� @code{str} �Υ���ǥå�����
�֤��ޤ���@code{str} �����Ĥ���ʤ���� @code{0} ���֤��ޤ���
@code{FIELD()} �� @code{ELT()} �εդǤ���

@example
mysql> select FIELD('ej', 'Hej', 'ej', 'Heja', 'hej', 'foo');
        -> 2
mysql> select FIELD('fo', 'Hej', 'ej', 'Heja', 'hej', 'foo');
        -> 0
@end example

@findex FIND_IN_SET()
@item FIND_IN_SET(str,strlist)
@code{str} �� @code{strlist} ��ˤ���С��� @code{1} ���� @code{N} ���֤��ޤ���
@code{strlist} �ϡ����줾��ΰۤʤ��ͤ� ',' ��ʬ�䤵�줿ʸ����Ǥ����ǽ��
���������ʸ����ǣ����ܤ� @code{SET} ���Υե�����ɤξ��@code{FIND_IN_SET} ��
�ӥåȱ黻����Ѥ��ƺ�Ŭ������ޤ���
@code{strlist} ����ʸ���ʤ� @code{0} ���֤��ޤ���
�ɤ��餫�ΰ����� @code{NULL} �ʤ� @code{NULL} ���֤��ޤ�.
���δؿ��Ϻǽ�ΰ�����  ',' ��ޤ����硢���ޤ�ư���ʤ��Ǥ��礦��

@example
mysql> SELECT FIND_IN_SET('b','a,b,c,d');
        -> 2
@end example

@findex MAKE_SET()
@item MAKE_SET(bits,str1,str2,...)
@code{bits} �˻��ꤵ�줿�ӥåȤ��б�����ʸ����Υ��åȤ��֤��ޤ���
(ʸ����ʣ���ξ�硢 @samp{,} �Ƕ��ڤ��ޤ�) 
@code{str1} �� �ӥå� 0 ���б�����@code{str2} �� �ӥå� 1 ���б�����
@code{str3} �� �ӥå� 2 ���б���... �Ȥʤ�ޤ���
@code{str1}, @code{str2}, @code{...} ��˴ޤޤ�Ƥ��� @code{NULL} ʸ����
��̤ˤ��ɲä���ޤ���

@example
mysql> SELECT MAKE_SET(1,'a','b','c');
        -> 'a'
mysql> SELECT MAKE_SET(1 | 4,'hello','nice','world');
        -> 'hello,world'
mysql> SELECT MAKE_SET(0,'a','b','c');
        -> ''
@end example

@findex EXPORT_SET()
@item EXPORT_SET(bits,on,off,[separator,[number_of_bits]])
'bits' ��Ϳ����줿���ͤ��Ф���
���ƤΥ��åȤ���Ƥ���ӥåȤ� 'on' �ǻ��ꤵ�줿ʸ����ɽ����
�ꥻ�åȤ���Ƥ���ӥåȤ� 'off' �ǻ��ꤵ�줿ʸ����ɽ����ʸ������֤��ޤ���
���줾���ʸ���� 'separator' (�ǥե����',') �Ǽ����줿ʸ���Ƕ��ڤ�졢
'number_of_bits' (default 64) ��Ϳ����줿��������ΥӥåȤ�ɽ�����ޤ���

@example
mysql> SELECT EXPORT_SET(5,'Y','N',',',4);
        -> Y,N,Y,N 
@end example

@findex LCASE()
@findex LOWER()
@item LCASE(str)
@itemx LOWER(str)
@code{str} �򸽺ߤΥ���饯�������åȥޥåԥ�
 (�ǥե���� ISO-8859-1 Latin1) �ˤ������äƾ�ʸ�����Ѵ����ޤ���

���δؿ��ϥޥ���Х��ȤǤ�����Ǥ���

@example
mysql> select LCASE('QUADRATICALLY');
        -> 'quadratically'
@end example

@findex UCASE()
@findex UPPER()
@item UCASE(str)
@itemx UPPER(str)
@code{str} �򸽺ߤΥ���饯�������åȥޥåԥ�
 (�ǥե���� ISO-8859-1 Latin1) �ˤ������ä���ʸ�����Ѵ����ޤ���

@example
mysql> select UCASE('Hej');
        -> 'HEJ'
@end example

���δؿ��ϥޥ���Х��ȤǤ�����Ǥ���

@findex FILE
@item LOAD_FILE(file_name)
�ե�������ɤ߹��ߡ��ե��������Ȥ�ʸ���Ȥ����֤��ޤ��� �ե������
�����С���ˤʤ��ƤϤʤ餺���ե������ե�ѥ��ǻ��ꤷ�ʤ���Фʤ�ޤ���
�����ơ� @strong{file} ���¤��ʤ���Фʤ�ޤ��� �ե������������
�ɤ߹��߲�ǽ�Ǥʤ���Фʤ餺�������ơ� @code{max_allowed_packet} ���
�������������Ǥʤ���Фʤ�ޤ���

���Τ����ɤ줫����ͳ�ǡ��⤷�ե����뤬¸�ߤ��ʤ����ɤ߹���ʤ���硢
���δؿ��� @code{NULL} ���֤��ޤ���

@example
mysql> UPDATE table_name
           SET blob_column=LOAD_FILE("/tmp/picture")
           WHERE id=1;
@end example
@end table

@strong{MySQL} ��ɬ�פȤ���п��ͤ�ʸ������Ѵ����ޤ���
�դ�Ʊ�ͤ˹Ԥ��ޤ���

@example
mysql> SELECT 1+"1";
       -> 2
mysql> SELECT concat(2,' test');
       -> '2 test'
@end example

����Ū�˿��ͤ�ʸ������Ѵ���������С�@code{CONCAT()} �˰����Ȥ����Ϥ��Ʋ�
������

ʸ����ؿ��ϰ����Ȥ��ƥХ��ʥ�ʸ����Ϳ������ȡ���̤�ʸ�����Х��ʥ�
ʸ����ˤʤ�ޤ���ʸ������Ѵ����줿���ͤϥХ��ʥ�ʸ����Ȥߤʤ���ޤ�����
�����Ӥˤ����ƶ����ޤ���

@findex Date and time functions
@findex Functions, date and time
@node Date and time functions, Miscellaneous functions, String functions, Functions
@subsection ���դȻ���ؿ�

���줾��η�������ͤ��ϰϤ����Ȼ��֤��ͤ����Ҥ����ͭ���ʷ����ˤĤ��Ƥ�
 @ref{Date and time types}. 

���մؿ�����Ѥ�����:
@code{date_col} ���ǿ���30���Ǥ������ƤΥ쥳���ɤ����򤷤ޤ�:

@example
mysql> SELECT something FROM table
           WHERE TO_DAYS(NOW()) - TO_DAYS(date_col) <= 30;
@end example

@table @code
@findex DAYOFWEEK()
@item DAYOFWEEK(date)
@code{date} �����������ޤ� (@code{1} = ������, @code{2} = ������, ... @code{7} = ������)
����� ODBC ɸ��˽����ޤ���
@example
mysql> select DAYOFWEEK('1998-02-03');
        -> 3
@end example

@findex WEEKDAY()
@item WEEKDAY(date)
@code{date} �����������ޤ� (@code{0} = ������, @code{1} = ������, ... @code{6} = ������)
@example
mysql> select WEEKDAY('1997-10-04 22:23:00');
        -> 5
mysql> select WEEKDAY('1997-11-05');
        -> 2
@end example

@findex DAYOFMONTH()
@item DAYOFMONTH(date)
��������֤��ޤ� (@code{1} - @code{31})
@example
mysql> select DAYOFMONTH('1998-02-03');
        -> 3
@end example

@findex DAYOFYEAR()
@item DAYOFYEAR(date)
ǯ�������֤��ޤ� (@code{1}-@code{366})
@example
mysql> select DAYOFYEAR('1998-02-03');
        -> 34
@end example

@findex MONTH()
@item MONTH(date)
����֤��ޤ� (@code{1} - @code{12})
@example
mysql> select MONTH('1998-02-03');
        -> 2
@end example

@findex DAYNAME()
@item DAYNAME(date)
������̾�����֤��ޤ���
@example
mysql> select DAYNAME("1998-02-05");
        -> 'Thursday'
@end example

@findex MONTHNAME()
@item MONTHNAME(date)
���̾�����֤��ޤ���
@example
mysql> select MONTHNAME("1998-02-05");
        -> 'February'
@end example

@findex QUARTER()
@item QUARTER(date)
@code{date} �ˤĤ��Ƥ�ǯ�λ�Ⱦ�����֤��ޤ����ϰϤ� @code{1} ���� 
@code{4} �Ǥ���
@example
mysql> select QUARTER('98-04-01');
        -> 2
@end example

@findex WEEK()
@item WEEK(date)
@itemx WEEK(date,first)
��������Ĥξ�硢@code{date} �ˤĤ��Ƥν����֤��ޤ����ϰϤ� @code{0} ���� 
@code{53} (������53���κǽ�Ȥ����Τ⤢�ꤨ�ޤ�)�ǡ�������������
�ǽ�����Ǥ�����������Ĥη����� @code{WEEK()} �ϡ����γ��Ϥ�������������
��������Ǥ��ޤ�����2������ @code{0} �ξ�硢���γ��Ϥ��������Ǥ�����2����
�� @code{1} �ξ�硢���γ��ϤϷ������Ǥ���
@example
mysql> select WEEK('1998-02-20');
        -> 7
mysql> select WEEK('1998-02-20',0);
        -> 7
mysql> select WEEK('1998-02-20',1);
        -> 8
mysql> select WEEK('1998-12-31',1);
        -> 53
@end example

@findex YEAR()
@item YEAR(date)
ǯ���֤��ޤ� (@code{1000} - @code{9999}).
@example
mysql> select YEAR('98-02-03');
        -> 1998
@end example
@item YEARWEEK(date)
@itemx YEARWEEK(date,first)
�ǡ�����ǯ�Ƚ����֤��ޤ�����2������ @code{WEEK()} ����2�����Ȥޤä���Ʊ��
�褦��Ư���ޤ�������: ǯ�κǽ�ȺǸ�ν��Ǥϡ�ǯ�� date �������ǯ�Ȥϰۤ�
�뤳�Ȥ�����ޤ���
@example

mysql> select YEARWEEK('1987-01-01');
        -> 198653
@end example

@findex HOUR()
@item HOUR(time)
�����֤��ޤ� (@code{0} - @code{23})
@example
mysql> select HOUR('10:05:03');
        -> 10
@end example

@findex MINUTE()
@item MINUTE(time)
ʬ���֤��ޤ� (@code{0}-@code{59})
@example
mysql> select MINUTE('98-02-03 10:05:03');
        -> 5
@end example

@findex SECOND()
@item SECOND(time)
�ä��֤��ޤ� (@code{0} to @code{59})
@example
mysql> select SECOND('10:05:03');
        -> 3
@end example

@findex PERIOD_ADD()
@item PERIOD_ADD(P,N)
@code{N} ������ @code{P} (�� @code{YYMM} �ޤ��� @code{YYYYMM}) ���ɲ�
���ޤ���@code{YYYYMM} ���֤��ޤ���

����: ���ְ��� @code{P} �������ͤǤ�@emph{����ޤ���}��

@example
mysql> select PERIOD_ADD(9801,2);
        -> 199803
@end example

@findex PERIOD_DIFF()
@item PERIOD_DIFF(P1,P2)
���� @code{P1} �� @code{P2} �κ��η���֤��ޤ���@code{P1} �� @code{P2} �Ϸ�
�� @code{YYMM} �ޤ��� @code{YYYYMM} �Ǥ���

����: ���ְ��� @code{P1} �� @code{P2} �������ͤǤ�@emph{����ޤ���}��

@example
mysql> select PERIOD_DIFF(9802,199703);
        -> 11
@end example

@findex DATE_ADD()
@findex DATE_SUB()
@findex ADDDATE()
@findex SUBDATE()
@findex EXTRACT(type FROM date)
@item DATE_ADD(date,INTERVAL expr type)
@itemx DATE_SUB(date,INTERVAL expr type)
@itemx ADDDATE(date,INTERVAL expr type)
@itemx SUBDATE(date,INTERVAL expr type)

�����ؿ������դα黻�˻��Ѥ��ޤ��� ������ @strong{MySQL} 3.22 ��
��������ǽ�Ǥ��� @code{ADDDATE()} �� @code{SUBDATE()} ��
@code{DATE_ADD()} , @code{DATE_SUB()} ��Ʊ���Ǥ���

@strong{MySQL} 3.23 �Ǥ�, @code{+} �� @code{-} ��
@code{DATE_ADD()} , @code{DATE_SUB()} ������˻��ѤǤ��ޤ�. (See example)

@code{date} �ˤϡ�@code{DATETIME} �� @code{DATE} �����ͤ���ꤷ�ޤ���
�����ͤ���黻�����Ϥ���ޤ���
@code{expr} �ˤϡ�date ���������������ͤ���ꤷ�ޤ���
@code{expr} �� @samp{-} ����ϤޤäƤ���С�����򼨤��ޤ���
@code{type} �Ϥɤ줰�餤�δ��֤��򼨤�������ɤǤ���

@code{EXTRACT(type FROM date)} �ؿ��ϡ�date ���� 'type' ����ʬ���֤��ޤ���

�ʲ���ɽ�ˡ�@code{type} �� @code{expr} �δ�Ϣ�򼨤��ޤ���

@multitable @columnfractions .18 .3 .42
@item @code{type} @strong{��} @tab @strong{��̣} @tab @code{expr} @strong{�Υե����ޥå�}
@item @code{SECOND}        @tab ��             @tab @code{SECONDS}
@item @code{MINUTE}        @tab ʬ             @tab @code{MINUTES}
@item @code{HOUR}          @tab ����           @tab @code{HOURS}
@item @code{DAY}           @tab ��             @tab @code{DAYS}
@item @code{MONTH}         @tab ��             @tab @code{MONTHS}
@item @code{YEAR}          @tab ǯ             @tab @code{YEARS}
@item @code{MINUTE_SECOND} @tab ʬ����         @tab @code{"MINUTES:SECONDS"}
@item @code{HOUR_MINUTE}   @tab ���֤�ʬ       @tab @code{"HOURS:MINUTES"}
@item @code{DAY_HOUR}      @tab �� �Ȼ���      @tab @code{"DAYS HOURS"}
@item @code{YEAR_MONTH}    @tab ǯ �ȷ�        @tab @code{"YEARS-MONTHS"}
@item @code{HOUR_SECOND}   @tab ���֤�ʬ       @tab @code{"HOURS:MINUTES:SECONDS"}
@item @code{DAY_MINUTE}    @tab ��������ʬ     @tab @code{"DAYS HOURS:MINUTES"}
@item @code{DAY_SECOND}    @tab ��������ʬ���� @tab @code{"DAYS HOURS:MINUTES:SECONDS"}
@end multitable

@strong{MySQL} �ϡ� @code{expr} �ե����ޥå���Τ����ʤ���������ڤ�������ޤ���
���ɽ��ζ��ڤ�ʸ������Ƥ�����ڤ�ʸ���Ǥ��� �⤷ @code{date} ������
 @code{DATE} �ͤǡ�@code{YEAR}, @code{MONTH}, @code{DAY} ����ʬ�Τߤ�ޤ�
�׻��򤹤�ʤ顢��̤� @code{DATE} �ͤ��֤�ޤ��� ����ʳ��ʤ� @code{DATETIME} �ͤ�
�֤�ޤ���

@example
mysql> SELECT "1997-12-31 23:59:59" + INTERVAL 1 SECOND;
        -> 1998-01-01 00:00:00
mysql> SELECT INTERVAL 1 DAY + "1997-12-31";
        -> 1998-01-01
mysql> SELECT "1998-01-01" - INTERVAL 1 SECOND;
       -> 1997-12-31 23:59:59 
mysql> SELECT DATE_ADD("1997-12-31 23:59:59",
                       INTERVAL 1 SECOND);
        -> 1998-01-01 00:00:00
mysql> SELECT DATE_ADD("1997-12-31 23:59:59",
                       INTERVAL 1 DAY);
        -> 1998-01-01 23:59:59
mysql> SELECT DATE_ADD("1997-12-31 23:59:59",
                       INTERVAL "1:1" MINUTE_SECOND);
        -> 1998-01-01 00:01:00
mysql> SELECT DATE_SUB("1998-01-01 00:00:00",
                       INTERVAL "1 1:1:1" DAY_SECOND);
        -> 1997-12-30 22:58:59
mysql> SELECT DATE_ADD("1998-01-01 00:00:00",
                       INTERVAL "-1 10" DAY_HOUR);
        -> 1997-12-30 14:00:00
mysql> SELECT DATE_SUB("1998-01-02", INTERVAL 31 DAY);
        -> 1997-12-02
mysql> SELECT EXTRACT(YEAR FROM "1999-07-02");
       -> 1999
mysql> SELECT EXTRACT(YEAR_MONTH FROM "1999-07-02 01:02:03");
       -> 199907
mysql> SELECT EXTRACT(DAY_MINUTE FROM "1999-07-02 01:02:03");
       -> 20102
@end example

�⤷���ʤ��λ��ꤹ�� interval �ͤ�û������ʤ�( @code{type} ������ɤ���
��䤵����ͤ�ޤ�Ǥ��ʤ����)�� @strong{MySQL} �� interval �ͤΰ���
������ʬ����ꤷ˺�줿��Τ��Ȳ��ꤷ�ޤ���
�㤨�С��⤷ @code{type} �� @code{DAY_SECOND} �˻��ꤷ����硢
 @code{expr} ���ͤ� ��������ʬ���� ����ʤ�ʪ�ȴ��Ԥ���ޤ���
�����Ǥ��ʤ��� @code{"1:10"} �Τ褦���ͤ���ꤷ�Ƥ����ʤ顢
 @strong{MySQL} �ϡ������� ����ʬ��˺�����ơ�ʬ���� ��Ϳ����줿��
���ꤷ�ޤ���
�Ĥޤꡢ @code{"1:10" DAY_SECOND} �� @code{"1:10" MINUTE_SECOND} ��
��������򤵤��ΤǤ���
����ϡ�@strong{MySQL} �� @code{TIME} �ͤ����ǤϤʤ��в���֤�ɽ���Ȳ��
������ˡ��������Ƥ��ޤ���

�⤷���������ͤ����Ѥ��줿�ʤ顢��̤� @code{NULL} �Ǥ�.
�⤷ @code{MONTH} �� @code{YEAR_MONTH} �� @code{YEAR} ��­�������ơ�
��̤Ȥʤ����դ���������κ����������礭�����ˤʤ�褦�ʤ顢
�������ϡ���������κ������˽�������ޤ���

@example
mysql> select DATE_ADD('1998-01-30',Interval 1 month);
        -> 1998-02-28
@end example

��Τ褦�ˡ�@code{INTERVAL} �� @code{type} ������ɤ�
��������¸�ǤϤ���ޤ���

@findex TO_DAYS()
@item TO_DAYS(date)
���� @code{date} ��Ϳ����ȡ�0ǯ������������֤��ޤ���

@example
mysql> select TO_DAYS(950501);
        -> 728779
mysql> select TO_DAYS('1997-10-07');
        -> 729669
@end example

@code{TO_DAYS()} �ϥ��쥴�ꥪ��γ���(1582)��������ͤǤλ��Ѥ�տޤ����
���ޤ������ѹ����줿���˼���줿�����θ������Ƥʤ�����Ǥ���

@findex FROM_DAYS()
@item FROM_DAYS(N)
Given a daynumber @code{N}, returns a @code{DATE} value.

@example
mysql> select FROM_DAYS(729669);
        -> '1997-10-07'
@end example

@code{FROM_DAYS()} �ϥ��쥴�ꥪ��γ���(1582)��������ͤǤλ��Ѥ�տޤ���
�Ƥ��ޤ������ѹ����줿���˼���줿�����θ������Ƥʤ�����Ǥ���

@findex DATE_FORMAT()
@item DATE_FORMAT(date,format)
@code{date} �ͤ� @code{format} ʸ����˽��ä��������ޤ������λ��꤬ 
@code{format} ʸ����ǻ��ѤǤ��ޤ�:
@multitable @columnfractions .1 .9
@item @code{%M} @tab ��̾ (@code{January}..@code{December})
@item @code{%W} @tab ���� (@code{Sunday}..@code{Saturday})
@item @code{%D} @tab �Ѹ쥵�ե��å����դ������ (@code{1st}, @code{2nd}, @code{3rd}, etc.)
@item @code{%Y} @tab 4���ǯ
@item @code{%y} @tab 2���ǯ
@item @code{%X} @tab ����ǯ�����κǽ��������������4��ο��͡�'%V' �ȶ��˻��Ѥ���ޤ�
@item @code{%x} @tab ����ǯ�����κǽ�����Ϸ�������4��ο��͡�'%v' �ȶ��˻��Ѥ���ޤ�
@item @code{%a} @tab ��ά���줿����̾ (@code{Sun}..@code{Sat})
@item @code{%d} @tab �����, ���� (@code{00}..@code{31})
@item @code{%e} @tab �����, ���� (@code{0}..@code{31})
@item @code{%m} @tab ��, ���� (@code{01}..@code{12})
@item @code{%c} @tab ��, ���� (@code{1}..@code{12})
@item @code{%b} @tab ��ά���줿��̾ (@code{Jan}..@code{Dec})
@item @code{%j} @tab ǯ���� (@code{001}..@code{366})
@item @code{%H} @tab �� (@code{00}..@code{23})
@item @code{%k} @tab �� (@code{0}..@code{23})
@item @code{%h} @tab �� (@code{01}..@code{12})
@item @code{%I} @tab �� (@code{01}..@code{12})
@item @code{%l} @tab �� (@code{1}..@code{12})
@item @code{%i} @tab ʬ, ���� (@code{00}..@code{59})
@item @code{%r} @tab ����, 12���� (@code{hh:mm:ss [AP]M})
@item @code{%T} @tab ����, 24���� (@code{hh:mm:ss})
@item @code{%S} @tab �� (@code{00}..@code{59})
@item @code{%s} @tab �� (@code{00}..@code{59})
@item @code{%p} @tab @code{AM} or @code{PM}
@item @code{%w} @tab ������ (@code{0}=Sunday..@code{6}=Saturday)
@item @code{%U} @tab �� (@code{0}..@code{53}), ���ΤϤ��ޤ�� ���ˤȤ������
@item @code{%u} @tab �� (@code{0}..@code{53}), ���ΤϤ��ޤ�� ���ˤȤ������
@item @code{%V} @tab �� (@code{1}..@code{53}), ���ΤϤ��ޤ����������'%X' �ȶ��˻��Ѥ���ޤ�
@item @code{%v} @tab �� (@code{1}..@code{53}), ���ΤϤ��ޤ�Ϸ�������'%x' �ȶ��˻��Ѥ���ޤ�
@item @code{%%} @tab ��ƥ�� @samp{%}��
@end multitable

¾�����Ƥ�ʸ���ϲ�ᤵ�줺�˷�̤˥��ԡ�����ޤ���

@example
mysql> select DATE_FORMAT('1997-10-04 22:23:00', '%W %M %Y');
        -> 'Saturday October 1997'
mysql> select DATE_FORMAT('1997-10-04 22:23:00', '%H:%i:%s');
        -> '22:23:00'
mysql> select DATE_FORMAT('1997-10-04 22:23:00',
                          '%D %y %a %d %m %b %j');
        -> '4th 97 Sat 04 10 Oct 277'
mysql> select DATE_FORMAT('1997-10-04 22:23:00',
                          '%H %k %I %r %T %S %w');
        -> '22 22 10 10:23:00 PM 22:23:00 00 6'
mysql> select DATE_FORMAT('1999-01-01', '%X %V');
        -> '1998 52'
@end example

@strong{MySQL} 3.23 �Ǥϡ� @code{%} ʸ���ϥե����ޥå�ʸ��������ɬ��ɬ�פȤ���ޤ���
���������ΥС������Ǥϡ� @code{%} ʸ���ϥ��ץ����Ǥ�����

@findex TIME_FORMAT()
@item TIME_FORMAT(time,format)
����Ͼ嵭�� @code{DATE_FORMAT()} �Τ褦�˻��Ѥ���ޤ�����
@code{format} ���ץ����Ǥϡ���,ʬ,�ä��������Ǥ��ޤ���
¾�Υ��ץ����� @code{NULL} or @code{0} ��Ϳ���ޤ���

@findex CURDATE()
@findex CURRENT_DATE
@item CURDATE()
@itemx CURRENT_DATE
���������դ��֤��ޤ������դη����ϡ�@code{CURDATE()} �����ͤޤ���ʸ����Τɤ�
���ʸ̮�ǻ��Ѥ��줿���˰�¸���� @code{YYYYMMDD} �ޤ��� @code{'YYYY-MM-DD'} ���֤���ޤ���

@example
mysql> select CURDATE();
        -> '1997-12-15'
mysql> select CURDATE() + 0;
        -> 19971215
@end example

@findex CURTIME()
@findex CURRENT_TIME
@item CURTIME()
@itemx CURRENT_TIME
���ߤλ���� @code{HHMMSS} �ޤ��� @code{'HH:MM:SS'} �η������֤��ޤ�����
��� @code{CURTIME()} �����ͤޤ���ʸ����Τɤ����ʸ̮�ǻ��Ѥ��줿���˰�
¸���ޤ���

@example
mysql> select CURTIME();
        -> '23:50:26'
mysql> select CURTIME() + 0;
        -> 235026
@end example

@findex NOW()
@findex SYSDATE()
@findex CURRENT_TIMESTAMP
@item NOW()
@itemx SYSDATE()
@itemx CURRENT_TIMESTAMP
���ߤλ�����֤��ޤ������ͤޤ���ʸ����Τɤ����ʸ̮�ǻ��Ѥ��줿���˰�¸����
 @code{YYYYMMDDHHMMSS} �ޤ��� @code{'YYYY-MM-DD HH:MM:SS'} �������֤���ޤ���

@example
mysql> select NOW();
        -> '1997-12-15 23:50:26'
mysql> select NOW() + 0;
        -> 19971215235026
@end example

@findex UNIX_TIMESTAMP()
@item UNIX_TIMESTAMP()
@itemx UNIX_TIMESTAMP(date)
�����ʤ��ǸƤӽФ��줿���ϡ�UNIX timestamp (GMT @code{'1970-01-01 00:00:00'} ��
����ÿ�) �Ǥ����̾�ϡ�@code{TIMESTAMP} �ե�����ɤ�����Ȥ��ƸƤӽФ����ե�����ɤ�
�ͤ��ÿ����֤��ޤ���@code{date} �ϥ����������Ǥ� @code{DATE} ʸ����@code{DATETIME} 
ʸ���󡢤ޤ��� @code{YYMMDD} �ޤ��� @code{YYYYMMDD} �����ο��ͤǤ���

@example
mysql> select UNIX_TIMESTAMP();
        -> 882226357
mysql> select UNIX_TIMESTAMP('1997-10-04 22:23:00');
        -> 875996580
@end example

@code{UNIX_TIMESTAMP} �� @code{TIMESTAMP} �ե�����ɤ˻��Ѥ��줿��硢
���δؿ��ϡ����ۤ� ``ʸ������ UNIX �����ॹ�����'' �Ѵ��򤹤뤳�Ȥʤ���
�ͤ����ޤ���

@findex FROM_UNIXTIME()
@item FROM_UNIXTIME(Unix_timestamp)
ʸ̮(����/ʸ����)�˰�¸���ơ�@code{'YYYY-MM-DD HH:MM:SS'} �ޤ��� 
@code{YYYYMMDDHHMMSS} ������ timestamp ʸ������֤��ޤ���

@example
mysql> select FROM_UNIXTIME(875996580);
        -> '1997-10-04 22:23:00'
mysql> select FROM_UNIXTIME(875996580) + 0;
        -> 19971004222300
@end example

@findex FROM_UNIXTIME()
@item FROM_UNIXTIME(unix_timestamp,format)
@code{format} �˽��ä��������줿 Unix timestamp ʸ������֤��ޤ���
@code{format} �� @code{DATE_FORMAT()} �ؿ��Υ���ȥ�˰������줿�Τ�Ʊ����
��Ҥ�ޤळ�Ȥ��Ǥ��ޤ���

@example
mysql> select FROM_UNIXTIME(UNIX_TIMESTAMP(),
                            '%Y %D %M %h:%i:%s %x');
        -> '1997 23rd December 03:43:30 x'
@end example

@findex SEC_TO_TIME()
@item SEC_TO_TIME(seconds)
@code{seconds} �������ʬ�ä��Ѵ������֤��ޤ����ؿ���ʸ����ʸ̮�ޤ��Ͽ���
ʸ̮�Τɤ���ǻ��Ѥ��줿���˰�¸���ơ�@code{'HH:MM:SS'} �ޤ��� 
@code{HHMMSS} �������ͤ��֤��ޤ���

@example
mysql> select SEC_TO_TIME(2378);
        -> '00:39:38'
mysql> select SEC_TO_TIME(2378) + 0;
        -> 3938
@end example

@findex TIME_TO_SEC()
@item TIME_TO_SEC(time)
@code{time} ���ä��Ѵ����ޤ���

@example
mysql> select TIME_TO_SEC('22:23:00');
        -> 80580
mysql> select TIME_TO_SEC('00:39:38');
        -> 2378
@end example
@end table

@findex Miscellaneous functions
@findex Functions, miscellaneous
@node Miscellaneous functions, Group by functions, Date and time functions, Functions
@subsection ����¾�δؿ�

@table @code
@findex DATABASE()
@item DATABASE()
���ߤΥǡ����١���̾���֤��ޤ���
@example
mysql> select DATABASE();
        -> 'test'
@end example

�⤷�ǡ����١��������򤵤�Ƥ��ʤ��ʤ顢@code{DATABASE()} �϶�ʸ�����֤��ޤ���

@findex USER()
@findex SYSTEM_USER()
@findex SESSION_USER()
@item USER()
@itemx SYSTEM_USER()
@itemx SESSION_USER()
���ߤ� @strong{MySQL} �桼��̾���֤��ޤ���
@example
mysql> select USER();
        -> 'davida@@localhost'
@end example

@strong{MySQL} 3.22.11 �ʹߤǤϡ����δؿ��ϥ桼����̾�ȥ��饤����ȤΥۥ���̾��ޤߤޤ���
�桼����̾����ʬ�������Ф��ˤϼ��Τ褦�ˤ��ޤ���
�ʤ���ϥۥ���̾���ޤޤ�Ƥ��ʤ��Ȥ�ư���Ǥ��礦�ˡ�

@example
ysql> select substring_index(USER(),"@@",1);
        -> 'davida'
@end example

@findex PASSWORD()
@item PASSWORD(str)
�ץ졼��ƥ����ȤΥѥ���� @code{str} ����ѥ����ʸ�����׻����ޤ���
����� @code{user} ���ĥơ��֥�� @code{Password} �ե�����ɤˡ�
�Ź沽���줿 @strong{MySQL} �ѥ���ɤ���¸����ݤ˻��Ѥ���ޤ���

@example
mysql> select PASSWORD('badpwd');
        -> '7f84554057dd964b'
@end example

@cindex Password encryption, reversibility of
@code{PASSWORD()} �Ź���ԲĵդǤ���

@code{PASSWORD()} �� UNIX �Υѥ���ɤ��Ź沽����Τ�Ʊ����ˡ��
�Ź沽��Ԥ��櫓�ǤϤ���ޤ���
UNIX �Υѥ���ɤ� @strong{MySQL} �Υѥ���ɤ�Ʊ���ȻפäƤϤ����ޤ���
UNIX �Υѥ���ɥե��������¸������ͤ� @code{PASSWORD()} ���֤���
�ͤ��ƤϤ����ޤ���
@code{ENCRYPT()} ���ȡ�

@findex ENCRYPT()
@item ENCRYPT(str[,salt])
UNIX �� @code{crypt()} �����ƥॳ����� @code{str} ��Ź沽���ޤ���
@code{salt} ��2ʸ����ʸ����Ǥ���
(@strong{MySQL} 3.22.16 ��, @code{salt} ��2ʸ���ʾ�������褦�ˤʤ�ޤ�����)

@example
mysql> select ENCRYPT("hello");
        -> 'VxuFAJXVARROc'
@end example

�����ƥ�� @code{crypt()} �����ѤǤ��ʤ����� @code{ENCRYPT()} �Ͼ�� 
@code{NULL} ���֤��ޤ���

���ʤ��Ȥ⤤���Ĥ��Υ����ƥ�Ǥϡ�
@code{ENCRYPT()} �� @code{str} ʸ����κǽ�� 8 ʸ���ʳ�������̵�뤷�ޤ���
����� @code{crypt()} �����ƥॳ����ο����񤤤ˤ�äƷ���Ť����ޤ���

@findex ENCODE()
@item ENCODE(str,pass_str)
�ѥ���ɤȤ��� @code{pass_str} ���Ѥ��� @code{str} ��Ź沽���ޤ������
�����沽����ˤϡ�@code{DECODE()}����Ѥ��ޤ���

��̤ϥХ��ʥ�ʸ����Ǥ����ե�����ɤˤ������¸���������� @code{BLOB} 
�ե�����ɷ�����Ѥ��Ƥ���������

@findex DECODE()
@item DECODE(crypt_str,pass_str)
�Ź沽���줿ʸ���� @code{crypt_str} ��ѥ���ɤȤ��� @code{pass_str} ��
�Ѥ������沽���ޤ���@code{crypt_str} �� @code{ENCODE()} �����֤��줿ʸ����
�Ǥ���٤��Ǥ���

@findex MD5()
@item MD5(string)
ʸ����� MD5 �����å����ष����̤��֤��ޤ��� �ͤ� 32 ��� 16��ɽ���Ǥ���
�㤨�Хϥå��奭���Ȥ��ƻ��ѤǤ���褦�ˡ�

@example
mysql> select MD5("testing")
        -> 'ae2b1fca515949e5d54fb22b8ed95575'
@end example

����� "RSA Data Security, Inc. MD5 Message-Digest Algorithm".

@findex LAST_INSERT_ID([expr])
@item LAST_INSERT_ID([expr])
�Ǹ�� @code{AUTO_INCREMENT} �ե�����ɤ���������Ƽ�ưŪ���������줿�ͤ��֤��ޤ���
@xref{mysql_insert_id, , @code{mysql_insert_id()}}.

@example
mysql> select LAST_INSERT_ID();
        -> 195
@end example

�Ǹ�κ������줿 ID �Ϥ��줾��Υ��ͥ��������˥����С��˰ݻ�����ޤ���
�����¾�Υ��饤����Ȥ�����ѹ��Ǥ��ʤ��Ǥ��礦��
�⤷¾����ޥ��å��ͤ��� @code{AUTO_INCREMENT} �ե������
���ͤ� @code{NULL} �Ǥ� @code{0} �Ǥ�ʤ��Ȥ������ȡ�
�򹹿����Ƥ⡢����� �ѹ�����ޤ���

@cindex Sequence emulation
�⤷ @code{UPDATE} ����� @code{LAST_INSERT_ID()} �ΰ����� @code{expr} ����ꤹ��ȡ�
�������ͤ� @code{LAST_INSERT_ID()} ���ͤȤ����֤�ޤ���
����� ���������ֹ�Υ��ߥ�졼�����˻��ѤǤ��ޤ���

�ǽ�˥ơ��֥�������

@example
mysql> create table sequence (id int not null);
mysql> insert into sequence values (0);
@end example

�����ưʲ��Τ褦�ˤ��ƥ��������ֹ��������

@example
mysql> UPDATE sequence SET id=last_insert_id(id+1);
@end example

@code{LAST_INSERT_ID()} �θƤӽФ�̵���ǥ��������ֹ���������뤳�Ȥ���ǽ
�Ǥ�����������ˡ�Ǥ��δؿ�����Ѥ���桼�ƥ���ƥ��ϡ�ID �ͤ��Ǹ�˼�ưŪ
���������줿�ͤȤ��ƥ����Ф˴�������ޤ���@strong{MySQL} ����̾��Ǥ�դ� 
@code{AUTO_INCREMENT} �ͤ��ɤ߹���ǿ����� ID ����Ф����Ȥ��Ǥ��ޤ�����
���С�@code{LAST_INSERT_ID()} (����̵��) �Ͽ����� ID ���֤��ޤ���C API ��
�� @code{mysql_insert_id()} �⤳���ͤ����뤿��˻��ѤǤ��ޤ���

@findex FORMAT()
@item FORMAT(X,D)
@code{'#,###,###.##'} �Τ褦�ʷ���(������ @code{X} ��)�ǿ��� @code{D} ������
���ޤ��� �⤷ @code{D} �� @code{0} �ʤ�, ��̤ˤϤ����ʤ�
�������⾮������ޤޤ�ޤ���

@example
mysql> select FORMAT(12332.123456, 4);
        -> '12,332.1235'
mysql> select FORMAT(12332.1,4);
        -> '12,332.1000'
mysql> select FORMAT(12332.2,0);
        -> '12,332'
@end example

@findex VERSION()
@item VERSION()
@strong{MySQL} �����ФΥС��������֤��ޤ���
@example
mysql> select VERSION();
        -> '3.23.13-log'
@end example

����: �С������ @code{-log} �ǽ������ϥ����󥰤�ͭ���Ǥ��뤳�Ȥ��
̣���ޤ���

@findex CONNECTION_ID()
@item CONNECTION_ID()
��³����³ ID (@code{thread_id}) ���֤��ޤ������٤Ƥ���³����³���Ȥΰ��
�� ID ������ޤ���
@example
mysql> select CONNECTION_ID();
        -> 1
@end example


@findex GET_LOCK()
@item GET_LOCK(str,timeout)
@code{timeout} �äΥ����ॢ���Ȥǡ�@code{str} ��̾�դ���줿���å��γ�������
�ޤ������å�������������� @code{1}, �����ॢ���Ȥξ��� @code{0}, ���顼�ξ��(��
�����­�䥹��åɤ� @code{mysqladmin kill} �ǻ����줿���ʤ�)�� @code{NULL}
���֤�ޤ���@code{RELEASE_LOCK} �μ¹ԡ������� @code{GET_LOCK} �μ¹ԡ�
����åɤν�λ�ξ��ˡ����å��ϲ�������ޤ������δؿ��ϥ��ץꥱ�������
���å���쥳���ɥ��å��Υ��ߥ�졼�ȤΤ���˻��ѤǤ��ޤ���
����ϡ�Ʊ��̾���Υ��å���Ԥ����Ȥ���¾�Υ��饤����Ȥ���Υꥯ�����Ȥ�
�֥��å����ޤ��� Ϳ����줿̾���Υ��å��˱����Ƥ��륯�饤����Ȥϡ�
��Ĵ���ƥ��å��󥰤�Ԥ�����ˡ�����ʸ�������ѤǤ��ޤ���

@example
mysql> select GET_LOCK("lock1",10);
        -> 1
mysql> select GET_LOCK("lock2",10);
        -> 1
mysql> select RELEASE_LOCK("lock2");
        -> 1
mysql> select RELEASE_LOCK("lock1");
        -> NULL
@end example

�����ܤ� @code{RELEASE_LOCK()} �� @code{NULL} ���֤��ޤ���
�ʤ��ʤ顢 @code{"lock1"} �ϡ������ܤ� @code{GET_LOCK()} �θƤӽФ������ǡ�
��ưŪ�˲�������뤫��Ǥ���

@findex RELEASE_LOCK()
@item RELEASE_LOCK(str)
@code{GET_LOCK} �dz����������å� @code{str} ��������ޤ������å�����
�����줿���� @code{1}, ���Υ���åɤˤ�äƥ��å�����Ƥ��ʤ����� @code{0} 
(���ξ�硢���å��ϲ�������ޤ���), 
@code{str}��¸�ߤ��ʤ����� @code{NULL} ���֤�ޤ���
�⤷�� @code{GET_LOCK()} �򥳡��뤷�������ʤ��ä���硢
���뤤�ϡ����˲�������Ƥ�����ϡ����å���¸�ߤ��ʤ��Ǥ��礦��

@findex BENCHMARK()
@item BENCHMARK(count,expr)
@code{BENCHMARK()} �ؿ��� @code{expr} ��Ϳ����줿ʸ�� @code{count} ��
�����֤��¹Ԥ��ޤ��� ����� @strong{MySQL} �Τ���ʸ�ν������ɤ줰�餤
®���Τ��Τ�Τ˻��Ѥ����Ǥ��礦�� ��̤Ͼ�� @code{0} �Ǥ���
���ꤷ�Ƥ�����Ѥϡ� @code{mysql} ���饤����ȤǤ���
���륯����μ¹Ի��֤��Τ뤿��λ��ѤǤ���

@example
mysql> select BENCHMARK(1000000,encode("hello","goodbye"));
+----------------------------------------------+
| BENCHMARK(1000000,encode("hello","goodbye")) |
+----------------------------------------------+
|                                            0 |
+----------------------------------------------+
1 row in set (4.74 sec)
@end example

��𤵤줿���֤ϡ����饤����ȤǤηв���֤Ǥ��� �����С�¦�� CPU ���֤Ǥ�
����ޤ���@code{BENCHMARK()} �򲿲󤫼¹Ԥ��ơ������Хޥ������٤νŤ�
���θ���Ʒ�̤��᤹�뤳�Ȥ򴫤�ޤ���

@findex INET_NTOA()
@item INET_NTOA(expr)
����ɽ�����Ф���ͥåȥ�����ɥ쥹(4 �ޤ��� 8 �Х���) ���֤��ޤ���

@example
mysql> select INET_NTOA(3520061480);
       ->  "209.207.224.40"
@end example

@findex INET_ATON()
@item INET_NTOA(expr)
�ͥåȥ�����ɥ쥹���Ф�����ͤ�ɽ���������֤��ޤ������ɥ쥹�� 4 �ޤ��� 
8 �Х��ȥ��ɥ쥹�Ǥ���

@example
mysql> select INET_ATON("209.207.224.40");
       ->  3520061480
@end example
@end table

@findex GROUP BY functions
@findex Functions, GROUP BY
@node Group by functions,  , Miscellaneous functions, Functions
@subsection @code{GROUP BY} ��δؿ�

@code{GROUP BY} ��ʤ��� ���롼�״ؿ�����Ѥ���ʤ顢
��������ƤΥ쥳���ɤ򥰥롼�ײ����뤳�Ȥˤʤ�ޤ���

@table @code
@findex COUNT()
@item COUNT(expr)
@code{SELECT} ʸ�ˤ�ä�������쥳���� �桢�ͤ� ��@code{NULL} ��
����쥳���ɤο����֤��ޤ���

@example
mysql> select student.student_name,COUNT(*)
           from student,course
           where student.student_id=course.student_id
           GROUP BY student_name;

@end example

�������줿�쥳���ɤο������쥳������� @code{NULL} �ͤ�ޤफ�ɤ����ǡ�
@code{COUNT(*)} ���֤��ͤϤϤ����֤�ۤʤ�ޤ���

�⤷ @code{SELECT} ����ĤΥơ��֥뤫�鸡���������ġ�
¾�Υե�����ɤ���������뤳�Ȥ�ʤ�������
@code{WHERE} �᤬̵���ʤ�С�
@code{COUNT(*)} ��®�������뤿��˺�Ŭ������ޤ���
�㤨�С�

@example
mysql> select COUNT(*) from student;
@end example

@findex COUNT(DISTINCT)
@findex DISTINCT
@item COUNT(DISTINCT expr,[expr...])
�ۤʤ��ͤο��Υ�����Ȥ��֤��ޤ���

@example
mysql> select COUNT(DISTINCT results) from student;
@end example

@strong{MySQL} �Ǥϡ����Υꥹ�Ȥ�Ϳ���뤳�Ȥǡ��̸Ĥμ����ȹ礻�ο�������
���Ȥ��Ǥ��ޤ���ANSI SQL �Ǥϡ����٤Ƥμ��� @code{CODE(DISTINCT ..)}  ���
��礹��ɬ�פ�����ޤ���

@findex AVG()
@item AVG(expr)
@code{expr}��ʿ���͡�

@example
mysql> select student_name, AVG(test_score)
           from student
           GROUP BY student_name;
@end example

@findex MIN()
@findex MAX()
@item MIN(expr)
@itemx MAX(expr)
@code{expr}.�κǾ�/�����͡�
@code{min()} �� @code{max()} ��ʸ�����������ȡ��Ǿ�/�����ʸ�����ͤ��֤��ޤ���

@example
mysql> select student_name, MIN(test_score), MAX(test_score)
           from student
           GROUP BY student_name;
@end example

@findex SUM()
@item SUM(expr)
@code{expr}��.
����: ��̥��åȤ�����쥳���ɤ��֤��ʤ����ϡ������ NULL ���֤��ޤ���

@findex STD()
@findex STDDEV()
@cindex Oracle compatibility
@cindex Compatibility, with Oracle
@item STD(expr)
@itemx STDDEV(expr)
@code{expt} ��ɸ��ͶƳ(standard derivative)������� @code{ANSI SQL} ���Ф����ĥ�Ǥ���
���δؿ��� @code{STDDEV()} �����ϡ�Oracle �ߴ��Τ�����󶡤���ޤ�����

@findex BIT_OR()
@item BIT_OR(expr)
@code{expr} ������ƤΥӥåȤ����� @code{OR}��64 �ӥå�(@code{BIGINT})����
�٤Ƿ׻�����ޤ���

@findex BIT_AND()
@item BIT_AND(expr)
@code{expr} ������ƤΥӥåȤ����� @code{AND}��64 �ӥå�(@code{BIGINT})��
���٤Ƿ׻�����ޤ���
@end table

@strong{MySQL} �� @code{GROUP BY} ���ĥ���Ƥ��ޤ���@code{SELECT} ɽ�����
@code{GROUP BY} ���˸���ʤ��ե�����ɤޤ��Ϸ׻�����ѤǤ��ޤ�������� @emph{���Υ��롼
�פΤ�������Ƥβ�ǽ����} ��ɽ���Ƥ��ޤ������λ��Ѥˤ�ꡢɬ�פʤ��ե�����ɤ�
�Υ����Ȥȥ��롼�פ��򤱤���Τǡ��⤤��ǽ�������ޤ����㤨�С����Υ�
����Ǥ� @code{customer.name} �ǥ��롼�פ���ɬ�פϤ���ޤ���:

@example
mysql> select order.custid,customer.name,max(payments)
       from order,customer
       where order.custid = customer.custid
       GROUP BY order.custid;
@end example

ANSI SQL �Ǥϡ�@code{GROUP BY} ��� @code{customer.name} ���ɲä���ɬ�פ�����ޤ���
@strong{MySQL} �Ǥϡ�ANSI �⡼�ɤǼ¹Ԥ��Ƥ��ʤ����ϡ�name �Ͼ�Ĺ�Ǥ���

@code{GROUP BY} �������ά�����ե�����ɤ����롼����ǰ�դǤʤ����ϡ���
�ε�ǽ����Ѥ��ʤ��Ǥ���������

�����Ĥ��Υ������Ǥϡ����줬��դǤʤ����Ǥ⡢@code{MIN()} �� 
@code{MAX()} ������Υե�������ͤ�������뤿��˻��Ѥ��뤳�Ȥ��Ǥ��ޤ���
���ϡ�@code{sort} �ե��������κǾ����ͤ�ޤ�쥳���ɤ���� 
@code{column} ���ͤ�Ϳ���ޤ�:

@example
substr(MIN(concat(sort,space(6-length(sort)),column),7,length(column)))
@end example

@cindex @code{ORDER BY}, aliases in
@cindex Aliases, in @code{ORDER BY} clauses
@cindex @code{GROUP BY}, aliases in
@cindex Aliases, in @code{GROUP BY} clauses
@cindex Expressions, aliases for
@cindex Aliases, for expressions
����: @strong{MySQL} 3.22 (�ޤ��Ϥ������) ����Ѥ��Ƥ����硢�ޤ���
ANSI SQL �˽������Ȥ��Ƥ�����ϡ�@code{GROUP BY} �� @code{ORDER BY} ���
������ѤǤ��ޤ��󡣼�����̾����Ѥ��뤳�ȤǤ������¤����Ǥ��ޤ�:

@example
mysql> SELECT id,FLOOR(value/100) AS val FROM tbl_name
           GROUP BY id,val ORDER BY val;
@end example

@code{MySQL} 3.23 �Ǥϼ���Ԥʤ����Ȥ��Ǥ��ޤ�:

@example
mysql> SELECT id,FLOOR(value/100) FROM tbl_name ORDER BY RAND();
@end example

@findex CREATE DATABASE
@node CREATE DATABASE, DROP DATABASE, Functions, Reference
@section @code{CREATE DATABASE}��ʸ

@example
CREATE DATABASE [IF NOT EXISTS] db_name
@end example

@code{CREATE DATABASE} ��Ϳ����줿̾���Υǡ����١�������ޤ����ǡ����١�����̾���Ȥ��Ƶ������̿̾��§�ϡ�@ref{Legal names}�˰ͤ�ޤ���
�⤷���ǡ����١��������Ǥ�¸�ߤ��Ƥ���ˤ⤫����餺 @code{IF NOT EXISTS} ��
���ꤷ�Ƥ��ʤ��ä��顢���顼��ȯ�����ޤ���

@strong{MySQL}�ˤ�����ǡ����١����ϡ��ǡ����١�����Υơ��֥����������ե������ޤ�ǥ��쥯�ȥ�Ȥ��Ƽ�������ޤ������������ϥǡ����١�����˥ơ��֥��¸�ߤ�����@code{CREATE DATABASE}���ơ��ȥ��Ȥϡ�@strong{MySQL}�ǡ����ǥ��쥯�ȥ겼�˥ǥ��쥯�ȥ�������������Ǥ���

@cindex @code{mysqladmin}
@code{mysqladmin}�Ǥ�ǡ����١�����������뤳�Ȥ��Ǥ��ޤ���
@xref{Programs}.

@findex DROP DATABASE
@node DROP DATABASE, CREATE TABLE, CREATE DATABASE, Reference
@section @code{DROP DATABASE}��ʸ

@example
DROP DATABASE [IF EXISTS] db_name
@end example

@code{DROP DATABASE}�ϡ��ǡ����١���������ƤΥơ��֥�ȶ��˥ǡ����١������˴����ޤ���@strong{���Υ��ޥ�ɤλ��Ѥˤ����������դ�ʧ�äƲ�������} 

@code{DROP DATABASE}�ϡ��ǡ����١����ǥ��쥯�ȥ꤫�������줿�ե�����ο����֤��ޤ������줾��Υơ��֥��@file{.MYD}�ե����롿@file{.MYI}�ե����롿@file{.frm}�ե�������������뤳�Ȥ��顢�̾盧���ͤϥơ��֥�Σ��ܤο��Ȥʤ�ޤ���

@strong{MySQL} 3.22�ʹߤǤϡ��ǡ����١�����¸�ߤ��ʤ����Ȥ˵������륨�顼���ɤ�����ˡ�������� @code{IF EXISTS} ����Ѥ��뤳�Ȥ��Ǥ��ޤ���

@cindex @code{mysqladmin}
@code{mysqladmin}�Ǥ�ǡ����١������˴����뤳�Ȥ��Ǥ��ޤ���
@xref{Programs}.

@findex CREATE TABLE
@node CREATE TABLE, ALTER TABLE, DROP DATABASE, Reference
@section @code{CREATE TABLE}��ʸ

@menu
* Silent column changes::       Silent column changes
@end menu

@example
CREATE [TEMPORARY] TABLE [IF NOT EXISTS] tbl_name [(create_definition,...)]
[table_options] [select_statement]

create_definition:
  col_name type [NOT NULL | NULL] [DEFAULT default_value] [AUTO_INCREMENT]
            [PRIMARY KEY] [reference_definition]
  or    PRIMARY KEY (index_col_name,...)
  or    KEY [index_name] (index_col_name,...)
  or    INDEX [index_name] (index_col_name,...)
  or    UNIQUE [INDEX] [index_name] (index_col_name,...)
  or    [CONSTRAINT symbol] FOREIGN KEY index_name (index_col_name,...)
            [reference_definition]
  or    CHECK (expr)

type:
        TINYINT[(length)] [UNSIGNED] [ZEROFILL]
  or    SMALLINT[(length)] [UNSIGNED] [ZEROFILL]
  or    MEDIUMINT[(length)] [UNSIGNED] [ZEROFILL]
  or    INT[(length)] [UNSIGNED] [ZEROFILL]
  or    INTEGER[(length)] [UNSIGNED] [ZEROFILL]
  or    BIGINT[(length)] [UNSIGNED] [ZEROFILL]
  or    REAL[(length,decimals)] [UNSIGNED] [ZEROFILL]
  or    DOUBLE[(length,decimals)] [UNSIGNED] [ZEROFILL]
  or    FLOAT[(length,decimals)] [UNSIGNED] [ZEROFILL]
  or    DECIMAL(length,decimals) [UNSIGNED] [ZEROFILL]
  or    NUMERIC(length,decimals) [UNSIGNED] [ZEROFILL]
  or    CHAR(length) [BINARY]
  or    VARCHAR(length) [BINARY]
  or    DATE
  or    TIME
  or    TIMESTAMP
  or    DATETIME
  or    TINYBLOB
  or    BLOB
  or    MEDIUMBLOB
  or    LONGBLOB
  or    TINYTEXT
  or    TEXT
  or    MEDIUMTEXT
  or    LONGTEXT
  or    ENUM(value1,value2,value3,...)
  or    SET(value1,value2,value3,...)

index_col_name:
        col_name [(length)]

reference_definition:
        REFERENCES tbl_name [(index_col_name,...)]
                   [MATCH FULL | MATCH PARTIAL]
                   [ON DELETE reference_option]
                   [ON UPDATE reference_option]

reference_option:
        RESTRICT | CASCADE | SET NULL | NO ACTION | SET DEFAULT

table_options:
	TYPE = @{ISAM | MYISAM | HEAP@}
or	AUTO_INCREMENT = #
or	AVG_ROW_LENGTH = #
or	CHECKSUM = @{0 | 1@}
or	COMMENT = "string"
or	MAX_ROWS = #
or	MIN_ROWS = #
or	PACK_KEYS = @{0 | 1@}
or	PASSWORD = "string"
or	DELAY_KEY_WRITE = @{0 | 1@}
or      ROW_FORMAT= @{ default | dynamic | static | compressed @}
or     RAID_TYPE= @{1 | STRIPED | RAID0 @} RAID_CHUNKS=#  RAID_CHUNKSIZE=#;

select_statement:
	[IGNORE | REPLACE] SELECT ...  (Some legal select statement)
@end example


@code{CREATE TABLE}�ϥ����ȥǡ����١����ˡ�Ϳ����줿̾���Υơ��֥��
�������ޤ����ơ��֥��̾���Ȥ��Ƶ������̿̾��§�ϡ�@xref{Legal names}��
�ͤ�ޤ���
�����ȥǡ����١�����̵�����䡢�ơ��֥뤬����¸�ߤ��Ƥ�����ϥ��顼��
ȯ�����ޤ���

@strong{MySQL} 3.22 �ʹߤǤϥơ��֥�̾�� @code{db_name.tbl_name} �Ȥ�������Ϳ�������Ǥ��ޤ���
����ϥ����ȥǡ����١��������뤫�ɤ����ˤ˴ط��ʤ�ư��ޤ���

@strong{MySQL} 3.23 �Ǥϡ��ơ��֥�������� @code{TEMPORARY} ������ɤ���Ѥ��뤳�Ȥ�
�Ǥ��ޤ��� ����ơ��֥�ϡ��⤷�����ͥ�������������硢��ư�Ǿõ��ޤ���
����ơ��֥��̾���Ϥ��줾�����³���ȤǤ���
����ϡ���Ĥΰ㤦��³�ǡ�Ʊ��̾���ΰ���ơ��֥��
���ͤ��뤳�Ȥʤ������ѤǤ���Ȥ������Ǥ���
����ˤϡ�����¸�ߤ���ơ��֥��Ʊ̾�Ǥ��äƤ⡢����ơ��֥�ϻ��ѤǤ��ޤ���
(����ơ��֥뤬��������ޤǡ��ºߤ���ơ��֥�ϱ�����ޤ�)

@strong{MySQL} 3.23 �ʹߤǤϡ� @code{IF NOT EXISTS} ������ɤ���ѤǤ��ޤ���
����ϡ��⤷�ơ��֥뤬����¸�ߤ��Ƥ�����硢���顼��ȯ�������ޤ���
�ơ��֥�ι�¤����դ��ɤ����ޤǤϸ������ʤ����Ȥ����ա�

���줾��Υơ��֥�ϡ��ǡ����١����ǥ��쥯�ȥ�ˤ�����ʲ���ʣ����
�ե������ɽ����ޤ�������� MyISAM �� �Υơ��֥��硧

@multitable @columnfractions .2 .8
@item @strong{�ե�����} @tab @strong{��Ū}
@item @code{tbl_name.frm} @tab �ơ��֥����(��)�ե�����
@item @code{tbl_name.MYD} @tab �ǡ����ե�����
@item @code{tbl_name.MYI} @tab ����ǥå����ե�����
@end multitable

�ե�����ɤ��Ф����η�°���ξܺ٤ϡ�@ref{Column types}�򻲾ȤΤ��ȡ�

@itemize @bullet
@item
 @code{NULL}��@code{NOT NULL}����ꤵ��ʤ��ä���硢�ե�����ɤ�@code{NULL}�����ꤵ�줿��ΤȤ��ư����ޤ���

@item
   �������Υե�����ɤˤ��ղ�°��@code{AUTO_INCREMENT}����ꤹ�뤳�Ȥ��Ǥ��ޤ���@code{AUTO_INCREMENT}�Υե�����ɤ���@code{NULL}����@code{0}������������硢�ե�����ɤˤ�@code{value+1}���ͤ����åȤ���ޤ���@code{value}�ϡ����Υơ��֥���������ե�����ɤˤ����븽�ߤκ����ͤǤ���
@code{AUTO_INCREMENT} �� @code{1} ����Ϥ��ޤ�ޤ�.
@xref{mysql_insert_id, , @code{mysql_insert_id()}}.

 ��������쥳���ɤ���@code{AUTO_INCREMENT}�ե�����ɤκ����ͤ�ޤ�Ǥ�����硢�����ͤϼ��˺����Ѥ���ޤ�(������������� ISAM �ơ��֥�ξ��ǡ�MyISAM �ơ��֥�Ǥϵ�����ޤ���)��
�ޤ����ơ��֥�������ƤΥ쥳���ɤ� @code{DELETE FROM TABLE} (@code{WHERE}��̵����) ��
���Ѥ��ƺ���������ϡ��Ϥᤫ����֤�ľ���ޤ���

@strong{����:} 1�ĤΥơ��֥�ˤ�1�Ĥ���@code{AUTO_INCREMENT}�ե�����ɤ����Ǥ��ޤ��󡣤ޤ�������ǥå�������ꤹ��ɬ�פ�����ޤ���
@strong{MySQL} 3.23 �� auto_increment �ե�����ɤ����ο�����äƤ������
������������ư��ޤ�����ο��������ϤȤƤ��礭�����ο��������Ȥߤʤ����
��������ϡ����ͤ���������ؤ� 'wrap' over ����������٤��������򤹤뤿
��ȡ��������ǥ��Ū�� 0 ��ޤ� auto_increment �ե�����ɤ����뤳�Ȥ��ʤ�
���Ȥ�μ¤ˤ��뤿��ˡ��Ԥʤ��ޤ���

@cindex ODBC compatibility
@cindex Compatibility, with ODBC
@strong{MySQL} �򤤤��Ĥ��� ODBC ���ץꥱ�������ȸߴ��ˤ��뤿��ˡ�����
������ǺǸ���������줿�쥳���ɤ򸫤Ĥ��뤳�Ȥ��Ǥ��ޤ�:

@example
SELECT * FROM tbl_name WHERE auto_col IS NULL
@end example

@item
@code{TIMESTAMP}�ե�����ɤˤ�����@code{NULL}�ͤϡ�¾�Υե������°���Ȱ�ä���������򤷤ޤ������@code{NULL}��@code{TIMESTAMP}�ե�����ɤ˳�Ǽ���뤳�ȤϤǤ��ޤ���@code{NULL}�ͤλ���ϸ��߻���򥻥åȤ��뤳�Ȥ��̣���ޤ���@code{TIMESTAMP}�ե�����ɤ����Τ褦�˿��񤦤Τǡ��̾��@code{NULL}°����@code{NOT NULL}°����Ŭ�ѤǤ��ޤ��󡣤�������ꤷ�Ƥ�̵�뤵��ޤ���

 ������@strong{MySQL}���饤����Ȥ���ϡ����°פ�@code{TIMESTAMP}�ե�����ɤ����ѤǤ��������Ф�@code{TIMESTAMP}�ե�����ɤؤ�@code{NULL}��Ŭ�Ѥ���𤷤ޤ�����@code{TIMESTAMP}�ե�����ɤϼºݤˤ�@code{NULL}�ͤ���¸���뤳�ȤϤ���ޤ���@code{DESCRIBE tbl_name}����Ѥ��ơ��ơ��֥����ʸ��������뤳�Ȥˤ�ꡢ���θ��ݤ��ǧ���뤳�Ȥ��Ǥ��ޤ���

 @code{TIMESTAMP}�ե�����ɤ�@code{0}����ꤹ�뤳�Ȥϡ�@code{NULL}����ꤹ�뤳�Ȥ��������ʤ����Ȥ����դ��Ƥ����������ʤ��ʤ顢@code{0}��@code{TIMESTAMP}���ͤȤ��������Ǥ��뤫��Ǥ���

@item
�ե�����ɤ��Ф��� @code{DEFAULT} �ͤ����ꤵ��ʤ����� @strong{MySQL} ��
��ưŪ�ˤ���������Ƥޤ���

�ե�����ɤ� @code{NULL} ���ͤȤ��Ƽ��������ϡ��ǥե�����ͤ� 
@code{NULL} �Ǥ���

�ե�����ɤ� @code{NOT NULL} �Ȥ���������줿���ϡ��ǥե�����ͤϥե���
��ɷ��˰�¸���ޤ�:

@itemize @minus
@item
@code{AUTO_INCREMENT} ������줿�ʳ��ο��ͷ��Υե�����ɤ��Ф��Ƥϡ�
����ͤ�@code{0}�Ȥʤ�ޤ���
@code{AUTO_INCREMENT}�ե�����ɤǤϡ��ǥե�����ͤϼ��Υ��������ֹ�ˤʤ�ޤ���

@item
@code{TIMESTAMP} ���ʳ������շ��Ȼ��﷿�Υե�����ɤ��Ф��Ƥϡ�
����ͤϤ��η��ˤ�����Ŭ�ڤ�``����''�ͤȤʤ�ޤ���
�㳰: �ե�����ɤ����Υơ��֥���Ǻǽ��@code{TIMESTAMP}�ե�����ɤǤ����硢����ͤϸ��߻���ˤʤ�ޤ���
@xref{Date and time types}.

@item
@code{ENUM} �ʳ���ʸ���󷿤Υե�����ɤ��Ф��Ƥϡ�����ͤ϶�ʸ����Ȥʤ�ޤ���
@code{ENUM} �Ǥϡ��ǥե�����ͤϺǽ������ͤǤ���
@end itemize

@item
@code{KEY}�ϡ�@code{INDEX}��Ʊ����Ǥ���

@item
@strong{MySQL}�Ǥϡ�@code{UNIQUE}�����ϸ�ͭ�ͤ������Ĥ��Ȥ��Ǥ��ޤ��󡣴���¸�ߤ���쥳���ɤȥ������ͤ���ʣ����쥳���ɤ��������褦�Ȥ�����硢���顼��ȯ�����ޤ���

@item
@code{PRIMARY KEY} �ϥ�ˡ��� @code{KEY} �ǡ����٤ƤΥ����ե�����ɤ� 
@code{NOT NULL} �Ȥ����������ʤ���Фʤ�ʤ��Ȥ������̤����¤�ȼ���ޤ���
@strong{MySQL} �Ǥϥ����� @code{PRIMARY} ��̾�դ����ޤ����ơ��֥�� 
@code{PRIMARY KEY} ���Ĥ������Ĥ��Ȥ��Ǥ��ޤ���@code{PRIMARY KEY} �����
�ʤ����ˡ����ץꥱ������󤬥ơ��֥���� @code{PRIMARY KEY} ��Ҥͤ�ȡ�
@strong{MySQL} �� @code{PRIMARY KEY} �Ȥ��ơ�@code{NULL} �ե�����ɤ����
�ʤ��ǽ�� @code{UNIQUE} �������֤��ޤ���

@item
@code{PRIMARY KEY}��ʣ���ե�����ɥ���ǥå����ȤǤ��ޤ����������ʤ��顢1�ĤΥե�����������Ǥ�@code{PRIMARY KEY}°�����Ѥ���ʣ�祤��ǥå�����������뤳�Ȥ��Ǥ��ޤ���Τǡ��ե�����������ˤ��������ϡ��ץ饤�ޥꡦ������ñ�ȥե�����ɤξ��ΤߤȤ��Ʋ�������ʣ��ե�����ɤξ��ϡ�@code{PRIMARY KEY(index_col_name,...)}ʸ����Ѥ��ʤ���Фʤ�ޤ���

@item
@code{PRIMARY} �� @code{UNIQUE} ���������ĤΥե�����ɤ�������ʤꡢ���η���������
��硢����� @code{_rowid} �Ȥ��Ƥ⻲�Ȥ��뤳�Ȥ��Ǥ��ޤ�(3.23.11 �Ǥο���
ǽ)��

@item
����ǥå�����̾���������Ƥʤ���硢��դ�̾�����դ��뤿��ˡ�@code{index_col_name}��κǽ�Υե������̾��(@code{_2}, @code{_3}, ...)�Τ褦�ʥ��ե��å������ղä�����Τ�������Ƥ��ޤ����ơ��֥뤬���Ѥ��Ƥ��륤��ǥå���̾�ϡ�@code{SHOW INDEX FROM tbl_name}�ˤ���ǧ���뤳�Ȥ��Ǥ��ޤ���
@xref{SHOW, , @code{SHOW}}.

@item
@cindex @code{NULL} values, and indexes
@cindex Indexes, and @code{NULL} values
@code{MyISAM} �ơ��֥�Τߤ���@code{NULL} �ͤ��ĥե�����ɤ��Ф���
����ǥå�������Ĥ��Ȥ�����ޤ���
����¾�Υơ��֥뷿�ξ�硢�ե�����ɤ� @code{NOT NULL} ��������ʤ��ƤϤʤ�ޤ���

@item
@code{col_name(length)}ʸ�򶦤˻��ꤹ�뤳�Ȥǡ�@code{CHAR}�ե����������@code{VARCHAR}�ե�����ɤΰ���ʬ�����򥤥�ǥå����Ȥ�������Ǥ��ޤ�������ˤ�ꥤ��ǥå����ե������Ŭ�٤˾��������뤳�Ȥ��Ǥ��ޤ���
@xref{Indexes}.

@item
@cindex @code{BLOB} columns, indexing
@cindex Indexes, and @code{BLOB} columns
@cindex @code{TEXT} columns, indexing
@cindex Indexes, and @code{TEXT} columns
@code{MyISAM} �ơ��֥뷿�Τߤ��� @code{BLOB} �� @code{TEXT} �ե�����ɾ��
����ǥå�������Ĥ��Ȥ�����ޤ��� @code{BLOB} �� @code{TEXT} �ե�����ɤ�
����ǥå�����ĥ���硢��ˡ�����ǥå�����Ĺ������ꤷ�ʤ��ƤϤʤ�ޤ���
@example
CREATE TABLE test (blob_col BLOB, index(blob_col(10)));
@end example

@item
@code{TEXT}�ե�����ɤ�@code{BLOB}�ե�����ɤ� @code{ORDER BY} �� @code{GROUP BY} ��
���Ѥ���ȡ��ǽ��@code{max_sort_length}�Х��Ȥ��������Ѥ���ޤ���
@xref{BLOB,  , @code{BLOB}}.

@item
@code{FOREIGN KEY}��@code{CHECK}�ڤ�@code{REFERENCES}��ϼºݤˤϲ���Ԥ��ޤ��󡣤����ι�ʸ�ϡ��ߴ����Τ���������Ѱդ���Ƥ��ꡢ¾��SQL�����Ф���Υ����ɤΰܿ����ưפˤ����ꡢ���Ⱦ���ȶ��˥ơ��֥���������褦�ʥ��ץꥱ��������ư����뤳�Ȥ���Ū�Ȥ��Ƥ��ޤ���
@xref{Missing functions}.

@item
���Ƥ�@code{NULL}�ե�����ɤϡ�1�ӥå�;�פ˾��񤷡�ľ��ΥХ��Ȥ˴ݤ���ޤ���

@item
�쥳���ɤκ���Ĺ�ϡ��ʲ��Τ褦�ˤ��Ƶ����ޤ�:

@example
�쥳���ɤ�Ĺ�� = 1
           + (�ե�����ɤ�Ĺ���ι��)
           + (NULL�ե�����ɤο� + 7)/8
           + (����Ĺ�ե�����ɤο�)
@end example

@item @code{table_options} �� @code{SELECT} ���ץ����ϡ�
@strong{MySQL} 3.23 �ʾ�ǤΤ߼�������ޤ���
 
�ơ��֥뷿�ϡ�

@multitable @columnfractions .20 .80
@item ISAM @tab ���ꥸ�ʥ�Υơ��֥� @xref{ISAM}.
@item MyISAM @tab ���������Х��ʥ�ߴ��Υơ��֥� @xref{MyISAM}.
@item HEAP @tab ���Υơ��֥�Υǡ����ϡ����꡼��ˤΤ��ߤ����� @xref{HEAP}.
@item BDB �ޤ��� Berkeley_db @tab �ȥ�󥶥����������ʥơ��֥� @xref{BDB}.
@end multitable
@xref{Table types}.

����¾�Υơ��֥륪�ץ�����Ȥäơ��ơ��֥�ο����񤤤��Ŭ�����ޤ���
�����Ƥ��ξ��ϡ����ץ�������������ɬ�פ�����ޤ��� 
����Ū�˻��ꤵ��ʤ��ä���硢���ץ����Ϥ��٤ƤΥơ��֥뷿�˺��Ѥ��ޤ���

@multitable @columnfractions .20 .80
@item @code{AUTO_INCREMENT} @tab ���ʤ������Υơ��֥�˥��åȤ����������� auto_increment ��
@item @code{AVG_ROW_LENGTH} @tab �ơ��֥�˴ޤޤ��쥳���ɤ�Ĺ���Τ����褽��ʿ���͡� ����Ĺ�Υ쥳���ɤ���ľ��ˤΤߡ�����򥻥åȤ��ޤ���
@item @code{CHECKSUM} @tab @strong{MySQL} �����ƤΥ쥳���ɤ�����å�����������硢����� 1 �˥��åȤ��ޤ��� (����Ϲ������٤������ޤ�������������������ơ��֥�򸫤Ĥ��Ф��䤹���ʤ�ޤ�) (MyISAM)
@item @code{COMMENT} @tab �ơ��֥�Ρ�60ʸ��������
@item @code{MAX_ROWS} @tab ���ʤ����ơ��֥����¸�������ȹͤ��Ƥ������쥳���ɿ���
@item @code{MIN_ROWS} @tab ���ʤ����ơ��֥����¸�������ȹͤ��Ƥ������쥳���ɿ�
@item @code{PACK_KEYS} @tab ��꾮��������ǥå����ˤ������ʤ顢����� 1 �ˤ��ޤ��� ����Ϲ������٤����ޤ������ɤ߽Ф���®���ʤ�ޤ� (MyISAM, ISAM).
@item @code{PASSWORD} @tab @code{.frm} �ե������ѥ�����դ��ǰŹ沽�� ���Υ��ץ����ϡ�ɸ��� @strong{MySQL} �С������ǤϤʤˤ�Ԥ��ޤ���
@item @code{DELAY_KEY_WRITE} @tab �ơ��֥뤬�������������ޤǥ����ơ��֥�ι��������餻������硢1�����ꤷ�ޤ�(MyISAM)��
@item @code{ROW_FORMAT} @tab �쥳���ɤ��ɤΤ褦�˳�Ǽ����뤫��������ޤ�(����Τ���)��
@end multitable

@code{MyISAM} �ơ��֥����Ѥ���ʤ�С�@strong{MySQL} ��
@code{max_rows * avg_row_length} ���ͤ򡢥ơ��֥뤬�ɤΤ��餤�礭���ʤ뤫
�ο���˻��Ѥ��ޤ��� 
�⤷���嵭�Υ��ץ�����ʤˤ���ꤷ�ʤ��ä���硢�ơ��֥�κ��祵������
4G �ˤʤ�ޤ���(�������ʤ��� OS �� 2G �������ݡ��Ȥ��Ƥ��ʤ���� 2G �ޤ�)

@code{PACK_KEYS} ����Ѥ��ʤ���硢�ǥե���Ȥ�ʸ���������ѥå���������
�ϥѥå����ޤ���@code{PACK_KEYS=1} ����Ѥ���Ȥ���˿��ͤ�ѥå������
����

�Х��ʥ���ͥ�����ѥå��������@strong{MySQL} �ϥץ�ե��å������̤����
���ޤ�������ϡ�Ʊ�����ͤ�¿�����ľ��ˤ��������礭�ʲ��ä�����Ȥ�������
���̣���ޤ����ץ�ե��å������̤ϡ����Υ����β��Х��Ȥ����Υ�����Ʊ���Ǥ�
�뤫�򼨤������;�פ�1�Х��Ȥ����٤ƤΥ�����ɬ�פȤʤ뤳�Ȥ��̣���ޤ�(��
��: �쥳���ɤؤΥݥ��󥿤ϡ����̤θ���Τ��� high-byte-first-order �ǥ���
��ľ��˳�Ǽ����ޤ�)������ϡ�2�ĤΥ쥳���ɤ�Ʊ������¿�����ľ�硢��Τ�
�٤Ƥ�'Ʊ��'�������̾�2�Х���(�쥳���ɤؤΥݥ��󥿤�ޤ�)������ɬ�פȤ���
�Ȥ������ȤǤ���������̾�Υ���������Ӥ��ƤߤƤ����������̾�Υ������ϡ�
��Υ�����'�����γ�Ǽ������' + �ݥ��󥿥�����(�̾�4)��ɬ�פȤ��ޤ���������
���٤ƤΥ����������ۤʤäƤ���ȡ������� @code{NULL} �ͤ���Ĥ��Ȥ��Ǥ���
�����ǤϤʤ����Ǥϡ��������1�Х��Ȥ���񤷤ޤ�(���ξ�硢�ѥå����줿����
��Ĺ���ϡ������� @code{NULL} �λ��˥ޡ����Τ���˻��Ѥ����Τ�Ʊ���Х���
���dz�Ǽ����ޤ�)��

@item
�⤷ @code{CREATE STATEMENT} �θ�� @code{SELECT} ����ꤹ��ʤ�С�
@strong{MySQL} �ϡ�@code{SELECT} ���֤äƤ������Ƥι��ܤ����뤿��ˡ�
�������ե�����ɤ�������ޤ���
�㤨�С�

@example
mysql> CREATE TABLE test (a int not null auto_increment,
           primary key (a), key(b))
           TYPE=HEAP SELECT b,c from test2;
@end example

����� 3�ĤΥե�����ɤ� @code{HEAP} �ơ��֥�˺������ޤ���
�⤷�ǡ�����ơ��֥�˥��ԡ����Ƥ������˥��顼���������ʤ顢
���Υơ��֥�ϼ�ưŪ�˾õ��뤳�Ȥ����դ��Ƥ���������

@item
@code{RAID_TYPE} ���ץ����ϡ��絬�ϥե�����򥵥ݡ��Ȥ��Ƥ��ʤ� OS ���
2G/4G�����¤��ˤ������򤷤ޤ����ޤ���@code{RAID} �ǥ��쥯�ȥ���̤�ʪ��
�ǥ��������֤����Ȥˤ�ꡢIO �ܥȥ�ͥå����餵���®�٤����뤳�Ȥ��Ǥ���
����@code{RAID_TYPE} �ϡ�@strong{MySQL} �� @code{--with-raid} �ǥ���ե���
����С��ɤ�� OS ��Ǥ�Ư���ޤ������ߡ�@code{RAID_TYPE} �� 
@code{STRIPED} ������������Ƥ��ޤ�(@code{1} �� @code{RAID0} �Ϥ������̾
�Ǥ�)��

@code{RAID_TYPE=STRIPED} �� @code{MyISAM} �ơ��֥�˻��ꤹ��ȡ�
@code{MyISAM} �ϥǡ����١����ǥ��쥯�ȥ���� 00, 01, 02 �Ȥ���̾���� 
@code{RAID_CHUNKS} ���֥ǥ��쥯�ȥ���������ޤ��������Υǥ��쥯�ȥ�Τ�
�줾��ˡ�@code{MyISAM} �� @code{table_name.MYD} ���������ޤ����ǡ����ե�
����˥ǡ������񤭹��ޤ�����@code{RAID} �ϥ�ɥ�Ϻǽ�� 
@code{RAID_CHUNKSIZE} *1024 �Х��Ȥ�ǽ�Υե�����ˡ����� 
@code{RAID_CHUNKSIZE} *1024 �Х��Ȥ򼡤Υե�����˥ޥåפ��ޤ���
@end itemize


@node Silent column changes,  , CREATE TABLE, CREATE TABLE
@subsection ���ۤΥե����������ѹ�

�����Ĥ��Υ������ˤ�����@strong{MySQL}�ϡ�@code{CREATE TABLE}���ơ��ȥ��Ȥ�Ϳ����줿�ե�������������ۤ�����ѹ����ޤ�
(����� @code{ALTER TABLE} �ǵ����뤫�⤷��ޤ���)

@itemize @bullet
@item
�ե������Ĺ��4̤����@code{VARCHAR}�ե�����ɤ�@code{CHAR}���ѹ�����ޤ���

@item
�ơ��֥���ˤ����Ĥ��β���Ĺ�ե�����ɤ������硢���Ū�˥쥳�������Τ�����Ĺ�Ȥʤ�ޤ���
���η�̡��ơ��֥뤬�����Ĥ��β���Ĺ�ե������(@code{VARCHAR}��@code{TEXT}�ڤ�@code{BLOB})
����Ĥʤ�С�3ʸ������礭���ե������Ĺ�����Ƥ�@code{CHAR}�ե�����ɤϡ�
@code{VARCHAR}�ե�����ɤ��ѹ�����ޤ���
���Τ��Ȥϡ��ե�����ɤλ�����ˡ�ˤϱƶ����ޤ���
@strong{MySQL}�Ǥϡ�@code{VARCHAR}��ʸ������Ǽ���뤿���1�Ĥμ��ʤ˲᤮�ޤ���
@strong{MySQL}�ϡ����ڡ������Υ���С�������Ԥ��ޤ������ơ��֥�������®���Ԥ��ޤ���
@xref{Table types}.
 
@item
@code{TIMESTAMP}�ե�����ɤ�ɽ���������ϡ�2��14���ϰϤζ����Ǥʤ���Фʤ�ޤ���ɽ����������0��14����礭�����ꤷ����硢��������14�˶�������ޤ���1����13���ϰϤδ���ξ�硢�礭�����ζ����ͤ˶�������ޤ���

@item
@code{TIMESTAMP} �ե�����ɤˤ� @code{NULL} �������Ǥ��ޤ��� @code{NULL} ��
���ߤ������򥻥åȤ��ޤ���
@code{NULL} and @code{NOT NULL} °�����̾����ˡ�Ǥ�Ŭ�Ѥ��줺��������
Ϳ��������̵�뤵��ޤ���
@code{DESCRIBE tbl_name} �Ͼ�� @code{TIMESTAMP} �ե�����ɤ� @code{NULL} �ͤ��������
��줿����𤲤ޤ���

@item
@strong{MySQL} ��¾�� SQL �ǡ����١����λ��Ѥ��Ƥ��뷿�� @strong{MySQL} ����
�ޥåפ��ޤ��� @xref{Other-vendor column types}.
@end itemize

�⤷ @strong{MySQL} ���ե�����ɤη��򤢤ʤ������ꤷ����ΤȰ㤦��Τˤ������ɤ�����
�Τꤿ����硢�ơ��֥�κ�����alter ��ˡ� @code{DESCRIBE tbl_name} ��ʸ
��ȯ�Ԥ��ޤ���

@cindex @code{myisampack}
@code{myisampack}����Ѥ��ƥơ��֥�򰵽̤�����硢�̤Υե����������ѹ����������ٵ����뤳�Ȥ�����ޤ���
@xref{Compressed format}.

@findex ALTER TABLE
@node ALTER TABLE, DROP TABLE, CREATE TABLE, Reference
@section @code{ALTER TABLE}��ʸ

@example
ALTER [IGNORE] TABLE tbl_name alter_spec [, alter_spec ...]

alter_specification:
        ADD [COLUMN] create_definition [FIRST | AFTER column_name ]
  or    ADD [COLUMN] (create_definition, create_definition,...)
  or    ADD INDEX [index_name] (index_col_name,...)
  or    ADD PRIMARY KEY (index_col_name,...)
  or    ADD UNIQUE [index_name] (index_col_name,...)
  or    ALTER [COLUMN] col_name @{SET DEFAULT literal | DROP DEFAULT@}
  or    CHANGE [COLUMN] old_col_name create_definition
  or    MODIFY [COLUMN] create_definition
  or    DROP [COLUMN] col_name
  or    DROP PRIMARY KEY
  or    DROP INDEX index_name
  or    RENAME [AS] new_tbl_name
  or    table_options
@end example

@code{ALTER TABLE}�ϡ���¸�Υơ��֥�ι�¤�ѹ����ǽ�ˤ��ޤ���
�㤨�С��ե�����ɤ��ɲä���������ǥå����κ������˴�����¸�Υե������°�����ѹ����ڤӥե�����ɤ�ơ��֥뤽�Τ�Τ�̾�����ѹ��Ǥ���
�ޤ����ơ��֥�Υ����Ȥ�ơ��֥�η������ѹ����뤳�Ȥ��ǽ�Ǥ���
@xref{CREATE TABLE, , @code{CREATE TABLE}}.

�⤷ @code{ALTER TABLE} �ǥե������������Ѥ��Ƥ� @code{DESCRIBE tbl_name} ��
�ե�����ɤ��ѹ����Ƥ��ʤ��ȼ����ʤ顢����� @strong{MySQL} ��
 @ref{Silent column changes}. �˽Ҥ٤Ƥ�����ͳ�ΰ�Ĥ��ѹ����Ƥ��ʤ���ǽ����
����ޤ��� �㤨�С� @code{VARCHAR} �ե�����ɤ� @code{CHAR} �ˤ��褦�Ȥ����, 
@strong{MySQL} �Ϥ��Υơ��֥��¾�β���Ĺ�Υե�����ɤ����뤫���ꡢ
@code{VARCHAR} �Τޤޤˤ��褦�Ȥ��ޤ���

@code{ALTER TABLE}�ϥ��ꥸ�ʥ�Υơ��֥�ΰ��Ū�ʥ��ԡ���������뤳�Ȥˤ��ư��ޤ���
���ԡ��ؤ��ѹ���Ȥ���λ����ȡ����ꥸ�ʥ�Υơ��֥�Ϻ�����쿷�������줿����̾�����ѹ�����ޤ�����������Ƥ��ѹ�����ưŪ�˿������ơ��֥���Ф��Ƽ»ܤ���뤳�Ȥˤ�ꡢ���ä��ѹ�̵���˴�λ���ޤ���@code{ALTER TABLE}���¹Ԥ���Ƥ���֡����ꥸ�ʥ�Υơ��֥��¾�Υ��饤����Ȥ����ɤߤ�������ǽ�Ǥ������Υơ��֥�ؤι�����񤭹��ߤϡ��������ơ��֥뤬������λ�Ȥʤ�ޤ��٤餵��ޤ���

@itemize @bullet
@item
@code{ALTER TABLE}��Ȥ��ˤϡ����Υơ��֥��@strong{select}��@strong{insert}��
@strong{delete}��@strong{update}��@strong{create}�����줫��@strong{drop}
���¤�ɬ�פǤ���

@item
@code{IGNORE}��ANSI SQL92���Ф���@strong{MySQL}�γ�ĥ�Ǥ���
����ϡ��������ơ��֥�Υ�ˡ��������ǽ�ʣ�����ä�����ư������椷�ޤ���
@code{IGNORE}�����ꤵ��ʤ���硢���ԡ��ϰ۾ェλ����������Хå�����ޤ���
@code{IGNORE}�����ꤵ�줿��硢��ˡ��������ν�ʣ�����ä��쥳���ɤ��Ф����ǽ�Υ쥳���ɤ�������Ѥ���¾�Ϻ������ޤ���

@item
1�Ĥ�@code{ALTER TABLE}���ơ��ȥ��Ȥ���ǡ�@code{ADD}��@code{ALTER}��
@code{DROP}�����줫��@code{CHANGE}���ʣ��Ū��ȯ�Ԥ���ǽ�Ǥ���
����ϡ�@code{ALTER TABLE}���ơ��ȥ������1�Ĥ����������������
�����ʤ�ANSI SQL92���Ф���@strong{MySQL}�γ�ĥ�Ǥ���

@item
@code{CHANGE col_name}��@code{DROP col_name}�ڤ�@code{DROP
INDEX}��ANSI SQL92���Ф���@strong{MySQL}�γ�ĥ�Ǥ���

@item
@code{MODIFY} �� @code{Oracle} �� @code{ALTER TABLE} ��ĥ�Ǥ���

@item
���ץ�����@code{COLUMN}�ϼ�­�Ǥ��ꡢ���Ҥ�ʤ����Ȥ���ǽ�Ǥ���

@item
¾�Υ��ץ����̵����@code{ALTER TABLE tbl_name RENAME AS new_name}����Ѥ���ȡ�
@strong{MySQL}��@code{tbl_name}�˰��פ���ơ��֥��̾����ñ����ѹ����ޤ���
�ƥ�ݥ��ơ��֥�κ�����ɬ�פȤ��ޤ���

@item
@code{create_definition}�ϡ�@code{CREATE TABLE}�ˤ�����@code{ADD}��@code{CHANGE}��Ʊ����ʸ����Ѥ��ޤ���
@xref{CREATE TABLE, , @code{CREATE TABLE}}.

@item
@code{CHANGE old_col_name create_definition}�����Ѥ��뤳�Ȥˤ��ե�����ɤ�̾�����ѹ����뤳�Ȥ��Ǥ��ޤ���
���Τ褦�ʤ��Ȥ�Ԥ�����ˤϡ��ե�����ɤε�̾�Τȿ�̾�Ρ����줫�餽�Υե�����ɤθ��ߤη�����ꤹ��ɬ�פ�����ޤ����㤨�С�����@code{INTEGER}�ե�����ɤ�@code{a}����@code{b}���ѹ������硢�ʲ��Τ褦�˼¹Ԥ��뤳�Ȥ��Ǥ��ޤ�:

@example
mysql> ALTER TABLE t1 CHANGE a b INTEGER;
@end example

�⤷�ե�����ɤ�̾�����Ѥ��뤳�Ȥʤ������������ѹ����������Ǥ��äƤ⡢
���� @code{CHANGE} ��ʸ�ϡ����Ȥ�Ʊ��̾���Ǥ��äƤ⡢
���Ĥ�̾������ꤹ��褦�׵ᤷ�ޤ���
��:

@example
mysql> ALTER TABLE t1 CHANGE b b BIGINT NOT NULL;
@end example

������ @strong{MySQL} 3.22.16a �����,  @code{MODIFY} ����Ѥ��ơ�
̾���ѹ��򤹤뤳�Ȥʤ��ե�����ɤη����ѹ����뤳�Ȥ��Ǥ��ޤ���

@example
mysql> ALTER TABLE t1 MODIFY b BIGINT NOT NULL;
@end example

@item
@code{CHANGE} �� @code{MODIFY} ����Ѥ��ơ��ե�����ɤΰ����˥���ǥå���
��¸�ߤ���褦�ʥե�����ɤ�û�����褦�Ȥ��Ƥ�(�㤨�� @code{VARCHAR} �ե���
��ɤκǽ��10ʸ����ˤ˥���ǥå�����������)������ǥå������줿ʸ����
����ե�����ɤ�û�����뤳�ȤϤǤ��ޤ���

@item
@code{CHANGE} �� @code{MODIFY} ���Ѥ��ƥե�����ɤη����ѹ������硢
@strong{MySQL}�ϲ�ǽ�ʸ¤꿷�������˥ǡ����򥳥�С��Ȥ��褦�Ȼ�ߤޤ���

@item
@strong{MySQL} 3.22�ʹߤǤϡ�@code{FIRST}����@code{ADD ... AFTER col_name}����Ѥ��ơ��ơ��֥�Υ쥳������λ��ꤷ�����֤ˡ��ե�����ɤ��ɲä��뤳�Ȥ��Ǥ��ޤ���
�ǥե���ȤǤϡ��ե�����ɤ�(���Υ쥳���ɤ�)�Ǹ���ɲä���ޤ���

@item
@code{ALTER COLUMN}�ϡ��ե�����ɤο����ʽ���ͤ���ꤷ���ꡢ�ե�����ɤθŤ�����ͤ��������ꤷ�ޤ���
�Ť�����ͤ�������졢�ե�����ɤ�@code{NULL}�������硢�����ʽ���ͤ�@code{NULL}�Ȥʤ�ޤ���
@code{NULL}��������ʤ���硢@strong{MySQL}�Ϥ������ͤ������Ƥޤ���
������Ƥ����ͤϡ�
@ref{CREATE TABLE, , @code{CREATE TABLE}}. ����������Ƥ��ޤ���

@item
@code{DROP INDEX}�ϡ�����ǥå����������ޤ��������ANSI SQL92���Ф���@strong{MySQL}�γ�ĥ�Ǥ���

@item
�ե�����ɤ��ơ��֥뤫���������ȡ����Υե�����ɤ��ޤޤ�Ƥ��륤��ǥå�������⤽�Υե�����ɤ��������ޤ���
����ǥå��������������ƤΥե�����ɤ���������ȡ����Υ���ǥå�����������ޤ���

@item
@code{DROP PRIMARY KEY}�ϡ��ץ饤�ޥꡦ����ǥå����������ޤ����⤷�ץ饤�ޥꥤ��ǥå�����¸�ߤ��ʤ���С����Υơ��֥�κǽ��@code{UNIQUE}����ǥå������������ޤ���
(@strong{MySQL}�ϡ�����Ū��@code{PRIMARY KEY}�����ꤵ��ʤ���кǽ��@code{UNIQUE}������@code{PRIMARY KEY}�Ȥ��ư����ޤ���)

@item
@findex mysql_info()
C API�ؿ�@code{mysql_info()}�ˤ�ꡢ�ɤ�����Υ쥳���ɤ����ԡ����줿����(@code{IGNORE}�����ꤵ��Ƥ������)�ɤ�����Υ쥳���ɤ���ˡ��������ν�ʣ�ˤ�������줿����Ĵ�٤뤳�Ȥ��Ǥ��ޤ���

@item
@cindex Foreign keys
@cindex References
@code{FOREIGN KEY}��@code{CHECK}�ڤ�@code{REFERENCES}��ϡ��ºݤˤ�
���⤷�ޤ��󡣤����ι�ʸ�ϡ��ߴ����Τ���������Ѱդ���Ƥ��ꡢ
¾��SQL�����Ф���Υ����ɤΰܿ����ưפˤ����ꡢ
���Ⱦ���ȶ��˥ơ��֥���������褦�ʥ��ץꥱ��������ư��
�����뤳�Ȥ���Ū�Ȥ��Ƥ��ޤ���
@xref{Missing functions}.
@end itemize

�ʲ��ϡ�@code{ALTER TABLE}�λ������ɽ����Ǥ���
���˼����褦�˺������줿�ơ��֥�@code{t1}����Ϥ�ޤ�:

@example
mysql> CREATE TABLE t1 (a INTEGER,b CHAR(10));
@end example

�ơ��֥�@code{t1}��̾����@code{t2}���ѹ�����ˤ�:

@example
mysql> ALTER TABLE t1 RENAME t2;
@end example

�ե������ @code{a}�� @code{INTEGER} ���� @code{TINYINT NOT NULL} ��
(̾����Ʊ���ޤޤ�)�ѹ�����
@code{b} �� @code{CHAR(10)} ���� @code{CHAR(20)} ���ѹ����Ĥġ�
̾���� @code{b} ���� @code{c}���ѹ�����ˤ�:

@example
mysql> ALTER TABLE t2 MODIFY a TINYINT NOT NULL, CHANGE b c CHAR(20);
@end example

@code{TIMESTAMP}���ɲä���̾����@code{d}�Ȥ���ˤ�:

@example
mysql> ALTER TABLE t2 ADD d TIMESTAMP;
@end example

�ե������@code{d}�˥���ǥå������ɲä����ե������@code{a}��ץ饤�ޥꡦ�����Ȥ���ˤ�:

@example
mysql> ALTER TABLE t2 ADD INDEX (d), ADD PRIMARY KEY (a);
@end example

�ե������@code{c}��������ˤ�:

@example
mysql> ALTER TABLE t2 DROP COLUMN c;
@end example

@code{c} �Ȥ���̾���� @code{NULL} ����Ĥ��ʤ� @code{AUTO_INCREMENT} ����
�ե�����ɤ��ɲä�����������ˤ�:

@example
mysql> ALTER TABLE t2 ADD c INT UNSIGNED NOT NULL AUTO_INCREMENT,
           ADD INDEX (c);
@end example

�����Dz桹�� @code{c} �򥤥�ǥå������ꤷ���Τϡ� @code{AUTO_INCREMENT} �ե�����ɤ�
����ǥå����Ǥ���٤�������ǡ� @code{c} �� @code{NOT NULL} ���ꤷ�Ƥ���Τ�
����ǥå����ե�����ɤ� @code{NULL} �ˤǤ��ʤ�����Ǥ���

@code{AUTO_INCREMENT} �ե�����ɤ��ɲä�����硢�ե�����ɤ��ͤ�
��ưŪ�˥��������ֹ�������ޤ���

See also @xref{ALTER TABLE problems, , @code{ALTER TABLE} problems}.


@findex DROP TABLE
@node DROP TABLE, OPTIMIZE TABLE, ALTER TABLE, Reference
@section @code{DROP TABLE}��ʸ

@example
DROP TABLE [IF EXISTS] tbl_name [, tbl_name,...]
@end example

@code{DROP TABLE}�ϡ�1������1�İʾ�Υơ��֥���˴����ޤ����ơ��֥�����ƤΥǡ����ȥơ��֥������@emph{�˴�}����ޤ��Τǡ����Υ��ޥ�ɤλ��ѤϿ��Ť˹ԤäƤ���������

@strong{MySQL} 3.22�ʹߤǤϡ��ơ��֥뤬¸�ߤ��ʤ����Ȥ˵������륨�顼���ɤ�����ˡ�������� @code{IF EXISTS} ����Ѥ��뤳�Ȥ��Ǥ��ޤ���


@findex OPTIMIZE TABLE
@node OPTIMIZE TABLE, CHECK TABLE, DROP TABLE, Reference
@section @code{OPTIMIZE TABLE}��ʸ

@example
OPTIMIZE TABLE tbl_name
@end example

@code{OPTIMIZE TABLE}�ϡ��ơ��֥������ʬ���������ꡢ����Ĺ�ȤʤäƤ���ơ��֥�(@code{VARCHAR}��@code{BLOB}�⤷����@code{TEXT}�ե�����ɤ���ĥơ��֥�)��¿�����ѹ���ä������˻��Ѥ��٤��Ǥ���
������줿�쥳���ɤϥ�󥯥ꥹ�Ȥǰݻ����졢����@code{INSERT}���ϡ��Ť��쥳���ɰ��֤�����Ѥ��ޤ���
̤�����ΰ��������뤿���@code{OPTIMIZE TABLE}����Ѥ��뤳�Ȥ��Ǥ��ޤ���

@code{OPTIMIZE TABLE}�ϡ����ꥸ�ʥ�Υơ��֥�ΰ��Ū�ʥ��ԡ���������뤳�Ȥˤ��ư��ޤ���
�Ť��ơ��֥�Ͽ������ơ��֥��(̤���ѥ쥳���ɤ������)���ԡ����졢
���Υơ��֥뤬�������Ƥ��鿷�����ơ��֥��̾�����ѹ�����ޤ���
@code{OPTIMIZE TABLE}���¹Ԥ���Ƥ���֡����ꥸ�ʥ�Υơ��֥��¾�Υ��饤����Ȥ����ɤߤ�������ǽ�Ǥ���
���Υơ��֥�ؤι�����񤭹��ߤϡ��������ơ��֥뤬������λ�Ȥʤ�ޤ��٤餵��ޤ���
��������Ƥ��ѹ�����ưŪ�˿������ơ��֥���Ф��Ƽ»ܤ���뤳�Ȥˤ�ꡢ���ä��ѹ�̵���˴�λ���ޤ���


@findex CHECK TABLE
@node CHECK TABLE, REPAIR TABLE, OPTIMIZE TABLE, Reference
@section @code{CHECK TABLE} ��ʸ

@example
CHECK TABLE tbl_name[,tbl_name...] [TYPE = QUICK]
@end example

�ơ��֥�Υ��顼������å����ޤ������Υ��ޥ�ɤϼ��Υե�����ɤ���ĥơ���
����֤��ޤ�:

@multitable @columnfractions .35 .65
@item Table @tab �ơ��֥�̾
@item Op @tab ��� 'check'
@item Msg_type @tab @code{status}, @code{error}, @code{info}, @code{warning} �ΰ�ġ�
@item Msg_text @tab ��������
@end multitable

����: �����å����줿�ƥơ��֥���Ф�������¿���Υ쥳���ɤ������ޤ�����
��Σ��쥳���ɤ� @code{Msg_type status} �ˤʤꡢ�̾�� @code{OK} �Ǥ����
���Ǥ���@code{OK} �������ʤ����ϡ��ơ��֥�ν������̾��̤�¹Ԥ��٤���
����@xref{Table maintenance}��

@code{TYPE=QUICK} ��Ϳ����줿���ϡ�@strong{MySQL} �ϸ���Ĺ�쥳���ɥơ�
�֥�Υ쥳���ɤ��������ޤ���

@code{CHECK TABLE} �� @code{MyISAM} �ơ��֥������ư����ơ��֥���Ф��� 
@code{myisamchk -m table_name} �μ¹Ԥ�Ʊ�����ȤǤ���

@findex REPAIR TABLE
@node REPAIR TABLE, DELETE, CHECK TABLE, Reference
@section @code{REPAIR TABLE} ��ʸ

@example
REPAIR TABLE tbl_name[,tbl_name...] [TYPE = QUICK]
@end example

@code{REPAIR TABLE} �� @code{MyISAM} �ơ��֥������ư��ޤ����ơ��֥�� 
@code{myisamchk -r table_name} ��¹Ԥ��뤳�Ȥ�Ʊ���Ǥ���

���줿�ơ��֥�������ޤ������ޥ�ɤϼ��Υե�����ɤ�ޤ�ơ��֥���֤���
��:

@multitable @columnfractions .35 .65
@item Table @tab �ơ��֥�̾
@item Op @tab ��� 'repair'
@item Msg_type @tab @code{status}, @code{error}, @code{info}, @code{warning} �Τɤ줫
@item Msg_text @tab ������
@end multitable

����: �������줿�ƥơ��֥�ξ����¿���Υ쥳���ɤ����뤳�Ȥ�����ޤ����Ǹ�
�Σ��쥳���ɤ� @code{Msg_type status} �ˤʤꡢ�̾�� @code{OK} �Ǥ���٤�
�Ǥ���@code{OK} �������ʤ���С�@code{myisamchk -o} �ǥơ��֥�ν������
�ߤ�٤��Ǥ���@code{REPAIR TABLE} �Ϥޤ� @code{myisamchk} �Τ��٤ƤΥ��ץ���
���������Ƥ��ʤ�����Ǥ����ᤤ���衢�桹�Ϥ���������ˤ���ͽ��Ǥ���

If @code{TYPE=QUICK} is given then @strong{MySQL} will try to do a
@code{REPAIR} of only the index tree.

@findex DELETE
@node DELETE, SELECT, REPAIR TABLE, Reference
@section @code{DELETE}��ʸ 

@example
DELETE [LOW_PRIORITY] FROM tbl_name
    [WHERE where_definition] [LIMIT rows]
@end example

@code{DELETE}�ϡ�@code{tbl_name}��ꡢ@code{where_definition}�ˤ�Ϳ����줿�����������쥳���ɤ�������������줿�쥳���ɿ����֤��ޤ���

@code{WHERE}�����ꤹ�뤳�Ȥʤ���@code{DELETE}��ȯ�Ԥ�����硢���ƤΥ쥳���ɤ��������ޤ���
@strong{MySQL}�ϡ��������ơ��֥��ƺ������뤳�ȤǼ¸����Ƥ��ꡢ����ϡ����ƤΥ쥳���ɤ�ºݤ˺��������⤫�ʤ��᤯ư��ޤ���
���ξ��@code{DELETE}�ϡ��ƶ��Τ��ä��쥳���ɿ��Ȥ���0���֤��ޤ���
(�ƺ����ϡ����Υǡ�������Ǽ����Ƥ���ե�����򥪡��ץ󤹤뤳�Ȥʤ��»ܤ���ޤ����顢@strong{MySQL}�ϼºݤ˺�����줿�쥳���ɿ����֤����Ȥ��Ǥ��ޤ���
���Ȥ��ǡ����ե�����䥤��ǥå����ե����뤬�𤵤줿�Ȥ��Ƥ⡢�ơ��֥�����ե�����@file{tbl_name.frm}��ͭ���Ǥ���¤ꡢ���Τ褦����ˡ�ǥơ��֥�κƺ�������ǽ�Ȥʤ�ޤ���)

�⤷���ƤΥ쥳���ɤ������Ƥ�����ˡ������ĤΥ쥳���ɤ��ä��졢�����ĤΥ쥳���ɤ�
���ԡ��ɤ����ˤ��Ƥ���Τ����������Τꤿ���ʤ�С�
@code{DELETE} ��ʸ��ʲ��Τ褦�˻��Ѥ��ޤ���

@example
mysql> DELETE FROM tbl_name WHERE 1>0;
@end example

����� @code{DELETE FROM tbl_name} �� @code{WHERE} ��ʤ��ǹԤ����⡢
�ȤƤ��٤��Ǥ����ʤ��ʤ���٤Ǿä����Ȥ��뤫��Ǥ���

�������@code{LOW_PRIORITY}����ꤷ����硢���Υơ��֥���ɤ�Ǥ��륯�饤����Ȥ����ʤ��ʤ�ޤ�@code{DELETE}�μ¹Ԥ��٤餻���ޤ���

������줿�쥳���ɤϥ�󥯥ꥹ�Ȥǰݻ����졢����@code{INSERT}���ϡ��Ť��쥳���ɰ��֤�����Ѥ��ޤ���
�ե�������꾮�������������ϡ�@code{OPTIMIZE TABLE}���ơ��ȥ��Ȥ��ơ��֥�κ������Τ����@code{myisamchk}��ƥ���ƥ�����Ѥ��Ƥ���������
@code{OPTIMIZE TABLE}��������ñ�Ǥ�����@code{myisamchk}�������᤯ư��ޤ���
@xref{OPTIMIZE TABLE, , @code{OPTIMIZE TABLE}}, ��
@ref{Optimization}.

@strong{MySQL}-�ò�  @code{DELETE} �� @code{LIMIT rows} ���ץ�����
�����С��˾ä�����Υ쥳���ɿ���Ĥ��ޤ�������� @code{DELETE} ���ޥ�ɤ�
���ޤ��¿���λ��֤���ʤ�����˻��Ѥ���ޤ���
@code{LIMIT} �ͤ��� affected row �ο������ʤ��ʤ�ޤǡ�
ñ��� @code{DELETE} ���ޥ�ɤ򷫤��֤������Ǥ���

@findex SELECT
@node SELECT, JOIN, DELETE, Reference
@section @code{SELECT}��ʸ

@example
SELECT [STRAIGHT_JOIN] [SQL_SMALL_RESULT] [SQL_BIG_RESULT] [SQL_BUFFER_RESULT]
       [HIGH_PRIORITY]
       [DISTINCT | DISTINCTROW | ALL]
    select_expression,...
    [INTO @{OUTFILE | DUMPFILE@} 'file_name' export_options]
    [FROM table_references
        [WHERE where_definition]
        [GROUP BY @{unsigned_integer | col_name | formula@}]
        [HAVING where_definition]
        [ORDER BY @{unsigned_integer | col_name | formula@} [ASC | DESC] ,...]
        [LIMIT [offset,] rows]
        [PROCEDURE procedure_name] ]
@end example

@code{SELECT}���̾1�Ĥޤ���1�İʾ�Υơ��֥뤫��쥳���ɤ򸡺�������Ф���Τ˻��Ѥ���ޤ���
@code{select_expression} �ϼ��Ф������ե�����ɤ򼨤��ޤ���
@code{SELECT}�Ϥޤ����ơ��֥�λ��Ȥʤ��˷׻��ˤ�äƵ���줿�쥳���ɤ���Ф�����˻��Ѥ���ޤ�����:

@example
mysql> SELECT 1 + 1;
         -> 2
@end example

���ƤΥ�����ɤλ��Ѥϡ��嵭�˼����褦�ʽ�������Τ�Ϳ������ɬ�פ�����ޤ����㤨�С�@code{HAVING}���ɬ��@code{GROUP BY}��θ塢@code{ORDER BY}������Ǥʤ���Фʤ�ޤ���

@itemize @bullet

@item
@cindex Aliases, on expressions
@cindex Expression aliases
@code{SELECT}��ɽ���Ǥϡ�@code{AS}�ˤ����̾�λ��꤬��ǽ�Ǥ�����̾�ϡ��ե������̾��ɽ���Ȥ��ƻȤ�졢@code{ORDER BY}�ڤ�@code{HAVING}��ȤȤ�˻��Ѥ��뤳�Ȥ��Ǥ��ޤ���
��:

@example
mysql> select concat(last_name,', ',first_name) AS full_name
    from mytable ORDER BY full_name;
@end example

@item
@code{FROM table_references}��ϡ�(�㤨�С����򤹤�쥳���ɤˤ�ꡢ1�����Ϥ���ʾ��)��礹��ơ��֥�Υꥹ�Ȥ򼨤��ޤ���
���Υꥹ�ȤϤޤ���@code{LEFT OUTER JOIN}���Ȥ�ޤळ�Ȥ�����ޤ���
@xref{JOIN, , @code{JOIN}}.

@item
@code{col_name}��@code{tbl_name.col_name}��@code{db_name.tbl_name.col_name}�Τ褦�ˤ��ƥե�����ɤ�ɽ�����Ȥ��Ǥ��ޤ���
@code{SELECT}���ơ��ȥ�����Ǥ���λ��Ȥ�ۣ��Ǥʤ���С�@code{tbl_name}��@code{db_name.tbl_name}�Τ褦�ʥץ�ե��å�����ܺ٤˵��Ҥ���ɬ�פϤ���ޤ���
�������Ū�ʥե�����ɤλ���������ɬ�פȤ���ۣ��ʻ��Ȥ���ϡ�@ref{Legal names}�򻲾ȤΤ��ȡ�

@item
@cindex Aliases, for tables
@cindex Table aliases
�ơ��֥뻲�Ȥϡ�@code{tbl_name AS alias_name}����@code{tbl_name alias_name}��Ȥä���̾����Ѥ��뤳�Ȥ���ǽ�Ǥ���

@example
mysql> select t1.name, t2.salary from employee AS t1, info AS t2
           where t1.name = t2.name;
mysql> select t1.name, t2.salary from employee t1, info t2
           where t1.name = t2.name;
@end example

@item
@code{LIKE}��ɽ���ˤ����ơ��磻��ɥ����ɡ�����饯���Ǥ���@samp{%}��@samp{_}
�ϡ��������̾�Υ磻��ɥ����ɤȤ��Ƥΰ�̣���������뤿���@samp{\}�θ���֤���뤳�Ȥˤ�ꡢ���@samp{%}��@samp{_}�θ����˻Ȥ��ޤ���

@item
�����Ѥ����򤵤줿�ե�����ɤϡ�@code{ORDER BY}���@code{GROUP BY}��ˤ����ơ��ե������̾���ե�����ɤΥ����ꥢ��̾�����ϥե�������ֹ�ˤƻؤ��������Ȥ��Ǥ��ޤ����ե�������ֹ��1����Ϥޤ�ޤ���

@example
mysql> select college, region, seed from tournament
           ORDER BY region, seed;
mysql> select college, region AS r, seed AS s from tournament
           ORDER BY r, s;
mysql> select college, region, seed from tournament
           ORDER BY 2, 3;
@end example

�ս���¤٤������ˤϡ� @code{ORDER BY} �����ǡ����ʤ����¤٤����ȻפäƤ���
�ե�����ɤ�̾���θ���ˡ� @code{DESC} (descending) ������ɤ�
�ɲä��ޤ���
�ǥե���ȤϾ���Ǥ��� ����� @code{ASC} ������ɤ���ꤷ�����Ȥˤʤ�ޤ���

@item
@code{HAVING}��ϡ�@code{select_expression}�ˤ����ƤɤΥե�����ɤ�̾���䥨���ꥢ��̾�Ǥ�ؤ��������Ȥ��Ǥ��ޤ���
����ϺǸ��Ŭ�Ѥ��졢���饤����Ȥ˥����ƥब������ľ���˼¹Ԥ����Τǡ���Ŭ������ޤ���
@code{WHERE}��ǽ񤯤٤���Τ�@code{HAVING}���Ѥ��ƤϤ����ޤ���
�㤨�С����Τ褦�˽񤤤ƤϤ����ޤ���:

@example
mysql> select col_name from tbl_name HAVING col_name > 0;
@end example

��������ˡ����Τ褦�˽񤤤Ƥ�������:

@example
mysql> select col_name from tbl_name WHERE col_name > 0;
@end example

@strong{MySQL} 3.22.5�ʹߤǤϡ����Τ褦�˥�����򵭽Ҥ��뤳�Ȥ��Ǥ��ޤ�:

@example
mysql> select user,max(salary) from users
           group by user HAVING max(salary)>10;
@end example

@strong{MySQL}�θŤ��С������Ǥϡ���������˼��Τ褦�˵��ҤǤ��ޤ�:

@example
mysql> select user,max(salary) AS sum from users
           group by user HAVING sum>10;
@end example

@item
@code{SQL_SMALL_RESULT}, @code{SQL_BIG_RESULT}, @code{SQL_BUFFER_RESULT},
@code{STRAIGHT_JOIN}, @code{HIGH_PRIORITY} �� ANSI SQL92 ���Ф��� @strong{MySQL} ��ĥ�Ǥ���

@item
@code{HIGH_PRIORITY} �ϡ��ơ��֥�ι������� @code{SELECT} ��ͥ�褵���ޤ���
����ϰ��٤Ǵ�λ���롢�ȤƤ�®��������ˤΤ�Ŭ�Ѥ��٤��Ǥ���
�⤷�꡼�ɥ��å�����Ƥ���ơ��֥뤬���ä��Ȥ���
���Ȥ� update ʸ�����Υơ��֥�β�����ԤäƤ����Ȥ��Ƥ⡢
@code{SELECT HIGH_PRIORITY} ������ϼ¹Ԥ���ޤ���

@item
@code{SQL_BIG_RESULT} �� @code{GROUP BY} �� @code{DISTINCT} �ȶ��˻��Ѥ���
�����Ǥ�����̥��åȤ�¿���Υ쥳���ɤ���Ĥ��Ȥ򥪥ץƥ��ޥ������Τ餻�ޤ���
���ξ�硢ɬ�פʤ� @strong{MySQL} �ϥǥ������١����ΰ���ơ��֥��ľ�ܻ���
���ޤ���@code{MySQL} �Ϥ��ξ�硢@code{GROUP BY} ���Ǿ�Υ����ǰ���ơ���
���Ԥʤ�����˥����Ȥ�Ԥʤ����Ȥ����򤷤ޤ���

@item
@code{SQL_SMALL_RESULT} (@strong{MySQL} ��ͭ�Υ��ץ����) �� @code{GROUP BY}
�� @code{DISTINCT} �ȶ��˻��Ѥ�������Ǥ���
��̥��åȤ��������ʤ뤳�Ȥ򥪥ץƥ��ޥ������Τ餻�ޤ������ξ�硢
@strong{MySQL} �ϥ����Ȥ�������ˡ�®������ơ��֥���̤���¸�Τ�
��˻��Ѥ��ޤ��� @strong{MySQL} 3.23 �Ǥϡ�������̾�ɬ�פǤϤ���ޤ���

@item
@code{STRAIGHT_JOIN}�ϡ�@code{FROM}��ˤƵ��Ҥ��줿�ơ��֥�ν���˽��äƷ�礹��褦�����ץƥ��ޥ����˶������ޤ������ץƥ��ޥ��������ơ��֥���Ŭ�ʽ���Ƿ�礷�ʤ����ˡ�������Υ��ԡ��ɥ��åפΤ���ˤ������Ѥ��뤳�Ȥ���ǽ�Ǥ���
@xref{EXPLAIN, , @code{EXPLAIN}}.

@item
@code{LIMIT} ��ϡ� @code{SELECT} ��ʸ���֤����쥳���ɿ�����ꤹ��Τ�
���Ѥ���ޤ��� @code{LIMIT} �ϰ�Ĥ���Ĥο����ΰ�������ޤ���

������2��Ϳ����줿�ʤ�С��ǽ�ΰ����Ϻǽ�Υ쥳���ɤ���Υ��ե��åȤ򼨤���2�Ĥ�ΰ������֤��쥳���ɤκ�����򼨤��ޤ���
���Υ쥳���ɤΥ��ե��åȤ�0�Ǥ�(1�ǤϤ���ޤ���)��

@example
mysql> select * from table LIMIT 5,10;  # 6��15���ܤ��֤�
@end example

�⤷��������Ĥʤ顢�֤��٤��쥳���ɤκ���Կ�����ꤷ�����Ȥˤʤ�ޤ���

@example
mysql> select * from table LIMIT 5;     # �ǽ��5�Ԥ���Ф�
@end example

����������С�@code{LIMIT n} �� @code{LIMIT 0,n} ��Ʊ���Ǥ���

@item
@tindex /etc/passwd
@code{SELECT}�ν񼰡�@code{SELECT ... INTO OUTFILE 'file_name'}�ϡ����򤵤줿�쥳���ɤ�ե�����˽񤭹��ߤޤ���
�ե�����ϥ����е��˺������졢����¸�ߤ���ե�����Ǥ��äƤϤʤ�ޤ���(@file{/etc/passwd}�Τ褦�ʥե�������˲����ɻߤ��ޤ�)��
@code{SELECT ... INTO OUTFILE}�ϡ�@code{LOAD DATA INFILE}�εդǤ���@code{export_options}�ι�ʸ�ϡ�@code{LOAD DATA INFILE}���ơ��ȥ��Ȥΰ����ǻȤ���@code{FIELDS}���@code{LINES}���Ʊ���褦�ʹ����Ǥ���
@xref{LOAD DATA, , @code{LOAD DATA}}.

@code{INTO OUTFILE}��Ȥ��Ȥ������������ס�����饯����@code{ASCII 0} (nul)�����������ƤΥ����ߥ͡���������饯���ϡ��ǥե���Ȥǥ��������פ���뤳�Ȥ˵���Ĥ��Ƥ���������
@xref{LOAD DATA, , @code{LOAD DATA}}.

��̤Ȥ��Ƽ��Ф����ƥ����ȥե�����Ǥϡ�
�ʲ��˼���ʸ���� @code{ESCAPED BY} �����ʸ���ˤ�äƥ��������פ���ޤ���

@itemize @bullet
@item @code{ESCAPED BY} ʸ������
@item @code{FIELDS TERMINATED BY} �κǽ��ʸ��
@item @code{LINES TERMINATED BY} �κǽ��ʸ��
@end itemize

����ˡ� @code{ASCII 0} �ϡ�@code{ESCAPED BY} 0 (@code{ASCII 48}) �˥���С��Ȥ���ޤ���

�����ʤ� @code{FIELDS TERMINATED BY}, @code{ESCAPED BY}, @code{LINES TERMINATED BY}
���ꤵ��Ƥ���ʸ���⡢���������פ��ʤ���Фʤ�ʤ���ͳ�ϡ�
�ƥ����ȥե�������ɤ��֤����褦�ˤ��뤿��ʤΤǤ���
@code{ASCII 0} �Ϥ����Ĥ��Υڡ����㡼�Ǥ⸫���褦�ˤ��뤿���
���������פ����ΤǤ���

��̤Υե������ SQL ��ʸ��ޤ�Ǥ��ʤ��Τǡ����⥨�������פ���ɬ�פϤ���ޤ���
@end itemize

@findex DUMPFILE
@code{INTO OUTFILE} ������� @code{INTO DUMPFILE} ����Ѥ���ȡ�
@strong{MySQL} �ϥե�����ˣ��쥳���ɤ�����񤭤ޤ����ե�����ɤ�Ԥν�ü
�Ȥ��٤ƤΥ��������פ�ޤߤޤ��󡣤���ϥե�������� BLOB ���Ǽ���������
�������Ǥ���

@findex JOIN
@findex INNER JOIN
@findex CROSS JOIN
@findex LEFT JOIN
@findex LEFT OUTER JOIN
@findex NATURAL LEFT JOIN
@findex NATURAL LEFT OUTER JOIN
@findex STRAIGHT_JOIN
@node JOIN, INSERT, SELECT, Reference
@section @code{JOIN} ��ʸ

@strong{MySQL}�ϡ��ʲ��˼���@code{SELECT}���ơ��ȥ��Ȥˤ�����@code{JOIN}��ʸ�򥵥ݡ��Ȥ��ޤ�:

@example
table_reference, table_reference
table_reference [CROSS] JOIN table_reference
table_reference INNER JOIN table_reference join_condition
table_reference STRAIGHT_JOIN table_reference
table_reference LEFT [OUTER] JOIN table_reference join_condition
table_reference LEFT [OUTER] JOIN table_reference
table_reference NATURAL [LEFT [OUTER]] JOIN table_reference
@{ oj table_reference LEFT OUTER JOIN table_reference ON conditional_expr @}
@end example

Where @code{table_reference} is defined as
@example
table_name [[AS] alias] [USE INDEX (key_list)] [IGNORE INDEX (key_list)]
@end example

and @code{join_condition} is defined as

@example
ON conditional_expr |
USING (column_list)
@end example

Note that in version before 3.23.16 the @code{INNER JOIN} didn't take
a join condition!

@cindex ODBC compatibility
@cindex Compatibility, with ODBC
��˼����Ǹ��@code{LEFT OUTER JOIN}��ʸ�ϡ�ODBC�Ȥθߴ����Τ��������¸�ߤ��ޤ���

@itemize @bullet
@item
table reference�ϡ�@code{tbl_name AS alias_name}��@code{tblname alias_name}�ˤ����̾����ꤹ�뤳�Ȥ��Ǥ��ޤ���

@example
mysql> select t1.name, t2.salary from employee AS t1, info AS t2
           where t1.name = t2.name;
@end example

@item
@code{INNER JOIN}��@code{,} (�����)�ϡ�Ʊ����Ǥ����ɤ������Ѥ����ơ��֥�֤�ľ�Ѥ�Ȥ�ޤ����̾��@code{WHERE}���ˤơ��ơ��֥뤬�ɤΤ褦�˥�󥯤����٤�����������ޤ���

@item
@code{ON}�����ϡ�@code{WHERE}��ǻ��Ѥ����褦�ʾ��ʸ�ν񼰤Ǥ���

@item
�⤷��@code{LEFT JOIN} �� @code{ON} �� @code{USING} �ˤ�����
��¦�Υơ��֥�˥ޥå�����쥳���ɤ�̵���ä���硢
���ƤΥե�����ɤ�@code{NULL}�Ǥ���1�ĤΥ쥳���ɤ�����¦�Υơ��֥�Ȥ��ƻ��Ѥ���ޤ���
���λ��¤ϡ�����ơ��֥�ˤĤ��ơ�¾�Υơ��֥���б�����쥳���ɤ�¸�ߤ��ʤ��쥳���ɤ�õ���Ȥ������Ȥ����ѤǤ��ޤ�:

@example
mysql> select table1.* from table1
           LEFT JOIN table2 ON table1.id=table2.id
           where table2.id is NULL;
@end example

������ϡ�@code{table1}���⡢@code{id}���ͤ�@code{table2}��¸�ߤ��ʤ����ƤΥ쥳���ɤ򸡺����ޤ���(¨����@code{table2}��Υ쥳���ɤȰ��פ��ʤ�@code{table1}�����ƤΥ쥳���ɡ�)
������󡢤��ξ���@code{table2.id}�ϡ�@code{NOT NULL}���������Ƥ����ΤȲ��ꤷ�ޤ���

@item
@code{USING} @code{(column_list)}��Υե������̾�ꥹ�Ȥϡ�ξ���Υơ��֥��¸�ߤ��ʤ���Фʤ�ޤ���@code{USING}�᤬���Τ褦��:

@example
A LEFT JOIN B USING (C1,C2,C3,...)
@end example

�������뤳�Ȥϡ�@code{ON}�������Τ褦����������Τ�Ʊ���Ǥ�:

@example
A.C1=B.C1 AND A.C2=B.C2 AND A.C3=B.C3,...
@end example

@item
Ʊ���ե������̾�����2�ĤΥơ��֥�� @code{NATURAL [LEFT] JOIN} �ϡ�
@code{USING} ���ȼ�ä� @code{INNER JOIN} �� @code{LEFT JOIN} ��
Ʊ���Ȥ����������ޤ���

@item
@code{STRAIGHT_JOIN}�ϡ���¦�Υơ��֥�����ˡ���˺�¦�Υơ��֥���ɤळ�Ȥ�����С�@code{JOIN}������Ʊ�����ȤǤ�������ϡ���祪�ץƥ��ޥ������������ʽ���ǥơ��֥����Ϥ���褦�ʤޤ�ʻ��֤˻��ѤǤ��ޤ���

@item
@strong{MySQL} 3.23.12 ���顢�ơ��֥뤫��������Ф����ˡ�
@strong{MySQL} ���ɤΥ���ǥå�������Ѥ��٤����Ȥ����ҥ�Ȥ�Ϳ���뤳�Ȥ�
�Ǥ���褦�ˤʤ�ޤ���������ϡ�@strong{MySQL} ���ְ�ä�����ǥå������
�Ѥ��Ƥ��뤳�Ȥ� @code{EXPLAIN} ����������ͭ�ѤǤ���@code{USE INDEX
(key_list)} ����ꤹ�뤳�Ȥˤ�äơ��ơ��֥뤫��쥳���ɤ򸫤Ĥ��뤿��ˡ�
���ꤵ�줿����ǥå����ΰ�Ĥ�������Ѥ���褦�� @strong{MySQL} �������뤳
�Ȥ��Ǥ��ޤ����̤ι�ʸ @code{IGNORE INDEX (key_list)} �ϡ�@strong{MySQL} 
������Υ���ǥå�������Ѥ��ʤ��褦�������뤿��˻��ѤǤ��ޤ���
@end itemize

��:

@example
mysql> select * from table1,table2 where table1.id=table2.id;
mysql> select * from table1 LEFT JOIN table2 ON table1.id=table2.id;
mysql> select * from table1 LEFT JOIN table2 USING (id);
mysql> select * from table1 LEFT JOIN table2 ON table1.id=table2.id
           LEFT JOIN table3 ON table2.id=table3.id;
mysql> select * from table1 USE INDEX (key1,key2) WHERE key1=1 and key2=2 AND
       key3=3;
mysql> select * from table1 IGNORE INDEX (key3) WHERE key1=1 and key2=2 AND
       key3=3;
@end example

@xref{LEFT JOIN optimization, , @code{LEFT JOIN} optimization}.

@findex INSERT
@node INSERT, REPLACE, JOIN, Reference
@section @code{INSERT}��ʸ

@example
    INSERT [LOW_PRIORITY | DELAYED] [IGNORE]
        [INTO] tbl_name [(col_name,...)]
        VALUES (expression,...),(...),...
or  INSERT [LOW_PRIORITY | DELAYED] [IGNORE]
        [INTO] tbl_name [(col_name,...)]
        SELECT ...
or  INSERT [LOW_PRIORITY | DELAYED] [IGNORE]
        [INTO] tbl_name
        SET col_name=expression, col_name=expression, ...
@end example

@code{INSERT}�ϡ���¸�Υơ��֥�˿������쥳���ɤ��������ޤ���
@code{INSERT ... VALUES}�񼰤ϡ��ͤ������������ܤȤ��ƥ쥳���ɤ��������ޤ���
@code{INSERT ... SELECT}�񼰤ϡ�¾��ɽ(ʣ����)������Ф����쥳���ɤ��������ޤ���
ʣ�����ͥꥹ�Ȥ��Ѥ���@code{INSERT ... VALUES}�񼰤ϡ�@strong{MySQL} 3.22.5�ʹߤǥ��ݡ��Ȥ���Ƥ��ޤ���
@code{col_name=expression}��ʸ�ϡ�@strong{MySQL} 3.22.10�ʹߤǥ��ݡ��Ȥ���Ƥ��ޤ���

@code{tbl_name}�ϡ��쥳���ɤ���������ơ��֥�Ǥ����ե������̾�ꥹ�Ȥϡ���³����������ơ��ȥ��ȤΥե�����ɤ�ؤ������ޤ���

@itemize @bullet
@item
�⤷�����ʤ�ե�����ɤ� @code{INSERT ... VALUES} �� @code{INSERT ... SELECT} �ʤɤ�
�������ʤ���С����ƤΥե�����ɤ��ͤ� @code{VALUES()} �����Ϳ�����ʤ��ƤϤʤ�ޤ���
�ơ��֥���Υե�����ɽ礬�����ʾ�硢�����Ĵ�٤뤿���@code{DESCRIBE tbl_name}����Ѥ��Ʋ�������

@item
�ơ��֥���ΰ����Υե�����ɤ������ꤷ�ʤ���硢���ꤵ��ʤ��ä��ե�����ɤˤϡ����줾��ν���ͤ����ꤵ��ޤ�������ͤγ����Ƥϡ�@ref{CREATE TABLE, , @code{CREATE TABLE}}. �ǽҤ٤��Ƥ��ޤ���

@item
@code{NULL}��@code{TIMESTAMP}�ե�����ɤ�����������硢�ե�����ɤˤϸ��߻��郎���åȤ���ޤ���¾���ͤ�����������硢���ꤵ�줿�ͤ�ñ��˥��åȤ���ޤ���

@item
@code{expression}�ϡ��ͥꥹ�������Ƭ�˶ᤤ���Υե�����ɤ򻲾Ȥ��ʤ���Фʤ�ޤ���
�㤨�С����Τ褦�˵��ҤǤ��ޤ�:

@example
mysql> INSERT INTO tbl_name (col1,col2) VALUES(15,col1*2);
@end example

�����������Τ褦�ˤϵ��ҤǤ��ޤ���:

@example
mysql> INSERT INTO tbl_name (col1,col2) VALUES(col2*2,15);
@end example

@item
�������@code{LOW_PRIORITY}����ꤷ����硢@code{INSERT}�μ¹ԤϤ��Υơ�
�֥뤫���ͤ��ɤ߹��९�饤����Ȥ����ʤ��ʤ�ޤ��٤餵��ޤ������ξ�硢��
�饤����Ȥ� insert ʸ����λ����ޤ��Ԥ�����ޤ����ơ��֥뤬���ˤ˻��Ѥ���
���硢Ĺ�����֤�����ޤ�������ϥ��饤����Ȥ���٤˷�³������ 
@code{INSERT DELAYED} ���о�Ū�Ǥ���

@item
�⤷ @code{IGNORE} ������ɤ� @code{INSERT} �� �ͤȤȤ�� Ϳ����ʤ顢
�ơ��֥���� @code{PRIMARY} �� @code{UNIQUE} �����ˤ��Ǥ�¸�ߤ����ʣ����
��Τ�̵�뤵�졢��������ޤ���
¿�ŹԤ��ͤ�ޤ�쥳���ɤ� @code{INSERT} �˥������ @code{IGNORE} ����ꤷ�ʤ���硢
�ơ��֥�� @code{PRIMARY} ������ @code{UNIQUE} �����˽�ʣ��������ݤˡ�
�����������۾ェλ���ޤ���
@code{IGNORE} ����ꤷ����硢��ʣ���륭���ͤ���ĥ쥳���ɤ���������ޤ���
C API �ؿ� @code{mysql_info()} �ˤ�ꡢ�ơ��֥�ˤ����ĤΥ쥳���ɤ��������줿��
�����å����뤳�Ȥ��Ǥ��ޤ���

@item
@strong{MySQL}����@code{DONT_USE_DEFAULT_FIELDS}���ץ����ˤ�����¤���Ƥ�����硢@code{NULL}�ͤ�����ʤ����ƤΥե�����ɤ�����Ū���ͤ򤷤ʤ���@code{INSERT}���ơ��ȥ��Ȥϡ����顼���������ޤ���
@xref{configure options,  , @code{configure} options}.

@item
�ʲ��ξ��ϡ�@code{INSERT INTO ... SELECT}���ơ��ȥ��ȤΤ�����Ѱդ���Ƥ��ޤ�:

@itemize @minus
@item
�����꡼�ϡ�@code{ORDER BY}���ޤळ�Ȥ��Ǥ��ޤ���

@item
@code{INSERT}���ơ��ȥ��ȤΥ������åȤȤʤ�ơ��֥�ϡ������꡼��@code{SELECT}����@code{FROM}��˻���Ǥ��ޤ��󡣤ʤ��ʤ顢������Υơ��֥뤫���@code{SELECT}��ANSI SQL�Ƕؤ����Ƥ��뤫��Ǥ���(����ϡ�@code{SELECT}���¹�������������쥳���ɤ���Ф��뤳�Ȥ���ǽ�Ǥ��뤳�ȤǤ������䤤��碌�����Ѥ���Ȥ��ˡ����Τ褦�ʾ����Ǻ��𤷤䤹���ʤ�ޤ���)

@item
@code{AUTO_INCREMENT}�ե�����ɤϡ��̾��̤�ư��ޤ���
@end itemize
@end itemize

@findex mysql_info()
¿�Ť��ͥꥹ�Ȥ���� @code{INSERT ... SELECT ...} ���� @code{INSERT ... VALUES()} ���ơ��ȥ��Ȥ���Ѥ����硢�����꡼�˴ؤ����������뤿��� C API�ؿ� @code{mysql_info()} ����Ѥ��뤳�Ȥ��Ǥ��ޤ���
���ξ���ν񼰤ϰʲ��˼���ʸ����Τ褦�ˤʤ�ޤ�:

@example
Records: 100 Duplicates: 0 Warnings: 0
@end example

@code{Duplicates}�ϡ�����¸�ߤ����ˡ�������ǥå������ͤȽ�ʣ���뤳�Ȥˤ�ꡢ�����Ǥ��ʤ��ä��쥳���ɿ���ɽ���ޤ���
@code{Warnings}�ϡ��������줿�ե�����ɤ����餫�ε��路���ͤǤ��ä��Ȥ�������ɽ���ޤ����ٹ�ϡ����Τ褦�ʾ��β���ȯ�����ޤ�:

@itemize @bullet
@item
@code{NOT NULL}������줿�ե�����ɤؤ�@code{NULL}���������ե�����ɤˤϽ���ͤ����ꤵ��ޤ���

@item
���ͥե�����ɤ��ϰϤ�Ķ�����ͤΥ��åȡ��ͤ��ϰ���θ³��ͤ���������ޤ���

@item
���ͥե�����ɤؤ� @code{`10.34 a'} �Τ褦���ͤΥ��åȡ��������äƤ��르�ߤϼ������졢�Ĥ�ο�����ʬ����������ޤ����ͤ����ͤȤ���Ƚ�ǤǤ��ʤ��ä���硢�ե�����ɤˤ� @code{0} �����åȤ���ޤ���

@item
@code{CHAR}��@code{VARCHAR}��@code{VARCHAR}��@code{TEXT}����@code{BLOB}�ե�����ɤؤκ���Ĺ��Ķ����ʸ������������ͤϥե�����ɤκ���Ĺ���ڤ�ΤƤ��ޤ���

@item
�������ϻ���ե�����ɤؤΥե������°����ȿ��������������°����Ŭ����``����''�ͤ����åȤ���ޤ���
@end itemize

@findex INSERT DELAYED
@findex DELAYED

@code{INSERT} ��ʸ�� @code{DELAYED} ���ץ����� @strong{MySQL} �ȼ���
���ץ����ǡ������ @code{INSERT} �������˽�λ���뤳�Ȥ��ԤƤʤ�
���饤����Ȥ���ľ��ˡ��ȤƤ���Ω���ޤ���
����ϡ������󥰤Τ���� @strong{MySQL} ����Ѥ�����ΰ���Ū������ǡ���λ
��Ĺ�����֤������� @code{SELECT} ���ơ��ȥ��Ȥ����Ū�˼¹ԤǤ��ޤ���
@code{DELAYED} �� @strong{MySQL} 3.22.15 ��Ƴ������ޤ�����  �����
 ANSI SQL92 ���Ф��� @strong{MySQL} ��ĥ�Ǥ���

@code{INSERT DELAYED} ����Ѥ���������饤����Ȥϰ��� ok �Ȥʤꡢ�ơ��֥�
��¾�Υ���åɤǻ�����Ǥʤ����˥쥳���ɤ���������ޤ���

@code{INSERT DELAYED} ����Ѥ���������ۤ������פϡ�
¿���Υ��饤����Ȥ���� insert ��Ʊ����«�ͤ�졢��ĤΥ֥��å���
�񤫤�뤳�ȤǤ��� �����¿�����̡��� insert ��¹Ԥ�����
�ȤƤ�®���ʤ�ޤ���

���ߡ����塼���󥰤��줿�쥳���ɤϡ�����餬�ơ��֥�����������ޤ�
���꡼���ݻ�����Ƥ�������Ǥ��� ����ϡ��⤷ @code{mysqld} ��
��������ˡ (@code{kill -9}) �ǥ��뤷���ꡢ @code{mysqld} ��ͽ������
������硢���塼���󥰤���Ƥ���쥳���ɤϥǥ������˽񤫤줺�����ޤ���

@code{DELAYED} ���ץ����� @code{INSERT} �� @code{REPLACE} �ǻ��Ѥ����硢
�ʲ��Τ��Ȥ������ޤ���
������ ``����å�'' �Ȥ� @code{INSERT DELAYED} ���ޥ�ɤ����������åɤ򤵤���
``�ϥ�ɥ顼'' �Ȥ�����Υơ��֥�Τ�������Ƥ�
@code{INSERT DELAYED} ��ʸ�����륹��åɤ�ؤ��ޤ���

@itemize @bullet
@item
����åɤ�����ơ��֥���Ф� @code{DELAYED} ��ʸ��¹Ԥ���Ȥ���
���Υơ��֥���Ф������Ƥ� @code{DELAYED} ��ʸ
��������뤿��˥ϥ�ɥ顼����åɤ���������ޤ���
�⤷���Τ褦�ʥϥ�ɥ顼��¸�ߤ��Ƥ��ʤ����ˤϡ�

@item
���Υ���åɤϡ����Υϥ�ɥ顼�� @code{DELAYED} ���å�����˻��äƤ��뤫
�ɤ���������å����ޤ��� �⤷���äƤ��ʤ��ʤ顢��������褦��
�ϥ�ɥ顼�˹𤲤ޤ��� 
���Ȥ�¾�Υ���åɤ� @code{READ} �� @code{WRITE} ���å��򤽤Υơ��֥��
���äƤ����Ȥ��Ƥ⡢ @code{DELAYED} ���å������뤳�Ȥ��Ǥ��ޤ���
�����������Υϥ�ɥ顼�����Ƥ� @code{ALTER TABLE} ���å���
 @code{FLUSH TABLES} ���Ԥ��ޤ��� ���Υơ��֥빽¤���ǿ��Ǥ���Τ�
�μ¤ˤ��뤿��ˡ�

@item
����åɤ� @code{INSERT} ���ơ��ȥ��Ȥ�¹Ԥ��ޤ������쥳���ɤ�ơ��֥�
�˽�����ˡ��ϥ�ɥ饹��åɤˤ�äƴ�������륭�塼�˺Ǹ�Υ쥳���ɤ�
���ԡ����֤��ޤ���ʸˡ���顼�ϥ���åɤˤ�ä����Τ��졢���饤����ȥץ���
������𤵤�ޤ���

@item
���饤����ȤϷ�̹Ԥν�ʣ���� @code{AUTO_INCREMENT} ���ͤ�
���Ǥ��ޤ��� ����ϥ����С��������뤳�Ȥ��Ǥ��ޤ��� �ʤ��ʤ顢
 @code{INSERT} �ϥ��󥵡��ȥ��ڥ졼����󤬴����˽�λ��������
�֤뤫��Ǥ��� �⤷ C API ����Ѥ��Ƥ���ʤ顢 @code{mysql_info()} �ؿ���
Ʊ�ͤ���ͳ�ˤ��ʤˤ��֤��ޤ���

@item
���������ϡ��쥳���ɤ����Υơ��֥�� insert ���줿�Ȥ������Υϥ�ɥ顼����å�
�ˤ�äƹ�������ޤ��� ʣ���쥳���ɤ������ξ�硢 ���������Ϻǽ�ιԤ�
�������줿�Ȥ��˹�������ޤ���

@item
���줾��� @code{delayed_insert_limit} �쥳���ɤ��񤫤줿�塢���Υϥ�ɥ顼��
�����ʤ� @code{SELECT} ʸ��ޤ��������Ƥ��ʤ������ǧ���ޤ���
�⤷�����ʤ顢³�������ˤ������Ф��Ƽ¹Ԥ��ǽ�ˤ��ޤ���

@item
�ϥ�ɥ顼�Υ��塼��˥쥳���ɤ��ʤ��ʤä��Ȥ����ơ��֥�ϥ�����å�����ޤ���
�⤷������ @code{INSERT DELAYED} ���ޥ�ɤ� @code{delayed_insert_timeout} �ð����
�����դ����ʤ���С��ϥ�ɥ顼�Ͻ�λ���ޤ���

@item
�⤷������Υϥ�ɥ顼�Υ��塼��� @code{delayed_queue_size} �ʾ�Υ쥳���ɤ�
���˱������Ƥ���ʤ�С����Υ���åɤϡ����塼��;͵��������Ԥ��ޤ���
����� @code{mysqld} �����С��� delayed ���줿���塼�����Ƥ�
���꡼��μ¤˻��Ѥ��ʤ��褦�ˤ���Τ���Ω���ޤ���

@item
���Υϥ�ɥ顼����åɤ�  @strong{MySQL} �ץ������ꥹ�Ȥ� @code{Command} ��
��ˡ� @code{delayed_insert} �ȶ���ɽ������ޤ���
����� @code{FLUSH TABLES} ���ޥ�ɤ� @code{KILL thread_id} ��¹Ԥ��뤳�Ȥǡ�
kill �Ǥ���Ǥ��礦��
�������������ϡ���λ�������ˡ����塼������ƤΥ쥳���ɤ�ơ��֥��
��¸���褦�Ȥ��ޤ���
���δ֡����Υ���åɤϡ�¾�Υ���åɤ����褿�����ʤ�
������ @code{INSERT} ���ޥ�ɤ�����դ��ޤ���
�⤷�����θ�� @code{INSERT DELAYED} ���ޥ�ɤ�¹Ԥ���ʤ顢
�������ϥ�ɥ顼����åɤ���������ޤ���

@item
�嵭�Τ��Ȥϡ��⤷ @code{INSERT DELAYED} ���ޥ�ɤ��������äƤ���ʤ顢
 @code{INSERT DELAYED} ���ޥ�ɤϡ����̤� @code{INSERT} ���ޥ�ɤ���⤤
ͥ���٤���ĤȤ������ȤǤ���
¾�� update ���ޥ�ɤ� @code{INSERT DELAY} ���塼�����ˤʤ�ޤǡ�
���뤤��ï���� @code{KILL thread_id} �� @code{FLUSH TABLES} ��¹Ԥ���
�ϥ�ɥ顼�򥭥뤹��ޤǡ�
�Ԥ�����ޤ���

@item
�ʲ��Υ��ơ������ѿ��� @code{INSERT DELAYED} ���ޥ�ɤˤĤ��Ƥξ����
Ϳ���ޤ���

@multitable @columnfractions .35 .65
@item @code{Delayed_insert_threads} @tab �ϥ�ɥ顼����åɤο�
@item @code{Delayed_writes} @tab @code{INSERT DELAYED} �ǽ񤫤��쥳���ɿ�
@item @code{Not_flushed_delayed_rows} @tab �񤭹��ߤ��Ԥĥ쥳���ɿ�
@end multitable

�������ѿ��� @code{SHOW STATUS} ��ʸ��ȯ�Ԥ�����
 @code{mysqladmin extended-status} ���ޥ�ɤ�¹Ԥ��뤳�ȤǸ���ޤ�.
@end itemize

����: @code{INSERT DELAYED} �ϡ��ơ��֥뤬������Ǥʤ���硢�̾�� 
INSERT �����٤��ʤ�ޤ���@code{INSERT DELAYED} ����Ѥ���ƥơ��֥�ˤ�
�����̤Υ���åɤ����륵���ФΡ��ɲäΥ����С��إåɤ⤢��ޤ�������ϡ�
�μ¤ˤ����ɬ�פȤ�����ˤ��� @code{INSERT DELAYED} ����Ѥ��٤����Ȥ��
̣���ޤ���

@findex REPLACE
@node REPLACE, LOAD DATA, INSERT, Reference
@section @code{REPLACE}��ʸ

@example
    REPLACE [LOW_PRIORITY | DELAYED]
        [INTO] tbl_name [(col_name,...)]
        VALUES (expression,...)
or  REPLACE [LOW_PRIORITY | DELAYED]
        [INTO] tbl_name [(col_name,...)]
        SELECT ...
or  REPLACE [LOW_PRIORITY | DELAYED]
        [INTO] tbl_name
          SET col_name=expression, col_name=expression,...
@end example

@code{REPLACE}�ϡ��ơ��֥���θŤ��쥳���ɤ���ˡ�������ǥå������
�������쥳���ɤ�Ʊ���ͤ���ľ��ˡ��������쥳���ɤ������������ˡ�
�Ť��쥳���ɤ�������Ȥ������Ȥ�����С�@code{INSERT}������Ʊ���褦��
ư��ޤ��� 
@xref{INSERT, , @code{INSERT}}.

@findex LOAD DATA INFILE
@node LOAD DATA, UPDATE, REPLACE, Reference
@section @code{LOAD DATA INFILE}��ʸ

@example
LOAD DATA [LOW_PRIORITY] [LOCAL] INFILE 'file_name.txt' [REPLACE | IGNORE]
    INTO TABLE tbl_name
    [FIELDS
        [TERMINATED BY '\t']
        [OPTIONALLY] ENCLOSED BY '']
        [ESCAPED BY '\\' ]]
    [LINES TERMINATED BY '\n']
    [IGNORE number LINES]
    [(col_name,...)]
@end example

@code{LOAD DATA INFILE}���ơ��ȥ��Ȥϡ��ƥ����ȥե����뤫��ơ��֥�ؤȡ�
�쥳���ɤ��®���ɤ߹��ߤޤ��� @code{LOCAL} ������ɤ����ꤵ���С��ե������
���饤����ȡ��ۥ��Ȥ����ɤ߹��ޤ�ޤ���
@code{LOCAL}�����ꤵ��ʤ���С��ե�����ϥ����Ф˰��֤���ɬ�פ�����ޤ�
(@code{LOCAL}�ϡ�@strong{MySQL} 3.22.6�ʹߤ����ѤǤ��ޤ�)��

�������ƥ������ͳ���顢�����Ф���ƥ����ȥե�������ɤ߽Ф����ϡ�
�ե����뤬�ǡ����١����ǥ��쥯�ȥ��¸�ߤ��뤫��
���Ƥ��ɤ߹��߸��¤�����ɬ�פ�����ޤ���
�ޤ��������Хե������ @code{LOAD DATA INFILE} ����Ѥ���ˤϡ�
�ǡ����١����� @strong{file} ���¤�����ʤ���Фʤ�ޤ���
@xref{Privileges provided}.

�⤷ @code{LOW_PRIORITY} ����ꤷ����硢@code{LOAD DATA} ��ʸ��
���Υơ��֥뤫��¾�Υ��饤����Ȥ��ɤ߹��ߤ�ԤäƤ���֡�
�٤餵��ޤ���

@code{LOCAL} ���Ѥ򤹤�ȡ����饤����ȡ��ۥ��Ȥ��饵���С��ۥ��Ȥ�
�ե���������Ƥ�ž�������ʬ��¿���٤��ʤ�Ǥ��礦��
�����ʤ�С���������Υե�������ɤ߹���Τˡ�
@strong{file} ���¤�ɬ�פʤ��Ȥ������ȤǤ���

@cindex @code{mysqlimport}
@code{mysqlimport}��ƥ���ƥ��ϡ��ǡ����ե�������ɤ߹��ߤ˻��Ѥ��뤳�Ȥ��Ǥ��ޤ���; ����ϡ������Ф�@code{LOAD DATA INFILE}���ޥ�ɤ��������뤳�Ȥˤ�äƽ�����¸����Ƥ��ޤ���
@code{--local}���ץ����ϡ�@code{mysqlimport}�ˡ����饤����ȡ��ۥ��Ȥ���ǡ����ե�������ɤ߹��ޤ��ޤ���
���饤����Ȥȥ����Ф����̥ץ��ȥ���򥵥ݡ��Ȥ��Ƥ���С���®�ʥͥåȥ���Ǥ���ɤ��ѥե����ޥ󥹤����뤿��ˡ�@code{--compress}���ץ�������ꤹ�뤳�Ȥ��Ǥ��ޤ���

�����С��ۥ��Ȥ˥ե�������֤���硢�����Фϡ��ʲ��Υ롼�����Ѥ��ޤ�:

@itemize @bullet
@item
�����ʥѥ��ǥե�����̾��Ϳ����줿��硢�����Фϥѥ�̾�򤽤Τޤ޻��Ѥ��ޤ���

@item
��������ʣ���ι������Ǥ����������Хѥ��ȶ��˥ե�����̾��Ϳ����줿��硢�����Фϡ������ФΥǡ����ǥ��쥯�ȥ�ʲ�����ե������õ���ޤ���

@item
�ե�����̾������ñ��Ϳ����줿��硢�����Фϡ�
�����ȤΥǡ����١����ǥ��쥯�ȥ��õ���ޤ���
@end itemize

�����Υ롼��ϡ��ե����뤬 @file{myfile.txt} �Τ褦��Ϳ�������
�ǡ����١����ǥ��쥯�ȥ꤫��ե����뤬�ɤ߽Ф��졢
@file{./myfile.txt} �Τ褦��Ϳ������С��������򤷤Ƥ���ǡ����١����Υǡ����ǥ��쥯�ȥ꤫��
�ե����뤬�ɤ߽Ф����Ȥ�����̣�Ǥ��뤳�Ȥ����դ��Ʋ�������

�㤨�С��ʲ��� @code{LOAD DATA} ʸ�ϡ�@file{data.txt} �ե������
@code{db1} �ǡ����١����ǥ��쥯�ȥ꤫���ɤߤޤ��� �ʤ��ʤ顢@code{db1} ��
�������򤵤�Ƥ���ǡ����١���������Ǥ��� ���Ȥ���@code{db2} �ǡ����١���
�Υơ��֥�ˡ��ե����뤫���ɤ߹�����ǡ�������������Ȥ��Ƥ⡣��

�ʲ��˼����褦�ʹ�ʸ�Ǥϡ��ե������ @code{db1} �ǡ����١����ǥ��쥯�ȥ�
�����ɤޤ�ޤ���@code{db2} �ǤϤ���ޤ���:

@example
mysql> USE db1;
mysql> LOAD DATA INFILE "data.txt" INTO TABLE db2.my_table; 
@end example

@code{REPLACE} �� @code{IGNORE} ������ɤϡ����Ǥ�¸�ߤ����ˡ���������
��ʣ���Ƥ���쥳���ɤ����Ϥ��Ф�������Ǥ���
@code{REPLACE} ����ξ�硢Ʊ����ˡ�����������Ĵ�¸�Υ쥳���ɤϿ������쥳���ɤ�
�֤��������ޤ���
@code{IGNORE} ����ξ�硢��¸�Υ쥳���ɤΥ�ˡ��������Ƚ�ʣ���륭�����Ŀ������쥳���ɤ�
���Ф���ޤ��� �⤷���ɤ������ꤷ�ʤ��ä���硢��ʣ�������������Ĥ��ä����
���顼��ȯ�������ƥ����ȥե������̵�뤵��ޤ���

@code{LOCAL} ������ɤ���Ѥ��ƥǡ�����������뤫������ɤ����硢
�����С������������ž����Ȥ����ˡ���Τ�ޤ���
����ǥǥե���Ȥ�ư��Ȥ��Ƥ� @code{IGNORE} �����ꤵ�줿�Τ�
Ʊ���ˤʤ�ޤ���

@code{LOAD DATA INFILE}�ϡ�@code{SELECT ... INTO OUTFILE}�εդǤ���
@xref{SELECT, , @code{SELECT}}.
�ǡ����١�������ե�����إǡ�����񤭹���ˤϡ�@code{SELECT ... INTO OUTFILE}����Ѥ��ޤ���
�ե����뤫��ǡ����١������ɤ��᤹�ˤϡ�@code{LOAD DATA INFILE}����Ѥ��ޤ���
@code{FIELDS}��@code{LINES}��ι�ʸ��ξ���Υ��ޥ�ɤȤ�Ʊ���Ǥ���
�ɤ������⥪�ץ����Ǥ�����ξ������ꤹ����ϡ�@code{FIELDS}�ϡ�@code{LINES}�����˻��ꤷ�ʤ���Фʤ�ޤ���

@code{FIELDS}�����ꤷ����硢��������(@code{TERMINATED BY}��@code{[OPTIONALLY] ENCLOSED BY}�ڤ�@code{ESCAPED BY})�ϡ����ʤ��Ȥ⣱�Ĥ���ꤷ�ʤ���Фʤ�ʤ����Ȥ�����ơ�������ޤ����ץ����Ȥʤ�ޤ���

@code{FIELDS}�����ꤷ�ʤ��ä���硢����ͤϰʲ��Τ褦�˵��Ҥ����Τ������Ȥʤ�ޤ�:

@example
FIELDS TERMINATED BY '\t' ENCLOSED BY '' ESCAPED BY '\\'
@end example

@code{LINES}�����ꤷ�ʤ��ä���硢����ͤϰʲ��Τ褦�˵��Ҥ����Τ������Ȥʤ�ޤ�:

@example
LINES TERMINATED BY '\n'
@end example

����������ȡ�@code{LOAD DATA INFILE} �ν���ͤϡ����Ϥؽ񤭹���ݤ˰ʲ��Τ褦�˿��񤤤ޤ�:

@itemize @bullet
@item
���Ԥ�쥳���ɤζ����Ȥߤʤ�

@item
����ʸ���ˤ�äƥե�����ɤ���ڤ�

@item
��������ʸ���ǥե�����ɤ�Ϥ�Ǥ��ʤ���ΤȤ���

@item
����ʸ�������ʸ���ڤ�@samp{\}������@samp{\}�����뤳�Ȥˤ�ꡢ������ե�������ͤΰ����Υ�ƥ��ʸ���Ǥ���Ȥ��ƽ������롣
@end itemize

�դˡ�@code{LOAD DATA INFILE}�ν���ͤϡ����Ϥ��ɤ߹���ݤ˰ʲ��Τ褦�˿��񤤤ޤ�:

@itemize @bullet
@item
�ե�����ɴ֤˥���ʸ�����

@item
������Υ�������ʸ���Ǥ�ե�����ɤ�Ϥޤʤ�

@item
@samp{\}�λ��Ѥˤ�ꡢ�ե�������ͤ���ǻ��Ѥ��륿��ʸ�������ʸ����@samp{\}�򥨥������פ���

@item
�쥳���ɤν���˲���ʸ�����
@end itemize

 @code{FIELDS ESCAPED BY '\\'}�Ƚ񤤤���硢ñ��ΥХå�����å���Ȥ����ɤ߽Ф�����ͤȤ��뤿��ˡ����ĤΥХå�����å������ꤷ�ʤ���Фʤ�ʤ����Ȥ����դ��Ʋ�������

@code{IGNORE number LINES} ���ץ����ϥե��������Ƭ�ˤ���쥳���ɤ�̵�뤹��Τ�
���Ѥ���ޤ���

@example
mysql> LOAD DATA INFILE "/tmp/file_name" into table test IGNORE 1 LINES;
@end example

�ǡ����١�������ե�����إǡ�����񤭡����줫���Ǥ��Υե����뤫��ǡ����١����إǡ������ɤ��᤹����ˡ�@code{SELECT ... INTO OUTFILE}���Ф�@code{LOAD DATA INFILE}��Ȥ���硢�����Υե�����ɤȥ쥳���ɤμ谷���˴ؤ��륪�ץ����ϡ����פ��ʤ���Фʤ�ޤ��󡣤���ʤ���С�@code{LOAD DATA INFILE}��Ŭ�ڤ˥ե������������ʤ��Ǥ��礦��
 �ե�����ɤ򥳥�ޤǶ��ڤäƥե�����ؽ񤭽Ф�����ˡ�@code{SELECT ... INTO OUTFILE}����Ѥ���Ȥ����:

@example
mysql> SELECT * FROM table1 INTO OUTFILE 'data.txt'
           FIELDS TERMINATED BY ','
           FROM ...
@end example

����޶��ڤ�ե����뤫���ɤ��᤹���ᡢ���������ơ��ȥ��ȤϤ����ʤ�Ǥ��礦:

@example
mysql> LOAD DATA INFILE 'data.txt' INTO TABLE table2
           FIELDS TERMINATED BY ',';
@end example

��������Ȥ��Ƽ��˼����褦�ʥ��ơ��ȥ��Ȥǥե�������ɤ߹��⤦�Ȥ��Ƥ⡢������ư��ʤ��Ǥ��礦���ʤ��ʤ顢����ϡ�@code{LOAD DATA INFILE}���Ф��ƥե�����ɤδ֤˥��֤�õ���褦�ؼ����뤫��Ǥ�:

@example
mysql> LOAD DATA INFILE 'data.txt' INTO TABLE table2
           FIELDS TERMINATED BY '\t';
@end example

�����餯�����줾������ϹԤ�ñ��Υե�����ɤȤ��ƽ��������Ǥ��礦��

@code{LOAD DATA INFILE}�ϳ��������������ե�������ɤ߽Ф����Ȥ��Ǥ��ޤ���
�㤨�С�dBASE�ե����ޥåȤΥե�����ϡ��ե�����ɤ򥳥�ޤǶ��ڤ�졢���֥륯�����ơ������ǰϤޤ�Ƥ��ޤ���
�쥳���ɤ�����ʸ���Ƕ��ڤ��Ƥ���Ȥ����顢���˼����ե�����ɵڤӥ쥳���ɤμ谷���ץ�������ꤷ�����ޥ�ɤ������Τ褦�ʥե�������ɤ߹���Τ˻��ѤǤ��ޤ���

@example
mysql> LOAD DATA INFILE 'data.txt' INTO TABLE tbl_name
           FIELDS TERMINATED BY ',' ENCLOSED BY '"'
           LINES TERMINATED BY '\n';
@end example

�����Ĥ��Υե�����ɵڤӥ쥳���ɤμ谷���ץ����ˡ���ʸ����(@code{''})����ꤹ�뤳�Ȥ�����ޤ������Ǥʤ��ʤ顢@code{FIELDS [OPTIONALLY] ENCLOSED BY}��@code{FIELDS ESCAPED BY}���ͤ�ñ���ʸ���Ǥʤ���Фʤ�ޤ���@code{FIELDS TERMINATED BY}��@code{LINES TERMINATED BY}�ϣ��İʾ��ʸ���Ȥʤ�Ǥ��礦���㤨�С��꥿����ʸ���Ȳ���ʸ���Υڥ��Ƕ��ڤ�줿�쥳���ɤ�񤭹�����ꡢ���Τ褦�ʥ쥳���ɤ�ޤ���ե�������ɤ߹�����ꤹ��ˤϡ�@code{LINES TERMINATED BY '\r\n'}�����ꤷ�ޤ���

@code{FIELDS [OPTIONALLY] ENCLOSED BY}�ϡ��ե�����ɤΰ���������椷�ޤ������Ϥκ�(@code{SELECT ... INTO OUTFILE})��@code{OPTIONALLY}���ʤ����ʤ顢���ƤΥե�����ɤ�@code{ENCLOSED BY}ʸ���ǰϤޤ�ޤ������Τ褦�ʽ���(�ե�����ɶ��ڤ�˥���ޤ����)����򼡤˼����ޤ�:

@example
"1","a string","100.20"
"2","a string containing a , comma","102.20"
"3","a string containing a \" quote","102.20"
"4","a string containing a \", quote and comma","102.20"
@end example

@code{OPTIONALLY}����ꤹ��С�@code{ENCLOSED BY}ʸ���ϡ� @code{CHAR}�ե�����ɤ�@code{VARCHAR}�ե�����ɤΤ߰Ϥ�Τ˻��Ѥ���ޤ�:

@example
1,"a string",100.20
2,"a string containing a , comma",102.20
3,"a string containing a \" quote",102.20
4,"a string containing a \", quote and comma",102.20
@end example

�ե�������ͤ���ˤ�����@code{ENCLOSED BY}ʸ���νи��ϡ�@code{ESCAPED BY}ʸ���򤽤������֤����Ȥˤ�ꥨ�������פ���뤳�Ȥ����դ��Ʋ�������@code{ESCAPED BY}�ͤ˶�����ꤹ��ȡ�@code{LOAD DATA INFILE}�ˤ���������ɤ߹���ʤ����Ϥ���������Ǥ��礦���㤨�С����Τ褦�˥���������ʸ������ˤ�����硢�ʲ��˼����褦�ʽ��ϤȤʤ�ޤ��������ܤΣ����ܤΥե�����ɤˡ�(���ä�)�ե�����ɤ���ڤ뤫�Τ褦�ʥ������Ȥ�³������ޤ�ޤ�Ǥ��뤳�Ȥ����뤷�Ʋ�����:

@example
1,"a string",100.20
2,"a string containing a , comma",102.20
3,"a string containing a " quote",102.20
4,"a string containing a ", quote and comma",102.20
@end example

���Ϥˤ����ơ�@code{ENCLOSED BY}ʸ�������ꤵ��Ƥ��ꡢ���줬�ե�������ͤ�ξü�˸��줿��硢����ʸ���ϼ�����ޤ���(����ϡ�@code{OPTIONALLY}�����ꤵ�줿���ɤ����˹��餺�����ƤϤޤ�ޤ�;@code{OPTIONALLY}�����ϲ��Ϥˤϸ��̤�����ޤ���)
 @code{ESCAPED BY}ʸ�������֤����줿@code{ENCLOSED BY}ʸ���νи��ϡ����ߤΥե�������ͤΰ����Ȥ��ƽ�������ޤ�������Ū�ˤϡ�����ե�����ɤ����켫�ȡ���@code{ENCLOSED BY}ʸ���ǻϤޤäƤ����硢�ե�����ɤ��������ȯ�����룲�Ť�@code{ENCLOSED BY}ʸ���ϡ�ñ���@code{ENCLOSED BY}ʸ���Ȥ��ƽ�������ޤ���
 �㤨�С�@code{ENCLOSED BY '"'}�����ꤵ���ȡ�������ϰʲ��Τ褦������ޤ�:

@example
"The ""BIG"" boss"  -> The "BIG" boss
The "BIG" boss      -> The "BIG" boss
The ""BIG"" boss    -> The ""BIG"" boss
@end example

@code{FIELDS ESCAPED BY}�ϡ��ü�ʸ����ɤΤ褦�˽񤭹�������ɤ߹�����ꤹ�뤫�����椷�ޤ���
 @code{FIELDS ESCAPED BY}ʸ�������Ǥʤ���硢���Ϥˤ����Ƽ��Τ褦��ʸ��(ʸ����)�Υץ�ե��å����˻��Ѥ���ޤ�:
@itemize @bullet
@item
@code{FIELDS ESCAPED BY}ʸ��
@item
@code{FIELDS [OPTIONALLY] ENCLOSED BY}ʸ��
@item
@code{FIELDS TERMINATED BY}�ͤ�@code{LINES TERMINATED BY}�ͤκǽ��ʸ��
@item
ASCII 0 (����������ʸ���θ��³���Ƽºݤ˽񤫤��ʸ����ASCII @code{'0'}�ǡ�'������'�Х��ȤǤϤ���ޤ���)
@end itemize

@code{FIELDS ESCAPED BY}ʸ�������Ǥ���С��ɤ�ʸ���⥨�������פ���ޤ���
�äˡ��ե�������ͤ���˼�����ʸ����ޤ�Ǥ���ʤ�С�����������ʸ���˶�����ꤹ��ΤϤ��ޤ��ɤ��ͤ��Ȥϸ����ʤ��Ǥ��礦��

���Ϥˤ����ơ�@code{FIELDS ESCAPED BY}ʸ�������Ǥʤ���硢����ʸ���νи��ϼ����졢��³��ʸ���ϥե�������ͤΰ����Ȥ��Ƥ��Τޤ޼�������ޤ���
�㳰�ϡ����������פ��줿@samp{0}��@samp{N}�Ǥ�(�㤨�С�����������ʸ����@samp{\}�Ǥ������@code{\0}��@code{\N})��
 �����Υ������󥹤ϡ�ASCII 0('������'�Х���) ��@code{NULL}�Ȥ��ƽ�������ޤ���@code{NULL}���ε�§�ϲ��򻲾Ȥ��Ʋ�������

@samp{\}-escape syntax�˴ؤ��뤳��ʳ��ξ���ϡ�@ref{Literals}���ȡ�

�ե�����ɤȥ쥳�������ץ���󤬳μ¤���ߺ��Ѥ������:

@itemize @bullet
@item
@code{LINES TERMINATED BY}����ʸ�����@code{FIELDS TERMINATED BY}�����Ǥʤ���硢�ƥ쥳���ɤ�ޤ�@code{FIELDS TERMINATED BY}�ǽ��餻���ޤ���

@item
@code{FIELDS TERMINATED BY}��@code{FIELDS ENCLOSED BY}�ͤ�ξ���Ȥ��(@code{''})�λ���(���ڤ��ʤ�)����Ĺ�ԥե����ޥåȤ����Ѥ���ޤ���
����Ĺ�ԥե����ޥåȤǤϡ��ե�����ɴ֤˶��ڤ�ʸ���󤬻��Ѥ���ޤ���
�������ꡢ�ե�������ͤϡ��ե�����ɤ�``ɽ��''����Ȥäƽ񤭹��ޤ줿�ꡢ�ɤ߹��ޤ�ޤ���
�㤨�С�����ե�����ɤ�@code{INT(7)}���������Ƥ����硢�ե�����ɤ��ͤ�7ʸ���η��Ȥäƽ񤭹��ޤ�ޤ���
���Ϥˤ����ƥե�����ɤϡ���ʸ�����ɤ߹��ߤˤ�������ޤ���
����Ĺ�ԥե����ޥåȤϤޤ���@code{NULL}�ͤ����˹�����Ѥ����ޤ�;���򻲾ȤΤ��ȡ�
����: �ޥ���Х���ʸ�����åȤ���Ѥ��Ƥ�����ϸ���Ĺ�ե����ޥåȤ�Ư����
����
@end itemize

@code{FIELDS}��@code{LINES}���ץ����ˤ��@code{NULL}�ͤ�¿�ͤʼ谷��:

@itemize @bullet
@item
@code{FIELDS}��@code{LINES}�ν���ͤΤ���ˡ����ϻ���@code{NULL}��@code{\N}�Ȥ��ƽ񤭹��ޤ졢���ϻ���@code{\N}��@code{NULL}�Ȥ����ɤ߹��ޤ�ޤ�(�����Τ��Ȥʤ��顢@code{ESCAPED BY}ʸ����@samp{\}�Ȥ��ޤ�)��

@item
@code{FIELDS ENCLOSED BY}������̵���������@code{NULL}�Υե�������ͤ�@code{NULL}�ͤȤ����ɤ߹��ޤ�ޤ�(����ϡ�ʸ����@code{'NULL'}�Ȥ����ɤ߹��ޤ��@code{FIELDS ENCLOSED BY}ʸ����ǰϤޤ줿@code{NULL}�Ȥϰۤʤ�ޤ�)��

@item
@code{FIELDS ESCAPED BY}�����λ���@code{NULL}��@code{NULL}�Ȥ��ƽ񤭹��ޤ�ޤ���

@item
����Ĺ�ԥե����ޥå�(@code{FIELDS TERMINATED BY}��@code{FIELDS ENCLOSED BY}�����������ξ��˵�����ޤ�)�ˤ����ơ�@code{NULL}�ϡ�����ʸ����Ȥ��ƽ񤭹��ޤ�ޤ���
����ϡ��ե�������Ǥϡ�@code{NULL}�ͤȶ����ͤθ�ʬ�����Ĥ��ʤ��Ȥ������Ȥ򼨤��Ƥ��뤳�Ȥ����դ��Ʋ��������ե����뤫��ǡ������ɤ��᤹����ξ�Ԥ���̤��ʤ���Фʤ�ʤ���硢����Ĺ�ԥե����ޥåȤϻ��Ѥ��٤��ǤϤ���ޤ���
@end itemize

�������@code{REPLACE}��@code{IGNORE}�ϡ���ˡ����������ͤ���ʣ����쥳���ɤ�¸�ߤ������ϥ쥳���ɤμ谷�������椷�ޤ���
@code{REPLACE}����ꤷ����硢Ʊ����ˡ����������ͤ���Ŀ������쥳���ɤϡ�����¸�ߤ���Ʊ����ˡ����������Ǥ���쥳���ɤ��֤������ޤ���
@code{IGNORE}����ꤷ����硢����¸�ߤ���쥳���ɤΥ�ˡ����������ͤȽ�ʣ�������ϥ쥳���ɤϡ������åפ���ޤ���
������Υ��ץ�������ꤷ�Ƥ��ʤ���硢��ʣ������ȯ�����줿�����ǥ��顼��ȯ�������ƥ����ȥե�����λĤ��̵�뤵��ޤ���

@code{LOAD DATA INFILE}�ǥ��ݡ��Ȥ���ʤ�������:
@itemize @bullet

@item
����Ĺ��(@code{FIELDS TERMINATED BY}��@code{FIELDS ENCLOSED BY}��ξ������)��@code{BLOB}�ե�����ɡ�
@item
���륻�ѥ졼����¾��Ʊ�����⤷����¾�Υץ�ե��å����Ȥ�����硢@code{LOAD DATA INFILE}�ϡ����������Ͻ������Ǥ��ʤ��Ǥ��礦��
�㤨�С��ʲ���@code{FIELDS}�������θ����Ȥʤ�ޤ�:

@example
FIELDS TERMINATED BY '"' ENCLOSED BY '"'
@end example

@item
@code{FIELDS ESCAPED BY}�����ǡ��ե�������ͤˡ�@code{FIELDS ENCLOSED BY}�ͤ�@code{LINES TERMINATED BY}�ͤθ��@code{FIELDS TERMINATED BY}�ͤ�����褦�ʤ�Τ�ޤ��硢�ե�����ɤ�Ԥ��ɤ߹��ߤ������Ǥ��ڤ��Ƥ��ޤ��ޤ���
����ϡ�@code{LOAD DATA INFILE}�����ե�����ɤ�쥳���ɤν�λ���֤������������ʤ����Ȥˤ��ȯ�����ޤ���
@end itemize

������ϡ�@code{persondata}�ơ��֥�����ƤΥե�����ɤ��ɤ߹��ߤޤ�:

@example
mysql> LOAD DATA INFILE 'persondata.txt' INTO TABLE persondata;
@end example

�ե�����ɥꥹ�Ȥ����ꤵ��Ƥ��ޤ��󤫤顢@code{LOAD DATA INFILE}�ϡ����ϥ쥳���ɤ��ơ��֥�Τ��줾��Υե�����ɤ�ޤ��Τ����ꤷ�ޤ���
@code{FIELDS}��@code{LINES}�ν���ͤ����Ѥ���ޤ���

�ơ��֥�ΰ����Υե�����ɤΤ��ɤ߹��ߤ�����硢�ե�����ɥꥹ�Ȥ���ꤷ�ޤ�:

@example
mysql> LOAD DATA INFILE 'persondata.txt'
           INTO TABLE persondata (col1,col2,...);
@end example

�ơ��֥���Υե�����ɽ�����ϥե�����Υե�����ɽ礬�ۤʤ���ˤ⡢@strong{MySQL}�˥ơ��֥�Υե�����ɤ����ϥե�����ɤ��б��򶵤��뤿��ˡ��ե�����ɥꥹ�Ȥ���ꤷ�ʤ���Фʤ�ޤ���

���ϥ쥳���ɤΥե�����ɿ����������ʤ���硢���ϥե�������ͤ�Ϳ�����ʤ��ե�����ɤϡ�����ͤ����ꤵ��ޤ���
����ͤγ����ƤˤĤ��Ƥϡ�@ref{CREATE TABLE, , @code{CREATE TABLE}}.
�ǽҤ٤��Ƥ��ޤ���

���Υե�������ͤ��Ѵ�����ޤ���

@itemize @bullet
@item
ʸ�����ξ�硢 �ե�����ɤ��ͤ϶�ʸ���˥��åȤ���ޤ���

@item
���ͷ��ξ�硢�ե�����ɤ��ͤ� @code{0} �˥��åȤ���ޤ���

@item
���դȻ���η��ξ�硢 �ե�����ɤ��ͤ� ``zero'' �ΰ�̣�����ͤ����åȤ���ޤ���
@xref{Date and time types}.
@end itemize

@code{TIMESTAMP} �ե�����ɤϡ��ե�������ͤ� @code{NULL} �ͤ����ꤵ��Ƥ������⤷���ϡ�
�ե�����ɥꥹ�Ȥ����ꤵ��Ƥ������ @code{TIMESTAMP} �ե�����ɤ����Υꥹ�Ȥ����������Ƥ������
(�ǽ��@code{TIMESTAMP}�ե�����ɤΤ�)�����߻��郎���ꤵ�������Ǥ���

���ϥ쥳���ɤΥե�����ɿ�������¿����硢;ʬ�ʥե�����ɤ�̵�뤵�졢�ٹ�ο������䤵��ޤ���

@code{LOAD DATA INFILE}�����Ƥ����Ϥ�ʸ�����ʸ����Ȥߤʤ����Ȥ��顢@code{INSERT}���ơ��ȥ��ȤǤǤ���褦��@code{ENUM}�ե�����ɤ�@code{SET}�ե�����ɤؤο��ͤλ���ϤǤ��ޤ������Ƥ�@code{ENUM}�ڤ�@code{SET}�ͤ�ʸ����Ȥ���Ϳ�����ʤ���Ф����ޤ���

@findex mysql_info()
@code{LOAD DATA INFILE}������ν�λ����������ξ�������뤿���C API�ؿ�@code{mysql_info()}����Ѥ��뤳�Ȥ��Ǥ��ޤ�������ν񼰤ϰʲ��˼����褦�ʤ�ΤǤ�:

@example
Records: 1  Deleted: 0  Skipped: 0  Warnings: 0
@end example

@code{LOAD DATA INFILE} �������ϥ쥳���ɤΥե�����ɿ��β���­�����ä����ˤ�
�ٹ�������������������С�@code{INSERT} ���ơ��ȥ���
(@xref{INSERT, , @code{INSERT}}. ) �ˤ���ͤ�������������
�ٹ�ȯ������Τ�Ʊ���������ǡ��ٹ�ȯ�����ޤ���
�ٹ�Ϥɤ��ˤ���¸����ޤ��� �ٹ�ο������Ƥ��ޤ����ä����ˤ���
���ѤǤ��ޤ��� �⤷�ٹ���Τꤿ�������ηٹ����ͳ���Τꤿ���Τʤ顢
�����ˡ������ޤ��� @code{SELECT ... INTO OUTFILE} ����Ѥ���
¾�Υե��������Ȥ������ꥸ�ʥ�Υե��������٤ޤ���

@code{INSERT}����Ӥ���@code{LOAD DATA INFILE}�θ�Ψ��@code{LOAD DATA INFILE}�ι�®���ˤĤ��ƤΤ��ܤ�������ϡ�@xref{Insert speed}�򻲾ȤΤ��ȡ�

@findex UPDATE
@node UPDATE, USE, LOAD DATA, Reference
@section @code{UPDATE} ��ʸ

@example
UPDATE [LOW_PRIORITY] [IGNORE] tbl_name SET col_name1=expr1,col_name2=expr2,...
    [WHERE where_definition] [LIMIT #]
@end example

@code{UPDATE} �ϥơ��֥��¸�ߤ���쥳���ɤΥե�����ɤ򡢿������ͤ˹������ޤ���
@code{SET} ��ϤɤΥե�����ɤ�ɤ����ä��ͤˤ��٤����򼨤��ޤ���
@code{WHERE} �᤬Ϳ����줿��硢�������٤��쥳���ɤ����ꤹ�뤳�Ȥˤʤ�ޤ���
����ʳ��ϡ����ƤΥ쥳���ɤ򹹿����ޤ���

@code{LOW_PRIORITY} ������ɤ���ꤷ����硢@code{UPDATE} �μ¹Ԥϡ�
�ơ��֥���ɤ�Ǥ��륯�饤����Ȥ��ʤ��ʤ�ޤǡ��٤餵��ޤ���

@code{IGNORE} ������ɤ���ꤷ�����ϡ�update ʸ�ϡ�
update �����ť����Υ��顼�������Ȥ��Ƥ⡢�۾ェλ���ޤ���
Rows that would cause conflicts will not be updated.

ɽ����� @code{tbl_name} ����Υե�����ɤ򥢥���������ȡ�@code{UPDATE} 
�ϸ��ߤΥե�������ͤ���Ѥ��ޤ����㤨�С����Υ��ơ��ȥ��Ȥ� 
@code{age} �ե�����ɤˤ��θ����ͤ�꣱�礭���ͤ����ꤷ�ޤ�:

@example
mysql> UPDATE persondata SET age=age+1;
@end example

@code{UPDATE} �Ϻ����鱦��ɾ������ޤ����㤨�С��ʲ���ʸ�� @code{age} �ե�����ɤ�
2�ܤˤ������Τ���1���䤷�ޤ���

@example
mysql> UPDATE persondata SET age=age*2, age=age+1;
@end example

�⤷�ե�����ɤ˸��ߤ�äƤ����ͤ���ꤷ����硢@strong{MySQL} �Ϥ�������Τ���
�ͤϹ������ޤ���

@findex mysql_info()
@code{UPDATE} ���ѹ����줿�쥳���ɿ����֤��ޤ���
@strong{MySQL} 3.22 �ʾ�Ǥϡ�C API �ؿ� @code{mysql_info()} ��
�ޥå����������줿�쥳���ɿ����֤��ޤ����ޤ� @code{UPDATE} ��˵�����
��˥󥰤ο����֤��ޤ���

@strong{MySQL} 3.23 �Ǥϡ� @code{LIMIT #} �ǻ��ꤷ���������쥳���ɤ��ѹ�
�Ǥ��ޤ���

@findex USE
@node USE, FLUSH, UPDATE, Reference
@section @code{USE} ��ʸ

@example
USE db_name
@end example

@code{USE db_name} ��ʸ�ϡ� @strong{MySQL} �� @code{db_name} �ǡ����١�����
���θ�Υ�����Υǥե���ȤΥǡ����١����ˤ���褦�˻ؼ����ޤ���
���ꤵ�줿�ǡ����١����ϡ����å����κǸ�ޤǡ����뤤�ϡ�¾�� @code{USE} ��ʸ
��ȯ�Ԥ����ޤǻĤ�ޤ���

@example
mysql> USE db1;
mysql> SELECT count(*) FROM mytable;      # selects from db1.mytable
mysql> USE db2;
mysql> SELECT count(*) FROM mytable;      # selects from db2.mytable
@end example

@code{USE} ��ʸ������Υǡ����١����򥫥��Ȥˤ��Ƥ⡢
¾�Υǡ����١����Υơ��֥뤫�饢���������뤳�Ȥ�˸���ޤ���
�ʲ��� @code{db1} �ǡ����١����� @code{author} �ơ��֥�ȡ�
 @code{db2} �ǡ����١����� @code{editor} �ơ��֥�˥�������������Ǥ���

@example
mysql> USE db1;
mysql> SELECT author_name,editor_name FROM author,db2.editor
           WHERE author.editor_id = db2.editor.editor_id;
@end example

@cindex Sybase compatibility
@cindex Compatibility, with Sybase
@code{USE} ��ʸ�� Sybase �θߴ��Τ�����󶡤���Ƥ��ޤ���

@cindex @code{mysqladmin}
@findex FLUSH
@node FLUSH, KILL, USE, Reference
@section @code{FLUSH} ��ʸ (����å���Υ��ꥢ)

@example
FLUSH flush_option [,flush_option]
@end example

@code{FLUSH} ���ޥ�ɤ� @strong{MySQL} �����Ѥ��Ƥ�����������å����
�����Ĥ��򤭤줤�˾ä����Ȥ��Ǥ��ޤ���
@code{FLUSH} ��¹Ԥ���ˤϡ� @strong{reload} ���¤��ʤ���Фʤ�ޤ���

@code{flush_option} �ˤϰʲ������Ĥ�����Ǥ��ޤ���

@multitable @columnfractions .15 .85
@item @code{HOSTS}  @tab �ۥ��ȥ���å���ơ��֥����ˤ��ޤ������ʤ��Υۥ��Ȥ�
IP ���ɥ쥹���Ѥ����ꡢ@code{Host ... is blocked} �Ȥ������顼��å�������
�Ф���ϥۥ��ȥơ��֥륭��å������ٶ��ˤ��ʤ��ƤϤʤ�ޤ���
�ʻ��ꤷ���ۥ��Ȥ��Ф��� @code{max_connect_errors} �ʾ����³���顼���Ф��硢
@strong{MySQL} �ϲ�����������
���ꤷ�����Υۥ��Ȥ���Τ����ʤ���³�׵����ݤ��ޤ����ۥ��ȥơ��֥륭��å���ξõ�ϡ�
�Ƥ���³������褦�ˤ��ޤ���@xref{Blocked host}.��
@code{mysqld} ��
@code{-O max_connection_errors=999999999} ���Ϥ������Υ��顼��å�������
����Ǥ��ޤ�

@item @code{LOGS}   @tab ɸ��Υ����ե�����ȹ��������ե������
�����Ĥ��ƺƤӳ����ޤ���
�⤷���������ե�������ĥ��̵���ǻ��ꤷ�Ƥ����硢���������������ե������
��ĥ�Ҥ��ֹ�ϡ�������Υե������� 1 ���䤷�����ˤʤ�ޤ���
�ե�����̾�˳�ĥ����Ѥ�����硢@strong{MySQL} �Ϲ��������ե�������Ĥ��Ƴ����ޤ���
@xref{Update log}.

@item @code{PRIVILEGES} @tab @code{mysql} �ǡ����١����ε��ĥơ��֥뤫�顢
���¾������ɹ����ޤ���

@item @code{TABLES} @tab ���Ƥγ����Ƥ���ơ��֥���Ĥ��ޤ���

@item @code{TABLES WITH READ LOCK} @tab Closes all open tables and locks all tables for read until one executes @code{UNLOCK TABLES}.

@item @code{STATUS} @tab �ۤȤ�ɤΥ��ơ������ѿ��� 0 �ˤ��ޤ���
@end multitable

��˼��������ޥ�ɤϡ�@code{mysqladmin} ����Ѥ��Ƥ�¹ԤǤ��ޤ���
@code{mysqladmin} �ΰ����Ϥ��줾�졢
@code{flush-hosts}, @code{flush-logs}, @code{reload}, @code{flush-tables} ��
�ʤ�ޤ���

@code{FLUSH} ���ޥ�ɤ�¹Ԥ���ˤϡ�@strong{reload} ���¤��ʤ���Фʤ�ޤ���

@cindex @code{mysqladmin}
@findex KILL
@node KILL, SHOW, FLUSH, Reference
@section @code{KILL} ��ʸ

@example
KILL thread_id
@end example

@code{thread_id} �ˤϡ�@code{mysqld} ����³�������äƤ��륹��åɤ� ID ��
����Ƕ��ڤäƻ��ꤷ�ޤ���
@code{SHOW PROCESSLIST} ���ޥ�ɤ����äƤ��륹��åɤ��Τ뤳�Ȥ��Ǥ���
 @code{KILL thread_id} ���ޥ�ɤǥ���åɤ� KILL �Ǥ��ޤ���

�⤷ @strong{process} ���¤�����ʤ顢���ƤΥ���åɤ��ǧ����KILL ����ޤ���
�����Ǥʤ���С���ʬ�Υ���åɤ�����
��ǧ����KILL ��������Ǥ��ޤ���

@code{mysqladmin processlist} �� @code{mysqladmin kill} �򥹥�åɤ�
������ KILL �˻��ѤǤ��ޤ���

@findex SHOW DATABASES
@findex SHOW TABLES
@findex SHOW COLUMNS
@findex SHOW FIELDS
@findex SHOW INDEX
@findex SHOW KEYS
@findex SHOW STATUS
@findex SHOW VARIABLES
@findex SHOW PROCESSLIST
@findex SHOW TABLE STATUS
@findex SHOW GRANTS
@node SHOW, EXPLAIN, KILL, Reference
@section @code{SHOW} ��ʸ (�ơ��֥��ե�����ɤʤɤˤĤ��Ƥξ��������)

@example
   SHOW DATABASES [LIKE wild]
or SHOW TABLES [FROM db_name] [LIKE wild]
or SHOW COLUMNS FROM tbl_name [FROM db_name] [LIKE wild]
or SHOW INDEX FROM tbl_name [FROM db_name]
or SHOW STATUS [LIKE wild]
or SHOW VARIABLES [LIKE wild]
or SHOW [FULL] PROCESSLIST
or SHOW TABLE STATUS [FROM db_name] [LIKE wild]
or SHOW GRANTS FOR user
@end example

@code{SHOW} �ϥǡ����١������ơ��֥롢�ե�����ɡ������С��ˤĤ��Ƥξ����Ϳ���ޤ���
@code{LIKE wild} �����Ѥ��줿��硢@code{wild} ʸ������̾�� SQL �磻��ɥ�����
 (@samp{%} �� @samp{_}) �Ǥ���

@code{tbl_name FROM db_name} ������ˡ�@code{db_name.tbl_name} �����ѤǤ��ޤ���
�������Ĥ�Ʊ���Ǥ���

@example
mysql> SHOW INDEX FROM mytable FROM mydb;
mysql> SHOW INDEX FROM mydb.mytable;
@end example

@code{SHOW DATABASES} �� @strong{MySQL} �����С���Υǡ����١����򼨤��ޤ���
@code{mysqlshow} ���ޥ�ɤǤ�Ʊ�����������ޤ���

@code{SHOW TABLES} �ϻ��ꤵ�줿�ǡ����١����Υơ��֥�����ɽ�����ޤ���
@code{mysqlshow db_name} ���ޥ�ɤǤ�Ʊ�����������ޤ���

@strong{NOTE}: �⤷�桼�����˥ơ��֥���Ф��븢�¤�̵����硢
�ơ��֥�� @code{SHOW TABLES} �� @code{mysqlshow db_name} ���׵��
ɽ������ޤ���

@code{SHOW COLUMNS} ��Ϳ����줿�ơ��֥�Υե�����ɤ�ɽ�����ޤ���
�⤷���Υե�����ɤη��������ʤ��� @code{CREATE TABLE} ��ʸ�¹Ի���Ϳ������Τ�
�㤦���ϡ� @strong{MySQL} �ϡ��ե�����ɤη���Ȥ������ѹ����뤳�Ȥ�
���뤳�Ȥ����դ��Ƥ���������
@xref{Silent column changes}.

@code{DESCRIBE} ʸ�� @code{SHOW COLUMNS} �Ȼ����褦�ʾ�����󶡤��ޤ���
@xref{DESCRIBE, , @code{DESCRIBE}}.

@code{SHOW TABLE STATUS} (�С������ 3.23 �ο���ǽ) �� @code{SHOW STATUS} 
�Τ褦�Ǥ��������줾��Υơ��֥�ˤĤ��Ƥ��¿���ξ�����󶡤��ޤ���
@code{mysqlshow --status db_name} ���ޥ�ɤ�¹Ԥ��Ƥ�Ʊ����Τ������ޤ���
�ʲ��ι��ܤ��֤äƤ��ޤ���

@multitable @columnfractions .30 .70
@item @strong{����} @tab @strong{��̣}
@item @code{Name} @tab �ơ��֥�̾
@item @code{Type} @tab �ơ��֥�μ��� (BDB, ISAM, MyISAM or HEAP)
@item @code{Row_format} @tab �쥳���ɤ���¸���� (Fixed, Dynamic, or Compressed)
@item @code{Rows} @tab �쥳���ɿ�
@item @code{Avg_row_length} @tab �쥳���ɤ�ʿ��Ĺ
@item @code{Data_length} @tab �ǡ����ե�������礭��
@item @code{Max_data_length} @tab �ǡ����ե�����κ�����
@item @code{Index_length} @tab ����ǥå����ե�������礭��
@item @code{Data_free} @tab ������Ƥ�줿�����Ѥ���Ƥ��ʤ��Х��ȿ�
@item @code{Auto_increment} @tab ���� autoincrement ��
@item @code{Create_time} @tab �ơ��֥��������
@item @code{Update_time} @tab ���ֺǸ�˹������줿����
@item @code{Check_time} @tab ���ֺǸ�˥����å����줿����
@item @code{Create_options} @tab @code{CREATE TABLE} �ǻ��Ѥ��줿��ĥ���ץ����
@item @code{Comment} @tab �ơ��֥�������ˤĤ���줿������ (���뤤�ϡ��ʤ����Υơ��֥��@strong{MySQL} �����������Ǥ��ʤ����Τ����Ĥ��ξ���).
@end multitable

@code{SHOW FIELDS} �� @code{SHOW COLUMNS} ����̾�Ȥ��ƻ��Ѥ��졢
@code{SHOW KEYS} �� @code{SHOW INDEX} ����̾�Ȥ��ƻ��Ѥ���ޤ���
�ơ��֥�Υե�����ɤ䥤��ǥå����� @code{mysqlshow db_name tbl_name}
�� @code{mysqlshow -k db_name tbl_name} �Ǥ⸫��ޤ���

@code{SHOW INDEX} �� ODBC �Ǥ��� @code{SQLStatistics} 
�˶ᤤ�����ǡ�����ǥå����ξ����ɽ�����ޤ���
�ʲ��ι��ܤ��֤�ޤ���

@multitable @columnfractions .35 .65
@item @strong{����} @tab @strong{��̣}
@item @code{Table} @tab �ơ��֥�̾
@item @code{Non_unique} @tab ����ǥå�������ʣ��ޤޤʤ��ʤ� 0
@item @code{Key_name} @tab ����ǥå���̾
@item @code{Seq_in_index} @tab ����ǥå����ι����ֹ档1 ����Ϥޤ�ޤ���
@item @code{Column_name} @tab �ե������̾��
@item @code{Collation} @tab �����ˤ��Υե�����ɤ�����ǥå�����ǥ����Ȥ���뤫.  @strong{MySQL} �Ǥ�, ����� @code{A} (Ascending) �� @code{NULL} (Not sorted) �ˤʤ�ޤ���
@item @code{Cardinality} @tab ����ǥå�����Υ�ˡ������ͤο��� ����� @code{isamchk -a} �μ¹Ԥǹ�������ޤ���
@item @code{Sub_part} @tab �⤷���Υե�����ɤ�����ǥå����˰���ʬ�������Ѥ��Ƥ����硢���Υ���ǥå����˻��Ѥ��Ƥ��륭��饯�������򤷤᤹�� �⤷�������Τ�����ǥå�������Ƥ���ʤ� @code{NULL} ��
@end multitable


@cindex @code{mysqladmin}
@code{SHOW STATUS} �� @code{mysqladmin extended-status} ��Ʊ�ͤˡ������Ф���Υ��ơ�
���������Ϳ���ޤ������Ϥϼ��Ȥϰۤʤ뤫�⤷��ޤ���:

@example
+--------------------------+--------+
| Variable_name            | Value  |
+--------------------------+--------+
| Aborted_clients          | 0      |
| Aborted_connects         | 0      |
| Connections              | 17     |
| Created_tmp_tables       | 0      |
| Delayed_insert_threads   | 0      |
| Delayed_writes           | 0      |
| Delayed_errors           | 0      |
| Flush_commands           | 2      |
| Handler_delete           | 2      |
| Handler_read_first       | 0      |
| Handler_read_key         | 1      |
| Handler_read_next        | 0      |
| Handler_read_rnd         | 35     |
| Handler_update           | 0      |
| Handler_write            | 2      |
| Key_blocks_used          | 0      |
| Key_read_requests        | 0      |
| Key_reads                | 0      |
| Key_write_requests       | 0      |
| Key_writes               | 0      |
| Max_used_connections     | 1      |
| Not_flushed_key_blocks   | 0      |
| Not_flushed_delayed_rows | 0      |
| Open_tables              | 1      |
| Open_files               | 2      |
| Open_streams             | 0      |
| Opened_tables            | 11     |
| Questions                | 14     |
| Slow_launch_threads      | 0      |
| Slow_queries             | 0      |
| Threads_connected        | 1      |
| Threads_running          | 1      |
| Uptime                   | 149111 |
+--------------------------+--------+
@end example

��˼��������ơ������ѿ��ϰʲ��˼����ΰ�̣������ޤ���

@multitable @columnfractions .35 .65
@item @code{Aborted_clients} @tab ���饤����Ȥ���³���Ĥ������˻��Ǥ��ޤä���������Ǥ��줿���ͥ���������
@item @code{Aborted_connects} @tab @strong{MySQL} �����С�����³���ߤƼ��Ԥ�����
@item @code{Bytes_received} @tab ���饤����Ȥ�����������Х��ȿ�
@item @code{Bytes_sent} @tab ���饤����Ȥ����������Х��ȿ�
@item @code{Connections} @tab @strong{MySQL} �����С�����³���ߤ���
@item @code{Created_tmp_tables} @tab ���ơ��ȥ��ȼ¹���˰��ۤΤ����˺������줿����ơ��֥�ο�
@item @code{Delayed_insert_threads} @tab ������� delayed insert �ϥ�ɥ顼����åɤο�
@item @code{Delayed_writes} @tab @code{INSERT DELAYED} �ǽ񤫤줿�쥳���ɿ�
@item @code{Delayed_errors} @tab @code{INSERT DELAYED} �ǽ񤫤줿�쥳���ɤǤʤ�餫�Υ��顼�Τ��ä��쥳���ɿ� (���֤� @code{duplicate key}).
@item @code{Flush_commands} @tab @code{FLUSH} ���ޥ�ɤμ¹Բ��
@item @code{Handler_delete} @tab �ơ��֥뤫��쥳���ɤ������뤿��Υꥯ�����ȿ�
@item @code{Handler_read_first} @tab �ơ��֥���κǽ�Υ쥳���ɤ��ɤि��Υꥯ�����ȿ���
@item @code{Handler_read_key} @tab �����˴�Ť��ƥ쥳���ɤ��ɤि��Υꥯ�����ȿ���
@item @code{Handler_read_next} @tab ������Ǽ��Υ쥳���ɤ��ɤि��Υꥯ�����ȿ���
@item @code{Handler_read_rnd} @tab ������֤˴�Ť��ƥ쥳���ɤ��ɤि��Υꥯ�����ȿ���
@item @code{Handler_read_rnd_next} @tab �ǡ����ե�����μ��Υ쥳���ɤ��ɤ��׵�ο���
¿���Υơ��֥륹������Ԥʤ���硢����Ϲ⤯�ʤ�ޤ� - �̾����ϥơ�
�֥뤬����������ǥå�������Ƥ��ʤ�����¸�ߤ��륤��ǥå�����ͭ���˻Ȥ���
���˥����꤬�񤫤�Ƥ��ʤ����Ȥ򼨺����ޤ���
@item @code{Handler_update} @tab �ơ��֥�Υ쥳���ɤ򹹿����뤿����׵��
@item @code{Handler_write} @tab �ơ��֥�˥쥳���ɤ��������뤿��Υꥯ�����ȿ�
@item @code{Key_blocks_used} @tab ��������å�����ǻ��Ѥ��줿�֥��å���
@item @code{Key_read_requests} @tab ����å��夫�饭���֥��å����ɤ߹�����ꥯ�����ȿ�
@item @code{Key_reads} @tab Disk ����ʪ��Ū�˥����֥��å����ɤ�����
@item @code{Key_write_requests} @tab ����å���˥����֥��å���񤭹�����ꥯ�����ȿ�
@item @code{Key_writes} @tab Disk��ʪ��Ū�˥����֥��å���񤭹�������
@item @code{Max_used_connections} @tab ����Ʊ����³��
@item @code{Not_flushed_key_blocks} @tab ��������å�����ˤ��륭���֥��å��ǡ��ѹ����줿��ΤΤ��ޤ�Disk�˽񤭽Ф���Ƥ��ʤ������֥��å���
@item @code{Not_flushed_delayed_rows} @tab @code{INSERT DELAY} ������ǽ񤭽Ф����ԤäƤ���쥳���ɿ�
@item @code{Open_tables} @tab �����ץ󤵤�Ƥ���ơ��֥��
@item @code{Open_files} @tab  �����ץ󤵤�Ƥ���ե������
@item @code{Open_streams} @tab �����Ƥ��륹�ȥ꡼��� (��˥����˻��Ѥ����)
@item @code{Opened_tables} @tab �����ץ󤵤줿�ơ��֥��
@item @code{Questions} @tab �����С�������줿������ο�
@item @code{Slow_launch_threads} @tab ��³�� @code{slow_launch_time} �ʾ���פ�������åɿ�
@item @code{Slow_queries} @tab @code{long_query_time} �ʾ�˻��֤Τ����ä�������ο�
@item @code{Threads_cached} @tab ����åɥ���å�����Υ���åɿ�
@item @code{Threads_connected} @tab ���߳����Ƥ�����³��
@item @code{Threads_running} @tab ���꡼�פ��Ƥ��ʤ�����åɤο�
@item @code{Uptime} @tab �����С������äƤ����ÿ�
@end multitable

��ˤĤ��ƤΤ����Ĥ������ȡ�

@itemize @bullet
@item
�⤷ @code{Opened_tables} ���礭����С� @code{table_cache} �ѿ�������������
�ΤǤ��礦��
@item
�⤷ @code{key_reads} ���礭����С� @code{key_cache} �����ʤ�����Ǥ��礦��
����å���ҥåȥ졼�Ȥ�
@code{key_reads}/@code{key_read_requests} �Ƿ׻��Ǥ��ޤ���
@item
�⤷ @code{Handler_read_rnd} ���礭����С�
@strong{MySQL} �˥ơ��֥�򥹥���󤵤���褦��¿���Υ�����
�䡢 ��������Ѥ��ʤ� JOIN ����Ƥޤ���
@end itemize

@code{SHOW VARIABLES} �� @strong{MySQL} �����ƥ��ѿ��Τ����Ĥ����ͤ򼨤��ޤ���
@code{mysqlshow variables} ���ޥ�ɤǤ�Ʊ�����������ޤ���
�⤷ɸ���ͤ�Ŭ���ʤ��ʤ顢�ۤȤ�ɤ��ѿ��� @code{mysqld} ��ư����
���ޥ�ɥ饤��Υ��ץ����Ȥ���Ϳ���뤳�Ȥˤ�ꡢ�ѹ��Ǥ��ޤ���
���Ϥϰʲ��Τ褦�ˤʤ�ޤ������ե����ޥåȤ���Ϥ����֤�㤦�Ǥ��礦��

@example
+------------------------+--------------------------+
| Variable_name          | Value                    |
+------------------------+--------------------------+
| back_log               | 5                        |
| connect_timeout        | 5                        |
| basedir                | /my/monty/               |
| datadir                | /my/monty/data/          |
| delayed_insert_limit   | 100                      |
| delayed_insert_timeout | 300                      |
| delayed_queue_size     | 1000                     |
| join_buffer_size       | 131072                   |
| flush_time             | 0                        |
| interactive_timeout    | 28800                    |
| key_buffer_size        | 1048540                  |
| language               | /my/monty/share/english/ |
| log                    | OFF                      |
| log_update             | OFF                      |
| long_query_time        | 10                       |
| low_priority_updates   | OFF                      |
| max_allowed_packet     | 1048576                  |
| max_connections        | 100                      |
| max_connect_errors     | 10                       |
| max_heap_table_size    | 16777216                 |
| max_delayed_threads    | 20                       |
| max_join_size          | 4294967295               |
| max_sort_length        | 1024                     |
| max_tmp_tables         | 32                       |
| net_buffer_length      | 16384                    |
| port                   | 3306                     |
| protocol-version       | 10                       |
| record_buffer          | 131072                   |
| skip_locking           | ON                       |
| slow_launch_time       | 2                        |
| socket                 | /tmp/mysql.sock          |
| sort_buffer            | 2097116                  |
| table_cache            | 64                       |
| thread_stack           | 131072                   |
| tmp_table_size         | 1048576                  |
| tmpdir                 | /machine/tmp/            |
| version                | 3.23.0-alpha-debug       |
| wait_timeout           | 28800                    |
+------------------------+--------------------------+
@end example

@xref{Server parameters, ,Server parameters}.

@findex Threads
@findex PROCESSLIST
@code{SHOW PROCESSLIST} �ϤɤΥ���åɤ����äƤ��뤫��ɽ�����ޤ���
@code{mysqlshow processlist} ���ޥ�ɤǤ�Ʊ�����������ޤ���
�⤷ @strong{process} ���¤�����ʤ顢���ƤΥ���åɤ��ߤ�ޤ���
���������¤��ʤ��ʤ顢��ʬ�Υ���åɤ�������ޤ���
@xref{KILL, , @code{KILL}}.
@code{FULL} ���ץ�������Ѥ��ʤ���硢�ƥ�����κǽ��100ʸ��������ɽ��
����ޤ���

@code{SHOW GRANTS FOR user} �ϥ桼���ε��Ĥ�ʣ�����뤿���ȯ�Ԥ���ɬ�פ���
�� grant ���ޥ�ɤ�ꥹ�Ȥ��ޤ���

@example
mysql> SHOW GRANTS FOR root@@localhost;
+---------------------------------------------------------------------+
| Grants for root@@localhost                                           |
+---------------------------------------------------------------------+
| GRANT ALL PRIVILEGES ON *.* TO 'root'@@'localhost' WITH GRANT OPTION |
+---------------------------------------------------------------------+
@end example

@findex EXPLAIN
@findex SELECT, optimizing
@node EXPLAIN, DESCRIBE, SHOW, Reference
@section @code{EXPLAIN} ��ʸ (@code{SELECT}�ˤĤ��Ƥξ��������)

@example
    EXPLAIN tbl_name
or  EXPLAIN SELECT select_options
@end example

@code{EXPLAIN tbl_name} �ϡ� @code{DESCRIBE tbl_name} ��
@code{SHOW COLUMNS FROM tbl_name} ��Ʊ���Ǥ���

�⤷ @code{EXPLAIN} ��Ȥ�ʤä� @code{SELECT} ��ʸ��¹Ԥ�����硢
@strong{MySQL} �Ϥ��� @code{SELECT} ��������ư��뤫����������
�����˥ơ��֥뤬��礵��뤫�ξ����Ϳ���ޤ���

@code{EXPLAIN} �ξ���򸵤ˡ�����ǥå�������Ѥ���®�� @code{SELECT} ��
���뤿��˥ơ��֥�˥���ǥå�����ä��ʤ��ƤϤʤ�ʤ��Ȥ��������狼��ޤ���
�ơ��֥���κ�Ŭ���⥪�ץ����ˤ�äƸ��뤳�Ȥ��Ǥ��ޤ���
@code{SELECT} ��ʸ�Ǥη�����Ū�˺�Ŭ������ˤ� @code{STRAIGHT_JOIN} ���ä��ޤ���

ñ��ǤϤʤ� join �Τ���ˡ�@code{EXPLAIN} �� @code{SELECT} ʸ�ǻ��Ѥ���Ƥ���
���줾��Υơ��֥�ξ�����֤��ޤ���
�ơ��֥���ɤޤ����ɽ������ޤ���@strong{MySQL} �� one-sweep multi-join method
���Ѥ������Ƥ� join ���褷�ޤ�������� @strong{MySQL} �Ϻǽ�Υơ��֥뤫��
��쥳�����ɤ߹��ߡ�����ܤΥơ��֥뤫��ޥå������쥳���ɤ�õ���������ƻ����ܤ�õ���Ȥ������ȤǤ���
���ƤΥơ��֥뤬���������������򤵤줿�ե�����ɤ���Ϥ����ơ��֥�ΰ�����
���ޥå�����쥳���ɤ��ĥơ��֥�򸫤Ĥ���ޤ� back-track ����ޤ���
���Υ쥳���ɤϤ��Υơ��֥뤫���ɤޤ졢���Υơ��֥뤫�������³���ޤ���

@code{EXPLAIN} �ν��Ϥϰʲ��Υե�����ɤ�ޤߤޤ���

@table @code
@item table
���ϥ쥳���ɤ����Ȥ����ơ��֥�

@item type
��join ������.  �͡��ʥ����פ������ϸ�Ҥ��ޤ�

@item possible_keys
@code{possible_keys} ���ܤϡ�@strong{MySQL} ���ơ��֥뤫��쥳���ɤ򸫤Ĥ��뤿���
�ɤΥ���ǥå�������Ѥ�������Ǥ������򼨤��ޤ���
����: ���Υե�����ɤϥơ��֥�ν�ˤޤä�����¸���ޤ��󡣤���ϡ�
possible_keys ��Τ����Ĥ��Υ����ϡ��������줿�ơ��֥��Ǥμ¹Ԥ˻��ѤǤ�
�ʤ����Ȥ��̣���ޤ���

���ι��ܤ����ʤ顢��Ϣ����
����ǥå�����̵���Ȥ������ȤǤ������ξ�硢���ʤ��� @code{WHERE} ���
Ĵ�٤뤳�Ȥˤ�äơ����������ǽ����夵���뤳�Ȥ��Ǥ��뤫�⤷��ޤ���
�⤷���줬����ǥå�����Ŭ�礷���ե�����ɤ򻲾Ȥ��Ƥ���ʤ�С�
���ˤ������Ȥ���ȡ�Ŭ�ڤʥ���ǥå������������ @code{EXPLAIN} �ǥ������
�⤦���٥����å����ƤߤƤ���������

�ơ��֥뤬�ɤ�ʥ���ǥå�������äƤ��뤫�ߤ�ˤϡ�@code{SHOW INDEX FROM tbl_name} �Ȥ��ޤ���

@item key������
@code{key} ���ܤϡ� @strong{MySQL} �����Ѥ���ȼºݤ˷�᤿�����򼨤��ޤ���
�ɤΥ���ǥå��������Ф�ʤ��ä��ʤ�С������� @code{NULL} �Ǥ���
@strong{MySQL} ���ְ�ä�����ǥå��������򤹤��硢�����Ƥ��� 
@strong{MySQL} ��¾�Υ���ǥå�������Ѥ���褦�˶������뤳�Ȥ��Ǥ��ޤ���
@code{myisamchk --analyze} �λ��ѡ�@xref{myisamchk syntax}���ޤ��� 
@code{USE INDEX/IGNORE INDEX} �λ��Ѥˤ�äơ�@xref{JOIN}��

@item key_len
@code{key_len} ���ܤϡ�@strong{MySQL} �����Ѥ���ȷ�᤿������Ĺ���򼨤��ޤ���
�⤷ @code{key} �� @code{NULL} �ʤ顢Ĺ���� @code{NULL} �Ǥ���
����: �����@strong{MySQL} ���ޥ���ѡ��ȥ����Τ����ĤΥѡ��Ȥ�ºݤ˻���
���뤫�򼨤��ޤ���

@item ref������
@code{ref} ���ܤϡ��ơ��֥뤫��쥳���ɤ� select ���뤿��ˡ��ɤΥե�����ɤ������
 @code{key} �ȶ��˻��Ѥ��줿���򼨤��ޤ���

@item rows������
@code{rows} �ե�����ɤϡ�@strong{MySQL} ���������¹Ԥ��뤿��˸�������
ɬ�פ�����ȹͤ��Ƥ���쥳���ɤο��򼨤��ޤ���

@item Extra��
This column contains additional information of how @strong{MySQL} will
resolve the query. Here follows an explanation of the different text
strings that can be found in this column:

@table @code
@item Not exists
@strong{MySQL} was able to do a @code{LEFT JOIN} optimisation on the
query and will not examine more rows in this table for a row combination
after it founds one rows that matches the @code{LEFT JOIN} criteria.
@item @code{range checked for each record (index map: #)}
@strong{MySQL} didn't find a real good index to use. It will instead for
each row combination in the preceding tables do a check which index to
use (if any) use this index to retrieve the rows from the table.  This
isn't very fast but is of course faster than having to do a join without
an index.
@item Using filesort
@strong{MySQL} will need to do an extra pass to find out how to retrieve
the rows in sorted order.  The sort is done by going through all rows
according to the @code{join type} and storing the sort key + pointer to
the row for all rows that match the @code{WHERE}. Then the keys are
sorted. Finally the rows are retrieved in sorted order.
@item Using index
The column information is retrieved from the table using only
information in the index tree without having to do an additional seek to
read the actually row.  This can be done when all the used columns for
the table are part of the same index.
@item Using temporary
To be able to resolve the query @strong{MySQL} will need to create a
temporary table to hold the result.  This typically happens if you do an
@code{ORDER BY} on a different column set than you did an @code{GROUP
BY} on.
@item where used
A @code{WHERE} clause will be used to restrict which rows will be
matched against the next table or sent to the client.  If you don't have
this information and the the table is of type @code{ALL} or @code{index}
you may have something wrong in your query (if you don't intend to
fetch/examine all rows from the table).
@end table

If you want to get your queries as fast as possible, you should look out for
@code{Using filesort} and @code{Using temporary}.
@end table

join type �ϰʲ��Τ�Τ�����ޤ����ɤ�ʪ�����˽񤤤Ƥ��ޤ���

@cindex System table
@cindex Table, system
@table @code
@item system
�ơ��֥뤬��쥳���ɤ������äƤ��� (= system table). ����� @code{const} join type
�����̤ʾ��Ǥ���

@cindex Constant table
@cindex Table, constant
@item const
�ơ��֥�ϡ��Ǥ�ޥå�����쥳���ɤ򣱤Ĥ�äƤ��ꡢ����ϥ������
�ǽ���ɤޤ�ޤ���
1 �ĤΥ쥳���ɤǤ��뤿�ᡢ���Υ쥳������Υե�����ɤ��ͤ�
���ץƥ��ޥ������ˤ�äƾ���Ȥ��Ƥߤʤ���ޤ���
1������ɤޤ��Τǡ�@code{const} �ơ��֥�ϤȤƤ�®���Ǥ�! 

@item eq_ref
���Υơ��֥�Τ��줾��Υ쥳���ɤȷ�礹��ݡ����Υơ��֥뤫��1�쥳�����ɤޤ�ޤ���
����� join �Ǥ� @code{const} �����ɤ����Ǥ���
����ǥå��������ƤΥѡ��Ȥ� join �ǻ��Ѥ��졢���ġ�����ǥå�����
@code{UNIQUE} �� @code{PRIMARY KEY} �Ǥ���Ȥ��ˡ�����ϻ��Ѥ���ޤ���

@item ref������
����ǥå������ͤ˹�ä����٤ƤΥ쥳���ɤϡ����Υơ��֥뤫��쥳���ɤȷ�礹�뤿��ˡ�
���Υơ��֥뤫���ɤޤ��Ǥ��礦��
�⤷���� join �������ΰ��ֺ�����Ƭ��ʬ��������Ѥ���ʤ�С�
���뤤�ϡ�
�⤷���Υ����� @code{UNIQUE} �� @code{PRIMARY KEY} �Ǥʤ����
(����������ʤ顢�⤷ join ���������ͤ򸵤˰�Ĥ����Ρ��쥳���ɤ�����Ǥ��ʤ����)��
@code{ref} �ϻ��Ѥ���ޤ���
�⤷���Υ����������Ĥ��Υޥå�����쥳���ɤ˻��Ѥ��������ʤ顢
join ���ɤ����Ǥ���

@item range
�����줿�ϰ���ˤ���쥳���ɤΤߤ���������ޤ���
@code{ref} ���ܤϤɤΥ���ǥå��������Ѥ���Ƥ��뤫�����ޤ���

@item index
@code{ALL} ��Ʊ���Ǥ���������ǥå����ĥ꡼�������������Τߤ�����ޤ���
����ϡ�����ǥå����ե�����ϥǡ����ե�������⾮�������ᡢ�̾� @code{ALL} ���®���Ǥ���

@item ALL
���Υơ��֥�Υ쥳���ɤȤΤ��줾��η��ˤ����ơ����ơ��֥뤬��������ޤ���
�⤷���Υơ��֥뤬�ǽ�Υơ��֥�� @code{const} ���֤ǤϤʤ��ʤ顢�̾�
������ɤ�����ޤ���¾�ξ��֤Ǥ�@strong{�ȤƤ�}�����ʤ�ޤ���
��������̡��쥳���ɤ�������ᤤ�ơ��֥뤫�餫������ͤ˴�Ť��Ƹ������뤳�Ȥ��Ǥ���褦�ˡ�
����ǥå������ɲä��뤳�Ȥˤ�� @code{ALL} ���򤱤뤳�Ȥ���ǽ�Ǥ��� 
@end table

@code{EXPLAIN} ���Ϥ� @code{rows} �ե��������Τ��٤Ƥ��ͤ����䤹���Ȥˤ�
�ꡢjoin ���ɤΤ褦���ɤ��ʤ뤫���ɤ�ɽ�������뤳�Ȥ��Ǥ��ޤ�������ϡ�
@strong{MySQL} ��������¹Ԥθ����򤹤�ɬ�פ�����쥳���ɤΤ����褽�ο���
�Τ餻�ޤ������ο��� @code{max_join_size} �ѿ��ǤΥ���������¤�����ˤ��
�Ѥ��ޤ���
@xref{Server parameters}.

�ʲ�����ϡ�@code{EXPLAIN} ���󶡤������򸵤ˡ������� @code{JOIN} ����Ŭ��
�Ǥ��뤫����Ǥ���

�ʲ��Τ褦�� @code{EXPLAIN} �Ǹ������� @code{SELECT} ��ʸ������Ȥ��ޤ���

@example
EXPLAIN SELECT tt.TicketNumber, tt.TimeIn,
            tt.ProjectReference, tt.EstimatedShipDate,
            tt.ActualShipDate, tt.ClientID,
            tt.ServiceCodes, tt.RepetitiveID,
            tt.CurrentProcess, tt.CurrentDPPerson,
            tt.RecordVolume, tt.DPPrinted, et.COUNTRY,
            et_1.COUNTRY, do.CUSTNAME
        FROM tt, et, et AS et_1, do
        WHERE tt.SubmitTime IS NULL
            AND tt.ActualPC = et.EMPLOYID
            AND tt.AssignedPC = et_1.EMPLOYID
            AND tt.ClientID = do.CUSTNMBR;
@end example

������Ǥϡ��ʲ��Τ褦�˲��ꤷ�ޤ���

@itemize @bullet
@item
�ե�����ɤϰʲ��Τ褦���������Ƥ��ޤ���

@multitable @columnfractions .1 .2 .7
@item @strong{Table} @tab @strong{Column} @tab @strong{Column type}
@item @code{tt}      @tab @code{ActualPC}      @tab @code{CHAR(10)}
@item @code{tt}      @tab @code{AssignedPC}    @tab @code{CHAR(10)}
@item @code{tt}      @tab @code{ClientID}      @tab @code{CHAR(10)}
@item @code{et}      @tab @code{EMPLOYID}      @tab @code{CHAR(15)}
@item @code{do}      @tab @code{CUSTNMBR}      @tab @code{CHAR(15)}
@end multitable

@item
�ơ��֥�ϰʲ��Υ���ǥå���������ޤ���

@multitable @columnfractions .1 .9
@item @strong{Table} @tab @strong{Index}
@item @code{tt}      @tab @code{ActualPC}
@item @code{tt}      @tab @code{AssignedPC}
@item @code{tt}      @tab @code{ClientID}
@item @code{et}      @tab @code{EMPLOYID} (primary key)
@item @code{do}      @tab @code{CUSTNMBR} (primary key)
@end multitable

@item
@code{tt.ActualPC} ���ͤϡ������褦��ʬ�ۤ���(���֤����)���ޤ���
@end itemize

�ǽ顢�����ʤ��Ŭ����Ԥ��Ƥ��ʤ����֤Ǥϡ�@code{EXPLAIN} ��ʸ��
�ʲ��ξ�����󼨤��ޤ���

@example
table type possible_keys                key  key_len ref  rows  Extra
et    ALL  PRIMARY                      NULL NULL    NULL 74
do    ALL  PRIMARY                      NULL NULL    NULL 2135
et_1  ALL  PRIMARY                      NULL NULL    NULL 74
tt    ALL  AssignedPC,ClientID,ActualPC NULL NULL    NULL 3872
      range checked for each record (key map: 35)
@end example

���줾��Υơ��֥�ǡ�@code{type} �� @code{ALL} �ˤʤäƤ��ޤ���
����� @strong{MySQL} �����ƤΥơ��֥������礹�뤳�Ȥ򼨤��ޤ���
���줾��Υơ��֥���ιԿ�ʬ�����ä�ʪ��Ĵ�٤���Τǡ��ȤƤ�Ĺ�����֤�������ޤ���
���ξ�硢@code{74 * 2135 * 74 * 3872 = 45,268,558,720} ��Ĵ�٤뤳�Ȥˤʤ�ޤ���
�ơ��֥뤬���粽�����Ȥ��ˤ�������֤�ͤ��Ƥ�������....

������꤬����ޤ���(�ޤ�) @strong{MySQL} ���ե�����ɤΥ���ǥå��������Ū��
���ѤǤ��Ƥ��ޤ���
������ξ��Ǥϡ�@code{VARCHAR} �� @code{CHAR} �ϡ�����餬Ʊ��Ĺ�����������Ƥ���С�
�Ѥ�꤬����ޤ���
@code{tt.ActualPC} �� @code{CHAR(10)} ���������Ƥ��ꡢ
@code{et.EMPLOYID} �� @code{CHAR(15)} �Ǥ���������Ĺ���ϰ㤤�ޤ���

���������礤��������ˤ����ꡢ@code{ALTER TABLE} ��Ȥä�
@code{ActualPC} ��Ĺ���� 10 ʸ������ 15 ʸ���ˤ��ޤ���

@example
mysql> ALTER TABLE tt MODIFY ActualPC VARCHAR(15);
@end example

����� @code{tt.ActualPC} and @code{et.EMPLOYID} ��ξ���Ȥ� @code{VARCHAR(15)} �ˤʤ�ޤ�����
 @code{EXPLAIN} ��ʸ��¹Ԥ�ľ���ȡ��ʲ����󼨤��ޤ���

@example
table type   possible_keys   key     key_len ref         rows    Extra
tt    ALL    AssignedPC,ClientID,ActualPC NULL NULL NULL 3872    where used
do    ALL    PRIMARY         NULL    NULL    NULL        2135
      range checked for each record (key map: 1)
et_1  ALL    PRIMARY         NULL    NULL    NULL        74
      range checked for each record (key map: 1)
et    eq_ref PRIMARY         PRIMARY 15      tt.ActualPC 1
@end example

�ޤ������ǤϤ���ޤ��󤬡����褯�ʤäƤ��ޤ�(@code{rows} �ͤ�
�����̤� 74 ��꾮�����ʤ�ޤ�)�����ξ�硢�¹ԤϿ��äǤ��礦��

@code{tt.AssignedPC = et_1.EMPLOYID} �� @code{tt.ClientID =
do.CUSTNMBR} ����Ӥˤ����ơ��ե�����ɤ�Ĺ���ΰ㤤���ӽ����뤳�Ȥ��Ǥ��ޤ�:

@example
mysql> ALTER TABLE tt MODIFY AssignedPC VARCHAR(15),
                      MODIFY ClientID   VARCHAR(15);
@end example

����� @code{EXPLAIN} �ϰʲ�����Ϥ��ޤ���

@example
table type   possible_keys   key     key_len ref            rows     Extra
et    ALL    PRIMARY         NULL    NULL    NULL           74
tt    ref    AssignedPC,ClientID,ActualPC ActualPC 15 et.EMPLOYID 52 where used
et_1  eq_ref PRIMARY         PRIMARY 15      tt.AssignedPC  1
do    eq_ref PRIMARY         PRIMARY 15      tt.ClientID    1
@end example

����� ``�ۤȤ��'' ���ɤ˶ᤤ�Ǥ���

�Ĥ�����ϡ��ǥե���ȤǤϡ�@strong{MySQL} �� @code{tt.ActualPC} �ե����������ͤ�
�ޤ�٤�ʤ�ʬ�ۤ��Ƥ�������ꤷ�Ƥ��ꡢ���� @code{tt} �ơ��֥�ξ��ˤ�Ŭ�礷�ޤ���
�����ˤ⡢����� @strong{MySQL} �˶�����ΤϤȤƤ��ñ�Ǥ���

@example
shell> myisamchk --analyze PATH_TO_MYSQL_DATABASE/tt
shell> mysqladmin refresh
@end example

����� join �� ``����'' �Ǥ���
@code{EXPLAIN} �ϰʲ��η�̤򼨤��ޤ���

@example
table type   possible_keys   key     key_len ref            rows    Extra
tt    ALL    AssignedPC,ClientID,ActualPC NULL NULL NULL    3872    where used
et    eq_ref PRIMARY         PRIMARY 15      tt.ActualPC    1
et_1  eq_ref PRIMARY         PRIMARY 15      tt.AssignedPC  1
do    eq_ref PRIMARY         PRIMARY 15      tt.ClientID    1
@end example

 @code{EXPLAIN} �ν������ @code{rows} ���ܤϡ� @strong{MySQL} JOIN ���ץƥ��ޥ�����
�ˤ�롢``��¬'' �Ǥ���  
������κ�Ŭ���Τ���ˡ����ο��ͤ��ºݤ˶ᤤ���ɤ���������å����٤��Ǥ���
�����Ǥʤ���С�@code{SELECT} ���ơ��ȥ��Ȥ� @code{STRAIGHT_JOIN} �����
����@code{FROM} ��˰ۤʤ��ǥơ��֥���¤٤뤳�Ȥǡ��ɤ��ѥե����ޥ󥹤�
�����ޤ���

@findex DESC
@findex DESCRIBE
@node DESCRIBE, COMMIT, EXPLAIN, Reference
@section @code{DESCRIBE} ��ʸ (�ե�����ɤˤĤ��Ƥξ��������)

@example
@{DESCRIBE | DESC@} tbl_name @{col_name | wild@}
@end example

@code{DESCRIBE} �ϥե�����ɤˤĤ��Ƥξ����Ϳ���ޤ���
@code{col_name} �ϥե�����ɤϥե������̾�ޤ���ʸ����Ǥ���
ʸ����� SQL @samp{%},@samp{_} �磻��ɥ����ɤ�ޤ�ޤ���

�⤷�ե�����ɤη������ʤ��� @code{CREATE TABLE} ʸ��Ϳ����ʪ�Ȱ�äƤ���ʤ顢
����� @strong{MySQL} ���ե�����ɤη����ѹ����Ƥ��뤳�Ȥ����դ��Ƥ���������
@xref{Silent column changes}.

@cindex Oracle compatibility
@cindex Compatibility, with Oracle
���Υ��ޥ�ɤ� Oracle �θߴ��Τ���ˤ���ޤ���

@code{SHOW} ��ʸ�ϻ����褦�ʾ�����󶡤��ޤ���
@xref{SHOW, , @code{SHOW}}.

@findex BEGIN
@findex COMMIT
@findex ROLLBACK
@node COMMIT, LOCK TABLES, DESCRIBE, Reference
@section @code{BEGIN/COMMIT/ROLLBACK} ��ʸ

�ǥե���ȤǤ� @strong{MySQL} �� @code{autocommit} �⡼�ɤ�ư��ޤ�����
��ϡ�������¹Ԥ���Ȥ����� @strong{MySQL} ��������ǥ������˳�Ǽ���뤳��
���̣���ޤ���

�⤷ @code{BDB} ���Υơ��֥����Ѥ���ʤ�, �ʲ��Υ��ޥ�ɤ� @strong{MySQL} ��
@code{autocommit} �⡼�ɤǤϤʤ����֤ˤ��뤳�Ȥ��Ǥ��ޤ���

@example
SET AUTOCOMMIT=0
@end example

���θ塢�ǥ��������ѹ����Ǽ���뤿��ˤ� @code{COMMIT} ����Ѥ����ޤ�����
����̵�뤹�뤿��ˤ� @code{ROLLBACK} ����ɬ�פ�����ޤ���

If you want to switch from @code{AUTOCOMMIT} mode for one serie of
statements, you can use the @code{BEGIN} statement.

@example
BEGIN;
SELECT @@A:=SUM(salary) FROM table1 WHERE type=1;
UPDATE table2 SET summmary=@@A WHERE type=1;
COMMIT;
@end example

����: �ȥ�󥶥����������ơ��֥����Ѥ��Ƥ��ʤ����ϡ�@code{autocommit}
�⡼�ɤΥ��ơ������ˤϰ�¸�����ˡ��ѹ��Ϥ����˳�Ǽ����ޤ���@xref{Table
types}.

@findex LOCK TABLES
@findex UNLOCK TABLES
@node LOCK TABLES, SET OPTION, COMMIT, Reference
@section @code{LOCK TABLES/UNLOCK TABLES} ��ʸ

@example
LOCK TABLES tbl_name [AS alias] @{READ | [READ LOCAL] | [LOW_PRIORITY] WRITE@}
             [, tbl_name @{READ | [LOW_PRIORITY] WRITE@} ...]
...
UNLOCK TABLES
@end example

@code{LOCK TABLES} �ϥ����ȤΥ���åɤΤ���˥ơ��֥����å����ޤ���
@code{UNLOCK TABLES} �Ϥ��Υ���åɤ����ƤΥ��å��������ޤ���
�����ȥ���åɤˤ�äƥ��å����줿���ƤΥơ��֥�ϡ�
����åɤ�¾�� @code{LOCK TABLES} ��ȯ�Ԥ������䥵���С�����³���Ĥ�����硢
��ư�Dz������ޤ���

����åɤ��ơ��֥�� @code{READ} ���å�����ľ�硢���Υ���å�(��¾�����ƤΥ���å�)��
�ơ��֥뤫����ɤ߹��ߤ������Ǥ��ޤ�������åɤ��ơ��֥�� @code{WRITE} ���å�����ľ�硢
���Υ���åɤ������ơ��֥�� @code{READ} �� @code{WRITE} ���Ǥ��ޤ���
¾�Υ���åɤϥ֥��å�����ޤ���

@code{READ LOCAL} �� @code{READ} �ΰ㤤�ϡ�@code{READ LOCAL} �ϡ����å���
�ݻ�����Ƥ���֤˥���եꥯ�Ȥ��ʤ� @code{INSERT} ���ơ��ȥ��Ȥ�¹Ԥ�
���뤳�ȤǤ���������������ϥ��å����ݻ����Ƥ���֤� @strong{MySQL} �γ���
�ǡ����١����ե���������褦�Ȥ�����ϻ��ѤǤ��ޤ���

���줾��Υ���åɤϤ���餬���ƤΥ��å�������ޤ��Ԥ��ޤ�(�����ॢ����̵��)��

@code{WRITE} ���å������̡��Ǥ���¤깹����Ԥ碌�뤿�ᡢ
 @code{READ} ���å�����ͥ���̤��⤯�ʤäƤ��ޤ���
����Ϥ��륹��åɤ� @code{READ} ���å��򤫤�������ʳ��Υ���åɤ� @code{WRITE} ��
�׵ᤷ����硢 @code{READ} �ϡ�@code{WRITE} ����åɤ����å��򤷡������������ޤ�
�ԤĤȤ������ȤǤ���
@code{LOW_PRIORITY WRITE} ����Ѥ���С�
@code{WRITE} ���å����ԤäƤ��륹��åɤ� @code{READ} ���å����������뤳�Ȥ��Ǥ��ޤ���
@code{LOW_PRIORITY WRITE} �� @code{READ} ���å��򤷤Ƥ��륹��åɤ���Ĥ�ʤ���
�狼�äƤ�����˻��Ѥ��٤��Ǥ���

@code{LOCK TABLES} ����Ѥ���Ȥ������Ѥ��褦�Ȥ������ƤΥơ��֥�����
�����٤��Ǥ��� 
�����ƥ�����ǻ��Ѥ��褦�Ȥ��Ƥ���Τ�Ʊ�������ꥢ����Ȥ�ʤ���Фʤ�ޤ���
�⤷������������ʣ����ơ��֥����Ѥ���ʤ�(alias ��Ȥ�ʤä�)��
���줾��� alias ����å����٤��Ǥ���
���Υݥꥷ���ϥơ��֥���å���ǥåɥ��å��ե꡼�ˤ��뤳�Ȥ�Τ��ˤ��ޤ���

@code{INSERT DELAYED} �ǻ��Ѥ��Ƥ��뤤���ʤ�ơ��֥�⡢���å����٤��ǤϤ���ޤ���
���ξ�� @code{INSERT} ���̤Υ���åɤǹԤʤ��뤫��Ǥ���

�̾���Ƥ�ñ��� @code{UPDATE} ��ʸ�ˤ����Ƥϡ��ơ��֥����å�����ɬ�פϤ���ޤ���
����åɤϡ�¾�Υ���åɤ����߼¹Ԥ��Ƥ��� SQL ʸ�˴��Ĥ��뤳�Ȥ��Ǥ��ޤ���
�����ϥơ��֥����å����������褤���ޤ�ʾ��Ǥ���

@itemize @bullet
@item
�ơ��֥��ޤȤ��¿��������¹Ԥ��褦�Ȥ����硢���Ѥ��褦�Ȥ��Ƥ���ơ�
�֥����å�����ȤȤƤ�®���ʤ�ޤ����������¾�Υ���åɤ� @code{READ} ����
�����줿�ơ��֥�ι����ϤǤ��ޤ��󤷡�¾�Υ���åɤ� @code{WRITE} ���å����줿
�ơ��֥���ɤळ�ȤϤǤ��ޤ���
@item
@code{MySQL} �ϥȥ�󥶥������Ķ��򥵥ݡ��Ȥ��ʤ����ᡢ¾�Υ���åɤ�
@code{SELECT},@code{UPDATE}�δ֤���ʤ����Ȥ��ݾڤ��������ϡ�
@code{LOCK TABLES} ����Ѥ���ɬ�פ�����ޤ���
������ϰ����Τ���ˤ� @code{LOCK TABLES} ��ɬ�פȤ��ޤ���
 
@example
mysql> LOCK TABLES trans READ, customer WRITE;
mysql> select sum(value) from trans where customer_id= some_id;
mysql> update customer set total_value=sum_from_previous_statement
           where customer_id=some_id;
mysql> UNLOCK TABLES;
@end example

 @code{LOCK TABLES} ����Ѥ��ʤ���硢@code{SELECT} �μ¹Ԥ� @code{UPDATE} ��
�¹Ԥ�Ԥ��֤ˡ�¾�Υ���åɤ������� @code{trans} �Ԥ���������䤬�Ǥ��ޤ���
@end itemize

���ù��� (@code{UPDATE customer SET value=value+new_value}) �ޤ��� 
@code{LAST_INSERT_ID()} �ؿ��λ��Ѥˤ�ꡢ¿���ξ�� @code{LOCK TABLES} �����
�Ǥ��ޤ���

�����Ĥ��ξ�硢�桼����٥���å�: @code{GET_LOCK()} �� @code{RELEASE_LOCK()} �λ���
�ˤ�äƤ���Ǥ��ޤ��������Υ��å��ϥ�������Υϥå���ơ��֥������
�����졢��®�Τ��� @code{pthread_mutex_lock()} �Ǽ�������ޤ�����
@xref{Miscellaneous functions}.

���å��ݥꥷ���Τ���ʤ����ˤĤ��Ƥ� @ref{Internal locking} �򸫤Ƥ�����
����

@findex SET OPTION
@node SET OPTION, GRANT, LOCK TABLES, Reference
@section @code{SET OPTION} ��ʸ

@example
SET [OPTION] SQL_VALUE_OPTION= value, ...
@end example

@code{SET OPTION} �ϥ����Ф䥯�饤����Ȥ����˱ƶ������͡��ʥ��ץ��������ꤷ�ޤ�. 
���ߤΥ��å���󤬽���뤫,�ޤ��Ϥ��ʤ����ۤʤä��ͤ˥��ץ��������ꤹ��ޤ�,
���ꤵ�줿���ץ�����ͤϻĤäƤ��ޤ�.

@table @code
@item CHARACTER SET character_set_name | DEFAULT
����ϻ��ꤵ�줿�ޥåԥ󥰤˽��äơ����٤Ƥ�ʸ����򥯥饤����Ȥ��饯�饤����Ȥ˥ޥåפ��ޤ�.
���ߡ�@code{character_set_name} �˻���Ǥ��륪�ץ����� @code{cp1251_koi8} �����Ǥ���,
@strong{MySQL} �Υ�������ˤ��� @file{sql/convert.cc} �ե�������Խ����뤳�Ȥˤ�ä�,
�ưפ˿������ޥåԥ󥰤�ä��뤳�Ȥ��Ǥ��ޤ�. ɸ��Υޥåԥ󥰤��᤹�ˤϡ�
@code{character_set_name} �� @code{DEFAULT} ����ꤷ�ޤ���

@code{CHARACTER SET} ���ץ��������ꤹ�뤿��ι�ʸ�ϡ�
¾�Υ��ץ��������ꤹ�빽ʸ�ȰۤʤäƤ��뤳�Ȥ����դ��Ƥ�������.

@item PASSWORD = PASSWORD('some password')
@cindex Passwords, setting
���ߤΥ桼���Υѥ���ɤ����ꤷ�ޤ��������ʤ���ƿ̾�Υ桼���⡢
��ʬ���ȥѥ���ɤ��Ѥ��뤳�Ȥ��Ǥ��ޤ�!

@item PASSWORD FOR user = PASSWORD('some password')
@cindex Passwords, setting
���ߥ������󤷤Ƥ���ۥ��Ȥ�����桼���Υѥ���ɤ����ꤷ�ޤ���
@code{mysql} �ǡ����١����˥����������Ǥ���桼�����������¹ԤǤ��ޤ���
�桼���� @code{user@@hostname} ������Ϳ���ʤ��ƤϤʤ�ޤ���
������ @code{user} �� @code{hostname} �ϡ�@code{mysql.user} �ơ��֥��
@code{User}, @code{Host} �ե�����ɤ���Ͽ����Ƥ��ʤ��ƤϤʤ�ޤ���
�㤨�С�@code{User} �� @code{Host} �ե�����ɤ� @code{'bob'} ��
@code{'%.loc.gov'} �ʤ�С��ʲ��Τ褦�ˤ��ޤ���

@example
mysql> SET PASSWORD FOR bob@@"%.loc.gov" = PASSWORD("newpass");

�ޤ���

mysql> UPDATE mysql.user SET password=PASSWORD("newpass") where user="bob' and host="%.loc.gov";
@end example

@item SQL_AUTO_IS_NULL = 0 | 1
@code{1} (�ǥե����) �����ꤹ��ȡ����Τ褦�ˤ��ơ�auto_increment �쥳��
�ɤ���ĥơ��֥�ǡ��Ǹ���������줿�쥳���ɤ򸫤Ĥ��뤳�Ȥ��Ǥ��ޤ�:
@code{WHERE auto_increment_column IS NULL}������ϡ�Access �Τ褦�ʤ�����
���� ODBC �ץ������ˤ�äƻ��Ѥ���ޤ���

@item SET AUTOCOMMIT= 0 | 1
@code{1} �����ꤹ��ȡ��ơ��֥�ؤΤ��٤Ƥ��ѹ��Ϥ����˹Ԥʤ��ޤ���
To start
an multi command transaction you have to use the @code{BEGIN}
statement. @xref{COMMIT}.
@code{0} �����ꤹ��ȡ����Υȥ�󥶥����������/�˴����뤿��ˡ�
@code{COMMIT} / @code{ROLLBACK} ����Ѥ���ɬ�פ�����ޤ���@xref{COMMIT}��
����: �� @code{AUTOCOMMIT} �⡼�ɤ��� @code{AUTOCOMMIT} �⡼�ɤ��ѹ��������
@strong{MySQL} �Ϥ��٤ƤΥ����ץ�ȥ�󥶥�������ưŪ�� 
@code{COMMIT} ���ޤ���

@item SQL_BIG_TABLES = 0 | 1
@cindex The table is full
@code{0} �ξ�硢���Ƥΰ���ơ��֥�ϥ��꡼�ǤϤʤ��ǥ������˽񤭽Ф���ޤ���
����Ͼ����٤��ʤ�ޤ�����¿���ΰ���ơ��֥��ɬ�פȤ����礭�� @code{SELECT} ��
�¹Ԥ��Ƥ⡢@code{The table tbl_name is full} ���顼���Фʤ��ʤ�ޤ���
��������³�ˤ����뤳���ͤΥǥե�����ͤ� @code{1} (���꡼�˰���ơ��֥����)
�Ǥ���

@item SQL_BIG_SELECTS = 0 | 1
@code{1} �ξ�硢�ȤƤ���֤Τ����� @code{SELECT} ���¹Ԥ��줿��硢
@strong{MySQL} �Ϥ������ߤ��ޤ���
����Ϥ��ޤ�˧�����ʤ�(�ְ�ä�) @code{WHERE} ��ʸ��ȯ�Ԥ��줿�Ȥ�����Ω���ޤ���
@code{max_join_size} �԰ʾ��Ƥ����褦�� @code{SELECT} ��
�礭�ʥ�������������ޤ���
��������³�ˤ����뤳���ͤΥǥե�����ͤ� @code{0} �Ǥ���
(���Ƥ� @code{SELECT} ��ʸ������ޤ�)

@item SQL_BUFFER_RESULT = 0 | 1
@code{SQL_BUFFER_RESULT} �ϰ���ե�������֤���� @code{SELECT} ����η��
����Ū���֤��ޤ�������� @strong{MySQL} ���ơ��֥���å����᤯���������
�����򤷡����饤����Ȥط�̥��åȤ��������뤿���Ĺ�����֤��ݤ��������
Ω���ޤ���

@item SQL_LOW_PRIORITY_UPDATES = 0 | 1
@code{1} �ξ�硢���Ƥ� @code{INSERT}, @code{UPDATE}, @code{DELETE},
 @code{LOCK TABLE WRITE}��ʸ�ϡ�
�оݤȤʤ�ơ��֥�������� @code{SELECT} �� @code{LOCK TABLE READ}
���ʤ��ʤ�ޤ��Ԥ��ޤ���

@item SQL_MAX_JOIN_SIZE = value | DEFAULT
�����餯 @code{value} ����¿���쥳���ɤ��ȹ礻������ɬ�פ�����褦��
@code{SELECT} ����Ĥ��ޤ��󡣤����ͤ����ꤹ�뤳�Ȥǡ����������Ѥ���ʤ���
������ @code{SELECT} ��Ĺ�����֤��ݤ���Ǥ����� @code{SELECT} ����ª�Ǥ���
��������� @code{DEFAULT} �ʳ����ͤ����ꤹ��ȡ�@code{SQL_BIG_SELECTS} ��
�饰��ꥻ�åȤ��ޤ���@code{SQL_BIG_SELECTS} �ե饰��Ƥ����ꤹ��ȡ�
@code{SQL_MAX_JOIN_SIZE} �ѿ���̵�뤵��ޤ���@code{-O max_join_size=#} �� 
@code{mysqld} ��ư���뤳�Ȥǡ������ѿ��Υǥե�����ͤ�����Ǥ��ޤ���

@item SQL_SAFE_MODE = 0 | 1
@code{1} �����ꤹ��ȡ�@code{WHERE} ����ǥ����� @code{LIMIT} ����Ѥ��ʤ�
�� @code{UPDATE} �ޤ��� @code{DELETE} ��Ԥʤ����Ȥ������� 
@strong{MySQL} �����ܡ��Ȥ��ޤ�������ϡ���� SQL ���ޥ�ɤ�����������δ�
��ä���������ª���ǽ�ˤ��ޤ���

@item SQL_SELECT_LIMIT = value | DEFAULT
@code{SELECT} ��ʸ�����֤����쥳���ɤκ����͡�
�⤷ @code{SELECT} �� @code{LIMIT} �����Ѥ��Ƥ����硢@code{LIMIT} ��
 @code{SQL_SELECT_LIMIT} ���ͤ��ͥ�褵��ޤ���
��������³�ˤ����뤳���ͤ�ɸ���ͤ� ``unlimited''.
�⤷��ߥåȤ��Ѥ��Ƥ���ʤ�С�@code{SQL_SELECT_LIMIT} ��
 @code{DEFAULT} ����ꤹ�뤳�Ȥˤ�ꡢɸ���ͤ��᤹���Ȥ��Ǥ��ޤ���

@item SQL_LOG_OFF = 0 | 1
�����ͤ� @code{1} �ξ�硢�⤷���饤����Ȥ� @strong{process} ���¤���äƤ���ʤ�С�
���Υ��饤����ȤΥ������Ԥ��ޤ���
����Ϲ��������˱ƶ����ޤ���

@item SQL_LOG_UPDATE = 0 | 1
@code{0} �ξ�硢�⤷���饤����Ȥ� @strong{process} ���¤���äƤ���ʤ�С�
���Υ��饤����Ȥι��������ε�Ͽ�ϹԤ��ޤ���
������̾�Υ����ˤϱƶ����ޤ���

@item TIMESTAMP = timestamp_value | DEFAULT
���饤����Ȥ˻��֤����ꤷ�ޤ���
�⤷�쥳���ɤΥꥹ�ȥ��˹�����������Ѥ����硢���ꥸ�ʥ�Υ����ॹ����פ����뤿��˻��Ѥ��ޤ���

@item LAST_INSERT_ID = #
@code{LAST_INSERT_ID()} ������֤��ͤ����ꤷ�ޤ���
�ơ��֥�򹹿����륳�ޥ����� @code{LAST_INSERT_ID()} ����Ѥ�����硢
����Ϲ�����������¸����ޤ���

@item INSERT_ID = #
 @code{AUTO_INCREMENT} �ͤ������������
@code{INSERT} ���ޥ�ɤ˽��äƻ��Ѥ�����ͤ򥻥åȤ��ޤ���
����Ϲ��������ˤ�äƻ��Ѥ���ޤ���

@end table

@findex GRANT
@findex REVOKE
@node GRANT, CREATE INDEX, SET OPTION, Reference
@section @code{GRANT} �� @code{REVOKE} ��ʸ

@example
GRANT priv_type [(column_list)] [, priv_type [(column_list)] ...]
    ON @{tbl_name | * | *.* | db_name.*@}
    TO user_name [IDENTIFIED BY 'password']
        [, user_name [IDENTIFIED BY 'password'] ...]
    [WITH GRANT OPTION]

REVOKE priv_type [(column_list)] [, priv_type [(column_list)] ...]
    ON @{tbl_name | * | *.* | db_name.*@}
    FROM user_name [, user_name ...]
@end example

@code{GRANT} �� @strong{MySQL} 3.22.11 �ʾ�Ǽ�������Ƥ��ޤ�; ���� 
@strong{MySQL} �С������Ǥϡ�@code{GRANT} ���ơ��ȥ��Ȥϲ���Ԥʤ���
����

@code{GRANT} �� @code{REVOKE} ���ޥ�ɥ��åȤμ����Ū�ϡ������ƥ������
�� @strong{MySQL} �桼���˼��Σ��Ĥθ��¥�٥�θ�����Ϳ��������ä���
�Ȥ�Ǥ���褦�ˤ��뤳�ȤǤ�:

@table @strong
@item Global ��٥�
Global ���¤�Ϳ����줿�����о�����ƤΥǡ����١�����Ŭ�Ѥ��ޤ��������θ��¤� 
@code{mysql.user} �ơ��֥���˳�Ǽ����ޤ���

@item Database ��٥�
Database ���¤�Ϳ����줿�ǡ����١���������ƤΥơ��֥��Ŭ�Ѥ��ޤ�����
���θ��¤� @code{mysql.db} �ơ��֥�� @code{mysql.host} �ơ��֥���˳�Ǽ����ޤ���

@item Table ��٥�
Table ���¤�Ϳ����줿�ơ��֥�������ƤΥե�����ɤ�Ŭ�Ѥ��ޤ��������θ��¤� 
@code{mysql.tables_priv} �ơ��֥���˳�Ǽ����ޤ���

@item Column ��٥�
Column ���¤�Ϳ����줿�ơ��֥���ΰ�ĤΥե�����ɤ�Ŭ�Ѥ��ޤ��������θ��¤� 
@code{mysql.column_priv} �ơ��֥���˳�Ǽ����ޤ���
@end table

@code{GRANT} ��ư����� �� @ref{Adding users}.

@code{GRANT} �� @code{REVOKE} ���ơ��ȥ��Ȥˤ����� @code{priv_type} �ˤ�
�ʲ�������Ǥ��ޤ�:

@example
ALL PRIVILEGES      FILE                RELOAD
ALTER               INDEX               SELECT
CREATE              INSERT              SHUTDOWN
DELETE              PROCESS             UPDATE
DROP                REFERENCES          USAGE
@end example

@code{ALL} �� @code{ALL PRIVILEGES} ��Ʊ����Ǥ�.
@code{REFERENCES} �Ϥޤ��¹Ԥ���ޤ���
@code{USAGE} �� ``no privileges'' ��Ʊ���Ǥ�.
����Ϥʤ�θ��¤�����ʤ��桼����������˻��Ѥ��ޤ�.

�桼�������鸢�µ��Ĥ�������ˤϡ�@code{GRANT OPTION} ���ץ������ͤ�
@code{priv_type} ����ꤷ�ޤ���

@example
REVOKE GRANT OPTION ON ... FROM ...;
@end example

�ơ��֥���Ф�����ĤΤ���˻���Ǥ��� @code{priv_type} �ϼ��Υե�����ɤ����Ǥ���
@code{SELECT},@code{INSERT}, @code{UPDATE}, @code{DELETE}, @code{CREATE}, @code{DROP},
@code{GRANT}, @code{INDEX}, @code{ALTER}.

�ե�����ɤ��Ф�����ĤΤ���˻���Ǥ��� @code{priv_type} �ϼ��Υե�����ɤ����Ǥ�
(����� @code{column_list} �����Ѥ������Ŭ�Ѥ���ޤ�)��
@code{SELECT}, @code{INSERT}, @code{UPDATE}.

@code{WITH GRANT OPTION} ��ϡ�@code{GRANT} ��ʸ����Ѥ���
¾�Υ桼�����˸��¤�Ϳ���뤳�Ȥ��Ǥ���褦�ˤ��ޤ���

@code{ON *.*} ����Ѥ��ƥ������Х븢�¤�����Ǥ��ޤ���
@code{ON db_name.*} ����Ѥ��ƥǡ����١������¤�����Ǥ��ޤ���@code{ON *} ��
���ꤹ��ȡ����ߤΥǡ����١����θ��¤�����Ǥ��ޤ���
(@strong{�ٹ�} ���ߤΥǡ����١���������ʤ����֤� @code{ON *} ����ꤷ����硢
global ���¤˱ƶ����ޤ���)

�桼���ؤθ����ζ�Ϳ��¾�Υۥ��Ȥ���Ŭ�����뤿��ˡ�@strong{MySQL} ��
 @code{user_name} ���ͤ� @code{user@@host} �η��ǽ񤱤�褦�ˤ��Ƥ��ޤ���
�ü�ʸ��(@samp{%} �Τ褦��)�� @code{user_name} ���ͤ���ꤷ������硢
�桼����ۥ���̾�򥯥����ȤǤ��ޤ�;
(�㤨�� @code{'test-user'@@'test-hostname'})��

�ۥ���̾�˥磻��ɥ����ɤ���ѤǤ��ޤ����㤨�С�@code{user@@"%.loc.gov"} ��
@code{loc.gov} �ɥᥤ������ƤΥۥ��Ȥ� @code{user} ��Ϳ����
@code{user@@"144.155.166.%"} �� @code{144.155.166} ���饹C���֥ͥåȤ�
������ۥ��Ȥ� @code{user} �Ȥʤ�ޤ���

ñ�� @code{user} �Ƚ񤯤� @code{user@@"%"} ��Ʊ���Ǥ�.
@strong{���ա�} �⤷ƿ̾�桼��������� @strong{MySQL} �����С��ؤ���³��
�������(�ǥե���ȤǤ�)�����ƤΥ�������桼���� @code{username@@localhost} ��ä���٤��Ǥ���
�ʤ��ʤ顢ƿ̾�桼������Ʊ���ޥ��󤫤� @strong{MySQL} �����С����������Ȥ�������
���Ѥ���뤫��Ǥ���
ƿ̾�桼������ @code{mysql.user} �桼�����ơ��֥�ˡ� @code{User=''} �Ȥ�����Ͽ����Ƥ��ޤ���
������ǧ����ˤϡ��ʲ��Τ褦�ˤ��ޤ���

@example
mysql> SELECT Host,User FROM mysql.user WHERE User='';
@end example

����������, @code{GRANT} �ϥۥ���̾���ơ��֥�̾���ǡ����١���̾���ե������̾��
����60ʸ���ޤǻ��ѤǤ��ޤ����桼����̾�Ϻ���16ʸ���ޤǤǤ���

�ơ��֥�/�ե�����ɤθ��¤� global(�桼���ȥǡ����١���)���¤� 
@code{GRANT} ���¤� @code{OR} ����ޤ����㤨�С��桼���� 
@code{mysql.user} �ơ��֥���� global @strong{select} ���¤���äƤ����硢
����ϥǡ����١�����ơ��֥�/�ե�����ɥ�٥���Υ���ȥ�Ǥϵ��ݤǤ��ޤ���

�ե�����ɤθ����ϼ��Τ褦�˷׻��Ǥ��ޤ�:
@example
global privileges
OR (database privileges AND host privileges)
OR table privileges
OR column privileges
@end example

¿���ξ�硢�ۤʤ븢�¥�٥�ΰ�Ĥǥ桼���˸�����Ϳ����Τǡ��������̾�
��ҤΤ褦�ˤ�ʣ���ǤϤ���ޤ���:)
�����������¤Υ����å��ξܺ٤Ϣ�@ref{Privilege system}.

�桼���ؤθ����ζ�Ϳ��¾�Υۥ��Ȥ���Ŭ�����뤿��ˡ�@strong{MySQL} �ϥ桼
��̾������ @code{user@@host} �ǻ���Ǥ��뤳�Ȥ򥵥ݡ��Ȥ��ޤ�����ñ�ʷ�
�� @code{user} �� @code{user@@%} ��Ʊ����Ǥ����ü�ʸ��(@code{.} �Τ褦
��)�ǥۥ���̾����ꤷ������硢@code{"user"@@"hostname"} ��ʸ����ѤǤ�
�ޤ���

�桼���ȥۥ���̾���Ȥ�¸�ߤ��ʤ���硢����ȥ�� @code{mysql.user} �ơ�
�֥���ɲä��졢@code{DELETE} ���ޥ�ɤǺ�������ޤǤ����˻Ĥ�ޤ���
�����ʤ�� @code{GRANT} �� @code{user} �ơ��֥����Ͽ����ޤ�����
 @code{REVOKE} �Ϥ��������Ǥ��ޤ���;
��������ˤ� @code{DELETE} ����Ѥ��ʤ��ƤϤʤ�ޤ���

@cindex Passwords, setting
@strong{MySQL} 3.22.12 �ʾ�Ǥϡ�
�������桼�������������줿��硢���뤤�ϡ����ʤ����������Х�ʸ��¤���Ĥ���Ƥ����硢
�桼�����Υѥ���ɤ� @code{IDENTIFIED BY} �����Ѥ�������Ǥ��ޤ���
���Ǥ˥桼�����˥ѥ���ɤ������硢���������ꤵ�줿�ѥ���ɤ��֤��������ޤ���

@strong{�ٹ�} �⤷�������桼�������äƤ�
@code{IDENTIFIED BY} �����ꤷ�ʤ���С� ���Υ桼�����ϥΡ��ѥ���ɤǤ���
����ϴ����Ǥ���

�ѥ���ɤ� @code{SET PASSWORD} ���ޥ�ɤǤ�����Ǥ��ޤ���
@xref{SET OPTION, , @code{SET OPTION}}.

�ǡ����١����˸��¤� @code{GRANT} �����硢@code{mysql.db} �ơ��֥����
����ȥ��ɬ�פʾ�����������ޤ������ƤΥǡ����١������¤� 
@code{REVOKE} �Ǻ�����줿�������Υ���ȥ�Ϻ������ޤ���

�桼�����ơ��֥�˲��⸢�¤���äƤ��ʤ���硢�ơ��֥�ΰ����׵��(�㤨
�С�@code{SHOW TABLES} ���ơ��ȥ��Ȥ�)�ˤϡ��ơ��֥�ϸ���ޤ���

@code{WITH GRANT OPTION} ��ϡ�¾�Υ桼�����ˡ���ʬ�����äƤ��븢�¤�Ϳ���뤳�Ȥ��Ǥ��ޤ���
@strong{���µ���}��¾��Ϳ����������դ��Ƥ���������
���ʤ��ȵ��Ĥ�Ϳ����桼�������㤦���¤���äƤ����硢
Ϳ�����븢�¤ε��Ĥϡ���Ĥ��碌��ʪ�ˤʤ�ޤ���

��ʬ���Ȥ����äƤ��ʤ����¤�¾�Υ桼������Ϳ���뤳�ȤϤǤ��ޤ���
@strong{���µ���}�Ϥ��ʤ�����ͭ���븢�¤ε��Ĥ�����Ϳ���뤳�Ȥ��Ǥ��ޤ���

���ʤ����桼�����˳��̤θ��¥�٥��Ϳ������硢���˥桼���������äƤ��뤤���ʤ븢��
(���뤤�� ������ĸ���) �Ϥ��Υ桼�����ˤ�äƤ���Ĥ�Ϳ�����ޤ���
���ʤ����ǡ����١������Ф��� @strong{insert} ���Ĥ򤢤�桼������Ϳ�����Ȳ��ꤷ�ޤ���
�⤷���ǡ����١������Ф��� @strong{select} ���¤�Ϳ�����ꡢ
@code{WITH GRANT OPTION} ��Ԥ��ȡ��桼������ @strong{select} ���¤����Ǥʤ�
 @strong{insert} �����뤳�Ȥˤʤ�ޤ���
�⤷ @strong{update} ���¤�桼������Ϳ����ȡ����Υ桼������
@strong{insert}, @strong{select}, @strong{update} ����ǽ�Ǥ���

@strong{alter} ���¤���̥桼����Ϳ����٤��ǤϤ���ޤ��󡣤��ξ��
�桼���ϥơ��֥���͡���Ǥ���������ˡ�Ǹ��¤��뤳�Ȥ��ߤ뤳�Ȥ���
���ޤ���

���ա��⤷ table/column ���¤��ͤΥ桼�����ˤ���Ϳ������硢
 @strong{MySQL} �����ƤΥ桼�������Ф��ƥơ��֥�ȥե�����ɤξ�ǧ���¤�Ƥ���ޤ���
����� @strong{MySQL} �򾯤��٤����ޤ���

@code{mysqld} ���ϻ������Ƥθ��¤ϥ�����ɤ߹��ޤ�ޤ����ǡ����١�����
�ơ��֥롢�ե�����ɸ��¤ϰ��ٸ��̤����ޤ����桼����٥븢�¤ϥ桼������³����
���̤����ޤ���
�����ε��ĥơ��֥�� @code{GRANT} �� @code{REVOKE} ��Ȥä��ѹ����Ƥ�
�����С��ˤϤ�����ȿ�Ǥ���ޤ���
�⤷�����ε��ĥơ��֥���ư���ѹ��������(@code{INSERT}, @code{UPDATE}, �����ѹ��������)��
@code{FLUSH PRIVILEGES} ��ʸ��¹Ԥ��뤫��@code{mysqladmin flush-privileges} ��¹Ԥ���
�����С��˵��ĥơ��֥�κ��ɤ߹��ߤ�Ԥ碌�ʤ��ƤϤʤ�ޤ���
@xref{Privilege changes}.

@code{ANSI SQL GRANT} �� @strong{MySQL} @code{GRANT} �Ȥ��礭�ʰ㤤��:

@itemize @bullet
@item
ANSI SQL �ϥ������Х�ȥǡ����١�����٥뾵ǧ���������ANSI SQL ��
 @strong{MySQL} �����ݡ��Ȥ������Ƥθ��¤򥵥ݡ��Ȥ��ޤ���
@item
ANSI SQL �ǥơ��֥���˴�����������Υơ��֥�����Ƥθ��¤��˴���
��ޤ���@code{ANSI SQL} �Ǹ��¤���ä���硢���θ��¤˴�Ť��ƾ�ǧ����
�����Ƥθ��¤���ä���ޤ���@code{MySQL} �Ǥϡ����Ƥθ��¤�����Ū�� 
@code{REVOKE} ���ޥ�ɤޤ��� @strong{MySQL} ���¥ơ��֥�����ˤ�äƤ�
���˴�����ޤ���
@end itemize


@cindex Indexes
@cindex Indexes, multi-part
@cindex Multi-part index
@findex CREATE INDEX
@node CREATE INDEX, DROP INDEX, GRANT, Reference
@section @code{CREATE INDEX} ��ʸ

@example
CREATE [UNIQUE] INDEX index_name ON tbl_name (col_name[(length)],... )
@end example

@code{CREATE INDEX} ��ʸ�� @strong{MySQL} 3.22 �������ΥС������ǤϤʤˤ⤷�ޤ���
3.22 �ʹߤǡ�@code{CREATE INDEX} �ϥ���ǥå����κ����Τ���� @code{ALTER TABLE}
 ��ƤӤ����Ƥ��ޤ���
@xref{ALTER TABLE, , @code{ALTER TABLE}}.

�̾�ơ��֥�������ƤΥ���ǥå����� @code{CREATE TABLE} ��
�ơ��֥����Ȥ��˰��٤˺�������ޤ���
@xref{CREATE TABLE, , @code{CREATE TABLE}}.
@code{CREATE INDEX} �ϴ���¸�ߤ���ơ��֥���Ф�������ǥå������ɲä��ޤ���

�ե�����ɤ� @code{(col1,col2,...)} �Ȥ��ƻ��ꤹ��ȡ�ʣ���ե�����ɥ���ǥå�����������ޤ���
����ǥå������ͤϡ�Ϳ����줿�ե�����ɤ��ͤ�Ϣ�뤷�ơ���������ޤ���

@code{CHAR} �� @code{VARCHAR} �ե�����ɤǤϡ�����ǥå����ϥե�����ɤΰ���ʬ��������Ѥ���
��������ޤ�������� @code{col_name(length)} ��ʸ����Ѥ��ޤ���
(@code{BLOB} �� @code{TEXT} ��Ǥ� length ��ɬ�פǤ�)��
�ǽ��10ʸ���򥤥�ǥå����Ȥ��ƻ��Ѥ���ˤϡ����ι�ʸ�ϰʲ��Τ褦�ˤ��ƻ��Ѥ��ޤ�(@code{name} �ե�����ɤ˥���ǥå�������ޤ�)��

@example
mysql> CREATE INDEX part_of_name ON customer (name(10));
@end example

�ե�����ɤΰ���ʬ�����򥤥�ǥå����˻��Ѥ���С�����ǥå����ե������Ϥ뤫�˾��������뤳�Ȥ��Ǥ��ޤ���
�ۤȤ�ɤ�̾�����ǽ��10ʸ���ˤ������̾�ۤʤ�Τǡ�
���Υ���ǥå����� @code{name} �ե��������������Ѥ����Ϥ�Ф�������ǥå�������٤�
�٤��ʤ뤳�ȤϤ���ޤ��󡣤ޤ���¿���Υǥ��������ڡ���������Ǥ���
 @code{INSERT} ��®������ΤǤ���

@strong{MySQL} version 3.23.2 �ʾ�� @code{MyISAM} ���Υơ��֥����Ѥ��Ƥ����硢
@code{NULL} �ͤ��ĥե�����ɤ䡢 @code{BLOB}/@code{TEXT} �ե�����ɤ��Ф���
����ǥå�����ĥ�뤳�Ȥ���ǽ�Ǥ���

@strong{MySQL} ���ɤΤ褦�ˤ��ƥ���ǥå�������Ѥ��뤫�� ��
��@ref{MySQL indexes, , @strong{MySQL} indexes}.

@findex DROP INDEX
@node DROP INDEX, Comments, CREATE INDEX, Reference
@section @code{DROP INDEX} ��ʸ

@example
DROP INDEX index_name ON tbl_name
@end example

@code{DROP INDEX} �� @code{index_name} �Ȥ���̾���Υ���ǥå�����ơ��֥� 
@code{tbl_name} �����˴����ޤ���
@code{DROP INDEX} �� @strong{MySQL} 3.22 �������ΥС������ǤϤʤˤ⤷�ޤ���
3.22 �ʹߤǡ�@code{DROP INDEX} �ϥ���ǥå������˴��Τ����
@code{ALTER TABLE} ��ƤӤ����Ƥ��ޤ���
@xref{ALTER TABLE, , @code{ALTER TABLE}}.

@findex Comment syntax
@node Comments, CREATE FUNCTION, DROP INDEX, Reference
@section ������ ��ʸ

@strong{MySQL} �� @code{# �����ޤ�} , @code{-- �����ޤ�} ������ @code{/* 
����ޤ���ʣ���� */} �����Ƚ񼰤򥵥ݡ��Ȥ��ޤ�:

@example
mysql> select 1+1;     # ���Υ����ȤϹ����ޤ�³��
mysql> select 1+1;     -- ���Υ����ȤϹ����ޤ�³��
mysql> select 1 /* ����Ϲ��楳���� */ + 1;
mysql> select 1+
/*
�����
ʣ���ԥ�����
*/
1;
@end example

@code{--} �����ȥ�������� @code{--} �θ���˺����ĤΥ��ڡ�����
ɬ�פǤ��뤳�Ȥ����ա�

�����С��ϥ����ȹ�ʸ�����򤷤ޤ����� @code{mysql} ���饤����Ȥ�
 @code{/* ... */} �����Ȥ�ʬ�Ϥ���ˤϤ����Ĥ����¤�����ޤ���

@itemize @bullet
@item
���󥰥륯�������Ȥȥ��֥륯������ʸ���ϰ���ʸ����Υȡ�����γ��Ϥ�
�����ޤ������Ȥ������Ȥ���Ǥ��äƤ⡣
�⤷�����Ȥ���ǥ������Ȥ�����ܤΥ������Ȥ˥ޥå����ʤ��ä���硢
�ѡ������ϥ����Ȥ���λ���Ƥ��ʤ���ǧ�����ޤ���
@code{mysql} �����å⡼�ɤǼ¹Ԥ��Ƥ����硢
�ץ���ץȤ� @code{mysql>} ���� @code{'>} �� @code{">} ���Ѥ��ޤ���

@item
���ߥ������ SQL ��ʸ�ν�λ�򼨤��������³��ʸ���ϼ��ι�ʸ�γ��Ϥ�
�ʤ�ޤ���
@end itemize

���������¤� @code{mysql} �����å⡼�ɤǼ¹Ԥ��Ƥ�����ȡ�
@code{mysql} �˥ե�������ɤ߹��ޤ��Ƥ����� ( @code{mysql < some-file} ) ��
ξ���Ǹ���ޤ���

@strong{MySQL} �� ANSI SQL �����Ȥ� @samp{--} �򥵥ݡ��Ȥ��ޤ���
@xref{Missing comments}.


@findex CREATE FUNCTION
@findex DROP FUNCTION
@findex UDF functions
@findex User-defined functions
@findex Functions, user-defined
@node CREATE FUNCTION, Reserved words, Comments, Reference
@section @code{CREATE FUNCTION/DROP FUNCTION} ��ʸ

@example
CREATE [AGGREGATE] FUNCTION function_name RETURNS @{STRING|REAL|INTEGER@}
       SONAME shared_library_name

DROP FUNCTION function_name
@end example

�桼��������ؿ� (UDF : user-definable functions) ��
 @strong{MySQL} �˿������ؿ������������ĥ��ˡ�Ǥ���
����� @strong{MySQL} �Υͥ��ƥ���(������)�ؿ�
(@code{ABS()}, @code{CONCAT()} �Τ褦��)��Ʊ���褦��ư��ޤ���

@code{AGGREGATE} �� @strong{MySQL} 3.23 �ο��������ץ����Ǥ���
@code{AGGREGATE} �ؿ��ϡ�@code{SUM} �� @code{COUNT()} �Τ褦�ʥͥ��ƥ��֤� 
@strong{MySQL} @code{GROUP} �ؿ��Τ褦�����Τ�ư��ޤ���

@code{CREATE FUNCTION} �ϡ��ؿ�̾��������ͭ�饤�֥��̾��
@code{mysql.func} �����ƥ�ơ��֥�ˡ���¸���ޤ���
�ؿ��κ������˴���Ԥ��ˤϡ� @code{mysql} �ǡ����١������Ф��ơ�
 @strong{insert} , @code{delete} ���¤��ʤ���Фʤ�ޤ���

���Ƥδؿ��ϥ����С��ε�ư�����ɤ߹��ޤ�ޤ���
������ @code{--skip-grant-tables} ���ץ����� @code{mysqld} �ˤĤ��Ƥ��ʤ���С�
���ξ�硢UDF �ν���������Ф��졢UDF �Ǻ�ä��ؿ��ϻ��ѤǤ��ޤ���
(�ؿ��� @code{CREATE FUNCTION} �ǥ����ɤ��졢 @code{DROP FUNCTION} �Ǻ������ޤ�)

�桼��������ؿ��˴ؤ��뤵��ʤ����� �� @ref{Adding functions}. 
UDF �ᥫ�˥����ư��������ˤϡ��ؿ��� C �� C++ �ǽ񤫤�Ƥ��ʤ���Фʤ�ޤ���
���ġ����ʤ��Υ��ڥ졼�ƥ��󥰥����ƥब�����ʥߥå������ǥ��󥰤�
���ݡ��Ȥ��Ƥ��ʤ���Фʤ�ޤ��󡣤���� @code{mysqld} �ϥ����ƥ��å��ǤϤʤ�
�����ʥߥå��ǥ���ѥ��뤵��Ƥ��ʤ���Фʤ�ޤ���

@cindex Keywords
@cindex Reserved words
@cindex Reserved words, exceptions
@node Reserved words,  , CREATE FUNCTION, Reference
@section Is @strong{MySQL} picky about reserved words?

���̤�����ϡ��ե�����ɤ�̾���� @code{TIMESTAMP} �Ȥ� @code{GROUP} �Ȥ���
 @strong{MySQL} �������ޤ�Ƥ���ǡ�������ؿ�̾��Ʊ̾�ˤ��ơ�
�ơ��֥���ä����˵�����ޤ���
���Τ褦�ʤ��ȤϹԤ��ޤ�(�㤨�� @code{ABS} �ϥե������̾�ˤǤ��ޤ�)��
���������ؿ��Ȥ��ƻ��Ѥ����硢
����̾�����ե������̾�Ȥ��ƻ��Ѥ���Ƥ���ʤ顢
�ؿ�̾�� @samp{(} �δ֤ζ���ϵ�����ޤ���

�ʲ��θ�� @strong{MySQL} ��ͽ�󤵤�Ƥ��ޤ���
�����ΤۤȤ�ɤϡ� ANSI SQL92 �ˤ�äơ�
�ơ��֥롢�ե������̾�Ȥ��Ƥλ��Ѥ϶ػߤ���Ƥ��ޤ���(�㤨�� @code{group})��
�ޤ������Ĥ��θ�� @strong{MySQL} ��ɬ�פȤ��� @code{yacc} �ѡ�������
���Ѥ��Ƥ���Τ�ͽ�󤵤�Ƥ��ޤ���

@c This is fixed by including the symbols table from lex.h here and then running
@c fix-mysql-reserved-words in emacs (or let David do it): 
@c (defun fix-mysql-reserved-words ()
@c  (interactive)
@c  (let ((cnt 0))
@c    (insert "\n@item ")
@c    (while (looking-at "[ \t]*{ +\"\\([^\"]+\\)\"[ \t]*,.*\n")
@c      (replace-match "@code{\\1}")
@c      (incf cnt)
@c      (if (> cnt 3)
@c 	  (progn
@c 	    (setf cnt 0)
@c 	    (insert "\n@item "))
@c 	(insert " @tab ")))))
@c But remove the non alphanumeric entries by hand first.
@c Updated after 3.23.4 990928 by David

@multitable @columnfractions .25 .25 .25 .25
@item @code{action} @tab @code{add} @tab @code{aggregate} @tab @code{all}
@item @code{alter} @tab @code{after} @tab @code{and} @tab @code{as}
@item @code{asc} @tab @code{avg} @tab @code{avg_row_length} @tab @code{auto_increment}
@item @code{between} @tab @code{bigint} @tab @code{bit} @tab @code{binary}
@item @code{blob} @tab @code{bool} @tab @code{both} @tab @code{by}
@item @code{cascade} @tab @code{case} @tab @code{char} @tab @code{character}
@item @code{change} @tab @code{check} @tab @code{checksum} @tab @code{column}
@item @code{columns} @tab @code{comment} @tab @code{constraint} @tab @code{create}
@item @code{cross} @tab @code{current_date} @tab @code{current_time} @tab @code{current_timestamp}
@item @code{data} @tab @code{database} @tab @code{databases} @tab @code{date}
@item @code{datetime} @tab @code{day} @tab @code{day_hour} @tab @code{day_minute}
@item @code{day_second} @tab @code{dayofmonth} @tab @code{dayofweek} @tab @code{dayofyear}
@item @code{dec} @tab @code{decimal} @tab @code{default} @tab @code{delayed}
@item @code{delay_key_write} @tab @code{delete} @tab @code{desc} @tab @code{describe}
@item @code{distinct} @tab @code{distinctrow} @tab @code{double} @tab @code{drop}
@item @code{end} @tab @code{else} @tab @code{escape} @tab @code{escaped}
@item @code{enclosed} @tab @code{enum} @tab @code{explain} @tab @code{exists}
@item @code{fields} @tab @code{file} @tab @code{first} @tab @code{float}
@item @code{float4} @tab @code{float8} @tab @code{flush} @tab @code{foreign}
@item @code{from} @tab @code{for} @tab @code{full} @tab @code{function}
@item @code{global} @tab @code{grant} @tab @code{grants} @tab @code{group}
@item @code{having} @tab @code{heap} @tab @code{high_priority} @tab @code{hour}
@item @code{hour_minute} @tab @code{hour_second} @tab @code{hosts} @tab @code{identified}
@item @code{ignore} @tab @code{in} @tab @code{index} @tab @code{infile}
@item @code{inner} @tab @code{insert} @tab @code{insert_id} @tab @code{int}
@item @code{integer} @tab @code{interval} @tab @code{int1} @tab @code{int2}
@item @code{int3} @tab @code{int4} @tab @code{int8} @tab @code{into}
@item @code{if} @tab @code{is} @tab @code{isam} @tab @code{join}
@item @code{key} @tab @code{keys} @tab @code{kill} @tab @code{last_insert_id}
@item @code{leading} @tab @code{left} @tab @code{length} @tab @code{like}
@item @code{lines} @tab @code{limit} @tab @code{load} @tab @code{local}
@item @code{lock} @tab @code{logs} @tab @code{long} @tab @code{longblob}
@item @code{longtext} @tab @code{low_priority} @tab @code{max} @tab @code{max_rows}
@item @code{match} @tab @code{mediumblob} @tab @code{mediumtext} @tab @code{mediumint}
@item @code{middleint} @tab @code{min_rows} @tab @code{minute} @tab @code{minute_second}
@item @code{modify} @tab @code{month} @tab @code{monthname} @tab @code{myisam}
@item @code{natural} @tab @code{numeric} @tab @code{no} @tab @code{not}
@item @code{null} @tab @code{on} @tab @code{optimize} @tab @code{option}
@item @code{optionally} @tab @code{or} @tab @code{order} @tab @code{outer}
@item @code{outfile} @tab @code{pack_keys} @tab @code{partial} @tab @code{password}
@item @code{precision} @tab @code{primary} @tab @code{procedure} @tab @code{process}
@item @code{processlist} @tab @code{privileges} @tab @code{read} @tab @code{real}
@item @code{references} @tab @code{reload} @tab @code{regexp} @tab @code{rename}
@item @code{replace} @tab @code{restrict} @tab @code{returns} @tab @code{revoke}
@item @code{rlike} @tab @code{row} @tab @code{rows} @tab @code{second}
@item @code{select} @tab @code{set} @tab @code{show} @tab @code{shutdown}
@item @code{smallint} @tab @code{soname} @tab @code{sql_big_tables} @tab @code{sql_big_selects}
@item @code{sql_low_priority_updates} @tab @code{sql_log_off} @tab @code{sql_log_update} @tab @code{sql_select_limit}
@item @code{sql_small_result} @tab @code{sql_big_result} @tab @code{sql_warnings} @tab @code{straight_join}
@item @code{starting} @tab @code{status} @tab @code{string} @tab @code{table}
@item @code{tables} @tab @code{temporary} @tab @code{terminated} @tab @code{text}
@item @code{then} @tab @code{time} @tab @code{timestamp} @tab @code{tinyblob}
@item @code{tinytext} @tab @code{tinyint} @tab @code{trailing} @tab @code{to}
@item @code{type} @tab @code{use} @tab @code{using} @tab @code{unique}
@item @code{unlock} @tab @code{unsigned} @tab @code{update} @tab @code{usage}
@item @code{values} @tab @code{varchar} @tab @code{variables} @tab @code{varying}
@item @code{varbinary} @tab @code{with} @tab @code{write} @tab @code{when}
@item @code{where} @tab @code{year} @tab @code{year_month} @tab @code{zerofill}
@end multitable

�ʲ��� ANSI SQL �Ǥϥե�����ɡ��ơ��֥�̾�Ȥ��Ƥλ��Ѥ�ػߤ���Ƥ��ޤ�����
 @strong{MySQL} �Ǥϵ��Ĥ���Ƥ��ޤ���
����ϡ�������̾��������������̾���ǡ�¿���οͤ����������̾���Ȥ���
���Ѥ��Ƥ��뤫��Ǥ���

@itemize @bullet
@item @code{ACTION}
@item @code{BIT}
@item @code{DATE}
@item @code{ENUM}
@item @code{NO}
@item @code{TEXT}
@item @code{TIME}
@item @code{TIMESTAMP}
@end itemize

@cindex Table types, Choosing
@cindex BDB table type
@cindex Berkeley_db table type
@cindex ISAM table type
@cindex HEAP table type
@cindex MySQL table types
@cindex MyISAM table type
@node Table types, Tutorial, Reference, Top
@chapter MySQL table types

With MySQL you can currently (version 3.23.6) choose between three basic
table formats. When you create a new table, you can tell @strong{MySQL}
which table type it should use for the table.  @strong{MySQL} will
always create a @code{.frm} file to hold the table and column
definitions.  Depending on the table type the index and data will be
stored in other files.

The default table type in @strong{MySQL} is @code{MyISAM}. If you are
trying to use a table type that is not incompiled or activated,
@strong{MySQL} will instead create a table of type @code{MyISAM}.

@code{ALTER TABLE} ʸ����Ѥ���С��ơ��֥��㤦�������ѹ��Ǥ��ޤ���
@xref{ALTER TABLE, , @code{ALTER TABLE}}.

Note that @strong{MySQL} supports two different kind of
tables. Transactions safe tables (@code{BDB}) and not transaction safe
tables (@code{ISAM},@code{MyISAM} and @code{HEAP}.

Advantages of transaction safe tables (TST)

@itemize @bullet
@item
Safer; Even if @code{MySQL} crashes or you get hardware problems, you
can get your data back;  Either by automatic recovery or from a backup
+ the transaction log.
@item
You can combine many statements and accept these all in one go with
the @code{COMMIT} command.
@item
You can execute @code{ROLLBACK} to ignore your changes (if you are not
running in auto commit mode).
@item
If an update fails, all your changes will be restored. (With NTST tables all
changes that has taken place are permanent)
@end itemize

Advantages of not transaction safe tables (NTST):

@itemize @bullet
@item
Much faster as there is no transcation overhead.
@item
Will use less disk space as there is no overhead of transactions.
@item
Will use less memory to do updates.
@end itemize

You can combine TST and NTST tables in the same statements to get the best
of both worlds.

@menu
* MyISAM::                      MyISAM tables
* ISAM::                        ISAM tables
* HEAP::                        HEAP tables
* BDB::
@end menu

@node MyISAM, ISAM, Table types, Table types
@section MyISAM tables

@code{MyISAM} �ϡ�@strong{MySQL} 3.23 �ǤΥǥե���ȤΥơ��֥�����Ǥ���
����� @code{ISAM} �����ɤ��ˤ���¿���������ʳ�ĥ��ǽ����äƤ��ޤ���

����ǥå����� @code{.MYI} (MYindex) ��ĥ�ҤΤĤ��ե��������¸���졢
�ǡ����ϡ� @code{.MYD} (MYData) ��ĥ�ҤΤĤ��ե��������¸����ޤ���
@code{myisamchk} �桼�ƥ���ƥ�����Ѥ��ơ� @code{MyISAM} �ơ��֥��
��������������ǽ�Ǥ��� @xref{Crash recovery}.

The following is new in @code{MyISAM}:

@itemize @bullet
@item
���륹��åɤ��ɤ߹�����Υơ��֥���Ф����㤦����åɤ�
Ʊ���ơ��֥�ˡ��������Ԥ� @code{INSERT} �Ǥ��ޤ���
����Ϥʤ���
You can @code{INSERT} new rows in a table without deleted rows,
while other threads are reading from the table.
@item
��ե����� (63 bit) �Υ��ݡ��ȡ�
��������filesystems/operating systems ������ե�����򥵥ݡ��Ȥ��Ƥ����硣
@item
���ǡ����ϡ����̥Х��Ȥ���ˤ�����ޤ��� ����ϡ��ǡ����򡢥ޥ���OS
���¸�ˤ��ޤ�����
The only requirement is that the machine uses two's-complement
signed integers (as every machine for the last 20 years has)
and IEEE floating point format (also totally dominant among mainstream
machines). The only area of machines that may not support binary
compatibility are embedded systems (because they sometimes have peculiar
processors).
@item
�����ͥ����Ϲ�̥Х��Ȥ���˽񤫤�ޤ��� ����ϥ���ǥå����ΰ���Ψ��
�ɤ����ޤ���
@item
Internal handling of one @code{AUTO_INCREMENT} column. @code{MyISAM}
will automatically update this on @code{INSERT/UPDATE}. The
@code{AUTO_INCREMENT} value can be reset with @code{myisamchk}. This
will make @code{AUTO_INCREMENT} columns faster (at least 10 %) and old
numbers will not be reused as with the old ISAM. Note that when a
@code{AUTO_INCREMENT} is defined on the end of a multi-part-key the old
behavior is still present.
@item
When inserted in sorted order (as when you are using an @code{AUTO_INCREMENT}
column) the key tree will be split so that the high node only contains one
key. This will improve the space utilization in the key tree.
@item
@code{BLOB} �� @code{TEXT} �ե�����ɤ˥���ǥå�����ĥ��ޤ�
@item
@code{NULL} �ͤ򥤥�ǥå�����ĥ��줿�ե�����ɤ˵����ޤ��� This takes 0-1
bytes/key.
@item
���ߡ������κ���Ĺ�ϥǥե���Ȥ� 500 �Ǥ��� In cases of keys longer
than 250 bytes, a bigger key block size than the default of 1024 bytes
is used for this key.
@item
Maximum number of keys/table enlarged to 32 as default. This can be
enlarged to 64 without having to recompile @code{myisamchk}.
@item
There is a flag in the @code{MyISAM} file that indicates whether or not the
table was closed correctly.  This will soon be used for automatic repair
in the @strong{MySQL} server.
@item
@code{myisamchk} will mark tables as checked if one runs it with
@code{--update-state}. @code{myisamchk --fast} will only check those
tables that don't have this mark.
@item
@code{myisamchk -a} stores statistics for key parts (and not only for
whole keys as in @code{ISAM}).
@item
Dynamic size rows will now be much less fragmented when mixing deletes
with updates and inserts.  This is done by automatically combining adjacent
deleted blocks and by extending blocks if the next block is deleted.
@item
@code{myisampack} �� @code{BLOB} �� @code{VARCHAR} �ե�����ɤ�ѥå����뤳�Ȥ���ǽ�Ǥ���
@end itemize

@code{MyISAM} also supports the following things, which @strong{MySQL}
will be able to use in the near future.

@itemize @bullet
@item
Support for a true @code{VARCHAR} type; A @code{VARCHAR} column starts
with a length stored in 2 bytes.
@item
Tables with @code{VARCHAR} may have fixed or dynamic record length.
@item
@code{VARCHAR} and @code{CHAR} may be up to 64K.
All key segments have their own language definition. This will enable
@strong{MySQL} to have different language definitions per column.
@item
A hashed computed index can be used for @code{UNIQUE}; This will allow
you to have @code{UNIQUE} on any combination of columns in a table. (You
can't search on a @code{UNIQUE} computed index, however.)
@end itemize

@menu
* Key space::                   Space needed for keys
* MyISAM table formats::        
@end menu

@node Key space, MyISAM table formats, MyISAM, MyISAM
@subsection Space needed for keys

@strong{MySQL} can support different index types, but the normal type is
ISAM or MyISAM.  These use a B-tree index and you can roughly calculate
the size for the index file as @code{(key_length+4)/0.67}, summed over
all keys.  (This is for the worst case when all keys are inserted in
sorted order and we don't have any compressed keys.)

String indexes are space compressed. If the first index part is a
string, it will also be prefix compressed.  Space compression makes the
index file smaller than the above figures if the string column has a lot
of trailing space or is a @code{VARCHAR} column that is not always used
to the full length. Prefix compression is used on keys that start
with a string.  Prefix compression helps if there are many strings
with an identical prefix.

In @code{MyISAM} tables, you can also prefix compress numbers by specifying
@code{PACK_KEYS=1} when you create the table.  This helps when you have
many integer keys which have an identical prefix when the numbers are stored
high-byte first.

@node MyISAM table formats,  , Key space, MyISAM
@subsection MyISAM table formats

@strong{MyISAM} supports 3 different table types. 2 of them are chosen
automatically depending on the type of columns you are using. The third,
compressed tables, can only be created with the @code{myisampack} tool.

@menu
* Static format::               Static (Fixed-length) table characteristics
* Dynamic format::              Dynamic table characteristics
* Compressed format::           Compressed table characteristics
@end menu

@node Static format, Dynamic format, MyISAM table formats, MyISAM table formats
@subsubsection Static (Fixed-length) table characteristics

This is the default format. It's used when the table contains no
@code{VARCHAR}, @code{BLOB} or @code{TEXT} columns.

���Υե����ޥåȤϡ��Ǥ�ñ�㡢���ġ������ʥե����ޥåȤǤ���
�����, Disk ��˺����ơ��֥����ǡ��Ǥ�®���ե����ޥåȤǤ⤢��ޤ���
����ϥǥ�������Υǡ����򸫤Ĥ��䤹������Ǥ���
When looking up something with an index and static
format it is very simple, just multiply the row number with the row length.

Also when scanning a table it is very easy to read a constant number of
records with each disk read.

�������Ȥ����Τϡ������ͤʤ��ȤǤ���
�⤷���ˡ���Ū(����Ĺ) MyISAM �ե�����˽񤭹�����ˡ�
���ʤ��Υ���ԥ塼��������å��夷����硢
@code{myisamchk} �ϡ����줾��Υ쥳���ɤγ������Ƚ�λ����°פ˸��Ĥ��뤳�Ȥ���
��ޤ��� 
So it can usually reclaim all records except the
partially written one. 
MySQL �Ǥϡ���ˡ����ƤΥ���ǥå������ƹ��ۤǤ��뤳�Ȥ����դ��Ƥ���������

@itemize @bullet
@item
���Ƥ� @code{CHAR}, @code{NUMERIC}, @code{DECIMAL} �ե�����ɤϡ����Υե������
Ĺ��­��ʤ���ʬ�ˤϥ��ڡ����������ޤ���
@item
�ȤƤ�®��
@item
����å��夷�䤹����
@item
����å���θ�ƹ��ۤ��䤹�����ʤ��ʤ�쥳���ɤ����ꤵ�줿���֤˳�����Ƥ��Ƥ�
�뤫�顣
@item
Doesn't have to be reorganized (with @code{myisamchk}) unless a huge number of
records are deleted and you want to return free disk space to the operating
system.
@item
�̾ưŪ�ơ��֥����¿���Υǥ��������̤�ɬ�ס�
@end itemize

@node Dynamic format, Compressed format, Static format, MyISAM table formats
@subsubsection Dynamic table characteristics

This format is used if the table contains any @code{VARCHAR}, @code{BLOB}
or @code{TEXT} columns or if the table was created with
@code{ROW_FORMAT=dynamic}.

���η����Ͼ���ʣ���Ǥ��� �ʤ��ʤ餽�줾��Υ쥳���ɤ����쥳���ɤ��ɤΤ��餤��
Ĺ������äƤ��뤫��Ͽ����إå�������äƤ��뤫��Ǥ���
One record can also end up at more than one
location when it is made longer at an update.

@code{OPTIMIZE table} �� @code{myisamchk} ����Ѥ��ơ��ơ��֥��
�ե饰���ơ������������뤳�Ȥ���ǽ�Ǥ���
If you have static data that you access/change a lot in the same
table as some @code{VARCHAR} or @code{BLOB} columns, it might be a good
idea to move the dynamic columns to other tables just to avoid
fragmentation.

@itemize @bullet
@item
���Ƥ�ʸ���ե�����ɤ�ưŪ�ˤʤ�ޤ��ʤ�����4byte���û��ʪ�Ͻ����ޤ���
@item
���줾��Υ쥳���ɤ���Ƭ�ˤϡ��ե�����ɤξ��֤�ɽ���ӥåȡ��ޥåפ����ޤ���
���ΥӥåȤϡ��ɤ�ʸ�����ե�����ɤ���ʸ��(@code{''})�ʤΤ���
�ɤο��ͥե�����ɤ������ʤΤ��򼨤��ޤ���
(����ϥե�����ɤ��ͤ� @code{NULL} �ͤȤϰ㤤�ޤ�)��
�⤷��ʸ�����ե�����ɤ�ʸ�����Ĺ��(���³������ϼ��������)�� ���� ��
���ä��ꡢ���뤤�ϡ����ͥե�����ɤ��ͤ� ���� �Ǥ��ä����ϡ�
���Υե�����ɤϥӥåȡ��ޥåפ˥ޡ������졢�ͤϥǥ������ˤ���¸����ޤ���
��ʸ���ǤϤʤ����ϡ�ʸ����ΥХ��ȿ����ӥåȡ��ޥåפ˵�Ͽ���졢
ʸ���󼫿Ȥ��ե�����ɤ���¸����ޤ���
@item
�̾����Ĺ�Υơ��֥���⾯�ʤ��ǥ��������̤Ǥ��ߤޤ�
@item
���줾��Υ쥳���ɤϡ��׵ᤵ�줿�����Υ��ڡ�������Ѥ��ޤ���
�⤷����쥳���ɤ��礭���ʤ�ȡ��׵ᤵ�줿ʬ�������¿�������Ҥ�ʬ���ޤ���
���η�̡��쥳���ɤΥե饰���ơ������ȯ�����ޤ���
@item
If you update a row with information that extends the row length, the
row will be fragmented.  In this case, you may have to run @code{myisamchk
-r} from time to time to get better performance.  Use @code{myisamchk -ei
tbl_name} for some statistics.
@item
Not as easy to reconstruct after a crash, because a record may be fragmented
into many pieces and a link (fragment) may be missing.
@item
���Ԥ����쥳���ɤ�Ĺ���ϡ�

@example
3
+ (�ե�����ɿ� + 7) / 8
+ (char �ե�����ɤο�)
+ ���ͥե�����ɤ�ѥå�����������
+ ʸ����Ĺ��
+ (NULL �ե�����ɤο� + 7) / 8
@end example

There is a penalty of 6 bytes for each link. A dynamic record is linked
whenever an update causes an enlargement of the record. Each new link will be
at least 20 bytes, so the next enlargement will probably go in the same link.
If not, there will be another link. You may check how many links there are
with @code{myisamchk -ed}. All links may be removed with @code{myisamchk -r}.
@end itemize

@node Compressed format,  , Dynamic format, MyISAM table formats
@subsubsection Compressed table characteristics

������ɤ߹������Ѥη��ǡ����ץ����ġ���� @code{myisampack} �Ǻ�������ޤ���
(@code{pack_isam} for @code{ISAM} tables).

@code{myisampack} and @code{pack_isam} are available to all customers
that have bought a @strong{MySQL} license or @code{MySQL} support
for their internal use.

@itemize @bullet
@item
The uncompress code exists in all @strong{MySQL} distributions so that
even customers who don't have @code{myisampack} can read tables that
were compressed with @code{myisampack}
@item
Compressed tables takes very little disk space. This minimizes disk usage which
is very nice when using slow disks (like CD-ROMs).
@item
Each record is compressed separately (very little access overhead).  The
header for a record is fixed (1-3 bytes) depending on the biggest record in the
table.  Each column is compressed differently. Some of the compression types
are:
@itemize @minus
@item
There is usually a different Huffman table for each column.
@item
Suffix space compression.
@item
Prefix space compression.
@item
Numbers with value @code{0} are stored using 1 bit.
@item
If values in an integer column have a small range, the column is stored using
the smallest possible type. For example, a @code{BIGINT} column (8 bytes) may
be stored as a @code{TINYINT} column (1 byte) if all values are in the range
@code{0} to @code{255}.
@item
If a column has only a small set of possible values, the column type is
converted to @code{ENUM}.
@item
A column may use a combination of the above compressions.
@end itemize
@item
Can handle fixed or dynamic length records, but not @code{BLOB} or @code{TEXT}
columns.
@item
Can be uncompressed with @code{myisamchk}.
@end itemize

@node ISAM, HEAP, MyISAM, Table types
@section ISAM tables

You can also use the deprecated ISAM table type. This will disappear
rather soon because @code{MyISAM} is a better implementation of the same
thing. ISAM uses a @code{B-tree} index. The index is stored in a file
with the @code{.ISM} extension and the data is stored in file with the
@code{.ISD} extension.  You can check/repair ISAM tables with the
@code{isamchk} utility. @xref{Crash recovery}.

@code{ISAM} has the following features/properties:

@itemize @bullet
@item Compressed and fixed length keys
@item Fixed and dynamic record length
@item 16 keys with 16 key parts / key
@item Max key length 256 (default)
@item Data is stored in machine format;  this is fast, but is machine/OS dependent.
@end itemize

Most of the things for @code{MyISAM} tables are also true for @code{ISAM}
tables. @xref{MyISAM}. The major differences compared to @code{MyISAM}
tables are:

@itemize @bullet
@item ISAM tables are not binary portable across OS/Platforms.
@item Can't handle tables > 4G.
@item Only support prefix compression on strings
@item Smaller key limits.
@item Dynamic tables gets more fragmented.
@item Tables are compressed with @code{pack_isam} rather than with @code{myisampack}.
@end itemize

@node HEAP, BDB, ISAM, Table types
@section HEAP tables

@code{HEAP} tables use a hashed index and are stored in memory.  This
makes them very fast, but if @strong{MySQL} crashes you will lose all
data stored in them.  @code{HEAP} is very useful as temporary tables!

@strong{MySQL} ���� HEAP �ơ��֥�ϡ�100% �����ʥåߥå����ϥå��󥰤�
���Ѥ��Ƥ����ޤ��ʥ����С��ե������ꥢ̵���ˡˡ�
There is no extra space needed for free lists.
@code{HEAP} tables also don't have problems with delete + inserts, which
normally is common with hashed tables..

@example
mysql> CREATE TABLE test TYPE=HEAP SELECT ip,SUM(downloads) as down
        FROM log_table GROUP BY ip;
mysql> SELECT COUNT(ip),AVG(down) FROM test;
mysql> DROP TABLE test;
@end example

Here are some things you should consider when you use @code{HEAP} tables:

@itemize @bullet
@item
You should always use specify @code{MAX_ROWS} in the @code{CREATE} statement 
to ensure that you accidently do not use all memory.
@item
Indexes will only be used with @code{=} and @code{<=>} (but are VERY fast).
@item
@code{HEAP} tables can only use whole keys to search for a row; compare this
to @code{MyISAM} tables where any prefix of the key can be used to find rows.
@item
@code{HEAP} tables use a fixed record length format.
@item
@code{HEAP} doesn't support @code{BLOB}/@code{TEXT} columns.
@item
@code{HEAP} doesn't support @code{AUTO_INCREMENT} columns.
@item
@code{HEAP} doesn't support an index on a @code{NULL} column.
@item
You can have non-unique keys in a @code{HEAP} table (this isn't common for
hashed tables).
@item
@code{HEAP} tables are shared between all clients (just like any other
table).
@item
You can't search for the next entry in order (that is to use the index
to do a @code{ORDER BY}).
@item
Data for @code{HEAP} tables are allocated in small blocks. The tables
are 100% dynamic (on inserting). No overflow areas and no extra key
space is needed.  Deleted rows are put in a linked list and are
reused when you insert new data into the table.
@item
You need enough extra memory for all HEAP tables that you want to use at
the same time.
@item
To free memory, you should execute @code{DELETE FROM heap_table} or
@code{DROP TABLE heap_table}.
@item
@strong{MySQL} cannot find out how approximately many rows there
are between two values (this is used by the range optimizer to decide which
index to use).  This may affect some queries if you change a @code{MyISAM}
table to a @code{HEAP} table.
@item
To ensure that you accidentally don't do anything stupid, you can't create
@code{HEAP} tables bigger than @code{max_heap_table_size}.
@end itemize

Memory needed for one row in a @code{HEAP} table is:

SUM_OVER_ALL_KEYS(max_length_of_key + sizeof(char*)*2) + 
ALIGN(length_of_row+1,sizeof(char*))

@code{sizeof(char*)} is 4 on 32 bit machines and 8 on 64 bit machines.

@node BDB,  , HEAP, Table types
@section BDB or Berkeley_db tables

Berkeley DB (@uref{http://www.sleepycat.com}) has provided @strong{MySQL}
with a transaction safe table handler. This will survive crashes and
also provides @code{COMMIT} and @code{ROLLBACK} on transactions. In
order to build MySQL 3.23.x (BDB support first appeared in 3.23.15) with
support for @code{BDB} tables, you will need Berkeley DB 3.1.11 or newer
which can be downloaded from @uref{http://www.mysql.com/download_3.23.html};
or also from Sleepycat's download page at @uref{http://www.sleepycat.com/download.html}.

Even if Berkeley DB is in itself very tested and reliably, the
@strong{MySQL} interface is still very alpha, but we are actively
improving and optimizing it to get it this stable real soon.

If you are running with @code{AUTOCOMMIT=0} then your changes in @code{BDB}
tables will not be updated until you execute @code{COMMIT}.  Instead of commit
you can execute @code{ROLLBACK} to forget your changes. @xref{COMMIT}.

The following options to @code{mysqld} can be used to change the behavour of
BDB tables:

@multitable @columnfractions .30 .70
@item --bdb-home=  directory @tab  Berkeley home direcory
item --bdb-lock-detect=# @tab  Berkeley lock detect. One of (DEFAULT, OLDEST, RANDOM or YOUNGEST)
@item --bdb-logdir=directory @tab Berkeley DB log file directory
@item --bdb-nosync @tab Don't synchronously flush logs
@item --bdb-recover @tab Start Berkeley DB in recover mode
@item --bdb-tmpdir=directory @tab Berkeley DB tempfile name
@item --skip-bdb @tab Don't use berkeley db.
@end multitable

If you use @code{--skip-bdb}, @strong{MySQL} will not initialize the
Berkeley DB library and this will save a lot of memory.  You can of course
not use @code{BDB} tables if you are using this option.

Some characteristic of @code{BDB} tables:

@itemize @bullet
@item
All @code{BDB} tables must have a primary key.
@item
If all columns you access in a @code{BDB} tables is part of the same index or
part of the the primary key then @strong{MySQL} can execute the query
without having to access the actual row.  In a @code{MyISAM} table the
above holds only if the columns are part of the same index.
@item
@code{LOCK TABLES} works on @code{BDB} tables as with other tables.  If
you don't use @code{LOCK TABLE}, @strong{MYSQL} will issue an internal
multiple write lock on the table to ensure that the table will be
properly locked if one another thread issues a table lock.
@item
@code{ALTER TABLE} doesn't yet work on @code{BDB} tables.
@item
Internal locking in @code{BDB} tables are done on page level.
@item
Scanning is slower than with @code{MyISAM} tables as one has data in BDB
tables is stored in B-trees and not in a separate data file.
@item
One must in the application always be prepared to handle the case that
any change of a @code{BDB} table may make an automatic rollback and any
read may fail with a deadlock error.
@item
Keys are not compressed to previous keys as with ISAM or MyISAM
tables. In other words, the key information will take a little more
space in @code{BDB} tables compared to MyISAM tables with don't use
@code{PACK_KEYS=0}.
@item
One must do a @code{FLUSH LOGS} from time to time to sync to get checkpoints
for the @code{BDB} tables.
@item
As transaction logs take more place than ordinary logs it's more important
to rotate and remove old logs when using @code{BDB} tables than using other table
types.
@end itemize

Some things that we have to fix in the near future:

@itemize @bullet
@item
Remove the requirement that @code{BDB} tables must have a primary key.  This
will be fixed by having an automatic hidden auto_increment column for
the tables without a primary key.
@item
@code{LOCK TABLES} should work as for other @strong{MySQL} tables.
@item
@code{ALTER TABLE} doesn't yet work.
@item
@code{SHOW TABLE STATUS} doesn't yet provide that much information for BDB
tables.
@end itemize
 
@node Tutorial, Server, Table types, Top
@chapter MySQL ���塼�ȥꥢ��

@menu
* Connecting-disconnecting::    Connecting to and disconnecting from the server
* Entering queries::            Entering queries
* Examples::                    Examples
* Searching on two keys::
* Database use::                Creating and using a database
* Getting information::         Getting information about databases and tables
* Batch mode::                  Using @code{mysql} in batch mode
* Twin::                        Queries from twin project
@end menu

���ξϤǤϡ� @code{mysql} ���饤����ȥץ������λ��Ѥλ�����
ñ��ʥǡ����١����κ����Ȼ��Ѥλ���������Ȥ��ƤȤ�夲�ޤ���
@code{mysql} (``terminal monitor'' �� ``monitor'' �Ȥ��ƻ��Ȥ���ޤ�)��
@strong{MySQL} �����С�����³�Ǥ������å⡼�ɤΥץ������ǡ�
������μ¹Ԥ��̤�ɽ������ǽ�Ǥ���
@code{mysql} �ϥХå��⡼�ɤ��ǽ�Ǥ��� �������ޤ��ե�����˽񤤤Ƥ�����
�����Ƥ��Υե������ @code{mysql} �˼¹Ԥ����ޤ���
�ɤ������ˡ�Ǥ� @code{mysql} �Ϥ��ξϤ������ǥ��С�����ޤ���

@code{mysql} ���󶡤��륪�ץ����򸫤�ˤϡ� @code{--help} ���ץ�����
�¹Ԥ��ޤ���

@example
shell> mysql --help
@end example

���ξϤǤ� @code{mysql} �����ˤ��ʤ��Υޥ���˥��󥹥ȡ��뤵��Ƥ����ΤȤ���
�ޤ� @strong{MySQL} �����С�����³��ǽ�Ǥ���Ȥ��ޤ��� �⤷�����Ǥʤ��ʤ顢
���ʤ��� @strong{MySQL} �����Ԥ�Ϣ�����äƤ���������
(�⤷@emph{���ʤ����Ȥ�}�����Ԥʤ顢���Υޥ˥奢���¾�Υ��������򻲾Ȥ��Ƥ���������)

�ܾϤǤϥǡ����١�����������ΤΥץ��������ǡ����١����λ��ѤˤĤ��ƽҤ٤ޤ���
�⤷���ʤ�������¸�ߤ��Ƥ���ǡ����١����˥�����������������˶�̣������ʤ顢
���ξϤΥǡ����١������ơ��֥�κ�����ˡ���������ɤ����Ф��Ƥ⤫�ޤ��ޤ���

���ξϤ��ܼ�Ū�ˤϥ��塼�ȥꥢ��Ǥ���Τǡ�¿���ξܺ٤ϡ����ʤ餺�㤦�Ϥˤ���ޤ���
�����˽񤫤�Ƥ�������ǡ�
����˾ܤ�������ˤĤ��Ƥϥޥ˥奢���Ŭ�ڤʥ���������Ĵ�٤Ʋ������� 


@node Connecting-disconnecting, Entering queries, Tutorial, Tutorial
@section �����С��ؤ���³������

�����С��� @code{mysql} ���ޥ�ɤ�����³���뤿��ˤϡ��̾
@strong{MySQL} �桼��̾���ѥ���ɤ���ꤹ��ɬ�פ�����Ǥ��礦��
�⤷���ʤ����������󤷤Ƥ���ʳ��Υޥ���ξ�ǥ����С������äƤ���С�
���ʤ��ϡ��ۥ���̾����������ɬ�פ�����Ǥ��礦��
�ޤ����ʤ��δ����Ԥ��䤤��碌�ơ����ʤ����Ȥ��٤���³�Τ���Υѥ�᡼�����򸫤Ĥ��Ф��Ʋ�������
(���ʤ�����ɤΤ褦�ʥۥ��ȡ��桼����̾�ȥѥ���ɤ�Ȥ��٤��ʤΤ���)
Ŭ�ڤʥѥ�᡼�������ΤäƤ���С����ʤ��ϡ��ʲ��Τ褦�ˤ�����³�Ǥ��ޤ���

@example
shell> mysql -h host -u user -p
Enter password: ********
@end example

@code{********} �Ȥ�����Ƥ�����ʬ�ˤϤ��ʤ��Υѥ���ɤ�����ޤ���
@code{mysql} �� @code{Enter password:} �ץ���ץȤ�Ф����Ȥ��ˡ�

�������ư���С������Ĥ��ξ���� @code{mysql>} �ץ���ץȤ�����ޤ���

@example
shell> mysql -h host -u user -p
Enter password: ********
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 459 to server version: 3.22.20a-log

Type 'help' for help.

mysql> 
@end example

���Υץ���ץȤ� @code{mysql} �����ޥ�����Ϥ��ԤäƤ�����֤򼨤��ޤ���

�����Ĥ��� @strong{MySQL} ���󥹥ȥ졼�����Ǥϡ���������ۥ��Ȥ�
�¹Ԥ���Ƥ��륵���С��ˡ��桼������``ƿ̾''(̾��̵��)����³������Ƥ��ޤ���
�⤷���ʤ��Υޥ��󤬤��ξ������ƤϤޤ�ʤ顢@code{mysql} �򥪥ץ����̵����
��ư���٤��Ǥ���

@example
shell> mysql
@end example

��³�����������塢 @code{mysql>} �ץ���ץȤǡ�@code{QUIT} �ȥ����פ����
���ĤǤ���³���ڤ뤳�Ȥ��Ǥ��ޤ���

@example
mysql> QUIT
Bye
@end example

control-D �����Ǥ��Ƥ⤫�ޤ��ޤ���

�ʲ��Υ��������ǤΤۤȤ�ɤ���Ǥϡ����ʤ��������С�����³���Ƥ����Τ�
���Ƥ��ޤ������ξ��� @code{mysql>} �ץ���ץȤˤ�äơ�����򼨤��Ƥ��ޤ���


@node Entering queries, Examples, Connecting-disconnecting, Tutorial
@section �����������

���Υ��������ǽҤ٤��褦�ˡ����ʤ��������С��ȤĤʤ��äƤ��뤳�Ȥ�Τ���Ʋ�������
���ξ��֤ǤϤޤ��ɤ�ʥǡ����١��������򤷤Ƥ��ʤ����֤Ǥ�������������Ϥ��ޤ��ޤ���
�����Ǥϡ��ơ��֥�κ�����ǡ��������ϡ����Ф����⡢
�����˥������ȯ�Ԥ��뤫�˽������֤��ޤ���
���Υ��������Ǥϡ����ʤ����Ȥ� @code{mysql} ��ư���˴��줵���뤿��ˡ�
���ʤ�����äƤߤ뤳�Ȥ��Ǥ���Ǥ������������Ĥ��Υ��������Ѥ��ơ�
���ޥ�����Ϥδ���Ū�ʸ�§��Ҥ٤ޤ���

�����С��ΥС�����󡢺��������դ򥵡��С����䤤��碌�롢ñ��ʥ��ޥ��
�������ˤ���ޤ��� �ʲ��Τ褦�� @code{mysql>} �ץ���ץȤθ�����Ϥ�
 RETURN �����򲡤��ƤߤƤ���������

@example
mysql> SELECT VERSION(), CURRENT_DATE;
+--------------+--------------+
| version()    | CURRENT_DATE |
+--------------+--------------+
| 3.22.20a-log | 1999-03-19   |
+--------------+--------------+
1 row in set (0.01 sec)
mysql>
@end example

���Υ�����ϡ�@code{mysql} �Τ����Ĥ��λ����������Ƥ��ޤ���

@itemize @bullet
@item
�̾���ޥ�ɤϡ����ߥ�����ǽ���� SQL ���ơ��ȥ��Ȥ��顢��������ޤ���
(���ߥ�����ɬ�פȤ���ʤ������Ĥ����㳰������ޤ���
�����˽Ҥ٤� @code{QUIT} �Ϥ��Τ����ΰ�ĤǤ������¾��ФƤ��ޤ���)

@item
���ޥ�ɤ�ȯ�Ԥ���ȡ�@code{mysql} �Ϥ���򥵡��С������ꡢ��̤�ɽ�����ޤ���
���θ塢 @code{mysql>} �ץ���ץȤ�Ф���¾�Υ��ޥ�ɤ������դ������֤Ǥ����
�����ޤ���

@item
@code{mysql} �ϥ�����η�̤�ɽ�ˤ��ƽФ��ޤ��� �ǽ�ιԤϹ��ܤΥ�٥�̾�Ǥ���
���β��ιԤˡ�������η�̤�³���ޤ��� �̾���ܤΥ�٥�̾�ϥǡ����١����Υơ��֥뤫��
���ʤ������Ф����ե������̾�ˤʤ�ޤ��� �ơ��֥�Υե������̾�ʳ��μ���
���ʤ������������Τʤ�(���礦����Τ褦��)��@code{mysql} ��Ϳ����줿�����Ȥ�
���ܤΥ�٥�̾�Ȥ���ɽ�����ޤ���

@item
@code{mysql} �ϲ��쥳����(rows)�֤äƤ������򼨤����¹Ԥˤɤ줯�餤�λ��֤�
�����ä����⼨���ޤ��� ����Ϥ������äѤʥ����С��Υѥե����ޥ󥹤򼨤��ޤ���
�������ͤ� wall clock time (CPU �� �ޥ��󥿥���ǤϤʤ�) ����Ѥ��Ƥ��ꡢ����ˡ�
�����С�����١�����ӥͥåȥ���Ԥ����֤Ȥ��ä��װ��ˤ�ƶ������Τǡ�
�����ΤǤ���
(���ξϤ�¾������ˤ����Ƥ� ``rows in set'' �ιԤϾʤ��ޤ���)
@end itemize

������ɤϡ������ʤ���ʸ����ʸ���Ǥ⵭�ҤǤ��ޤ���
�ʲ��˼����������Ʊ���Ǥ���

@example
mysql> SELECT VERSION(), CURRENT_DATE;
mysql> select version(), current_date;
mysql> SeLeCt vErSiOn(), current_DATE;
@end example

�ʲ��Υ�����ϡ�@code{mysql} ���ñ�ʷ׻����Ȥ��ƻ��Ѥ�����Ǥ���

@example
mysql> SELECT SIN(PI()/4), (4+1)*5;
+-------------+---------+
| SIN(PI()/4) | (4+1)*5 |
+-------------+---------+
|    0.707107 |      25 |
+-------------+---------+
@end example


���ޤǤϸ��Ƥ��������ޥ�ɤϡ����Ūû������ԤΤ�ʸ�Ǥ���
���ʤ��ϰ�Ԥ�ʣ����ʸ��񤯤��Ȥ�����ޤ���
���줾���ʸ�ν����ˤϥ��ߥ�������դ��ޤ��� 

@example
mysql> SELECT VERSION(); SELECT NOW();
+--------------+
| version()    |
+--------------+
| 3.22.20a-log |
+--------------+

+---------------------+
| NOW()               |
+---------------------+
| 1999-03-19 00:15:33 |
+---------------------+
@end example

���ޥ�ɤϰ�Ԥˤ���ɬ�פ⤢��ޤ��� ʣ���Ԥˤ錄��Ĺ�����ޥ�ɤǤ����ꤢ��ޤ���
@code{mysql} �ϥ��ߥ�����ǡ���ʸ�ν����ȸ��ʤ��ޤ��� ���ιԤκǸ��ʸ�κǸ�Ȥ�
���ʤ��ޤ��� �ʤ����ʤ�С�@code{mysql} �ϼ�ͳ�����Ϥ���������ߥ����󤬸����ޤǤ�
���������Ϥ��줿�Ԥ�¹Ԥ��ޤ����

ʣ���Ԥˤޤ����ä�ʸ����Ǥ���

@example
mysql> SELECT
    -> USER()
    -> ,
    -> CURRENT_DATE;
+--------------------+--------------+
| USER()             | CURRENT_DATE |
+--------------------+--------------+
| joesmith@@localhost | 1999-03-18   |
+--------------------+--------------+
@end example

������Ǥϡ�ʣ���ˤޤ����륯����ˤ����ơ��ǽ�ιԤ����ϤΤ��ȡ�
�����˥ץ���ץȤ� @code{mysql>} ���� @code{->} ���Ѥ�뤫�򼨤��Ƥ��ޤ���
����� @code{mysql} �����ޤ�ʸ������äƤ��餺���Ĥ����ʬ�����Ϥ��ԤäƤ���
���Ȥ򼨤��ޤ���  The prompt is your friend, because it provides
valuable feedback.  If you use that feedback, you will always be aware of
what @code{mysql} is waiting for.

������˥��ޥ�ɤμ¹Ԥ�����褦�Ȼפä���硢
@code{\c} �Ǥ���򥭥�󥻥�Ǥ��ޤ���

@example
mysql> SELECT
    -> USER()
    -> \c
mysql>
@end example

Here, too, notice the prompt.  It switches back to @code{mysql>} after you
type @code{\c}, providing feedback to indicate that @code{mysql} is ready
for a new command.

�ʲ���ɽ�ˡ� @code{mysql} �Υץ���ץȤȤ��ξ��֤������򼨤��ޤ���

@multitable @columnfractions .10 .9
@item @strong{�ץ���ץ�} @tab @strong{��̣}
@item @code{mysql>} @tab ���������ޥ�ɤ��Ծ���
@item @code{@ @ @ @ ->} @tab ʣ���Ԥˤޤ����륳�ޥ�ɤΡ����ιԤ����Ϥ��ԤäƤ�����֡�
@item @code{@ @ @ @ '>} @tab ���󥰥륯������ (@samp{'}) �ǻϤ��줿ʸ���Ρ����ιԤ����Ϥ��ԤäƤ�����֡�
@item @code{@ @ @ @ ">} @tab ���֥륯������ (@samp{"}) �ǻϤ��줿ʸ���Ρ����ιԤ����Ϥ��ԤäƤ�����֡�
@end multitable

���ʤ���ʸ�򥻥ߥ�����ǽ���餹���Ȥ�˺��Ƽ¹Ԥ������ˡ�
ʣ���Ԥ������Ԥ���������ޤ��� ���ξ�硢 @code{mysql} ��
�������Ϥ��Ԥ��ޤ���

@example
mysql> SELECT USER()
    ->
@end example

If this happens to you (you think you've entered a statement but the only
response is a @code{->} prompt), most likely @code{mysql} is waiting for the
semicolon.  If you don't notice what the prompt is telling you, you might sit
there for a while before realizing what you need to do.  Enter a semicolon to
complete the statement, and @code{mysql} will execute it:

@example
mysql> SELECT USER()
    -> ;
+--------------------+
| USER()             |
+--------------------+
| joesmith@@localhost |
+--------------------+
@end example

The @code{'>} and @code{">} prompts occur during string collection.
In @strong{MySQL}, you can write strings surrounded by either @samp{'}
or @samp{"} characters (for example, @code{'hello'} or @code{"goodbye"}),
and @code{mysql} lets you enter strings that span multiple lines.  When you
see a @code{'>} or @code{">} prompt, it means that you've entered a line
containing a string that begins with a @samp{'} or @samp{"} quote character,
but have not yet entered the matching quote that terminates the string.
That's fine if you really are entering a multiple-line string, but how likely
is that?  Not very.  More often, the @code{'>} and @code{">} prompts indicate
that you've inadvertantly left out a quote character.  For example:

@example
mysql> SELECT * FROM my_table WHERE name = "Smith AND age < 30;
    ">
@end example

If you enter this @code{SELECT} statement, then hit RETURN and wait for the
result, nothing will happen.  Instead of wondering, ``why does this
query take so long?,'' notice the clue provided by the @code{">} prompt.  It
tells you that @code{mysql} expects to see the rest of an unterminated
string.  (Do you see the error in the statement?  The string @code{"Smith} is
missing the second quote.)

At this point, what do you do?  The simplest thing is to cancel the command.
However, you cannot just type @code{\c} in this case, because @code{mysql}
interprets it as part of the string that it is collecting!  Instead, enter
the closing quote character (so @code{mysql} knows you've finished the
string), then type @code{\c}:

@example
mysql> SELECT * FROM my_table WHERE name = "Smith AND age < 30;
    "> "\c
mysql>
@end example

The prompt changes back to @code{mysql>}, indicating that @code{mysql}
is ready for a new command.

It's important to know what the @code{'>} and @code{">} prompts signify,
because if you mistakenly enter an unterminated string, any further lines you
type will appear to be ignored by @code{mysql} --- including a line
containing @code{QUIT}!  This can be quite confusing, especially if you
don't know that you need to supply the terminating quote before you can
cancel the current command.

@node Examples, Searching on two keys, Entering queries, Tutorial
@section Examples of common queries

Here follows examples of how to solve some common problems with
@strong{MySQL}.

Some of the examples use the table @code{shop} to hold the price of each
article (item number) for certain traders (dealers).  Supposing that each
trader has a single fixed price per article, then (@code{item},
@code{trader}) is a primary key for the records.

You can create the example table as:

@example
CREATE TABLE shop (
 article INT(4) UNSIGNED ZEROFILL DEFAULT '0000' NOT NULL,
 dealer  CHAR(20)                 DEFAULT ''     NOT NULL,
 price   DOUBLE(16,2)             DEFAULT '0.00' NOT NULL,
 PRIMARY KEY(article, dealer));

INSERT INTO shop VALUES
(1,'A',3.45),(1,'B',3.99),(2,'A',10.99),(3,'B',1.45),(3,'C',1.69),
(3,'D',1.25),(4,'D',19.95);
@end example

Okay, so the example data is:

@example
SELECT * FROM shop

+---------+--------+-------+
| article | dealer | price |
+---------+--------+-------+
|    0001 | A      |  3.45 |
|    0001 | B      |  3.99 |
|    0002 | A      | 10.99 |
|    0003 | B      |  1.45 |
|    0003 | C      |  1.69 |
|    0003 | D      |  1.25 |
|    0004 | D      | 19.95 |
+---------+--------+-------+
@end example

@menu
* example-Maximum-column::      
* example-Maximum-row::         
* example-Maximum-column-group::  
* example-Maximum-column-group-row::  
* example-Foreign keys::        
@end menu

@node example-Maximum-column, example-Maximum-row, Examples, Examples
@subsection The maximum value for a column

``What's the highest item number?''

@example
SELECT MAX(article) AS article FROM shop

+---------+
| article |
+---------+
|       4 |
+---------+
@end example

@node example-Maximum-row, example-Maximum-column-group, example-Maximum-column, Examples
@subsection The row holding the maximum of a certain column

``Find number, dealer, and price of the most expensive article.''

In ANSI SQL this is easily done with a sub-query:

@example
SELECT article, dealer, price
FROM   shop
WHERE  price=(SELECT MAX(price) FROM shop)
@end example

In @strong{MySQL} (which does not yet have sub-selects), just do it in
two steps:

@enumerate
@item
Get the maximum price value from the table with a @code{SELECT} statement.
@item
Using this value compile the actual query:
@example
SELECT article, dealer, price
FROM   shop
WHERE  price=19.95
@end example
@end enumerate

Another solution is to sort all rows descending by price and only
get the first row using the @strong{MySQL} specific @code{LIMIT} clause:

@example
SELECT article, dealer, price
FROM   shop
ORDER BY price DESC
LIMIT 1
@end example

@strong{Note}:  If there are several most expensive articles (e.g. each 19.95)
the @code{LIMIT} solution shows only one of them!

@node example-Maximum-column-group, example-Maximum-column-group-row, example-Maximum-row, Examples
@subsection Maximum of column: per group: only the values

``What's the highest price per article?''

@example
SELECT article, MAX(price) AS price
FROM   shop
GROUP BY article

+---------+-------+
| article | price |
+---------+-------+
|    0001 |  3.99 |
|    0002 | 10.99 |
|    0003 |  1.69 |
|    0004 | 19.95 |
+---------+-------+
@end example

@node example-Maximum-column-group-row, example-Foreign keys, example-Maximum-column-group, Examples
@subsection The rows holding the group-wise maximum of a certain field

``For each article, find the dealer(s) with the most expensive price.''

In ANSI SQL, I'd do it with a sub-query like this:

@example
SELECT article, dealer, price
FROM   shop s1
WHERE  price=(SELECT MAX(s2.price)
              FROM shop s2
              WHERE s1.article = s2.article)
@end example

In @strong{MySQL} it's best do it in several steps:

@enumerate
@item
Get the list of (article,maxprice). @xref{example-Maximum-column-group-row}.
@item
For each article get the corresponding rows which have the stored maximum
price.
@end enumerate

This can easily be done with a temporary table:

@example
CREATE TEMPORARY TABLE tmp (
        article INT(4) UNSIGNED ZEROFILL DEFAULT '0000' NOT NULL,
        price   DOUBLE(16,2)             DEFAULT '0.00' NOT NULL);

LOCK TABLES article read;

INSERT INTO tmp SELECT article, MAX(price) FROM shop GROUP BY article;

SELECT article, dealer, price FROM shop, tmp
WHERE shop.article=tmp.article AND shop.price=tmp.price;

UNLOCK TABLES;

DROP TABLE tmp;
@end example

If you don't use a @code{TEMPORARY} table, you must also lock the 'tmp' table.

`Can it be done with a single query?''

Yes, but only by using a quite inefficient trick that I call the
``MAX-CONCAT trick'':

@example
SELECT article,
       SUBSTRING( MAX( CONCAT(LPAD(price,6,'0'),dealer) ), 7) AS dealer,
  0.00+LEFT(      MAX( CONCAT(LPAD(price,6,'0'),dealer) ), 6) AS price
FROM   shop
GROUP BY article;

+---------+--------+-------+
| article | dealer | price |
+---------+--------+-------+
|    0001 | B      |  3.99 |
|    0002 | A      | 10.99 |
|    0003 | C      |  1.69 |
|    0004 | D      | 19.95 |
+---------+--------+-------+
@end example

The last example can of course be made a bit more efficient by doing the
splitting of the concatenated column in the client.

@node example-Foreign keys,  , example-Maximum-column-group-row, Examples
@subsection Using foreign keys

You don't need foreign keys to join 2 tables.

The only thing @strong{MySQL} doesn't do is @code{CHECK} to make sure that
the keys you use really exist in the table(s) you're referencing and it
doesn't automatically delete rows from table with a foreign key
definition. If you use your keys like normal, it'll work just fine!


@example
CREATE TABLE persons (
    id SMALLINT UNSIGNED NOT NULL AUTO_INCREMENT, 
    name CHAR(60) NOT NULL,
    PRIMARY KEY (id)
);

CREATE TABLE shirts (
    id SMALLINT UNSIGNED NOT NULL AUTO_INCREMENT,
    style ENUM('t-shirt', 'polo', 'dress') NOT NULL,
    color ENUM('red', 'blue', 'orange', 'white', 'black') NOT NULL,
    owner SMALLINT UNSIGNED NOT NULL REFERENCES persons,
    PRIMARY KEY (id)
);


INSERT INTO persons VALUES (NULL, 'Antonio Paz');

INSERT INTO shirts VALUES
(NULL, 'polo', 'blue', LAST_INSERT_ID()),
(NULL, 'dress', 'white', LAST_INSERT_ID()),
(NULL, 't-shirt', 'blue', LAST_INSERT_ID());


INSERT INTO persons VALUES (NULL, 'Lilliana Angelovska');

INSERT INTO shirts VALUES
(NULL, 'dress', 'orange', LAST_INSERT_ID()),
(NULL, 'polo', 'red', LAST_INSERT_ID()),
(NULL, 'dress', 'blue', LAST_INSERT_ID()),
(NULL, 't-shirt', 'white', LAST_INSERT_ID());


SELECT * FROM persons;
+----+---------------------+
| id | name                |
+----+---------------------+
|  1 | Antonio Paz         |
|  2 | Lilliana Angelovska |
+----+---------------------+

SELECT * FROM shirts;
+----+---------+--------+-------+
| id | style   | color  | owner |
+----+---------+--------+-------+
|  1 | polo    | blue   |     1 |
|  2 | dress   | white  |     1 |
|  3 | t-shirt | blue   |     1 |
|  4 | dress   | orange |     2 |
|  5 | polo    | red    |     2 |
|  6 | dress   | blue   |     2 |
|  7 | t-shirt | white  |     2 |
+----+---------+--------+-------+


SELECT s.* FROM persons p, shirts s
 WHERE p.name LIKE 'Lilliana%'
   AND s.owner = p.id
   AND s.color <> 'white';

+----+-------+--------+-------+
| id | style | color  | owner |
+----+-------+--------+-------+
|  4 | dress | orange |     2 |
|  5 | polo  | red    |     2 |
|  6 | dress | blue   |     2 |
+----+-------+--------+-------+
@end example

@findex UNION
@node Searching on two keys, Database use, Examples, Tutorial
@section Searching on two keys

@strong{MySQL} doesn't yet optimize when you search on two different
keys combined with @code{OR} (Searching on one key with different @code{OR}
parts is optimized quite good):

@example
SELECT field1_index, field2_index FROM test_table WHERE field1_index = '1'
OR  field2_index = '1'
@end example

The reason is that we haven't yet had time to come up with an efficient
way to handle this in the general case. (The @code{AND} handling is
in comparison now completely general and works very well).

For the moment you can solve this very efficently by using a
@code{TEMPORARY} table; This type of optimization is also very good if
you are using very complicated queries where the SQL server does the
optimizations in the wrong order.

@example
CREATE TEMPORARY TABLE tmp
SELECT field1_index, field2_index FROM test_table WHERE field1_index = '1';
INSERT INTO tmp
SELECT field1_index, field2_index FROM test_table WHERE field2_index = '1';
SELECT * from tmp;
DROP TABLE tmp;
@end example

The above way to solve this query is in effect an @code{UNION} of two queries.

@node Database use, Getting information, Searching on two keys, Tutorial
@section Creating and using a database

@menu
* Creating database::           Creating a database
* Creating tables::             Creating a table
* Loading tables::              Loading data into a table
* Retrieving data::             Retrieving information from a table
* Multiple tables::             Using more than one table
@end menu

Now that you know how to enter commands, it's time to access a database.

Suppose you have several pets in your home (your ``menagerie'') and you'd
like to keep track of various types of information about them.  You can do so
by creating tables to hold your data and loading them with the desired
information.  Then you can answer different sorts of questions about your
animals by retrieving data from the tables.  This section shows how to do
all that:

@itemize @bullet
@item
How to create a database
@item
How to create a table
@item
How to load data into the table
@item
How to retrieve data from the table in various ways
@item
How to use multiple tables
@end itemize

The menagerie database will be simple (deliberately), but it is not difficult
to think of real-world situations in which a similar type of database might
be used.  For example, a database like this could be used by a farmer to keep
track of livestock, or by a veterinarian to keep track of patient records.

Use the @code{SHOW} statement to find out what databases currently exist
on the server:

@example
mysql> SHOW DATABASES;
+----------+
| Database |
+----------+
| mysql    |
| test     |
| tmp      |
+----------+
@end example

The list of databases is probably different on your machine, but the
@code{mysql} and @code{test} databases are likely to be among them.  The
@code{mysql} database is required because it describes user access
privileges.  The @code{test} database is often provided as a workspace for
users to try things out.

If the @code{test} database exists, try to access it:

@example
mysql> USE test
Database changed
@end example

Note that @code{USE}, like @code{QUIT}, does not require a semicolon.  (You
can terminate such statements with a semicolon if you like; it does no harm.)
The @code{USE} statement is special in another way, too:  it must be given on
a single line.

You can use the @code{test} database (if you have access to it) for the
examples that follow, but anything you create in that database can be
removed by anyone else with access to it.  For this reason, you should
probably ask your @strong{MySQL} administrator for permission to use a
database of your own.  Suppose you want to call yours @code{menagerie}.  The
administrator needs to execute a command like this:

@example
mysql> GRANT ALL ON menagerie.* TO your_mysql_name;
@end example

where @code{your_mysql_name} is the @strong{MySQL} user name assigned to
you.

@node Creating database, Creating tables, Database use, Database use
@subsection Creating and selecting a database

If the administrator creates your database for you when setting up your
permissions, you can begin using it.  Otherwise, you need to create it
yourself:

@example
mysql> CREATE DATABASE menagerie;
@end example

Under Unix, database names are case sensitive (unlike SQL keywords), so you
must always refer to your database as @code{menagerie}, not as
@code{Menagerie}, @code{MENAGERIE} or some other variant.  This is also true
for table names.  (Under Windows, this restriction does not apply, although
you must refer to databases and tables using the same lettercase throughout a
given query.)

Creating a database does not select it for use, you must do that explicitly.
To make @code{menagerie} the current database, use this command:

@example
mysql> USE menagerie
Database changed
@end example

Your database needs to be created only once, but you must select it for use
each time you begin a @code{mysql} session.  You can do this by issuing a
@code{USE} statement as shown above.  Alternatively, you can select the
database on the command line when you invoke @code{mysql}.  Just specify its
name after any connection parameters that you might need to provide.  For
example:

@example
shell> mysql -h host -u user -p menagerie
Enter password: ********
@end example

Note that @code{menagerie} is not your password on the command just shown.
If you want to supply your password on the command line after the @code{-p}
option, you must do so with no intervening space (e.g., as
@code{-pmypassword}, not as @code{-p mypassword}).  However, putting your
password on the command line is not recommended, because doing so exposes it
to snooping by other users logged in on your machine.

@node Creating tables, Loading tables, Creating database, Database use
@subsection Creating a table

Creating the database is the easy part, but at this point it's empty, as
@code{SHOW TABLES} will tell you:

@example
mysql> SHOW TABLES;
Empty set (0.00 sec)
@end example

The harder part is deciding what the structure of your database should be:
what tables you will need, and what columns will be in each of them.

You'll want a table that contains a record for each of your pets.  This can
be called the @code{pet} table, and it should contain, as a bare minimum,
each animal's name.  Because the name by itself is not very interesting, the
table should contain other information.  For example, if more than one person
in your family keeps pets, you might want to list each animal's owner.  You
might also want to record some basic descriptive information such as species
and sex.

How about age?  That might be of interest, but it's not a good thing to store
in a database.  Age changes as time passes, which means you'd have to update
your records often.  Instead, it's better to store a fixed value such as
date of birth.  Then, whenever you need age, you can calculate it as the
difference between the current date and the birth date.  @strong{MySQL}
provides functions for doing date arithmetic, so this is not difficult.
Storing birth date rather than age has other advantages, too:

@itemize @bullet
@item
You can use the database for tasks such as generating reminders for upcoming
pet birthdays.  (If you think this type of query is somewhat silly, note that
it is the same question you might ask in the context of a business database
to identify clients to whom you'll soon need to send out birthday greetings,
for that computer-assisted personal touch.)

@item
You can calculate age in relation to dates other than the current date.  For
example, if you store death date in the database, you can easily calculate
how old a pet was when it died.
@end itemize

You can probably think of other types of information that would be useful in
the @code{pet} table, but the ones identified so far are sufficient for now:
name, owner, species, sex, birth and death.

Use a @code{CREATE TABLE} statement to specify the layout of your table:

@example
mysql> CREATE TABLE pet (name VARCHAR(20), owner VARCHAR(20),
    -> species VARCHAR(20), sex CHAR(1), birth DATE, death DATE);
@end example

@code{VARCHAR} is a good choice for the @code{name}, @code{owner} and
@code{species} columns because the column values will vary in length.  The
lengths of those columns need not all be the same, and need not be
@code{20}.  You can pick any length from @code{1} to @code{255}, whatever
seems most reasonable to you.  (If you make a poor choice and it turns
out later that you need a longer field, @strong{MySQL} provides an
@code{ALTER TABLE} statement.)

Animal sex can be represented in a variety of ways, for example, @code{"m"}
and @code{"f"}, or perhaps @code{"male"} and @code{"female"}.  It's simplest
to use the single characters @code{"m"} and @code{"f"}.

The use of the @code{DATE} data type for the @code{birth} and @code{death}
columns is a fairly obvious choice.

Now that you have created a table, @code{SHOW TABLES} should produce some
output:

@example
mysql> SHOW TABLES;
+---------------------+
| Tables in menagerie |
+---------------------+
| pet                 |
+---------------------+
@end example

To verify that your table was created the way you expected, use
a @code{DESCRIBE} statement:

@example
mysql> DESCRIBE pet;
+---------+-------------+------+-----+---------+-------+
| Field   | Type        | Null | Key | Default | Extra |
+---------+-------------+------+-----+---------+-------+
| name    | varchar(20) | YES  |     | NULL    |       |
| owner   | varchar(20) | YES  |     | NULL    |       |
| species | varchar(20) | YES  |     | NULL    |       |
| sex     | char(1)     | YES  |     | NULL    |       |
| birth   | date        | YES  |     | NULL    |       |
| death   | date        | YES  |     | NULL    |       |
+---------+-------------+------+-----+---------+-------+
@end example

You can use @code{DESCRIBE} any time, for example, if you forget the names of
the columns in your table or what types they are.

@node Loading tables, Retrieving data, Creating tables, Database use
@subsection Loading data into a table

After creating your table, you need to populate it.  The @code{LOAD DATA} and
@code{INSERT} statements are useful for this.

Suppose your pet records can be described as shown below.
(Observe that @strong{MySQL} expects dates in @code{YYYY-MM-DD} format;
this may be different than what you are used to.)

@multitable @columnfractions .16 .16 .16 .16 .16 .16
@item @strong{name} @tab @strong{owner} @tab @strong{species} @tab @strong{sex} @tab @strong{birth} @tab @strong{death}
@item Fluffy @tab Harold @tab cat @tab f @tab 1993-02-04 @tab
@item Claws @tab Gwen @tab cat @tab m @tab 1994-03-17 @tab
@item Buffy @tab Harold @tab dog @tab f @tab 1989-05-13 @tab
@item Fang @tab Benny @tab dog @tab m @tab 1990-08-27 @tab
@item Bowser @tab Diane @tab dog @tab m @tab 1998-08-31 @tab 1995-07-29
@item Chirpy @tab Gwen @tab bird @tab f @tab 1998-09-11 @tab
@item Whistler @tab Gwen @tab bird @tab @tab 1997-12-09 @tab
@item Slim @tab Benny @tab snake @tab m @tab 1996-04-29 @tab
@end multitable

Because you are beginning with an empty table, an easy way to populate it is to
create a text file containing a row for each of your animals, then load the
contents of the file into the table with a single statement.

You could create a text file @file{pet.txt} containing one record per line,
with values separated by tabs, and given in the order in which the columns
were listed in the @code{CREATE TABLE} statement.  For missing values (such
as unknown sexes, or death dates for animals that are still living), you can
use @code{NULL} values.  To represent these in your text file, use
@code{\N}.  For example, the record for Whistler the bird would look like
this (where the whitespace between values is a single tab character):

@multitable @columnfractions .15 .15 .15 .15 .25 .15
@item @code{Whistler} @tab @code{Gwen} @tab @code{bird} @tab @code{\N} @tab @code{1997-12-09} @tab @code{\N}
@end multitable

To load the text file @file{pet.txt} into the @code{pet} table, use this
command:

@example
mysql> LOAD DATA LOCAL INFILE "pet.txt" INTO TABLE pet;
@end example

You can specify the column value separator and end of line marker explicitly
in the @code{LOAD DATA} statement if you wish, but the defaults are tab and
linefeed.  These are sufficient for the statement to read the file
@file{pet.txt} properly.

When you want to add new records one at a time, the @code{INSERT} statement
is useful.  In its simplest form, you supply values for each column, in the
order in which the columns were listed in the @code{CREATE TABLE} statement.
Suppose Diane gets a new hamster named Puffball.  You could add a new record
using an @code{INSERT} statement like this:

@example
mysql> INSERT INTO pet
    -> VALUES ('Puffball','Diane','hamster','f','1999-03-30',NULL);
@end example

Note that string and date values are specified as quoted strings here.  Also,
with @code{INSERT}, you can insert @code{NULL} directly to represent a
missing value.  You do not use @code{\N} like you do with @code{LOAD DATA}.

From this example, you should be able to see that there would be a lot more
typing involved to load
your records initially using several @code{INSERT} statements rather
than a single @code{LOAD DATA} statement.

@node Retrieving data, Multiple tables, Loading tables, Database use
@subsection Retrieving information from a table

@menu
* Selecting all::               Selecting all data
* Selecting rows::              Selecting particular rows
* Selecting columns::           Selecting particular columns
* Sorting rows::                Sorting rows
* Date calculations::           Date calculations
* Working with NULL::           Working with @code{NULL} values
* Pattern matching::            Pattern matching
* Counting rows::               Counting rows
@end menu

The @code{SELECT} statement is used to pull information from a table.
The general form of the statement is:

@example
SELECT what_to_select
FROM which_table
WHERE conditions_to_satisfy
@end example

@code{what_to_select} indicates what you want to see.  This can be a list of
columns, or @code{*} to indicate ``all columns.'' @code{which_table}
indicates the table from which you want to retrieve data.  The @code{WHERE}
clause is optional.  If it's present, @code{conditions_to_satisfy} specifies
conditions that rows must satisfy to qualify for retrieval.

@node Selecting all, Selecting rows, Retrieving data, Retrieving data
@subsubsection Selecting all data

The simplest form of @code{SELECT} retrieves everything from a table:

@example
mysql> SELECT * FROM pet;
+----------+--------+---------+------+------------+------------+
| name     | owner  | species | sex  | birth      | death      |
+----------+--------+---------+------+------------+------------+
| Fluffy   | Harold | cat     | f    | 1993-02-04 | NULL       |
| Claws    | Gwen   | cat     | m    | 1994-03-17 | NULL       |
| Buffy    | Harold | dog     | f    | 1989-05-13 | NULL       |
| Fang     | Benny  | dog     | m    | 1990-08-27 | NULL       |
| Bowser   | Diane  | dog     | m    | 1998-08-31 | 1995-07-29 |
| Chirpy   | Gwen   | bird    | f    | 1998-09-11 | NULL       |
| Whistler | Gwen   | bird    | NULL | 1997-12-09 | NULL       |
| Slim     | Benny  | snake   | m    | 1996-04-29 | NULL       |
| Puffball | Diane  | hamster | f    | 1999-03-30 | NULL       |
+----------+--------+---------+------+------------+------------+
@end example

This form of @code{SELECT} is useful if you want to review your entire table,
for instance, after you've just loaded it with your initial dataset.  As it
happens, the output just shown reveals an error in your data file:  Bowser
appears to have been born after he died!  Consulting your original pedigree
papers, you find that the correct birth year is 1989, not 1998.

There are are least a couple of ways to fix this:

@itemize @bullet
@item
Edit the file @file{pet.txt} to correct the error, then empty the table
and reload it using @code{DELETE} and @code{LOAD DATA}:

@example
mysql> DELETE FROM pet;
mysql> LOAD DATA LOCAL INFILE "pet.txt" INTO TABLE pet;
@end example

However, if you do this, you must also re-enter the record for Puffball.

@item
Fix only the erroneous record with an @code{UPDATE} statement:

@example
mysql> UPDATE pet SET birth = "1989-08-31" WHERE name = "Bowser";
@end example
@end itemize

As shown above, it is easy to retrieve an entire table.  But typically you
don't want to do that, particularly when the table becomes large.  Instead,
you're usually more interested in answering a particular question, in which
case you specify some constraints on the information you want.  Let's look at
some selection queries in terms of questions about your pets that they
answer.

@node Selecting rows, Selecting columns, Selecting all, Retrieving data
@subsubsection Selecting particular rows

You can select only particular rows from your table.  For example, if you want
to verify the change that you made to Bowser's birth date, select Bowser's
record like this:

@example
mysql> SELECT * FROM pet WHERE name = "Bowser";
+--------+-------+---------+------+------------+------------+
| name   | owner | species | sex  | birth      | death      |
+--------+-------+---------+------+------------+------------+
| Bowser | Diane | dog     | m    | 1989-08-31 | 1995-07-29 |
+--------+-------+---------+------+------------+------------+
@end example

The output confirms that the year is correctly recorded now as 1989, not 1998.

String comparisons are normally case-insensitive, so you can specify the
name as @code{"bowser"}, @code{"BOWSER"}, etc.  The query result will be
the same.

You can specify conditions on any column, not just @code{name}.  For example,
if you want to know which animals were born after 1998, test the @code{birth}
column:

@example
mysql> SELECT * FROM pet WHERE birth >= "1998-1-1";
+----------+-------+---------+------+------------+-------+
| name     | owner | species | sex  | birth      | death |
+----------+-------+---------+------+------------+-------+
| Chirpy   | Gwen  | bird    | f    | 1998-09-11 | NULL  |
| Puffball | Diane | hamster | f    | 1999-03-30 | NULL  |
+----------+-------+---------+------+------------+-------+
@end example

You can combine conditions, for example, to locate female dogs:

@example
mysql> SELECT * FROM pet WHERE species = "dog" AND sex = "f";
+-------+--------+---------+------+------------+-------+
| name  | owner  | species | sex  | birth      | death |
+-------+--------+---------+------+------------+-------+
| Buffy | Harold | dog     | f    | 1989-05-13 | NULL  |
+-------+--------+---------+------+------------+-------+
@end example

The preceding query uses the @code{AND} logical operator.  There is also an
@code{OR} operator:

@example
mysql> SELECT * FROM pet WHERE species = "snake" OR species = "bird";
+----------+-------+---------+------+------------+-------+
| name     | owner | species | sex  | birth      | death |
+----------+-------+---------+------+------------+-------+
| Chirpy   | Gwen  | bird    | f    | 1998-09-11 | NULL  |
| Whistler | Gwen  | bird    | NULL | 1997-12-09 | NULL  |
| Slim     | Benny | snake   | m    | 1996-04-29 | NULL  |
+----------+-------+---------+------+------------+-------+
@end example

@code{AND} and @code{OR} may be intermixed.  If you do that, it's a good idea
to use parentheses to indicate how conditions should be grouped:

@example
mysql> SELECT * FROM pet WHERE (species = "cat" AND sex = "m")
    -> OR (species = "dog" AND sex = "f");
+-------+--------+---------+------+------------+-------+
| name  | owner  | species | sex  | birth      | death |
+-------+--------+---------+------+------------+-------+
| Claws | Gwen   | cat     | m    | 1994-03-17 | NULL  |
| Buffy | Harold | dog     | f    | 1989-05-13 | NULL  |
+-------+--------+---------+------+------------+-------+
@end example

@node Selecting columns, Sorting rows, Selecting rows, Retrieving data
@subsubsection Selecting particular columns


If you don't want to see entire rows from your table, just name the columns
in which you're interested, separated by commas.  For example, if you want to
know when your animals were born, select the @code{name} and @code{birth}
columns:

@example
mysql> SELECT name, birth FROM pet;
+----------+------------+
| name     | birth      |
+----------+------------+
| Fluffy   | 1993-02-04 |
| Claws    | 1994-03-17 |
| Buffy    | 1989-05-13 |
| Fang     | 1990-08-27 |
| Bowser   | 1989-08-31 |
| Chirpy   | 1998-09-11 |
| Whistler | 1997-12-09 |
| Slim     | 1996-04-29 |
| Puffball | 1999-03-30 |
+----------+------------+
@end example

To find out who owns pets, use this query:

@example
mysql> SELECT owner FROM pet;
+--------+
| owner  |
+--------+
| Harold |
| Gwen   |
| Harold |
| Benny  |
| Diane  |
| Gwen   |
| Gwen   |
| Benny  |
| Diane  |
+--------+
@end example

@findex DISTINCT
However, notice that the query simply retrieves the @code{owner} field from
each record, and some of them appear more than once.  To minimize the output,
retrieve each unique output record just once by adding the keyword
@code{DISTINCT}:

@example
mysql> SELECT DISTINCT owner FROM pet;
+--------+
| owner  |
+--------+
| Benny  |
| Diane  |
| Gwen   |
| Harold |
+--------+
@end example

You can use a @code{WHERE} clause to combine row selection with column
selection.  For example, to get birth dates for dogs and cats only,
use this query:

@example
mysql> SELECT name, species, birth FROM pet
    -> WHERE species = "dog" OR species = "cat";
+--------+---------+------------+
| name   | species | birth      |
+--------+---------+------------+
| Fluffy | cat     | 1993-02-04 |
| Claws  | cat     | 1994-03-17 |
| Buffy  | dog     | 1989-05-13 |
| Fang   | dog     | 1990-08-27 |
| Bowser | dog     | 1989-08-31 |
+--------+---------+------------+
@end example

@node Sorting rows, Date calculations, Selecting columns, Retrieving data
@subsubsection Sorting rows

You may have noticed in the preceding examples that the result rows are
displayed in no particular order.  However, it's often easier to examine
query output when the rows are sorted in some meaningful way.  To sort a
result, use an @code{ORDER BY} clause.

Here are animal birthdays, sorted by date:

@example
mysql> SELECT name, birth FROM pet ORDER BY birth;
+----------+------------+
| name     | birth      |
+----------+------------+
| Buffy    | 1989-05-13 |
| Bowser   | 1989-08-31 |
| Fang     | 1990-08-27 |
| Fluffy   | 1993-02-04 |
| Claws    | 1994-03-17 |
| Slim     | 1996-04-29 |
| Whistler | 1997-12-09 |
| Chirpy   | 1998-09-11 |
| Puffball | 1999-03-30 |
+----------+------------+
@end example

To sort in reverse order, add the @code{DESC} (descending) keyword to the
name of the column you are sorting by:

@example
mysql> SELECT name, birth FROM pet ORDER BY birth DESC;
+----------+------------+
| name     | birth      |
+----------+------------+
| Puffball | 1999-03-30 |
| Chirpy   | 1998-09-11 |
| Whistler | 1997-12-09 |
| Slim     | 1996-04-29 |
| Claws    | 1994-03-17 |
| Fluffy   | 1993-02-04 |
| Fang     | 1990-08-27 |
| Bowser   | 1989-08-31 |
| Buffy    | 1989-05-13 |
+----------+------------+
@end example

You can sort on multiple columns.  For example, to sort by type of
animal, then by birth date within animal type with youngest animals first,
use the following query:

@example
mysql> SELECT name, species, birth FROM pet ORDER BY species, birth DESC;
+----------+---------+------------+
| name     | species | birth      |
+----------+---------+------------+
| Chirpy   | bird    | 1998-09-11 |
| Whistler | bird    | 1997-12-09 |
| Claws    | cat     | 1994-03-17 |
| Fluffy   | cat     | 1993-02-04 |
| Fang     | dog     | 1990-08-27 |
| Bowser   | dog     | 1989-08-31 |
| Buffy    | dog     | 1989-05-13 |
| Puffball | hamster | 1999-03-30 |
| Slim     | snake   | 1996-04-29 |
+----------+---------+------------+
@end example

Note that the @code{DESC} keyword applies only to the column name immediately
preceding it (@code{birth}); @code{species} values are still sorted in
ascending order.

@node Date calculations, Working with NULL, Sorting rows, Retrieving data
@subsubsection ���դη׻�

@strong{MySQL} �Ϥ����Ĥ������դη׻���Ԥ��ؿ����󶡤��ޤ���
�㤨�С�ǯ�η׻������դ���ʬ����Ф����ꡣ

�ڥåȤ�ǯ�𤬲��ͤʤΤ����Τ뤿��ˤϡ����ߤ����դ��������Ȥκ���׻�
���ޤ��� ���Τ���ˤϡ���Ĥ����դ�������ľ���������ꡢ������ 365
(ǯ������) �dz��ޤ���

@example
mysql> SELECT name, (TO_DAYS(NOW())-TO_DAYS(birth))/365 FROM pet;
+----------+-------------------------------------+
| name     | (TO_DAYS(NOW())-TO_DAYS(birth))/365 |
+----------+-------------------------------------+
| Fluffy   |                                6.15 |
| Claws    |                                5.04 |
| Buffy    |                                9.88 |
| Fang     |                                8.59 |
| Bowser   |                                9.58 |
| Chirpy   |                                0.55 |
| Whistler |                                1.30 |
| Slim     |                                2.92 |
| Puffball |                                0.00 |
+----------+-------------------------------------+
@end example

�������ư���ޤ����������ɤ��������Ĥ��Τ��Ȥ�����ޤ��� 
��1�ˡ����η�̤ϡ��⤷�쥳���ɤˤ����Ĥ��ν��֤�Ϳ����С���ñ���¤Ӵ�����
���褽���ʤ��ȡ�
��2�ˡ�ǯ����θ��Ф��ϡ����ΤޤޤǤϤʤ�ʤΤ�ʬ����ޤ���

�ǽ������� @code{ORDER BY name} ���ä��뤳�Ȥ� name ����¤Ӵ���������ޤ���
����ܤ�������Ф��Ƥϡ��㤦���Ф�����Ϥ˸����褦�ˡ���θ��Ф���
�����ޤ� (����� �ե�����ɤΥ����ꥢ�� �ȸƤӤޤ�) : 

@example
mysql> SELECT name, (TO_DAYS(NOW())-TO_DAYS(birth))/365 AS age
    -> FROM pet ORDER BY name;
+----------+------+
| name     | age  |
+----------+------+
| Bowser   | 9.58 |
| Buffy    | 9.88 |
| Chirpy   | 0.55 |
| Claws    | 5.04 |
| Fang     | 8.59 |
| Fluffy   | 6.15 |
| Puffball | 0.00 |
| Slim     | 2.92 |
| Whistler | 1.30 |
+----------+------+
@end example

@code{name} �ǤϤʤ� @code{age} ���¤Ӵ�����ˤϡ� @code{ORDER BY} ���
�ʲ��Τ褦���Ѥ��ޤ���

@example
mysql>  SELECT name, (TO_DAYS(NOW())-TO_DAYS(birth))/365 AS age
    ->  FROM pet ORDER BY age;
+----------+------+
| name     | age  |
+----------+------+
| Puffball | 0.00 |
| Chirpy   | 0.55 |
| Whistler | 1.30 |
| Slim     | 2.92 |
| Claws    | 5.04 |
| Fluffy   | 6.15 |
| Fang     | 8.59 |
| Bowser   | 9.58 |
| Buffy    | 9.88 |
+----------+------+
@end example

���������꤬�����˻��Ǥ��ޤä�ưʪ�Ρ�����������ǯ���Ĵ�٤�Τˤ�
���ѤǤ��ޤ��� �ɤ�ưʪ�����Ǥ��뤫�ɤ����ϡ�@code{death} �ͤ� @code{NULL} ��
�ɤ�����Ƚ�Ǥ��ޤ��� �������ͤ� ��@code{NULL} �ʤ�С� @code{death} �� @code{birth}
�κ��η׻���Ԥ��ޤ���

@example
mysql>  SELECT name, birth, death, (TO_DAYS(death)-TO_DAYS(birth))/365 AS age
    ->  FROM pet WHERE death IS NOT NULL ORDER BY age;
+--------+------------+------------+------+
| name   | birth      | death      | age  |
+--------+------------+------------+------+
| Bowser | 1989-08-31 | 1995-07-29 | 5.91 |
+--------+------------+------------+------+
@end example

���Υ�����Ǥϡ� @code{death != NULL} �ǤϤʤ� @code{death IS NOT NULL} ��
���Ѥ��ޤ��� �ʤ��ʤ顢 @code{NULL} �����̤��ͤ�����Ǥ��� ����ϸ�Dz��⤷�ޤ���
@xref{Working with NULL,  , Working with @code{NULL}}.

�⤷���ʤ��������������ưʪ���Τꤿ���Ȥ��ޤ��� ���μ�η׻��Ǥϡ�
ǯ�������ط�����ޤ���  @code{birth} �ե�����ɤη������ñ��
���Ф������ʤ�Ǥ��礦�� @strong{MySQL} �����դ���ʬ����Ф������Ĥ��δؿ���
�󶡤��ޤ��� @code{YEAR()}, @code{MONTH()}, @code{DAYOFMONTH()} �ʤɡ�
�����Ǥ� @code{MONTH()} �������Ǥ��礦�� ���줬�ɤΤ褦��ư�����Τ����ˤϡ�
@code{birth} �� @code{MONTH(birth)} ��ξ����ɽ�������륯�����¹Ԥ��Ƥߤޤ���

@example
mysql> SELECT name, birth, MONTH(birth) FROM pet;
+----------+------------+--------------+
| name     | birth      | MONTH(birth) |
+----------+------------+--------------+
| Fluffy   | 1993-02-04 |            2 |
| Claws    | 1994-03-17 |            3 |
| Buffy    | 1989-05-13 |            5 |
| Fang     | 1990-08-27 |            8 |
| Bowser   | 1989-08-31 |            8 |
| Chirpy   | 1998-09-11 |            9 |
| Whistler | 1997-12-09 |           12 |
| Slim     | 1996-04-29 |            4 |
| Puffball | 1999-03-30 |            3 |
+----------+------------+--------------+
@end example

�����������ޤ���ưʪ�򸫤Ĥ���Τϴ�ñ�Ǥ��� ����4����Ȥ��ޤ���
����ȡ�5�����ޤ��ưʪ��õ���ޤ���

@example
mysql> SELECT name, birth FROM pet WHERE MONTH(birth) = 5;
+-------+------------+
| name  | birth      |
+-------+------------+
| Buffy | 1989-05-13 |
+-------+------------+
@end example

�⤷���ߤ�12��ʤ顢����äȺ��뤫�⤷��ޤ��� ��ο��� (@code{12}) ��
1 ��­���� 13 �����ޤ��ưʪ��õ���櫓�ˤϤ����ޤ��� ������1�����ޤ��
ưʪ��õ���ޤ���

���ߤ�����ʤΤ��򵤤ˤ��뤳�Ȥʤ���ư��륯�����񤯤��Ȥ���ǽ�Ǥ���
������ˡ�Ǥϡ����ʤ��Ϸ�ο����򥯥���˻��Ѥ��뤳�Ȥ�����ޤ���
@code{DATE_ADD()} �ؿ���Ϳ�������դ��餢����֤�­�����Ȥ���ǽ�Ǥ���
�⤷������ @code{NOW()} ���ͤ� 1���� ­���� @code{MONTH()} �Ƿ��
��ʬ����Ф������η�̤��������Ĵ�٤뤿��˻��Ѥ��ޤ���

@example
mysql> SELECT name, birth FROM pet
    -> WHERE MONTH(birth) = MONTH(DATE_ADD(NOW(), INTERVAL 1 MONTH));
@end example

Ʊ�����Ȥ��Ǥ����̤���ˡ�Ȥ��ơ���;�ؿ� ����Ѥ�����̤� 1 ��­����ˡ������ޤ���
(�⤷���12��ʤ顢��;�ؿ� (@code{MOD}) ����Ѥ�����̤� @code{0} �ˤʤ�ޤ�)��

@example
mysql> SELECT name, birth FROM pet
    -> WHERE MONTH(birth) = MOD(MONTH(NOW()), 12) + 1;
@end example

Note that @code{MONTH} return a number between 1 and 12. And
@code{MOD(something,12)} returns a number between 0 and 11. So the
addition has to be after the @code{MOD()} oterwise we would go from
November (11) to January (1).

@node Working with NULL, Pattern matching, Date calculations, Retrieving data
@subsubsection @code{NULL} �ͤο�����

���ʤ�������˴����ޤǤϡ�@code{NULL} �ͤˤ϶ä����⤷��ޤ���
��ǰŪ�ˡ�@code{NULL} �ͤ� ``��̵��'' �� ``̤�Τ���'' ���̣����
¾���ͤ��⤤���֤�ۤʤäư����ޤ���
@code{NULL} ��ɾ���κݤˤϡ����ͤ���ӱ黻�� @code{=}, @code{<}, @code{!=} ��
���Ѥ��뤳�ȤϽ���ޤ��� ���ʤ����Ȥ����ǥ⤹�뤿��ˡ��ʲ��Τ褦�ˤ��ƤߤƤ���������

@example
mysql> SELECT 1 = NULL, 1 != NULL, 1 < NULL, 1 > NULL;
+----------+-----------+----------+----------+
| 1 = NULL | 1 != NULL | 1 < NULL | 1 > NULL |
+----------+-----------+----------+----------+
|     NULL |      NULL |     NULL |     NULL |
+----------+-----------+----------+----------+
@end example

�μ¤ˤ�������Ӥ��餤���ʤ��̣�������̤�������ޤ���
��������ˡ� @code{IS NULL} , @code{IS NOT NULL} �黻�Ҥ���Ѥ��ޤ���

@example
mysql> SELECT 1 IS NULL, 1 IS NOT NULL;
+-----------+---------------+
| 1 IS NULL | 1 IS NOT NULL |
+-----------+---------------+
|         0 |             1 |
+-----------+---------------+
@end example

@strong{MySQL} �Ǥ�, 0 �� false�ʵ��� �ǡ�1 �� true�ʿ��ˤǤ���

���� @code{NULL} �����̤ʰ����Ϥʤ��ʤΤ��� ���Υ��������򸫤Ƥ���������
�ɤ�ưʪ����Ϥ������Ƥ��ʤ����Ȥ����Ť��뤿��ˤϡ�
@code{death != NULL} �ǤϤʤ� @code{death IS NOT NULL} �λ��Ѥ�
ɬ�פȤ����ΤǤ���

@node Pattern matching, Counting rows, Working with NULL, Retrieving data
@subsubsection �ѥ����󡦥ޥå�

@strong{MySQL} ��ɸ��SQL�Υѥ����󡦥ޥå����󶡤��ޤ���
�ޤ�����ĥ���줿����ɽ�����ˤ��������Υѥ����󡦥ޥå���
����� @code{vi}, @code{grep} and @code{sed} �ʤ� UNIX �Υ桼�ƥ���ƥ���
���Ѥ���Ƥ���ʪ�Ȼ��Ƥ��ޤ�����������󶡤��ޤ���

SQL �ѥ����󡦥ޥå��ϡ� @samp{_} �Ǥ����ʤ룱ʸ���Ȥ���פ���
@samp{%} �Ǥ�����0���ʾ��ʸ����˰��פ��ޤ���
@strong{MySQL} �Ǥϡ��ǥե���Ȥ� SQL �ѥ�����ϥ��������¸�Ǥ���
�����Ĥ����ʲ��˼����ޤ��� SQL�ѥ��������Ѥ����硢 @code{=} ��
@code{!=} ����Ѥ��ʤ��褦�����դ��Ƥ��������� @code{LIKE} �� @code{NOT LIKE}
������˻��Ѥ��ޤ���

@samp{b} ����Ϥޤ�̾���򸫤Ĥ���ˤ�:

@example
mysql> SELECT * FROM pet WHERE name LIKE "b%";
+--------+--------+---------+------+------------+------------+
| name   | owner  | species | sex  | birth      | death      |
+--------+--------+---------+------+------------+------------+
| Buffy  | Harold | dog     | f    | 1989-05-13 | NULL       |
| Bowser | Diane  | dog     | m    | 1989-08-31 | 1995-07-29 |
+--------+--------+---------+------+------------+------------+
@end example

@samp{fy} �ǽ����̾���򸫤Ĥ���ˤ�:

@example
mysql> SELECT * FROM pet WHERE name LIKE "%fy";
+--------+--------+---------+------+------------+-------+
| name   | owner  | species | sex  | birth      | death |
+--------+--------+---------+------+------------+-------+
| Fluffy | Harold | cat     | f    | 1993-02-04 | NULL  |
| Buffy  | Harold | dog     | f    | 1989-05-13 | NULL  |
+--------+--------+---------+------+------------+-------+
@end example

@samp{w} ��ޤ�̾���򸫤Ĥ���ˤ�:

@example
mysql> SELECT * FROM pet WHERE name LIKE "%w%";
+----------+-------+---------+------+------------+------------+
| name     | owner | species | sex  | birth      | death      |
+----------+-------+---------+------+------------+------------+
| Claws    | Gwen  | cat     | m    | 1994-03-17 | NULL       |
| Bowser   | Diane | dog     | m    | 1989-08-31 | 1995-07-29 |
| Whistler | Gwen  | bird    | NULL | 1997-12-09 | NULL       |
+----------+-------+---------+------+------------+------------+
@end example

5ʸ����̾���򸫤Ĥ���ˤ�, @samp{_} �ѥ�����ʸ������Ѥ��ơ�

@example
mysql> SELECT * FROM pet WHERE name LIKE "_____";
+-------+--------+---------+------+------------+-------+
| name  | owner  | species | sex  | birth      | death |
+-------+--------+---------+------+------------+-------+
| Claws | Gwen   | cat     | m    | 1994-03-17 | NULL  |
| Buffy | Harold | dog     | f    | 1989-05-13 | NULL  |
+-------+--------+---------+------+------------+-------+
@end example

@strong{MySQL} �Ǥ�¾�Υѥ����󡦥ޥå��η����󶡤���ޤ�������ɽ���γ�ĥ����Ѥ��ơ�
�����Υѥ����󡦥ޥå���ƥ��Ȥ���ݤˤϡ�@code{REGEXP} �� @code{NOT REGEXP}
�黻�ҡʤ��뤤��@code{RLIKE}, @code{NOT RLIKE} �黻�ҡ�������Ʊ���Ǥ���
����Ѥ��ޤ���

��ĥ����ɽ���Τ����Ĥ�����ħ��

@itemize @bullet
@item
@samp{.} �Ϥ����ʤ��ʸ���Ȥ���פ��ޤ���

@item
@samp{[...]} �ϡ����ä���ˤ���ʸ���Ȱ��פ��ޤ���
�㤨�С�@samp{[abc]} �� @samp{a}, @samp{b} ���뤤�� @samp{c} �˥ޥå����ޤ���
ʸ�����ϰϻ��ꤹ����ˤϥ��å������Ѥ��ޤ��� @samp{[a-z]} �Ϥ����ʤ�
��ʸ���Υ���ե��٥å�ʸ���ˤ���פ��� @samp{[0-9]} �Ϥ����ʤ�����ˤ�
���פ��ޤ���

@item
@samp{*} �ϡ���˻��ꤵ��Ƥ���ʸ�� 0 �İʾ�˥ޥå����ޤ���
�㤨�С�@samp{x*} �� ʸ�� @samp{x} �������Ĥ�Ϣ³���Ƥ���ʪ�˥ޥå�����
@samp{[0-9]*} �Ϥ����ʤ���ͤȤ�ޥå����� @samp{.*} �Ϥ�����ʸ�����
���פ��ޤ���

@item
����ɽ���ϥ�������¸�Ǥ��� ��������ʸ����ʸ���ɤ���Ǥ�ޥå�����������硢
ʸ�����饹����ѤǤ��ޤ��� �㤨�С� @samp{[aA]} ����ʸ����ʸ���� @samp{a} ��
�ޥå�����@samp{[a-zA-Z]} ����ʸ����ʸ���Τ����ʤ륢��ե��٥å�ʸ���ˤ�ޥå����ޤ���

@item
�ѥ�����ϡ��ƥ��Ȥ��줿�ͤ���Τɤ����ˤ����硢�ޥå����ޤ���
(SQL patterns match only if they match the entire value).

@item
�ͤΤϤ��ᡢ���뤤�Ͻ����˰��֤���ꤷ�ƥޥå������������ϡ�
�ѥ�����ν��˥ޥå���������� @samp{^} ����Ѥ���
�ѥ�����ν����˥ޥå���������� @samp{$} ����Ѥ��ޤ���
(�����ϥ��󥫡��ȸƤФ�ޤ�)
@end itemize

�ʲ��ϳ�ĥ���줿����ɽ�����ɤ�ư��������Ǥ���
��˼����� @code{LIKE} �Υ������ @code{REGEXP} �ǰʲ��Τ褦�˽񤭴�����ޤ���

@samp{b} �ǻϤޤ�̾����ߤĤ���ˤϡ�@samp{^} ��̾����Ƭ�˥ޥå�������
���� @samp{[bB]} �Ȥ��ơ���ʸ����ʸ���ˤ�ޥå������ޤ���

@example
mysql> SELECT * FROM pet WHERE name REGEXP "^[bB]";
+--------+--------+---------+------+------------+------------+
| name   | owner  | species | sex  | birth      | death      |
+--------+--------+---------+------+------------+------------+
| Buffy  | Harold | dog     | f    | 1989-05-13 | NULL       |
| Bowser | Diane  | dog     | m    | 1989-08-31 | 1995-07-29 |
+--------+--------+---------+------+------------+------------+
@end example

@samp{fy} �ǽ����̾���򸫤Ĥ���ˤϡ� @samp{$} ����Ѥ���̾����
�Ǹ�˥ޥå������ޤ���

@example
mysql> SELECT * FROM pet WHERE name REGEXP "fy$";
+--------+--------+---------+------+------------+-------+
| name   | owner  | species | sex  | birth      | death |
+--------+--------+---------+------+------------+-------+
| Fluffy | Harold | cat     | f    | 1993-02-04 | NULL  |
| Buffy  | Harold | dog     | f    | 1989-05-13 | NULL  |
+--------+--------+---------+------+------------+-------+
@end example

@samp{w} ��ޤ�̾���򸫤Ĥ���ˤϡ�@samp{[wW]} ����Ѥ���
��ʸ����ʸ���˥ޥå������ޤ���

@example
mysql> SELECT * FROM pet WHERE name REGEXP "[wW]";
+----------+-------+---------+------+------------+------------+
| name     | owner | species | sex  | birth      | death      |
+----------+-------+---------+------+------------+------------+
| Claws    | Gwen  | cat     | m    | 1994-03-17 | NULL       |
| Bowser   | Diane | dog     | m    | 1989-08-31 | 1995-07-29 |
| Whistler | Gwen  | bird    | NULL | 1997-12-09 | NULL       |
+----------+-------+---------+------+------------+------------+
@end example

����ɽ���Ϥ⤷����Τɤ����ˤǤ⤢��Хޥå����뤿�ᡢ
SQL �ѥ�����Τ褦�ˡ��ѥ����������˥磻��ɥ����ɤ��ɬ�פϤ���ޤ���

5ʸ����̾���򸫤Ĥ���ˤϡ�@samp{^} �� @samp{$} ����Ѥ���̾���ν��Ƚ�����
�ޥå����������δ֤� @samp{.} ��5������ޤ���

@example
mysql> SELECT * FROM pet WHERE name REGEXP "^.....$";
+-------+--------+---------+------+------------+-------+
| name  | owner  | species | sex  | birth      | death |
+-------+--------+---------+------+------------+-------+
| Claws | Gwen   | cat     | m    | 1994-03-17 | NULL  |
| Buffy | Harold | dog     | f    | 1989-05-13 | NULL  |
+-------+--------+---------+------+------------+-------+
@end example

���Υ������ @samp{@{n@}} ``@code{n}�󷫤��֤�'' ���ڥ졼������
�񴹤���ǽ�Ǥ���

@example
mysql> SELECT * FROM pet WHERE name REGEXP "^.@{5@}$";
+-------+--------+---------+------+------------+-------+
| name  | owner  | species | sex  | birth      | death |
+-------+--------+---------+------+------------+-------+
| Claws | Gwen   | cat     | m    | 1994-03-17 | NULL  |
| Buffy | Harold | dog     | f    | 1989-05-13 | NULL  |
+-------+--------+---------+------+------------+-------+
@end example

@node Counting rows,  , Pattern matching, Retrieving data
@subsubsection Counting rows

Databases are often used to answer the question, ``How often does a certain
type of data occur in a table?''  For example, you might want to know how
many pets you have, or how many pets each owner has, or you might want to
perform various kinds of censuses on your animals.

Counting the total number of animals you have is the same question as ``How
many rows are in the @code{pet} table?,'' because there is one record per pet.
The @code{COUNT()} function counts the number of non-@code{NULL} results, so
the query to count your animals looks like this:

@example
mysql> SELECT COUNT(*) FROM pet;
+----------+
| COUNT(*) |
+----------+
|        9 |
+----------+
@end example

Earlier, you retrieved the names of the people who owned pets.  You can
use @code{COUNT()} if you want to find out how many pets each owner has:

@example
mysql> SELECT owner, COUNT(*) FROM pet GROUP BY owner;
+--------+----------+
| owner  | COUNT(*) |
+--------+----------+
| Benny  |        2 |
| Diane  |        2 |
| Gwen   |        3 |
| Harold |        2 |
+--------+----------+
@end example

Note the use of @code{GROUP BY} to group together all records for each
@code{owner}.  Without it, all you get is an error message:

@example
mysql> SELECT owner, COUNT(owner) FROM pet;
ERROR 1140 at line 1: Mixing of GROUP columns (MIN(),MAX(),COUNT()...)
with no GROUP columns is illegal if there is no GROUP BY clause
@end example

@code{COUNT()} and @code{GROUP BY} are useful for characterizing your
data in various ways.  The following examples show different ways to
perform animal census operations.

Number of animals per species:

@example
mysql> SELECT species, COUNT(*) FROM pet GROUP BY species;
+---------+----------+
| species | COUNT(*) |
+---------+----------+
| bird    |        2 |
| cat     |        2 |
| dog     |        3 |
| hamster |        1 |
| snake   |        1 |
+---------+----------+
@end example

Number of animals per sex:

@example
mysql> SELECT sex, COUNT(*) FROM pet GROUP BY sex;
+------+----------+
| sex  | COUNT(*) |
+------+----------+
| NULL |        1 |
| f    |        4 |
| m    |        4 |
+------+----------+
@end example

(In this output, @code{NULL} indicates ``sex unknown.'')

Number of animals per combination of species and sex:

@example
mysql> SELECT species, sex, COUNT(*) FROM pet GROUP BY species, sex;
+---------+------+----------+
| species | sex  | COUNT(*) |
+---------+------+----------+
| bird    | NULL |        1 |
| bird    | f    |        1 |
| cat     | f    |        1 |
| cat     | m    |        1 |
| dog     | f    |        1 |
| dog     | m    |        2 |
| hamster | f    |        1 |
| snake   | m    |        1 |
+---------+------+----------+
@end example

You need not retrieve an entire table when you use @code{COUNT()}.  For
example, the previous query, when performed just on dogs and cats, looks like
this:

@example
mysql> SELECT species, sex, COUNT(*) FROM pet
    -> WHERE species = "dog" OR species = "cat"
    -> GROUP BY species, sex;
+---------+------+----------+
| species | sex  | COUNT(*) |
+---------+------+----------+
| cat     | f    |        1 |
| cat     | m    |        1 |
| dog     | f    |        1 |
| dog     | m    |        2 |
+---------+------+----------+
@end example

Or, if you wanted the number of animals per sex only for known-sex animals:

@example
mysql> SELECT species, sex, COUNT(*) FROM pet
    -> WHERE sex IS NOT NULL
    -> GROUP BY species, sex;
+---------+------+----------+
| species | sex  | COUNT(*) |
+---------+------+----------+
| bird    | f    |        1 |
| cat     | f    |        1 |
| cat     | m    |        1 |
| dog     | f    |        1 |
| dog     | m    |        2 |
| hamster | f    |        1 |
| snake   | m    |        1 |
+---------+------+----------+
@end example

@node Multiple tables,  , Retrieving data, Database use
@subsection Using more than one table

The @code{pet} table keeps track of which pets you have.  If you want to
record other information about them, such as events in their lives like
visits to the vet or when litters are born, you need another table.  What
should this table look like?

@itemize @bullet
@item
It needs to contain the pet name so you know which animal each event pertains
to.

@item
It needs a date so you know when the event occurred.

@item
It needs a field to describe the event.

@item
If you want to be able to categorize events, it would be useful to have an
event type field.
@end itemize

Given these considerations, the @code{CREATE TABLE} statement for the
@code{event} table might look like this:

@example
mysql> CREATE TABLE event (name VARCHAR(20), date DATE,
    -> type VARCHAR(15), remark VARCHAR(255));
@end example

As with the @code{pet} table, it's easiest to load the initial records
by creating a tab-delimited text file containing the information:

@multitable @columnfractions .15 .15 .15 .55
@item Fluffy @tab 1995-05-15 @tab litter @tab 4 kittens, 3 female, 1 male
@item Buffy @tab 1993-06-23 @tab litter @tab 5 puppies, 2 female, 3 male
@item Buffy @tab 1994-06-19 @tab litter @tab 3 puppies, 3 female
@item Chirpy @tab 1999-03-21 @tab vet @tab needed beak straightened
@item Slim @tab 1997-08-03 @tab vet @tab broken rib
@item Bowser @tab 1991-10-12 @tab kennel
@item Fang @tab 1991-10-12 @tab kennel
@item Fang @tab 1998-08-28 @tab birthday @tab Gave him a new chew toy
@item Claws @tab 1998-03-17 @tab birthday @tab Gave him a new flea collar
@item Whistler @tab 1998-12-09 @tab birthday @tab First birthday
@end multitable

Load the records like this:

@example
mysql> LOAD DATA LOCAL INFILE "event.txt" INTO TABLE event;
@end example

Based on what you've learned from the queries you've run on the @code{pet}
table, you should be able to perform retrievals on the records in the
@code{event} table; the principles are the same.  But when is the
@code{event} table by itself insufficient to answer questions you might ask?

Suppose you want to find out the ages of each pet when they had their
litters.  The @code{event} table indicates when this occurred, but to
calculate age of the mother, you need her birth date.  Because that is
stored in the @code{pet} table, you need both tables for the query:

@example
mysql> SELECT pet.name, (TO_DAYS(date) - TO_DAYS(birth))/365 AS age, remark
    -> FROM pet, event
    -> WHERE pet.name = event.name AND type = "litter";
+--------+------+-----------------------------+
| name   | age  | remark                      |
+--------+------+-----------------------------+
| Fluffy | 2.27 | 4 kittens, 3 female, 1 male |
| Buffy  | 4.12 | 5 puppies, 2 female, 3 male |
| Buffy  | 5.10 | 3 puppies, 3 female         |
+--------+------+-----------------------------+
@end example

There are several things to note about this query:

@itemize @bullet
@item
The @code{FROM} clause lists two tables because the query needs to pull
information from both of them.

@item
When combining (joining) information from multiple tables, you need to
specify how records in one table can be matched to records in the other.
This is easy because they both have a @code{name} column.  The query uses
@code{WHERE} clause to match up records in the two tables based on the
@code{name} values.

@item
Because the @code{name} column occurs in both tables, you must be specific
about which table you mean when referring to the column.  This is done
by prepending the table name to the column name.
@end itemize

You need not have two different tables to perform a join.  Sometimes it is
useful to join a table to itself, if you want to compare records in a table
to other records in that same table.  For example, to find breeding pairs
among your pets, you can join the @code{pet} table with itself to pair up
males and females of like species:

@example
mysql> SELECT p1.name, p1.sex, p2.name, p2.sex, p1.species
    -> FROM pet AS p1, pet AS p2
    -> WHERE p1.species = p2.species AND p1.sex = "f" AND p2.sex = "m";
+--------+------+--------+------+---------+
| name   | sex  | name   | sex  | species |
+--------+------+--------+------+---------+
| Fluffy | f    | Claws  | m    | cat     |
| Buffy  | f    | Fang   | m    | dog     |
| Buffy  | f    | Bowser | m    | dog     |
+--------+------+--------+------+---------+
@end example

In this query, we specify aliases for the table name in order to be able
to refer to the columns and keep straight which instance of the table
each column reference is associated with.

@node Getting information, Batch mode, Database use, Tutorial
@section �ǡ����١����ȥơ��֥�ξ��������

�ǡ����١�����ơ��֥��̾�������Ǥ��ä��������뤤�ϥơ��֥�ι�¤�Ϥɤ��Ǥ��ä�����
(�ʤ�Ȥ����ե�����ɤ����ä��Τ�)˺��Ƥ��ޤä���硣
@strong{MySQL} �ǤϤ����Ĥ��Υǡ����١����ȥơ��֥�ξ�����󶡤���ʸ���̤���
���������������ޤ���

���ʤ��ϴ��� @code{SHOW DATABASES} ���ΤäƤ���Ϥ���, ����ϥ����С���
��������ǡ������١����ΰ�����ɽ�����ޤ��� �������򤷤Ƥ���ǡ����١�����
���Ǥ��뤫���Τ�ˤϡ�@code{DATABASE()} �ؿ�����Ѥ��ޤ���

@example
mysql> SELECT DATABASE();
+------------+
| DATABASE() |
+------------+
| menagerie  |
+------------+
@end example

�⤷�ǡ����١�����ޤ��������򤷤Ƥ��ʤ���С���̤ϥ֥�󥯤Ǥ���

�ǡ����١����˴ޤޤ��ơ��֥�򸫤Ĥ���ˤ�(���Ȥ��С����ʤ����ơ��֥�̾��
�Τ�ʤ����)�����Υ��ޥ�ɤ���Ѥ��ޤ���

@example
mysql> SHOW TABLES;
+---------------------+
| Tables in menagerie |
+---------------------+
| event               |
| pet                 |
+---------------------+
@end example

�⤷�ơ��֥�ι�¤���Τꤿ���ʤ顢@code{DESCRIBE} ���ޥ�ɤ������Ǥ���
����ϥơ��֥�Τ��줾��Υե�����ɤˤĤ��Ƥξ����ɽ�����ޤ���

@example
mysql> DESCRIBE pet;
+---------+-------------+------+-----+---------+-------+
| Field   | Type        | Null | Key | Default | Extra |
+---------+-------------+------+-----+---------+-------+
| name    | varchar(20) | YES  |     | NULL    |       |
| owner   | varchar(20) | YES  |     | NULL    |       |
| species | varchar(20) | YES  |     | NULL    |       |
| sex     | char(1)     | YES  |     | NULL    |       |
| birth   | date        | YES  |     | NULL    |       |
| death   | date        | YES  |     | NULL    |       |
+---------+-------------+------+-----+---------+-------+
@end example

@code{Field} �ϥե������̾�򼨤���@code{Type} �ϥե�����ɤΥǡ�������
@code{Null} �Ϥ��Υե�����ɤ� @code{Null} �ͤ�ޤफ�򼨤���
@code{Key} �Ϥ��Υե�����ɤ�����ǥå���������Ƥ��뤫�򼨤���
@code{Default} �ϥե�����ɤΥǥե���Ȥ��ͤ򼨤��ޤ���

�⤷�ơ��֥�˥���ǥå�������äƤ���ʤ顢
@code{SHOW INDEX FROM tbl_name} �������ξ���򼨤��ޤ���

@node Batch mode, Twin, Getting information, Tutorial
@section @code{mysql} �ΥХå��⡼�ɤǤλ���

���Υ��������Ǥϡ�@code{mysql} �����å⡼�ɤǻ��Ѥ�������������Ϥ�
��̤�ɽ�����ޤ����� @code{mysql} �ϥХå��⡼�ɤǤ�¹Բ�ǽ�Ǥ���
�����Ԥ��ˤϡ����ʤ����¹Ԥ��������ޥ�ɤ�ե�����˽񤤤Ƥ�����
���Υե����뤫�����Ϥ��ɤ߹���褦�ˤ��� @code{mysql} ��¹Ԥ��ޤ���

@example
shell> mysql < batch-file
@end example

�⤷��³�ѥ�᥿������ꤹ��ɬ�פ�������ϡ��ʲ��Τ褦�ˤʤ�Ǥ��礦��

@example
shell> mysql -h host -u user -p < batch-file
Enter password: ********
@end example

������ˡ�� @code{mysql} ����Ѥ���Ȥ������ʤ��ϥ�����ץȥե������
�������������¹Ԥ��뤳�Ȥˤʤ�Ǥ��礦��

�ʤ�������ץȤ���Ѥ���Τ��� ����ˤϰʲ�����ͳ������ޤ���

@itemize @bullet
@item
�⤷�����֤��������¹Ԥ�����(�����Ȥ��轵�Ȥ�)��������ץȤ�񤯤��Ȥǡ�
���μ¹Ԥ��٤ˤ��ʤ������ޥ�ɤ򥿥��פ��뤳�Ȥ�ʤ����Ȥ���ǽ�Ǥ���

@item
�⤷���ˤ��륯����˻����������������񤯾�硢�����򥳥ԡ���
������ץȥե�������Խ��Ǥ��ޤ���

@item
�Хå��⡼�ɤϥ�����γ�ȯ���ʣ���ˤޤ����륳�ޥ�ɤˤ����Ω���ޤ���
�⤷���ޥ�ɤ��ְ�äƤ����Ȥ��Ƥ����Ƥ��Ǥ�ľ��ɬ�פ�����ޤ���
���顼�������뤿��˥�����ץȤ��Խ������Ƥ� @code{mysql} �˼¹Ԥ����ޤ���

@item
�⤷¿���ν��Ϥ�Ф��褦�ʥ�����ξ�硢�ڡ����㡼����Ѥ��ƽ��Ϥ򸫤뤳�Ȥ�
����ޤ��� ���Ϥ����������뤷�Ʋ��̤��鸫���ʤ��ʤ��ꤤ���Ǥ��礦��

@example
shell> mysql < batch-file | more
@end example

@item
���ʤ��Ϥ�������Ԥ�����ˡ���̤�ե�����˽񤭽Ф����Ȥ���ǽ�Ǥ���

@example
shell> mysql < batch-file > mysql.out
@end example

@item
���ʤ��ϡ�¾�ͤؤΤ��ʤ��Υ�����ץȤ����ۤ��뤳�Ȥ��Ǥ��ޤ�������ˤ�ꡢ�ۤ��οͤ�����
���ޥ�ɤ�¹Ԥ��뤳�Ȥ��Ǥ��ޤ��� 

@item
�����Ĥ��ξ����Ǥϡ����å⡼�ɤǤϻ��Ѥ��Ѥ��ޤ��� ���Ȥ��С��������
 @code{cron} ����֤Ȥ��Ƽ¹Ԥ����硣 ���ξ�硢�Хå��⡼�ɤǤʤ���Фʤ�ޤ���

@item
ü���������������ʤ�ʸ���� @code{mysql} ���ޥ�ɤ��Ϥ���硣
���Ȥ��С�EUC-JP, Shift_JIS �δ���ʸ���ʤɤϡ�ü����Ķ��ˤ�äƤ�ľ�����ϤǤ��ʤ����⤢��Ǥ��礦��
@end itemize

@code{mysql} ��Хå��⡼�ɤǻ��Ѥ��뤫�����å⡼�ɤǻ��Ѥ��뤫�ǡ�
�ǥե���Ȥν��Ϸ������Ѥ��ޤ��� �㤨�С� @code{SELECT DISTINCT species FROM pet} ��
���Ϥ����å⡼�ɤǤϼ��Τ褦�ˤʤ�ޤ���

@example
+---------+
| species |
+---------+
| bird    |
| cat     |
| dog     |
| hamster |
| snake   |
+---------+
@end example

���������Хå��⡼�ɤǤϡ�

@example
species
bird
cat
dog
hamster
snake
@end example

�⤷�Хå��⡼�ɤǤ����å⡼�ɤΤ褦�ʽ��Ϥ����������ˤϡ�@code{mysql -t} �Ȥ��ޤ���
������ˡ��¹Ԥ������ޥ�ɤ�ɽ��������ʤ�С�@code{mysql -vvv} �Ȥ��ޤ���

@node Twin,  , Batch mode, Tutorial
@section Queries from twin project

At Analytikerna and Lentus, we have been doing the systems and field work
for a big research project. This project is a collaboration between the
Institute of Environmental Medicine at Karolinska Institutet Stockholm
and the Section on Clinical Research in Aging and Psychology at the
University of Southern California.

The project involves a screening part where all twins in Sweden older
than 65 years are interviewed by telephone. Twins who meet certain
criteria are passed on to the next stage. In this latter stage, twins who
want to participate are visited by a doctor/nurse team. Some of the
examinations include physical and neuropsychological examination,
laboratory testing, neuroimaging, psychological status assessment, and family
history collection. In addition, data are collected on medical and
environmental risk factors.

More information about Twin studies can be found at:

@example
@url{http://www.imm.ki.se/TWIN/TWINUKW.HTM}
@end example

The latter part of the project is administered with a web interface
written using Perl and @strong{MySQL}.

Each night all data from the interviews are moved into a @strong{MySQL}
database.

@menu
* Twin pool::                   Find all non-distributed twins
* Twin event::                  Show a table on twin pair status
@end menu

@node Twin pool, Twin event, Twin, Twin
@subsection Find all non-distributed twins

The following query is used to determine who goes into the second part of the
project:

@example
select
        concat(p1.id, p1.tvab) + 0 as tvid,
        concat(p1.christian_name, " ", p1.surname) as Name,
        p1.postal_code as Code,
        p1.city as City,
        pg.abrev as Area,
        if(td.participation = "Aborted", "A", " ") as A,
        p1.dead as dead1,
        l.event as event1,
        td.suspect as tsuspect1,
        id.suspect as isuspect1,
        td.severe as tsevere1,
        id.severe as isevere1,
        p2.dead as dead2,
        l2.event as event2,
        h2.nurse as nurse2,
        h2.doctor as doctor2,
        td2.suspect as tsuspect2,
        id2.suspect as isuspect2,
        td2.severe as tsevere2,
        id2.severe as isevere2,
        l.finish_date
from
        twin_project as tp
        /* For Twin 1 */
        left join twin_data as td on tp.id = td.id and tp.tvab = td.tvab
        left join informant_data as id on tp.id = id.id and tp.tvab = id.tvab
        left join harmony as h on tp.id = h.id and tp.tvab = h.tvab
        left join lentus as l on tp.id = l.id and tp.tvab = l.tvab
        /* For Twin 2 */
        left join twin_data as td2 on p2.id = td2.id and p2.tvab = td2.tvab
        left join informant_data as id2 on p2.id = id2.id and p2.tvab = id2.tvab
        left join harmony as h2 on p2.id = h2.id and p2.tvab = h2.tvab
        left join lentus as l2 on p2.id = l2.id and p2.tvab = l2.tvab,
        person_data as p1,
        person_data as p2,
        postal_groups as pg
where
        /* p1 gets main twin and p2 gets his/her twin. */
        /* ptvab is a field inverted from tvab */
        p1.id = tp.id and p1.tvab = tp.tvab and
        p2.id = p1.id and p2.ptvab = p1.tvab and
        /* Just the sceening survey */
        tp.survey_no = 5 and
        /* Skip if partner died before 65 but allow emigration (dead=9) */
        (p2.dead = 0 or p2.dead = 9 or
         (p2.dead = 1 and
          (p2.death_date = 0 or
           (((to_days(p2.death_date) - to_days(p2.birthday)) / 365)
            >= 65))))
        and
        (
        /* Twin is suspect */
        (td.future_contact = 'Yes' and td.suspect = 2) or
        /* Twin is suspect - Informant is Blessed */
        (td.future_contact = 'Yes' and td.suspect = 1 and id.suspect = 1) or
        /* No twin - Informant is Blessed */
        (ISNULL(td.suspect) and id.suspect = 1 and id.future_contact = 'Yes') or
        /* Twin broken off - Informant is Blessed */
        (td.participation = 'Aborted'
         and id.suspect = 1 and id.future_contact = 'Yes') or
        /* Twin broken off - No inform - Have partner */
        (td.participation = 'Aborted' and ISNULL(id.suspect) and p2.dead = 0))
        and
        l.event = 'Finished'
        /* Get at area code */
        and substring(p1.postal_code, 1, 2) = pg.code
        /* Not already distributed */
        and (h.nurse is NULL or h.nurse=00 or h.doctor=00)
        /* Has not refused or been aborted */
        and not (h.status = 'Refused' or h.status = 'Aborted'
        or h.status = 'Died' or h.status = 'Other')
order by
        tvid;
@end example

Some explanations:
@table @asis
@item @code{concat(p1.id, p1.tvab) + 0 as tvid}
We want to sort on the concatenated @code{id} and @code{tvab} in
numerical order. Adding @code{0} to the result causes @strong{MySQL} to treat the
result as a number.
@item column @code{id}
This identifies a pair of twins. It is a key in all tables.
@item column @code{tvab}
This identifies a twin in a pair. It has a value of @code{1} or @code{2}.
@item column @code{ptvab}
This is an inverse of @code{tvab}. When @code{tvab} is @code{1} this is
@code{2}, and vice versa. It exists to save typing and to make it easier for
@strong{MySQL} to optimize the query.
@end table

This query demonstrates, among other things, how to do lookups on a
table from the same table with a join (@code{p1} and @code{p2}). In the example, this
is used to check whether a twin's partner died before the age of 65. If so,
the row is not returned.

All of the above exist in all tables with twin-related information. We
have a key on both @code{id,tvab} (all tables) and @code{id,ptvab}
(@code{person_data}) to make queries faster.

On our production machine (A 200MHz UltraSPARC), this query returns
about 150-200 rows and takes less than one second.

The current number of records in the tables used above:
@multitable @columnfractions .3 .5
@item @strong{Table}            @tab @strong{Rows}
@item @code{person_data}        @tab 71074
@item @code{lentus}		@tab 5291
@item @code{twin_project}       @tab 5286
@item @code{twin_data}		@tab 2012
@item @code{informant_data}	@tab 663
@item @code{harmony}		@tab 381
@item @code{postal_groups}	@tab 100
@end multitable

@node Twin event,  , Twin pool, Twin
@subsection Show a table on twin pair status

Each interview ends with a status code called @code{event}. The query
shown below is used to display a table over all twin pairs combined by
event. This indicates in how many pairs both twins are finished, in how many
pairs one twin is finished and the other refused, and so on.

@example
select
        t1.event,
        t2.event,
        count(*)
from
        lentus as t1,
        lentus as t2,
        twin_project as tp
where
        /* We are looking at one pair at a time */
        t1.id = tp.id
        and t1.tvab=tp.tvab
        and t1.id = t2.id
        /* Just the sceening survey */
        and tp.survey_no = 5
        /* This makes each pair only appear once */
        and t1.tvab='1' and t2.tvab='2'
group by
        t1.event, t2.event;

@end example

@cindex Server functions
@node Server, Replication, Tutorial, Top
@chapter @strong{MySQL} �����С��ե��󥯥����

@menu
* Languages::                   @strong{MySQL} �����ݡ��Ȥ��Ƥ������ϡ�
* Table size::                  @strong{MySQL} �ϥơ��֥��ɤ줯�餤�礭���Ǥ��뤫��
@end menu

@cindex Which languages @strong{MySQL} supports
@cindex Language support
@node Languages, Table size, Server, Server
@section @strong{MySQL} �����ݡ��Ȥ��Ƥ������ϡ�

@code{mysqld} �ϼ��θ���ǥ��顼��å��������󶡤Ǥ��ޤ�: ��������, ����
�����, �Ѹ�(�ǥե����), Estonia, �ե�󥹸�, �ɥ��ĸ�, �Υ륦������, ���Υ륦����
��,�ݡ����ɸ�, �ݥ�ȥ����, ���ڥ���줽���ƥ��������ǥ�졣

�������� @code{mysqld} �򳫻Ϥ��뤿��ˤ� @code{--language=lang} �ޤ�
�� @code{-L lang} �����å��ΰ�Ĥ�Ȥ��ޤ�:

@example
shell> mysqld --language=swedish
@end example

or:

@example
shell> mysqld --language=/usr/local/share/swedish
@end example

����̾�����ƾ�ʸ���Ǥ��뤳�Ȥ����դ��Ƥ���������

����ե������(�ǥե���ȤǤ�)���ξ��ˤ���ޤ���
@file{@var{mysql_base_dir}/share/@var{LANGUAGE}/}.

���顼��å������ե�����򹹿����������ϡ� @file{errmsg.txt} �ե�������Խ�����
 @file{errmsg.sys} �ե������������뤿��˰ʲ��Τ褦�˼¹Ԥ��ޤ�:

@example
shell> comp_err errmsg.txt errmsg.sys
@end example

�⤷ @strong{MySQL} �򿷤�����Τ˥��åץ��졼�ɤ����ʤ顢��������������ʬ��Ʊ���Ȥ����ˡ�
������ @file{errmsg.txt} �ե�����˽�����ۤɤ����Ƥ���������

@menu
* Character sets::              �ǡ����ȥ����Ȥ˻��Ѥ���륭��饯�������å�
* Adding character set::        ����������饯�������åȤ��ɲ�
* String collating::            String collating support
* Multi-byte characters::       Multi-byte character support
@end menu

@node Character sets, Adding character set, Languages, Languages
@subsection �ǡ����ȥ����Ȥ˻��Ѥ���륭��饯�������å�

�ǥե���ȤǤϡ�@strong{MySQL} �� ISO8859-1 (Latin1) ����饯�������åȤ���Ѥ�
�ޤ�������� USA �����衼���åѤǻ��Ѥ���륭��饯�������åȤǤ���

����饯�������åȤ�̾���Ȥ��Ƶ������ʸ���ȡ�@code{ORDER BY} �� @code{GROUP BY} 
���ޥ�ɤˤ�äƥ����Ȥ������ˡ����ꤷ�ޤ���
����饯�������åȤϡ�̾���Ȥ��ƻ��Ѥ��Ƥ�褤ʸ���� @code{SELECT} ��ʸ���
 @code{ORDER BY} �� @code{GROUP BY} ���ޥ�ɤ��Ѥ�����������ˡ����ꤷ�ޤ���

You can change the character set with the
@code{--default-character-set} option when you start the server.
The character sets available depend on the @code{--with-charset=charset}
option to @code{configure}, and the character set configuration files
listed in @file{SHAREDIR/charsets/Index}.
@xref{Quick install}.

When a client connects to a @strong{MySQL} server, the server sends the
default character set in use to the client.  The client will switch to
use this character set for this connection.

One should use @code{mysql_real_escape_string()} when escaping strings
for a SQL query.  @code{mysql_real_escape_string()} is identical to the
old @code{mysql_escape_string()} function, except that it takes the MYSQL
connection handle as the first parameter.

If the client is compiled with different paths than where the server is
installed and the user that configured @strong{MySQL} didn't included all
character sets in the @strong{MySQL} binary one must specify for
the client where it can find the additional character sets it will need
if the server runs with a different character set than the client.

On can specify this by putting in a @strong{MySQL} option file:

@example
[client]
default-set-dir=/usr/local/mysql/share/mysql/charsets
@end example

where the path points to where the dynamic @strong{MySQL} character sets
are stored.

One can force the client to use specific character set by specifying:

@example
[client]
default-character-set=character-set-name
@end example

but normally this is never needed.

To add another character set to @strong{MySQL}, use the following procedure:

@node Adding character set, String collating, Character sets, Languages
@subsection ����������饯�������åȤ��ɲ�

@enumerate
@item
Decide if the set is simple or complex.  If the character set
does not need to use special string collating routines for
sorting, and does not need mulit-byte character support, it is
simple.  If it needs either of those features, it is complex.

@item
If the character set is simple, then create the file
@file{sql/share/charsets/MYSET.conf}, and add MYSET the
@file{sql/share/charsets/Index} file.  Read the
@file{sql/share/charsets/README} for more instructions.

@item
Add the character set name to the @code{CHARSETS_AVAILABLE} and
@code{COMPILED_CHARSETS} lists in @code{configure.in}.

@item
Reconfigure, recompile and test.

@item
If the character set is complex, create the file
@file{strings/ctype-MYSET.c} �ե������ @strong{MySQL} �Υ������ǥ��쥯�ȥ�ʲ��˺������ޤ���

@item
Add MYSET to the end of the @file{sql/share/charsets/Index} file.  Take
note of its position in the file - this is its character set number,
denoted @code{MYNUMBER} below.

@item
ɬ�פ����������Τ�Ĵ�٤뤿��ˡ���¸�� @file{ctype-*.c} �ե�����ΰ�Ĥ򸫤Ƥ�
�����������Υե�������ǻ��Ѥ��������̾���ϡ�
@code{ctype_MYSET}, @code{to_lower_MYSET} �Τ褦�ˤ��ʤ���Ф����ʤ����Ȥ����դ��Ƥ���������

Near the top of the file, place a special comment like this:

@example
/*
 * This comment is parsed by configure to create ctype.c,
 * so don't change it unless you know what you are doing.
 *
 * .configure. number_MYSET=MYNUMBER
 * .configure. strxfrm_multiply_MYSET=N
 * .configure. mbmaxlen_MYSET=N
 */
@end example

The @code{configure} program uses this comment to include
the character set into the @strong{MySQL} library automatically.

The strxfrm_multiply and mbmaxlen lines will be explained in
the following sections.  Only include them if you the string
collating functions or the multi-byte character set functions,
respectively.

@code{to_lower[]} �� @code{to_upper[]} �ϡ����줾��Υ���饯�������åȤ˱�����
��ʸ������ʸ�����б������������ñ�������Ǥ���
�㤨�С�

@example
to_lower['A'] should contain 'a'
to_upper['a'] should contain 'A'
@end example

@code{sort_order[]} ��ʸ�����ɤΤ褦�˥����Ȥ����٤����ΥޥåפǤ���¿���Υ���
�ȤǤϡ������ @code{to_upper[]} ��Ʊ���Ǥ� (���������¸������)��
@strong{MySQL} �� @code{sort_order[character]} ���ͤ򸵤�ʸ���򥽡��Ȥ��ޤ���
For more complicated sorting rules, see
the discussion of string collating below.

@code{ctype[]} �ϳ�ʸ������������ӥåȤ�����ǡ�1�����ޤ�Υӥå���1ʸ����������ޤ���
( @code{to_lower[]}, @code{to_upper[]},@code{sort_order[]}�ϡ�ʸ�����ͤǥ���ǥå�������ޤ�����
@code{ctype[]}��ʸ������+1 �ǥ���ǥå�������ޤ���
����� EOF �����뤿��ˤ����֤�������Ȥ��Ƥ���Τǡ�������ˡ����Ѥ��Ƥ��ޤ���)
@file{m_ctype.h} �˼��Υӥåȥޥ���������򸫤뤳�Ȥ��Ǥ��ޤ�:

@example
#define _U      01      /* Upper case */
#define _L      02      /* Lower case */
#define _N      04      /* Numeral (digit) */
#define _S      010     /* Spacing character */
#define _P      020     /* Punctuation */
#define _C      040     /* Control character */
#define _B      0100    /* Blank */
#define _X      0200    /* heXadecimal digit */
@end example

���줾���ʸ�����Ф��� @code{ctype[]} �ϡ�ʸ������ꤹ�뤿���
�ӥå�����ȤˤʤäƤ��ʤ���Фʤ�ޤ���
���Ȥ��С�@code{'A'} ����ʸ����� (@code{_U}) �� 16����� (@code{_X}) ξ���Ȥ��
°����Τǡ�@code{ctype['A'+1]} �ϰʲ����ͤ�ޤޤʤ��ƤϤʤ�ޤ���:
@example
_U + _X = 01 + 0200 = 0201
@end example

@item
Add support for the string collating or multi-byte features needed, as
described in the following sections.

@item
@code{CHARSETS_AVAILABLE} �ꥹ�Ȥ� @code{configure.in} ����� @code{COMPILED_CHARSETS} �ꥹ��
�˥���饯�������å�̾���ɲä��ޤ���

@item
configure�ȥ���ѥ���򤷤ʤ������ƥ��Ȥ��Ƥ���������
@end enumerate

@cindex String collating
@node String collating, Multi-byte characters, Adding character set, Languages
@subsection String collating support

If the sorting rules for your language are too complex to be handled
with the simple @code{sort_order[]} table, you need to use the string
collating functions.

Right now the best documentation on this is the character sets that are
already implemented.  Look at the big5, czech, gbk, sjis and tis160
character sets for examples.

You must specify the @code{strxfrm_multiply_MYSET=N} value in the
special comment at the top of the file.  @code{N} should be set to
the maximum ratio the strings may grow during my_strxfrm_MYSET (it
must be a positive integer).

@cindex Multi-byte characters
@node Multi-byte characters,  , String collating, Languages
@subsection �ޥ���Х���ʸ���Υ��ݡ���

If your character set includes multi-byte characters, you need to use
the multi-byte character functions.

Right now the best documentation on this is the character sets that are
already implemented.  Look at the euc_kr, gb2312, gbk, sjis and ujis
character sets for examples.

You must specify the @code{mbmaxlen_MYSET=N} value in the
special comment at the top of the file.  @code{N} should be set to
the size in bytes of the largest character in the set.


@cindex Table size
@cindex Size of tables
@node Table size,  , Languages, Server
@section @strong{MySQL} �ϥơ��֥��ɤ줯�餤�礭���Ǥ��뤫��

@strong{MySQL} 3.22 �Υơ��֥륵���������¤� 4G �Ǥ���
@strong{MySQL} 3.23 �ο����� @code{MyISAM} �Ǥϡ�����Υơ��֥륵������ 800���ƥ�Х���
(2 ^ 63 bytes) �Ǥ�.

������������Ȥ��̤� OS ���ȤΥե����륵���������¤�����ޤ���
�㤨�Ф����Ĥ��� OS �Ǥϰʲ��Τ褦�ˤʤäƤ��ޤ���

@multitable @columnfractions .6 .4
@item Linux-Intel @tab 2G (or 4G with reiserfs)
@item Linux-Alpha @tab 8T (?)
@item Solaris 2.5.1 @tab 2G (possible 4G with patch)
@item Solaris 2.6 @tab 4G
@item Solaris 2.7 Intel @tab 4G
@item Solaris 2.7 ULTRA-SPARC @tab 8T (?)
@end multitable

����ϡ��̾@strong{MySQL} �Υơ��֥륵������
���ڡ��졼�ƥ��󥰥����ƥ�ˤ�ä����¤����Ȥ������ȤǤ���

By default, @strong{MySQL} tables have a maximum size of about 4G.  You can
check the maximum table size for a table with the @code{SHOW TABLE STATUS}
command or with the @code{myisamchk -dv table_name}.
@xref{SHOW}.

If you need bigger tables than 4G (and your operating system supports
this), you should set the @code{AVG_ROW_LENGTH} and @code{MAX_ROWS}
parameter when you create your table.  @xref{CREATE TABLE}.  You can
also set these later with @code{ALTER TABLE}. @xref{ALTER TABLE}.

If you need to have bigger tables than 2G / 4G

�⤷�礭�ʥơ��֥��꡼�ɥ���꡼�ǻ��Ѥ���ʤ顢@code{myisampack}��Ȥä�ʣ���Υơ��֥���礷�������ǰ��̤��뤳�Ȥ��Ǥ��ޤ���@code{myisampack}�Ͼ��ʤ��Ȥ� 50% �ơ��֥�򰵽̤��뤳�Ȥ��Ǥ������η�̡��礭�ʥơ��֥����Ѥ��뤳�Ȥ��Ǥ��ޤ���
@xref{myisampack,  , @code{myisampack}}.

¾����ˡ�Ȥ��ơ�"Ʊ���褦��"�ơ��֥���ĤˤǤ��� MERGE �饤�֥�꡼��ޤ���ˡ������ޤ���
("Ʊ���褦��" �Ȥϡ�Ʊ�����ܾ�����ä����ƤΥơ��֥뤬����Ƥ�����֤򤵤��ޤ�)
MERGE �ϥ���ǥå����򥵥ݡ��Ȥ��Ƥ��ʤ����ᡢƱ��Υơ��֥뤷�������Ǥ��ޤ���
����˥���ǥå����ε�ǽ��ᤤ�����ɲä���ͽ��Ǥ���

@cindex Replication
@node Replication, Performance, Server, Top
@chapter Replication in MySQL

@menu
* Replication Intro::           Introduction
* Replication Implementation::  
* Replication HOWTO::           HOWTO
* Replication Features:: Replication Features.  Replication Features.  Replication Features.  Replication Features.  Replication Features.  Replication Features.  Replication Features.  Replication Features
* Replication Options::         Replication Options in my.cnf
* Replication SQL::             SQL Commands related to replication
@end menu

@node Replication Intro, Replication Implementation, Replication, Replication
@section Introduction

One way replication can be used both to increase robustness and
speed. For robustness you have two systems and switch to the backup if
you have problems with the master. The extra speed is achieved by
sending a part of the non-updating queries to the replica server. Of
course this only works if non-updating queries dominate, but that is the
normal case.

Starting in 3.23.15, @strong{MySQL} supports one-way replication
internally. One server acts as the master, while the other acts as the
slave. Note that one server could play the roles of master in one pair
and slave in the other. The master server keeps a binary log of updates
and an index file to binary logs to keep track of log rotation.  The
slave upon connecting informs the master where it left off sinse the
last successfully propogated update, catches up on the updates, and then
blocks and waits for the master to notify it of the new updates.

@node Replication Implementation, Replication HOWTO, Replication Intro, Replication
@section Replication Implementation Overview

@strong{MySQL} internal replication uses the master-slave approach. One
server is designated as the master, while the other ( or others) as
slave(s). The master keeps a binary log of updates. The slave connects
to the master, catches up on the missed updates, and then starts
receiving updates immediately as they come to the master. If the
connection is lost, the slave will reconnect. If the master goes down,
the slave will keep trying to connect every @code{master-connect-retry}
seconds until the master comes back up and the connection can be
established. The slave keeps track of where it left off in the
replication process, so it can use the info in the case it goes down and
gets restarted later.

@node Replication HOWTO, Replication Features, Replication Implementation, Replication
@section HOWTO 
Below is a quick HOWTO on how to set up replication on your current system:

@itemize @bullet
@item
Upgrade both slave and master to 3.23.15 or higher.  
@item
Set up special replication user(s) on the master with the @code{FILE}
privilege and permission to connect from all the slaves
@item
Take a snapshot of all the tables/databases on the master that could
possibly be involved in the update queries before taking the next step
@item
In @code{my.cnf} on the master add @code{log-bin} and restart it. Make
sure there are no important updates to the master between the time you
have taken the snapshot and the time master is restarted with
@code{log-bin} option
@item
Load the snapshot of the master to all the slaves
@item
Add the following to @code{my.cnf} on the slave(s):

@example
master-host=<hostname of the master>
master-user=<replication user name>
master-password=<replication user password>
@end example

replacting the values in <> with what is relevant to your system.

@item Restart the slave(s)

@end itemize

After you have done the above, the master and the slave(s) should be in
sync.

@node Replication Features, Replication Options, Replication HOWTO, Replication
@section Replication Features

Below is an explanation of what is supported and what is not:

@itemize @bullet
@item
Replication will be done correctly with @code{AUTO_INCREMENT},
@code{LAST_INSERT_ID}, and @code{TIMESTAMP} values
@item
@code{LOAD DATA INFILE} will be handled properly as long as the file
still resides on the master server at the time of update
propogation. @code{LOAD LOCAL DATA INFILE} will be skipped.
@item
Update queries that use user variables are not replication-safe (yet)
@item
If the query on the slave gets an error, the slave thread will
terminate, and a message will appear in @code{.err} file. You should
then connect to the slave manually, fix the cause of the error
(eg. non-existent table), and then run @code{SLAVE START} sql command ( available starting in 3.23.16,
in 3.23.15 you will have to restart the server).
@item
If connection to the master is lost, the slave will retry immediately,
and then in case of failure every @code{master-connect-retry} (default
60) seconds. Because of this, it is safe to shut down the master, and
then restart it after a while. The slave will also be able to deal with
network connectivity outages.
@item
Shutting down the slave (cleanly) is also safe, as it keeps track of
where it left off.  Unclean shutdowns might produce problems, especially
if disk cache was not synced before the system died. Your system fault
tolerance will be greatly increased if you have a good UPS.
@item
If the master is listening on a non-standard port, you will also need to
specify this with @code{master-port} parameter in @code{my.cnf} .
@item
In 3.23.15,all of the tables and databases will be replicated. Starting in 3.23.16, you
can restrict replication to a set of databases with @code{replicate-do-db} directives in
@code{my.cnf} or just excluse a set of databases with @code{replicate-ignore-db}.
@item
Starting in 3.23.16, @code{SET SQL_LOG_BIN = 0} will turn off replication (binary) logging on the
master, and @code{SET SQL_LOG_BIN = 1} will turn in back on - you must have the process privilege to do
this.
@item The slave thread does not log updates to the binary log of the slave, so it is possible to couple
two servers in a mutual master-slave relationship. You can actually set up a load balancing scheme and
do queries safely on either of the servers. Just do not expect to do LOCK TABLES on one server, then
connect to the other and still have that lock :-) .
@end itemize

@node Replication Options, Replication SQL, Replication Features, Replication
@section Replication Options in my.cnf

The table below explains the replications options in @code{my.cnf} . All of the are available
starting in 3.23.15 unless indicated otherwise.

@multitable @columnfractions .25 .25 .25 .25
@item @strong{Option} @tab @strong{Description} @tab @strong{Where to set} @tab @strong{Example}
@item @code{log-bin} @tab Should be set on the master. Tells it to keep a binary update
log. If a parameter is specified, the log will be written to the specified location. @tab Master @tab
@code{log-bin}
@item @code{log-bin-index} @tab Because the user could issue @code{FLUSH LOGS} command, we need to
know which log is currently active and which ones have been rotated out and it what sequence. This info
is stored in the binary log index file. The default is `hostname`.index . You can use this option
if you want to be a rebel. @tab Master @tab @code{log-bin-index=db.index}
@item @code{master-host} @tab Master hostname or IP address for replication. If not set,
the slave thread will not be started @tab Slave @tab @code{master-host=db-master.mycompany.com}
@item @code{master-user} @tab The user the slave thread will authenticate as when connecting to
the master. The user must have @code{FILE} privilige. If the master user is not set, user @code{test}
 is assumed. @tab Slave @tab @code{master-user=scott}
@item @code{master-password} @tab The password the slave thread will authenticate with when
connecting to the master. If not set, empty password is assumed @tab Slave @tab
@code{master-password=tiger}
@item @code{master-port} @tab The port the master is listening on. If not set, the compiled setting of
@code{MYSQL_PORT} is assumed. If you have not tinkered with @code{configure} options, this should be
3306. @tab Slave @tab @code{master-port=3306}
@item @code{master-connect-retry} @tab The number of seconds the slave thread will sleep before retrying
to connect to the master in case the master goes down or the connection is lost.
Default is 60. @tab Slave @tab @code{master-connect-retry=60}
@item @code{master-info-file} @tab The location of the file that remembers where we left off on the
 master during the replication process. The default is master.info in the data directory.
Sasha:  The only reason I see for ever changing the default is the desire to
be rebelious. @tab Slave @tab @code{master-info-file=master.info}
@item @code{replicate-do-db} @tab Tells the slave thread to restrict replication to the specified database. To sp
cify more than one database, use the directive multiple times, once for each database.
Note that this will only work if you do not use cross-database queries such as
@code{UPDATE some_db.some_table SET foo='bar'} while having selected a different or
no database. @tab Slave @tab @code{replicate-ignore-db=some_db}
@item @code{replicate-ignore-db} @tab Tells the slave thread to not replicate to the specified
database. To specify more than one database to ignore, use the directive multiple times,
once for each database. You must not use cross database updates for this option. @tab Slave @tab @code{replicate-
o-db=some_db}
@item @code{sql-bin-update-same} @tab If set, setting  @code{SQL_LOG_BIN} to a value will
automatically set @code{SQL_LOG_UPDATE} to the same value and vice
versa. @tab Master @tab @code{sql-bin-update-same}

@item @code{log-slave-updates} @tab Tells the slave to log the updates from the slave thread to the binary log. Off by default. You will need to turn it on if you plan to daisy-chain the slaves @tab Slave @tab @code{log-slave-updates}

@end multitable

@node Replication SQL,  , Replication Options, Replication
@section SQL commands related to replication

Replication can be controlled through the SQL interface. Below is the
summary of commands:

@multitable @columnfractions .30 .40 .30
@item @strong{Command} @tab @strong{Description} @tab @strong{Where to run}
@item @code{SLAVE START} @tab Starts the slave thread. @tab Slave
@item @code{SLAVE STOP} @tab Stops the slave thread. @tab Slave
@item @code{SET SQL_LOG_BIN=0} @tab Disables update logging @tab Master
@item @code{SET SQL_LOG_BIN=1} @tab Re-enable update logging @tab Master
@end multitable

@cindex Performance
@cindex Optimization
@node Performance, MySQL Benchmarks, Replication, Top
@chapter MySQL �κ�����ǽ��Ҥ������ˤ�

Optimization is a complicated task because it ultimately requires
understanding of the whole system. While it may be possible to do some
local optimizations with small knowledge of your system/application, the
more optimal you want your system to become the more you will have to
know about it.

So this chapter will try to explain and give some examples of different
ways to optimize @strong{MySQL}. But remember that there are always some
(increasingly harder) ways to make the system even faster left to do.

@menu
* Optimize Basics::             Optimization overview
* System::                      System/Compile time and startup parameter tuning
* Data size::                   Get your data as small as possible
* MySQL indexes::               How @strong{MySQL} uses indexes
* Query Speed::                 Speed of queries that access or update data
* Tips::                        Other optimization tips
* Benchmarks::                  Using your own benchmarks
* Design::                      Design choices
* Design Limitations::          MySQL design limitations/tradeoffs
* Portability::                 Portability
* Internal use::                What have we used MySQL for?
@end menu

@node Optimize Basics, System, Performance, Performance
@section ��Ŭ�� ����

�����ƥ��®�����뤿��κǤ���פ���ʬ�ϡ�����������Ū���߷פǤ���
You also need to know what kinds of things your system will be
doing, and what your bottlenecks are.

��ʥܥȥ�ͥå��ϡ�
@itemize @bullet
@item Disk ������ �� 
���ҤΥǡ����򸫤Ĥ��뤿��ˤϡ��ǥ������˻��֤�������ޤ���
1999ǯ�κǿ����Υǥ������Ǥϡ����Τ����ʿ�ѻ��֤ϡ�10ms�����̾��꾮�����Ǥ���
�������äơ��桹�ϡ�������� 1�ä���1000 ���������뤳�Ȥ��Ǥ��ޤ���
���λ��֤ϡ���ĤΥơ��֥�Ǥ���ʤ�С��ǡ��������äȶ��˥ǥ��������������λ��֤�
�����������ä��뤳�Ȥˤʤꡢ�ȤƤ��Ŭ������Τ��񤷤��ʤäƤ����ޤ���
������Ŭ��������ˡ�ϡ��ǡ����� 1�İʾ�Υǥ�������ʬ��������Ǥ���
@item Disk reading/writing
When the disk is at the correct position we need to read the data. With
modern disks in 1999 one disk delivers something like 10-20Mb/s. This
is easier to optimize than seeks because you can read in parallel from
multiple disks.
@item CPU cycles �� 
�ǡ�����ᥤ�󡦥��꡼��������줿(�ޤ��ϴ��˥����¸�ߤ��Ƥ���)���ˡ�
��̤����뤿��ˤϡ�������������ɬ�פ�����ޤ���
���꡼���̤��⾮���ʥơ��֥����äƤ����硢����ϡ����¤��װ��Ȥʤ�ޤ���
�������ơ��֥�Ǥϡ����ԡ��ɤϡ��̾�����ˤϤʤ�ޤ���
@item Memory bandwidth �� 
CPU ������å���˼��ޤ�ʤ��褦�ʥǡ������׵ᤷ����硢�ᥤ�󡦥��꡼
�ΥХ�����ϥܥȥ�ͥå��ˤʤ�ޤ���
����ϤۤȤ�ɤΥ����ƥ��ʬ����ˤ����ܥȥ�ͥå��Ȥʤ�ޤ�����
ï���Ϥ�����ΤäƤ���٤��Ǥ���
@end itemize

@node System, Data size, Optimize Basics, Performance
@section �����ƥࡢ����ѥ�������������ȥѥ�᥿���Υ��塼�˥�

We start with the system level things since some of these decisions have
to be made very early. In other cases a fast look at this part may
suffice because it not that important for the big gains. However, it is always
nice to have a feeling about how much one could gain by changing things
at this level.

�Ȥ��٤� OS �ϤȤƤ���פǤ��� ʣ���� CPU ����ĥޥ���Ǥϡ�
Solaris (�ʤ��ʤ顢Solaris �Υ���åɤϤȤƤ������餷��ư��뤫��)��
���뤤�ϡ�Linux ( kernel 2.2 ���ɤ� SMP �򥵥ݡ��Ȥ��Ƥ��뤫��) ��
���Ѥ��٤��Ǥ��� 32bit �ޥ���� Linux �Ǥϡ�2G bytes �Υե����륵������
���¤�����ޤ��� ����Ͽ������ե����륷���ƥ� (XFS) �Υ�꡼������
�ʤ��ʤä��ߤ�����ΤǤ���

Because we have not run @strong{MySQL} in production on that many platforms we
advice you to test your intended platform before choosing it, if possible.

Other tips:
@itemize @bullet
@item
��ʬ RAM ������ʤ�С����Ƥ� swap �򳰤��Ƥ�褤�Ǥ��礦��
�����Ĥ��Υ����ƥ�Ǥϡ����Ȥ����꡼�������Ƥ��Ƥ⡢
swap ����Ѥ����礬����ޤ���

@item
�����Υ��å����򤱤뤿�ᡢ@code{--skip-locking} @strong{MySQL} ���ץ����
����Ѥ��ޤ��� 
Note that this will not impact @strong{MySQL}'s functionality as
long as you only run one server.
@code{myisamchk} ��¹Ԥ������ˡ������С���ߤ�뤳�Ȥ�˺��ʤ��Ǥ���������
On some system
this switch is mandatory because the external locking does not work in any
case.

MIT ����åɤǥ���ѥ��뤹����� @code{--skip-locking} ���ǥե���ȤǤ���
��������ƤΥץ�åȥե������ MIT ����åɤ� @code{flock()} �����˥��ݡ��Ȥ�
�Ƥ��ʤ�����Ǥ���

@code{--skip-locking} �����ѤǤ��ʤ�������Ĥξ��֤ϡ�
�⤷���ʤ���ʣ���� @strong{MySQL} @emph{�����С�} (���饤����ȤǤϤʤ�) ��
Ʊ���ǡ������Ф������餻�Ƥ�����Ǥ���
Or run
@code{myisamchk} on the table without first flushing and locking the
@code{mysqld} server tables first.

���Ȥ� @code{--skip-locking} ����Ѥ��Ƥ��Ƥ⡢
@code{LOCK TABLES} / @code{UNLOCK TABLES} �λ��Ѥϲ�ǽ�Ǥ���
@end itemize

@menu
* Compile and link options::    How compiling and linking affects the speed of MySQL
* Disk issues::                 Disk issues
* Server parameters::           Tuning server parameters
* Table cache::                 How MySQL opens and closes tables
* Creating many tables::        Drawbacks of creating large numbers of tables in the same database
* Open tables::                 Why so many open tables?
* Memory use::                  How MySQL uses memory
* Internal locking::            How MySQL locks tables
* Table locking::               Table locking issues
@end menu

@node Compile and link options, Disk issues, System, System
@subsection MySQL ��®�٤˱ƶ����륳��ѥ���ȥ����ˡ

���Υƥ��Ȥ�¿���� Linux ��� @strong{MySQL} �٥���ޡ����ǹԤ��ޤ�����
��������������¾�� OS �ˤĤ��Ƥ⤤���Ĥ��λ�ɸ��Ϳ���ޤ��� 

@code{-static} �ǤΥ�󥯻��˺�®�μ¹Է��������ޤ���
TCP/IP ������� Unix �����åȤ�ǡ����١����ؤ�
��³�˻��Ѥ��뤳�Ȥ⡢����ɤ���ǽ��Ϳ���ޤ���

Linux �Ǥϡ�@code{pgcc} �� @code{-O6} �ǥ���ѥ��뤷�����˺�®�Υ����ɤ������ޤ���
���Υ��ץ����� @file{sql_yacc.cc} �򥳥�ѥ��뤹��ȡ�@code{gcc/pgcc} ��
���Ƥδؿ��򥤥�饤��ˤ��뤿���¿���Υ����ɬ�פȤ���Τǡ�200M �Υ��꤬ɬ�פǤ���
@code{libstdc++} �饤�֥������ä��򤱤뤿��ˤϡ�
@strong{MySQL} �� configure ���� @code{CXX=gcc} �����ꤹ�٤��Ǥ��� 

����ɤ�����ѥ��顼�������ƥ���ѥ��顼�Υ��ץ����ϡ�10-30% ��
®�٤θ����⤿�餷�ޤ��� ����Ϥ��ʤ����Ȥ� MySQL �򥳥�ѥ��뤹��
���˽��פʤ��ȤǤ���

Intel �Ǥϡ��㤨�� pgcc �� Cygnus CodeFusion compiler �Ǻ�®�Ȥʤ�ޤ���
�桹�� ������ Fujitsu ����ѥ��顼�Ǥ�ƥ��Ȥ��ޤ�������
@strong{MySQL} ���Ŭ�����ץ����ǥ���ѥ��뤹��ˤϡ�
�ޤ������ʥХ����ե꡼�ǤϤ���ޤ���Ǥ�����

Here is a list of some mesurements that we have done:
@itemize @bullet
@item
@code{pgcc} ����Ѥ��� @code{-O6} �����Ƥ򥳥�ѥ��뤹��ȡ�
@code{gcc} 2.95.2 ���Ť��С������Ǥϡ�
@code{mysqld} �����С��� 11% ®���ʤ�ޤ��� 

@item 
ưŪ���(@code{-static}) ̵��)�ξ�硢��̤� 13% �٤��ʤ�ޤ���
Note that you still can use a dynamic linked MySQL library. It
is only the server that is critical for performance.

@item 
(localhost �ؤ���³��) Unix �����åȤ������ TCP/IP ����Ѥ���ȡ���̤� 7.5% �٤��ʤ�ޤ��� 

@item
SPARCstation 10 �Ǥϡ�@code{gcc} 2.7.3 �� Sun Pro C++ 4.2 ��� 13% ®���ʤ�ޤ���

@item 
���󥰥�ץ����å��� Solaris 2.5.1 �Ǥϡ�mit-pthreads �� Solaris �ͥ��ƥ��֥���åɤ�� 8-12% �٤��ʤ�ޤ���
With more load/CPUs the difference should
get bigger.
@end itemize

TCX �ˤ�����ۤ���Ƥ��� @strong{MySQL}-Linux ���ۤ� @code{pgcc} �ǥ���ѥ��뤵���
���ޤ�����
but we had to go back to regular gcc because of a bug in pgcc that would
generate the code that does not run on AMD. We will continue using gcc until that bug is resolved.
In the meantime, if you have a non-AMD machine, you can get a faster binary by compiling with pgcc.
The Linux binary is linked statically.

@node Disk issues, Server parameters, Compile and link options, System
@subsection Disk ������

@itemize @bullet
@item
���˽Ҥ٤��ǥ��������������礭�ʥܥȥ�ͥå��Ǥ��� ��������ϡ��ǡ���������Ū��
����å��󥰤��Բ�ǽ�ˤʤ�ۤɡ��礭���ʤ�Ϥ��Ȥ��ˡ������������ˤʤäƤ��ޤ���
For large databases,
where you access data more or less randomly, you can count on that you
will need at least one disk seek to read and a couple of disk seeks to
write things. ��������򾯤ʤ�����ˤϡ�disk���������֤ξ��ʤ��ǥ�������
���Ѥ��ޤ���
@item
���ѤǤ���ǥ��������ԥ�ɥ�ο������䤷�ޤ�(����ˤ�äƥǥ�����������
�Υ����С��إåɤϽ̾����ޤ�)��
����ϰ㤦�ǥ������˥���ܥ�å���󥯤�Ϥä��ꡢ���ȥ饤�פ�Ԥ����Ȥ�
��ǽ�Ǥ���
@table @strong
@item symbolic link ���
������̾�Υǡ����ǥ��쥯�ȥ꤫�顢�㤦�ǥ������ء�
����ǥå�����ǡ����ե�����򥷥�ܥ�å�����󥯤��뤳�ȤǤ���
����� ������ �� �꡼�� ��®�����ޤ��� (�⤷���Υǥ�������
¾�˻��Ѥ���Ƥ��ʤ����). @xref{Symbolic links}.
@item Striping
���ȥ饤�ԥ󥰤ϡ�ʣ���Υǥ��������Ф��ơ��ޤ��ǡ����κǽ�Υ֥��å���
1���ܤ� disk �˽񤭡�2���ܤΥ֥��å���2���ܤ�disk�˽񤭡��缡 N ����
(N �� disk �ο�) �ޤǽ�˽񤤤Ƥ����ޤ��� ����ϡ��⤷�ǡ��������ȥ饤�פ�
���������⾮������С����褤�ѥե����ޥ󥹤����뤳�Ȥ�����ޤ���
���ȥ饤�ԥ󥰤ϡ�OS �� ���ȥ饤�פΥ������ˤȤƤ��¸���Ƥ��뤳�Ȥ����դ��Ƥ���������
���Τ��ᡢ���ʤ��Υ��ץꥱ�������Υ٥���ޡ��������ȥ饤�ץ������ˤ�ä�
�Ѥ��Ǥ��礦�� @xref{Benchmarks}.

���ȥ饤�ԥ󥰤Υ��ԡ��ɤΰ㤤�ϡ�@strong{�ȤƤ�} �ѥ�᥿���˰�¸���Ƥ��ޤ���
Depending on how you set the striping parameters and
number of disks you may get difference in orders of magnitude. Note that
you have to choose to optimize for random or sequential access.
@end table
@item
�������Τ��ᡢ���ʤ��� RAID 0+1 (striping + mirroring) ����Ѥ�������
�פ����⤷��ޤ��� ����������� N �ĤΥɥ饤�֤Υǡ���������Τ�
2*N �ĤΥɥ饤�֤�ɬ�פȤʤ�ޤ���
����Ϥ⤷��⤬����ʤ�а��֤褤��ˡ�Ǥ��礦�� ��������ǽΨŪ�ˤ����
��갷������ˡ��ܥ�塼�ࡦ�ޥ͡������ȡ����եȥ���������񤹤�ɬ�פ�
���äƤ�褤�Ǥ���
@item
A good option is to have semi-important data (that can be re-generated)
on RAID 0 disk while store really important data (like host information
and logs) on a RAID 0+1 or RAID N disks. RAID N can be a problem if you
have many writes because of the time to update the parity bits.
@item
�ǡ����١����˻��Ѥ��Ƥ���ե����륷���ƥ�� mount �ѥ�᥿�����ѹ����Ƥ�
�ɤ��Ǥ��礦�� ��Ĥδ�ñ����ˡ�Ȥ��Ƥϡ�noatime ���ץ����ǥե����륷���ƥ��
�ޥ���Ȥ��ޤ��� ����� inode �ˤ���Ǹ�˥��������������֤ι�����
�����åפ��ޤ��� ����Ǥ����餫 �ǥ��������������򤱤뤳�Ȥ��Ǥ���Ǥ��礦��
@end itemize

@menu
* Symbolic links::              Using symbolic links for databases and tables
@end menu

@node Symbolic links,  , Disk issues, Disk issues
@subsubsection �ǡ����١����ȥơ��֥�˥���ܥ�å���󥯤���Ѥ���

�ơ��֥�ȥǡ����١����Υե������ MySQL �Υǡ����١����ǥ��쥯�ȥ꡼����
�㤦���˰�ư���� ������Ф��ƥ���ܥ�å���󥯤�ĥ�뤳�Ȥ��Ǥ��ޤ���
������㤨�Хǥ��������̤����ʤ��ʤäơ��ǡ����١������ư���������ˤ����������ʤ�Ǥ��礦�� 

@strong{MySQL} �����ơ��֥뤬����ܥ�å���󥯤Ǥ��뤳�Ȥ˵��Ť�����硢
symlink ����Ϥ�������ˤ��μ��ΤΥơ��֥����Ѥ��ޤ���
����� @code{realpath()} ������򥵥ݡ��Ȥ������ƤΥ����ƥ��Ư���ޤ��ʾ�
�ʤ��Ȥ� Linux �� Solaris �� @code{realpath()} �򥵥ݡ��Ȥ��ޤ����ˡ�
@code{realpath()} �򥵥ݡ� �Ȥ��ʤ������ƥ��Ǥϡ�symlink �ȥơ��֥��
Ʊ���˻��Ѥ��٤��Ǥ���ޤ��� �ơ��֥�ϥơ��֥�ι������̷�⤹����ˤʤ�Ǥ��礦�� 

@strong{MySQL} �ϥǥե���ȤǤϥǡ����١���Ʊ�ΤΥ�󥯤򥵥ݡ��Ȥ��ޤ���
�����ǡ����١����֤Υ���ܥ�å���󥯤�������ʤ��¤ꡢ����������Ư���Ǥ��礦��
@strong{MySQL} �ǡ����ǥ��쥯�ȥ�� @code{db1} �ǡ����١���������Ȥ��ơ�
���� @code{db2} �� @code{db1} �Υ���ܥ�å���󥯤ˤ����Ȥ��ޤ�: 

@example
shell> cd /path/to/datadir
shell> ln -s db1 db2
@end example

����ȡ�@code{db1} ��� @code{tbl_a} �ơ��֥�� @code{db2} ��  @code{tbl_a} �ơ��֥�Ȥ��Ƹ����ޤ���
�⤷���륹��åɤ� @code{db1.tbl_a} �򹹿�����¾�Υ���åɤ� @code{db2.tbl_a} ��
����������硢 ���꤬ȯ�����ޤ��� 

�������ä����Ѥ�ɤ����Ƥ⤷������硢@file{mysys/mf_format.c} ��ʲ��Τ褦���ѹ����ޤ�: 

@example
if (!lstat(to,&stat_buff))  /* Check if it's a symbolic link */
    if (S_ISLNK(stat_buff.st_mode) && realpath(to,buff))
@end example

Change the code to this:

@example
if (realpath(to,buff))
@end example

@cindex Startup parameters
@node Server parameters, Table cache, Disk issues, System
@subsection �����С��ѥ�᡼�����Υ��塼�˥�

@code{mysqld} �����С������Ѥ��Ƥ��븽�ߤΥХåե��������򼡤����뤳�Ȥ��Ǥ��ޤ�:

@example
shell> mysqld --help
@end example

���η�̡����Ƥ� @code{mysqld} ���ץ����ȼ��Τ褦�ʥ���ե�����ǽ�ѿ��Υꥹ��
�������ޤ������Ϸ�̤ˤϥǥե�����ͤ��ޤޤ졢�ʲ��Τ褦��ɽ������ޤ�:

@example
Possible variables for option --set-variable (-O) are:
back_log              current value: 5
connect_timeout       current value: 5
delayed_insert_timeout  current value: 300
delayed_insert_limit  current value: 100
delayed_queue_size    current value: 1000
flush_time            current value: 0
interactive_timeout   current value: 28800
join_buffer_size      current value: 131072
key_buffer_size       current value: 1048540
lower_case_table_names  current value: 0
long_query_time       current value: 10
max_allowed_packet    current value: 1048576
max_connections       current value: 100
max_connect_errors    current value: 10
max_delayed_threads   current value: 20
max_heap_table_size   current value: 16777216
max_join_size         current value: 4294967295
max_sort_length       current value: 1024
max_tmp_tables        current value: 32
max_write_lock_count  current value: 4294967295
net_buffer_length     current value: 16384
query_buffer_size     current value: 0
record_buffer         current value: 131072
sort_buffer           current value: 2097116
table_cache           current value: 64
thread_concurrency    current value: 10
tmp_table_size        current value: 1048576
thread_stack          current value: 131072
wait_timeout          current value: 28800
@end example

�⤷ @code{mysqld} �����С������餻�Ƥ���ʤ顢�ʲ��Υ��ޥ�ɤǤ��ѿ����ͤ򸫤뤳�Ȥ��Ǥ��ޤ�:

@example
shell> mysqladmin variables
@end example

�����Υ��ץ����ϰʲ��Τ褦�˷��Ƥ���������
buffer size, buffer length, stack size �� byte ñ�̤�Ϳ���ޤ���
�������ͤθ���� @samp{K} �� @samp{M} ���ɲä���ȡ������Х��ȡ��ᥬ�Х��Ȥˤʤ�ޤ���
�㤨�С�@code{16M} ��16�ᥬ�Х��Ȥ򼨤��ޤ�����ʸ����ʸ���ζ��̤Ϥʤ���
@code{16M} �� @code{16m} ��Ʊ����̣�ˤʤ�ޤ���

��Ư��Υ����С������׾���� @code{SHOW STATUS} �ǻ��ȤǤ��ޤ�. @xref{SHOW}. 

@table @code
@item @code{ansi_mode}.
�⤷ @code{mysqld} �� @code{--ansi} ���ץ����ǵ�ư����Ƥ���ʤ顢@code{ON}.
@xref{Ansi mode}.

@item @code{back_log}
@strong{MySQL} �����Ƥ�̤������³�׵�ο��Ǥ�������� @strong{MySQL} 
����åɤ�@strong{��Τ�����}¿������³�׵��ȤƤ�û�����֤��������ˡ�Ư��
�ޤ�����³�Υ����å��ȿ���������åɤγ��Ϥϥᥤ�󥹥�åɤˤ���������
(�������ۤ�Τ鷺��)��������ޤ���back_log �ϡ�@strong{MySQL} ���ִ�Ū�˿�
�����׵�ؤβ�������ߤ������ˡ�����û�����֤δ֤˥����å��Ǥ�����³���Ǥ���
û�����֤�¿������³����Ԥ�����ˤ�������������ä���ɬ�פ�����ޤ���

����������ʤ顢����� TCP/IP ��³������ listen ���塼�Υ������Ǥ���
���ڥ졼�ƥ��󥰥����ƥ�Ϥ��Υ��塼���礭�������¤��Ƥ��ޤ���
UNIX �����ƥॳ���� @code{listen(2)} �Υޥ˥奢��ڡ����ˡ�����˾ܺ٤�����ޤ���
�����ͤ����¤ˤ�������硢���Ȥ���OS�Υɥ�����Ȥ򸫤Ƥ���������
@code{back_log} �򤳤�OS�������ͤ��¿����äƤ���������̤���ޤ���

@item @code{thread_cache_size}
How many threads we should keep keep in a cache for reuse.  When a
client disconnects the clients threads is put in the cache if there
isn't more than @code{thread_cache_size} threads from before.  All new
threads are first taken from the cache and only when the cache is empty
a new thread is created.  This variable can be increased to improve
performance if you have a lot of new connections (Normally this doesn't
however give a notable performance improvement if you have a good
thread implementation).

@item @code{concurrent_inserts}
�⤷ @code{ON} (����ϥǥե���ȤǤ�) �ʤ顢@code{MySQL} �ϡ�
@code{SELECT} �����꤬�¹Ԥ���Ƥ��� @code{MyISAM} �ơ��֥���Ф��ơ�
Ʊ���� @code{INSERT} �����ѤǤ���褦�ˤ��ޤ���
���Υ��ץ����� @code{mysqld} �Υ��ץ����� @code{--safe} �� @code{--skip-new} ��
���ꤹ�뤳�Ȥ�  @code{OFF} �ˤǤ��ޤ���

@item @code{connect_timeout}
@code{mysqld} �����С�����³�ѥ��åȤ��Ԥ��ÿ��� (@code{Bad handshake} ���֤��ޤǤ��ÿ�)

@item @code{delayed_insert_timeout}
�ɤ줰�餤 @code{INSERT DELAYED} ����åɤ� @code{INSERT} ʸ���ԤĤ٤�����

@item @code{delayed_insert_limit}
@code{delayed_insert_limit} �ĤΥ쥳���ɤ����������塢 @code{INSERT DELAYED} �ϥ�ɥ顼��
�Ԥ�����Ƥ��� @code{SELECT} ʸ���ʤ��������å����ޤ��� �⤷����ʤ顢
������³�������ˤ����μ¹Ԥ�����ޤ���

@item @code{delay_key_write}
�⤷ enabled �Ǥ����(���줬�ǥե����)��@strong{MySQL} �� @code{CREATE TABLE} ʸ��
@code{DELAY_KEY_WRITE} ���ץ�����º�Ť��ޤ���
@code{DELAY_KEY_WRITE}���ץ�������ꤵ��ƺ��줿�ơ��֥�Υ����Хåե��ϡ�
���Υ���ǥå����ι����ˤϥե�å��夵�줺�������ơ��֥뤬�Ĥ���줿�Ȥ��ˤ���
�ե�å��夵��ޤ��� ����ϥ����ν񤭽Ф���®�����ޤ������⤷�������Ѥ���ʤ顢
���ƤΥơ��֥�� @code{myisamchk --fast --force} �Ǽ�ưŪ�˸�������褦�ˤ��٤��Ǥ���
�⤷ @code{mysqld} �� @code{--delay-key-write_for_all_tables} ���ץ�����դ���
��ư������硢����ϡ����ƤΥơ��֥뤬 @code{delay_key_write} ���ץ������ꤵ���
�������줿��ΤȤ��ư�����������դ��Ƥ���������
���Υե饰�ϡ�@code{mysqld} �� @code{--skip-new} �� @code{--safe-mode} ���ץ����
�ǵ�ư�����̵���ˤ��뤳�Ȥ����ޤ���

@item @code{delayed_queue_size}
What size queue (in rows) should be allocated for handling @code{INSERT
DELAYED}.  If the queue becomes full, any client that does @code{INSERT
DELAYED} will wait until there is room in the queue again.

@item @code{flush_time}
���줬�⤷���󥼥��˥��åȤ��줿�ʤ顢�� @code{flush_time} �ä��Ȥ�
���ƤΥơ��֥뤬�Ĥ����ޤ��� (�꥽�����β�����Disk�ؤ�sync�Τ����)

@item @code{init_file}
�����С���ư���ˡ�@code{--init-file} ���ץ�����Ϳ�����ե������̾���Ǥ���
���Υե�����ˤϡ������С���ư���˼¹Ԥ����� SQL ʸ��񤤤Ƥ����ޤ���

@item @code{interactive_timeout}
The number of seconds the server waits for activity on an interactive
connection before closing it.  ���󥿥饯�ƥ��� ���饤����Ȥ���ˤϡ�
C API @code{mysql_real_connect()} �� @code{CLIENT_INTERACTIVE} ���ץ�����
���åȤ��ޤ���  See also @code{wait_timeout}.

@item @code{join_buffer_size}
���ΥХåե���(����ǥå���̵����)�����ʷ��˻��Ѥ���ޤ��������2�Ĥ�
�ơ��֥�֤δ����ʷ�礴�Ȥ�1�������Ƥ��ޤ�������ǥå������ɲä���
���ʤ��������®�������ʷ������뤿��ˡ���������ä��Ƥ����������̾
®��������������ɤ���ˡ�ϡ�����ǥå������ɲä��뤳�ȤǤ���

@c Make texi2html support index @anchor{Index cache size}. Then change
@c some xrefs to point here
@item @code{key_buffer_size}
����ǥå������֥��å��ϥХåե����졢���������ƤΥ���åɤ˶�ͭ����ޤ���
@code{key_buffer_size} �ϥ���ǥå������֥��å��Τ���ΥХåե����������Ǥ���

Increase this to get better index handling (for all reads and multiple
writes) to as much as you can afford; 64M on a 256M machine that mainly
runs @strong{MySQL} is quite common.  If you however make this too big
(more than 50 % of your total memory?) your system may start to page
and become REALLY slow. Remember that because @strong{MySQL} does not cache data
read, that you will have to leave some room for the OS filesystem cache.

You can check the performance of the key buffer by doing @code{show
status} and examine the variables @code{Key_read_requests},
@code{Key_reads}, @code{Key_write_requests} and @code{Key_writes}.  The
@code{Key_reads/Key_read_request} ratio should normally be < 0.01.
The @code{Key_write/Key_write_requests} is usually near 1 if you are
using mostly updates/deletes but may be much smaller if you tend to
do updates that affect a lot of rows at the same time or if you are
using @code{delay_key_write}. @xref{SHOW}.

To get even more speed when writing many rows at the same time use
@code{LOCK TABLES}.  @xref{LOCK TABLES, , @code{LOCK TABLES}}.

@item @code{lower_case_table_names}
Change all table names to lower case on disk.

@item @code{long_query_time}
�⤷���륯���꤬������(��)�����֤�������С�@code{Slow_queries} �����󥿡�
�����䤵��ޤ���

@item @code{max_allowed_packet}
��ĤΥѥ��åȤκ��祵��������å������Хåե��� @code{net_buffer_length} �Х��Ȥ˽��������ޤ�����
@code{max_allowed_packet}�ޤ��礭�����뤳�Ȥ��Ǥ��ޤ������Υǥե�����ͤϡ�
�礭�ʥѥ��åȡ��ְ�ä��ѥ��åȤ�������ˤϾ������ͤǤ���
�礭�� @code{BLOB} ����Ѥ��Ƥ�����ϡ���������ä���ɬ�פ�����ޤ������Ѥ���
������� @code{BLOB} ��Ʊ�����餤�礭������٤��Ǥ���

@item @code{max_connections}
�������Ʊ�����饤����Ȥο�����������ä�����ϡ�@code{mysqld} �����ĥե���
��ǥ�������ץ��ο������䤹ɬ�פ�����Ǥ��礦��
��ҤΥե�����ǥ�����ץ��������¤������򻲾ȤΤ��ȡ� @xref{Too many connections}.

@item @code{max_connect_errors}
�⤷����ۥ��Ȥ������³���Ǥ������ͤ�ʾ�ˤʤä���硢����ʸ塢
���Υۥ��Ȥ������³����䤷�ޤ���@code{FLUSH HOSTS} ���ޥ�ɤ�
�ۥ��Ȥε��ݤ����Ǥ��ޤ���

@item @code{max_delayed_threads}
�����ͤ�Ķ���� @code{INSERT DELAYED} �򰷤�����åɤ�ư�Ǥ��ޤ���
�⤷���Ƥ� @code{INSERT DELAYED} ����åɤ����Ѥ���Ƥ��ơ�����˿������ơ��֥��
�ǡ������������褦�Ȥ���ȡ����Υ쥳���ɤ� @code{DELAYED} ��Ϳ�����Ƥ��ʤ�
����Ʊ�ͤ���������ޤ���

@item @code{max_join_size}
@code{max_join_size} ���¿���쥳���ɤ򿨤�ȥ��顼���֤�ޤ���Ĺ�����֤򤫤���
ɴ���Ԥ��֤��褦�� @code{WHERE} �ʤ��η����������褦�ʥ桼������ä�
������ˤ�������ꤷ�Ƥ���������

@item @code{max_heap_table_size}
Don't allow creation of heap tables bigger than this.

@item @code{max_sort_length}
@code{BLOB} �ޤ��� @code{TEXT} ���ܾ�ǥ����Ȥ�����˻��Ѥ���Х��ȿ���
(�ǽ�� @code{max_sort_length} �Х��Ȥ��������줾����ͤǻ��ѤǤ����Ĥ��̵�뤵��ޤ�)

@item @code{max_tmp_tables}
(���Υ��ץ����Ϥޤ��ʤˤ�Ԥ��ޤ���).
���饤����Ȥ�Ʊ���˥����ץ�Ǥ���ơ��֥���κ����͡�

@item @code{max_write_lock_count}
After this many write locks, allow some read locks to run in between.

@item @code{net_buffer_length}
�̿��Хåե���������֤Ǥ��Υ������˥ꥻ�åȤ���ޤ���������̾���ѹ���
�٤��ǤϤ���ޤ��󤬡��ȤƤ⾮���ʥ��ꤷ���ʤ����ϡ��������Ԥ����
������Υ����������ꤷ�Ƥ���������
( ����ϡ����饤����Ȥ��������Ƥ���SQLʸ��Ĺ��ʬ����Ф����Ǥ��礦��
�⤷��ʸ�������ͤ򤳤�����硢�Хåե��ϼ�ưŪ���礭���ʤ�ޤ���
������ @code{max_allowed_packet} �Х��ȤޤǤǤ�)

@item @code{net_retry_count}
If a read on a communication port is interrupted, retry this many times
before giving up.  This value should be quite high on @code{FreeBSD} as
internal interrupts is sent to all threads.

@item @code{record_buffer}
�����������Ԥ��ƥ���åɤ���������󤹤�ơ��֥���ˡ����Υ������ΥХ�
�ե��������Ƥޤ���¿���ν����������Ԥ����ϡ���������ä����Ƥ���
������

@item @code{query_buffer_size}
The initial allocation of the query buffer. If most of your queries are
long (like when inserting blobs), you should increase this!

@item @code{skip_show_databases}
����ϡ� @code{PROCESS_PRIV} ���¤���äƤ��ʤ��桼������
 @code{SHOW DATABASES} ��������˻ߤ��ޤ��� �⤷��¾�ͤΥǡ����١�����
�ơ��֥�򸫤褦�Ȥ���ͤ�������򡢤��ʤ������ۤ���ʤ�С�
����ϥ������ƥ��򶯲��Ǥ��ޤ���

@item @code{sort_buffer}
�����Ȥ�Ԥ�ɬ�פ�����ƥ���åɤ����Υ������ΥХåե��������Ƥޤ�����
��®�� @code{ORDER BY} �ޤ��� @code{GROUP BY} �Τ���ˤϤ�������䤷�Ƥ�
��������
@xref{Temporary files}.

@item @code{table_cache}
���ƤΥ���åɤˤĤ��ƤΥ����ץ�ơ��֥�ο�����������ä�����ϡ�
@code{mysqld}���׵᤹�륪���ץ�ե�����ǥ�������ץ��ο���
���ä��뤳�Ȥ����դ��ʤ��Ȥ����ޤ���
@strong{MySQL} �ϥ�ˡ����ơ��֥����2�ĤΥե�����ǥ�������ץ���ɬ�פ�
���ޤ���
��ҤΥե�����ǥ�����ץ��������¤������򻲾ȤΤ��ȡ�
You can check if you
need to increase the table cache by checking the @code{Opened_tables}
variable. @xref{SHOW}.  If this variable is big and you don't do
@code{FLUSH TABLES} a lot (which just forces all tables to be closed and
reopenend), then you should increase the value of this variable.

�ơ��֥륭��å��夬�ɤΤ褦��Ư�����Ϥ�����򻲾� @ref{Table cache}.

@item @code{tmp_table_size}
���꡼��� ����ơ��֥뤬�����ͤ�Ķ���褦�Ȥ�����硢@strong{MySQL} ��
��ưŪ�ˡ������disk �١����� @code{MyISAM} �ơ��֥���Ѵ����ޤ���
¿�������Ū�� @code{GROUP BY} �������Ԥ����ϡ�
���� @code{tmp_table_size} �����ä��Ƥ���������

@item @code{thread_stack}
�ƥ���åɤΥ����å����礭����@code{crash-me} �ˤ�äƸ��Ф����¿��
�����¤�����˰�¸���ޤ����ǥե���ȤǤϡ��̾�Υ��ڥ졼�������Ф���
��ʬ�ȤäƤ���ޤ���
@xref{Benchmarks}.

@item @code{wait_timeout}
�����С������ͥ��������Ĥ���ޤǤ˥����ƥ��֤ʥ��ͥ��������Ԥ��ÿ���
@code{interactive_timeout} �⻲�ȤΤ��ȡ�
@end table

@strong{MySQL} �ϤȤƤ⥹������֥�ʥ��르�ꥺ�����Ѥ��ޤ������Τ���
�̾�ϤȤƤ⾯�ʤ������ư����ޤ�����ɤ���ǽ�����뤿��� 
@strong{MySQL} ��¿���Υ����Ϳ���뤳�Ȥ��Ǥ��ޤ���

When tuning a @strong{MySQL} server, the two most important variables to use
are @code{key_buffer_size} and @code{table_cache}.  You should first feel
confident that you have these right before trying to change any of the
other variables.

¿���Υ���(>=256M)��¿���Υơ��֥����äƤ��ơ�Ŭ�٤Υ��饤����ȿ��Ǻ�����ǽ������
����硢���Τ褦�ʤ�Τ���Ѥ��ޤ�:

@example
shell> safe_mysqld -O key_buffer=64M -O table_cache=256 \
           -O sort_buffer=4M -O record_buffer=1M &
@end example

If you have only 128M and only a few tables, but you still do a lot of
sorting, you can use something like:

@example
shell> safe_mysqld -O key_buffer=16M -O sort_buffer=1M
@end example

¿������³�Ǿ��ʤ����ꤷ���ʤ���硢���Τ褦�ʤ�Τ���Ѥ��ޤ�:

@example
shell> safe_mysqld -O key_buffer=512k -O sort_buffer=100k \
           -O record_buffer=100k &
@end example

or even:

@example
shell> safe_mysqld -O key_buffer=512k -O sort_buffer=16k \
           -O table_cache=32 -O record_buffer=8k -O net_buffer=1K &
@end example

�⤷�ȤƤ�¿������³�����ꡢ@code{mysqld} ������³���Ф��ƾ��ʤ����꡼��
ư���褦�����ꤵ��Ƥ���С�����åפ��ɤ߽񤭤ˤ��ѥե����ޥ󥹤��㲼�������ޤ���
�������ʬ�ʥ��꡼������С����Ƥ���³�ˤ������� @code{mysqld} �Υѥե����ޥ��ɤ��ʤ�ޤ���

@code{mysqld} �ؤΥ��ץ������ѹ������硢���Υ����ФΥ��󥹥��󥹤ˤ�����
ͭ���Ǥ��뤳�Ȥ����դ��Ʋ�������

�ѥ�᡼���ѹ��θ��̤򸫤�ˤϡ����Τ褦�ˤ��ޤ�:

@example
shell> mysqld -O key_buffer=32m --help
@end example

@code{--help} ���ץ����ϺǸ�ˤĤ��Ƥ���������
����¾�Υ��ץ����� --help �θ�ˤĤ���ȡ����Υ��ץ�����ȿ�Ǥ���ޤ���

@cindex Table cache
@findex table_cache
@node Table cache, Creating many tables, Server parameters, System
@subsection @strong{MySQL} �ϤɤΤ褦�˥ơ��֥�Υ����ץ� & ����������Ԥʤ�����

@code{table_cache} , @code{max_connections} , @code{max_tmp_tables} ��
�����С������������֤ˤ��Ƥ������������ե�����κ�����˱ƶ����ޤ���
�⤷�������ѿ��Τ����ΰ�ġ����뤤��ʣ�������ä�����ʤ顢
���ʤ��Υ��ڥ졼�ƥ��󥰡������ƥ�Ρ�1 �ץ�����������˳������
 �ե����롦�ǥ�����ץ� �κ����ͤ����䤹���Ȥˤʤ뤫�⤷��ޤ���
¿���Υ����ƥ�ǤϤ������¤����䤹���Ȥ���ǽ�Ǥ���
�����ɤ���äƹԤ����ϡ����ʤ��λ��Ѥ��Ƥ��� OS �Υɥ�����Ȥ򸫤Ƥ���������
�����ͤ��ѹ���ˡ�ϡ������ƥ�ˤ�äƤޤ��ޤ�������Ǥ���

@code{table_cache} �� @code{max_connections} �˴�Ϣ���ޤ���
�㤨�� 200 �Υ��ͥ�������Ʊ���˳�����ʤ顢���ʤ��Ȥ� @code{200 * n} ��
�ơ��֥롦����å��夬ɬ�פǤ��� ������ @code{n} �� join �ˤ�����ơ��֥��
������Ǥ���

�����ץ�ơ��֥�Υ���å���Ϻ���� @code{table_cache} �ޤ��礭���ʤ�ޤ�(��
�ե���Ȥ� 64, @code{mysqld} �Υ��ץ���� @code{-O table_cache=#} ���ѹ���ǽ)��
����å��夬���դˤʤäơ�¾�Υ���åɤ��ơ��֥�Υ����ץ���ߤ�����
�ޤ��� @code{mysqladmin refresh} @code{mysqladmin flush-tables}
����Ѥ�����������ơ��ơ��֥�ϥ�����������ޤ���

����å��夬���äѤ��ˤʤä���硢�����С��ϰʲ��ν��֤��ä�
����å������ѤǤ���褦�����֤��ޤ���

@itemize @bullet
@item
���߻Ȥ��Ƥ��ʤ��ơ��֥뤬��������ޤ�����äȤ���Ѥ���Ƥ��ʤ��ơ��֥뤫�餫���ˡ�

@item
�⤷����å��夬���դǥơ��֥��������뤳�Ȥ����褺������˿������ơ��֥��
�����ץ��׵᤬�����硢����å���ϰ��Ū�ʳ�ĥ��ɬ�פȤ��ޤ���

@item
�⤷���Υ���å��夬�����ĥ�����֤���Ƥ��ơ����ġ��ơ��֥뤬���Ѿ��֤���
̤���Ѿ��֤˰ܹԤ�����硢���Υơ��֥���Ĥ���졢����å��夫���������ޤ���
@end itemize

�ơ��֥�ϳ�Ʊ������������ (�Ƥ�) �����ץ󤵤�ޤ�������ϡ�Ʊ���ơ��֥��2�ĤΥ����
�ɤ��¹Ԥ���Ƥ����硢�ޤ���Ʊ���������(@code{AS} ��)�ơ��֥��2�󥢥�����
�����硢�ơ��֥��2�󥪡��ץ󤹤�ɬ�פ����뤳�Ȥ��̣���ޤ����ǽ�Υơ��֥�Υ���
�ץ��2�ĤΥե����뵭�һҤ���Ѥ���³���ơ��֥�γƻ��Ѥ�1�Ĥ����Υե����뵭��
�Ҥ���Ѥ��ޤ���


@node Creating many tables, Open tables, Table cache, System
@subsection Drawbacks of creating large numbers of tables in the same database

�⤷��������Υե����뤬��ĤΥǥ��쥯�ȥ�ˤ����硢�����ץ󡢥���������
���������٤��ʤ�Ǥ��礦�� �⤷ @code{SELECT} ʸ��¿���Υơ��֥���Ф�
�¹Ԥ�����硢�ơ��֥륭��å��夬���դʤ�С����Υ����С��إåɤ�¿���ʤ�Ǥ��礦��
�ʤ��ʤ顢���줾��Υơ��֥�ˤĤ������ץ󤷡������������ʤ��ƤϤʤ�ʤ�����Ǥ���
���Υ����С��إåɤ���¤���ˤϡ��ơ��֥륭��å�����礭�����ޤ���

@node Open tables, Memory use, Creating many tables, System
@subsection ���Τ���ʤ�¿���Υơ��֥�򥪡��ץ󤹤�Τ���

@code{mysqladmin status} ��¹Ԥ���ȡ����Τ褦�ʤ�Τ������ޤ�:

@example
Uptime: 426 Running threads: 1 Questions: 11082 Reloads: 1 Open tables: 12
@end example

�Τ��ˤ��ä�6�Ĥ����ơ��֥뤬�ʤ��Τˡ����Τ褦�ʷ�̤��Ф�ΤǾ������Ǥ��뤫�⤷��ޤ���

@strong{MySQL} �ϥޥ������åɤʤΤǡ�Ʊ���ơ��֥�ǰ��٤�¿���Υ���������
�ޤ���Ʊ���ե������ǰۤʤ���֤����2�ĤΥ���åɤǡ������Ǿ�������
���ᡢƱ����ư���ƥ���åɤΤ���ơ��֥��Ƥӥ����ץ󤷤ޤ�������Ϥ�����
���Υ���ȥǡ����ե�����ˤĤ��Ƥΰ�Ĥγ�ĥ�ե����뵭�һҤ���Ѥ��ޤ���
����ǥå����ե����뵭�һҤ����ƤΥ���åɴ֤Ƕ�ͭ����ޤ���


@cindex Memory use
@node Memory use, Internal locking, Open tables, System
@subsection MySQL �ϤɤΤ褦�˥������Ѥ���Τ���

�ʲ��� @code{mysqld} �����С����ɤΤ褦�˥��꡼����Ѥ��뤫�������Ĥ������ޤ���
�����С���Ϳ�����ѿ�̾�ϡ������С��Υ��꡼�λ������˴�Ϣ����̾���ȤʤäƤ��ޤ���

@itemize @bullet
@item
�����Хåե� (�ѿ� @code{key_buffer}) �����ƤΥ���åɤǶ�ͭ���졢
�Ĥ��ɬ�׻��˳�����Ƥ��ޤ���
@xref{Server parameters}.

@item
����³�Ϥ����Ĥ��Υ���åɶ��֤���Ѥ��ޤ���
�����å� (64K, �ѿ� @code{thread_stack}), ��³�Хåե�(variable
@code{net_buffer_length}), ��̥Хåե�(variable
@code{net_buffer_length})����³�Хåե��ȷ�̥Хåե���ɬ�פȤʤä�����
ưŪ�˺��� @code{max_allowed_packet} �ޤ������ޤ���
�����꤬���äƤ���������Υ������ʸ���Υ��ԡ���������Ƥ��ޤ���

@item
���ƤΥ���åɤ�Ʊ���١��������ͭ���ޤ���

@item
�ޤ� memory-mapped ����Ѥ��Ƥ��ޤ��� (���̥ơ��֥�Ͻ����ޤ�����������̤���)��
����� 4GB �� 32bit ������֤�¿�����礭�ʥơ��֥�򰷤��ˤϾ���������Ǥ���
64bit ���ɥ쥹���֤���ĥ����ƥ��桹��������줿�����桹�� mmemory-mapping ���̾�˥��ݡ��Ȥ��ޤ���

@item
�ơ��֥��ۤ��ƽ缡��������Ԥʤ����׵�ϡ��ɤ߹��ߥХåե��������Ƥޤ�
(�ѿ� record_buffer)

@item
���Ƥη���1�ѥ��ǹԤʤ�졢¿���η��ϰ���ơ��֥����Ѥ����˹Ԥʤ�
��ޤ���¿���ΰ���ơ��֥�ϥ���١���(HEAP)�Υơ��֥�Ǥ����礭�ʥ쥳��
�ɥ����� (= ���ե������Ĺ�ι��) ����İ���ơ��֥�ޤ��ϡ�@code{BLOB} ��ޤ�
�ơ��֥�ϥǥ���������֤���ޤ���

@strong{MySQL} 3.23.2 �����Ǥ�����ϡ�HEAP �ơ��֥뤬 
@code{tmp_table_size} �Υ�������ۤ���ȡ����顼 @code{The table tbl_name is full}
���Ф뤳�ȤǤ�������桹�ϡ�ɬ�׻��˥��� (HEAP) �ơ��֥��ǥ������١�
�� (NISAM) �ơ��֥�˼�ưŪ���ѹ����뤳�Ȥˤ�ꡢ����������ޤ�������
�������򤹤뤿�ᡢ@code{mysqld} �ؤ� @code{tmp_table_size} ���ץ�����
���ϥ��饤�����¦�� SQL ���ץ���� @code{SQL_BIG_TABLES} �����äǤ��ޤ���
@xref{SET OPTION, , @code{SET OPTION}}.
@strong{MySQL} 3.20 �Ǥϡ�����ơ��֥�κ��祵������ 
@code{recordbuffer*16} �Ǥ��������Τ��ᡢ���ΥС���������Ѥ��Ƥ���ȡ�
@code{recordbuffer} ���ɲä���ɬ�פ�����ޤ��� @code{mysqld} �� @code{--big-tables} ��
���Ϥ��뤳�Ȥǡ���˰���ơ��֥��ǥ�������˳�Ǽ�Ǥ��ޤ��������������
¿����ʣ���ʥ������®�٤˱ƶ����ޤ���

@item
�ۤȤ�ɤΥꥯ�����Ȥϡ�1,2�Ĥΰ���ե�����Ȥ鷺���ʥ����ȥХåե��ؤγ�����Ƥ�Ԥ��ޤ���
@xref{Temporary files}.

@item
�ѷ��ȱ黻���˻��Ѥ����ۤȤ�����ƤΥ���ϥ���������ꥹ�ȥ���ǹ�
�ʤ��ޤ��������ʹ��ܤ�ɬ�פȤ������ꥪ���С��إåɤϤʤ����̾����
������������/���������򤵤�ޤ��������ͽ�����ʤ��礭��ʸ����ˤ�
��������Ƥ��ޤ�(����� @code{malloc()} �� @code{free()} �ǹԤʤ��ޤ�)��

@item
�ƥ���ǥå����ե�����ϰ��٥����ץ󤵤졢�ǡ����ե�����ϳ�Ʊ���¹ԥ����
����˰��٥����ץ󤵤�ޤ�����Ʊ������åɤˤϡ��ơ��֥빽¤���ƥե�����ɤι�¤����
�� @code{3 * n} �Υ������ΥХåե���������Ƥ��ޤ���
( @code{n} �� @code{BLOB} ���Υե�����ɤ�Ĺ����ޤ�ʤ�����쥳���ɤκ���Ĺ�Ǥ� )
@code{BLOB} �� 5 ���� 8 �Х��� + @code{BLOB} �ǡ�����Ĺ������Ѥ��ޤ���

@item
@code{BLOB} ����ijƥơ��֥�Ǥϡ�����礭�� @code{BLOB} ���ɤ߹��ߤǥХåե�
��ưŪ�˳��礵��ޤ����ơ��֥�Υ������򤹤��硢������Ƥ�줿�Хåե��Ϻ�
���礭�� @code{BLOB} ��Ʊ���礭���ˤʤ�ޤ���

@item
���Ƥλ��Ѥ���Ƥ���ơ��֥�Υơ��֥�ϥ�ɥ顼�ϥ���å��������¸���졢
FIFO �Ȥ��ƴ�������ޤ���
�̾����å���� 64 �ĤΥơ��֥�Ǥ����ơ��֥뤬 2 �Ĥμ¹Ԥ��Ƥ��륹
��åɤ�Ʊ���˻��Ѥ�����硢����å�����˥ơ��֥�� 2 �ĤΥ���ȥ꤬
����ޤ���
@xref{Table cache}.

@item
@code{mysqladmin refresh} �ϻ��Ѥ���Ƥ��ʤ����ƤΥơ��֥�򥯥���������
���Ѥ���Ƥ������ƤΥơ��֥�򡢼¹��楹��åɤ����ä����˥������������
���˥ޡ������ޤ��������¿���λ��ѥ�����������Τ�ͭ���Ǥ������ƤΥ�
���ե�����⥯�������Ⱥƥ����ץ󤵤�ޤ���
@end itemize

@strong{mysqld} �¹Ի���@code{ps} ��¾�Υץ������ϡ����줬¿���Υ���
����Ѥ��Ƥ������𤹤�Ǥ��礦������ϰۤʤä����ꥢ�ɥ쥹��Υ����
�ɥ����å��ˤ�ä�ȯ�����ޤ����㤨�С�Solaris ps �ϥ����å��֤�̤���ѥ�
������ѥ���Ȥ��Ʒ׻����ޤ���'swap -s' ��ͭ���ʥ���åפ�����å���
�뤳�ȤǤ����Τ�����ޤ����桹�ϻ��ΤΥ���꡼�����Хץ������� 
@code{mysqld} ��ƥ��Ȥ��ޤ��������Τ��ᡢ����꡼������������ޤ���

@node Internal locking, Table locking, Memory use, System
@subsection @strong{MySQL} �ϤɤΤ褦�˥ơ��֥����å����뤫

@strong{MySQL} �����ƤΥ��å��ϥǥåɥ��å��ե꡼�Ǥ�������ϡ���˥���
�곫�ϻ��˰��٥��å���ɬ�פȤ������Ƥ��׵ᤷ�����Ʊ����ǥơ��֥�����
�����뤳�ȤǴ�������ޤ���

@strong{MySQL} �����Ѥ��� @code{WRITE} ���å��ϼ��Τ褦��Ư���ޤ�:

@itemize @bullet
@item
�ơ��֥��˥��å����ʤ���� write ���å����֤��ޤ���
@item
�����Ǥʤ���� write ���å����塼�˥��å����֤��ޤ���
@end itemize

@strong{MySQL} �� @code{READ} ���å��ϼ��Τ褦��ư���ޤ�:

@itemize @bullet
@item
�ơ��֥��� write ���å����ʤ���� read ���å����֤��ޤ���
@item
�����Ǥʤ���� read ���å����塼�˥��å����֤��ޤ���
@end itemize

���å����������줿�Ȥ����ǽ�� write ���å����塼��Υ���åɤˡ����θ� 
read ���å����塼��Υ���åɤ˥��å���Ϳ���ޤ���

����ϡ�Ʊ���ơ��֥��¿���ι����򤹤��硢@code{SELECT} ��ʸ�� 
update ���ʤ��ʤ�ޤ��Ԥ�����뤳�Ȥ��̣���ޤ���

Ʊ���ơ��֥��¿���� @code{INSERT} ��¿���� @code{SELECT} ��Ԥ���硢������褹���
�ϡ�¾�Υơ��֥�˹Ԥ��������ơ����ޤˡ����ΰ���ơ��֥뤫�����ƤΥ쥳��
�ɤ�⤦�����Υơ��֥�� update ���ޤ���

����ϼ��Υ����ɤǹԤ��ޤ�:
@example
mysql> LOCK TABLES real_table WRITE, insert_table WRITE;
mysql> insert into real_table select * from insert_table;
mysql> delete from insert_table;
mysql> UNLOCK TABLES;
@end example

��ޤ꤭�ä�������ͥ�踢��Ϳ���뤿�ᡢ@code{INSERT} ��ʸ�� @code{LOW_PRIORITY} �� @code{HIGH_PRIORITY} ���ץ���󤬻��ѤǤ��ޤ���
@xref{INSERT, , @code{INSERT}}.

��ĤΥ��塼��������Ѥ���褦�� @file{mysys/thr_lock.c} ��Υ��å������ɤ��ѹ�
���뤳�Ȥ�Ǥ��ޤ������ξ�硢�����Ĥ��Υ��ץꥱ�������Τ���ˡ�
write ���å��� read ���å���Ʊ��ͥ���̤ˤ��ޤ���

@node Table locking,  , Internal locking, System
@subsection �ơ��֥롦���å��󥰤�����

@strong{MySQL} �Υơ��֥롦���å��󥰤Υ����ɤϥǥåɥ��å����ե꡼�Ǥ���

@strong{MySQL} �ϤȤƤ�®�����å����ԡ��ɤ����뤿��ˡ�
(�쥳���ɤΥ��å���ե�����ɤΥ��å��������) �ơ��֥�Υ��å�����Ѥ��ޤ���
�礭�ʥơ��֥�ˤϡ� �ơ��֥�Υ��å��ϥ쥳���ɤΥ��å����Ϥ뤫���ɤ��Ǥ�����
�����Ĥ�����Ȥ��꤬����ޤ���

@strong{MySQL} 3.23.7 �ʾ�Ǥϡ����륹��åɤ� @code{MyISAM} �ơ��֥���ɤ�Ǥ������ˡ�
Ʊ���ơ��֥�˥쥳���ɤ�������������Ǥ��ޤ���
����ϸ��ߡ�������ʤ����ˤΤ�ư���ޤ���

�ơ��֥�Υ��å��Ϥ�������Υ���åɤ�Ʊ���ˤ���ơ��֥뤫���ɤ߽Ф��Τ��ǽ�ˤ��ޤ�����
�⤷���륹��åɤ�����ơ��֥���Ф�������׵��Ф���硢
����Ϥޤ��ǽ����¾Ū�ʥ������������ʤ���Фʤ�ޤ���.
���ι����δ֡���������λ����ޤǡ���������Υơ��֥�˥����������褦�Ȥ���
¾�����ƤΥ���åɤ��Ԥ�����뤳�Ȥˤʤ�ޤ���

�̾�ǡ����١����ι����� @code{SELECT} ������פȤ���뤿�ᡢ
�ơ��֥�򹹿��������ƤΥ���åɤ����ơ��֥뤫�����򸡺����륹��åɤ���
�⤤ͥ���̤�����ޤ��� ����� ��������Υơ��֥���Ф��ơ�¿���νŤ������꤬ȯ�Ԥ���
�����ˡ� �������Դ����˽����ʤ����Ȥ�μ¤ˤ��뤿��Ǥ���

@strong{MySQL 3.23.7} ���顢@code{max_write_lock_count} �ѿ������ѤǤ��ޤ���
����ϡ���ĤΥơ��֥���Ф��ơ����ꤵ�줿������� INSERT ���Ԥ�줿��ˡ�
@code{SELECT} ��ȯ�Ԥ���褦�ˤ��ޤ���

����1�Ĥμ�����꤬�ʲ��Ǥ���

@itemize @bullet
@item
���륯�饤����Ȥ��¹Ԥ�Ĺ�����֤Τ����� @code{SELECT} ��ȯ�ԡ�
@item
���θ�ˡ�¾�Υ��饤����Ȥ������Ѥ���Ƥ���ơ��֥���Ф� @code{UPDATE} ��ȯ�ԡ�
���Υ��饤����Ȥ���� @code{SELECT} ����λ����ޤ��Ԥ��ޤ�
@item
�����¾�Υ��饤����Ȥ�Ʊ���ơ��֥���Ф��� @code{SELECT} ��ʸ��ȯ�ԡ�
@code{UPDATE} �� @code{SELECT} ����⤤ͥ���٤���ĤΤǡ�
���� @code{SELECT} ����� @code{UPDATE} ����λ����ޤ��Ԥ��ޤ���
����ϰ��ֺǽ�� @code{SELECT} �� ��λ����ޤ��Ԥ�����ޤ���
@end itemize

��������Τ����Ĥ��β�ǽ�ʲ��ϰʲ����̤�Ǥ���

@itemize @bullet
@item
@code{SELECT} ��ʸ��®���¹ԤǤ���褦�˻�ߤޤ��� �����Ԥ��ˤ����ꡢ
�����Ĥ��Υ��ޥ꡼�ơ��֥��������ʤ���Фʤ�ʤ����⤷��ޤ���.

@item
@code{mysqld} �� @code{--low-priority-updates} ���ץ����ǵ�ư��
��������ƤΤ���ơ��֥�򹹿����빽ʸ���Ф��ơ� @code{SELECT} ��ʸ����
�㤤ͥ���٤�Ϳ���ޤ��� ���ξ�硢���ҤΥ��ʥꥪ��κǸ�� @code{SELECT} ��ʸ��
@code{INSERT} ��ʸ����λ�������˼¹Ԥ���ޤ���

@item
@code{LOW_PRIORITY} °��������Ѥ��ơ� @code{INSERT},@code{UPDATE},@code{DELETE} ��ʸ
���㤤ͥ���٤�Ϳ���뤳�Ȥ����ޤ���

@item
Start @code{mysqld} with a low value for @strong{max_write_lock_count} to give
@code{READ} locks after a certain number of @code{WRITE} locks.

@item
SQL ���ޥ�ɤ� @code{SET SQL_LOW_PRIORITY_UPDATES=1} ����Ѥ��ơ�
��������Υ���åɤ�������Ƥι������㤤ͥ���٤˻��ꤹ������Ǥ��ޤ���
@xref{SET OPTION, , @code{SET OPTION}}.

@item
@code{HIGH_PRIORITY} °�����Ѥ��ơ������ @code{SELECT} ���ȤƤ���פǤ����
���ꤹ�뤳�Ȥ���ǽ�Ǥ���. @xref{SELECT, , @code{SELECT}}.

@item
�⤷ @code{INSERT} �� @code{SELECT} �򤢤碌�ƻ��Ѥ����������꤬��������硢
������ @code{MyISAM} �ơ��֥���ڤ��ؤ��ޤ��� ����� @code{SELECT}
�� @code{INSERT} ��Ʊ���˹Ԥ��ޤ���

@item
�⤷ @code{INSERT} �� @code{SELECT} ��ʸ���˺��ߤ�����Τʤ顢
@code{INSERT} �� @code{DELAYED} °������Ϥ���������褵����Ǥ��礦��
@xref{INSERT, , @code{INSERT}}.

@item
�⤷ @code{SELECT} �� @code{DELETE} �����꤬����ʤ顢
@code{DELETE} �� @code{LIMIT} ���ץ���󤬽����ˤʤ�Ǥ��礦��
 @xref{DELETE, , @code{DELETE}}.
@end itemize

@node Data size, MySQL indexes, System, Performance
@section ��ǽ�ʸ¤�ǡ����򾮤�������

One of the most basic optimization is to get your data (and indexes) to
take as little space on the disk (and in memory) as possible. This can
give huge improvements because disk reads are faster and normally less
main memory will be used. Indexing also takes less resources if
done on smaller columns.

@strong{MySQL} supports a lot of different table types and row formats.
Choosing the right table format may give you a big performance gain.
@xref{Table types}.

�ʲ��˵󤲤�ƥ��˥å�����Ѥ���С��ơ��֥�ǤΥѥե����ޥ󥹤θ��塢
��¸�ΰ�ν̾�������ǽ�Ǥ��礦��

@itemize @bullet
@item
��ǽ�ʤ�С����־����ʷ�����Ѥ��ޤ��� @strong{MySQL} ��
�ǥ������ȥ��꡼�����󤹤�¿���η�����äƤ��ޤ���
@item
��꾮�������������ǽ�ʤ�л��Ѥ��ޤ��� �㤨�С�
@code{MEDIUMINT} �� @code{INT} ����ɤ��Ǥ��礦��
@item
��ǽ�ʤ�ե�����ɤ� @code{NOT NULL} ��������Ƥ�����������������Ƥ���®������
�ƥե���������1�ӥåȤ����󤷤ޤ���
Note that if you really need
@code{NULL} in your application you should definitely use it. Just avoid
haveing it on all columns by default.
@item
����Ĺ�Υե������ (@code{VARCHAR}, @code{TEXT}, @code{BLOB}) ������ʤ����ϡ�
���ꥵ�����쥳���ɷ��������Ѥ���ޤ���
����Ϥ��ʤ�®���Ǥ��������������ˤ������餫���ΰ��ϲ�񤷤ޤ���
@xref{MyISAM table formats}.
@item
���줾��Υơ��֥�ϲ�ǽ�ʸ¤�û���ץ饤�ޥꡦ����ǥå�������Ĥ٤��Ǥ���
����ϣ��쥳���ɤ��դˤ�����ΨŪ�ˤ��ޤ���
@item
���줾��Υơ��֥�ˤĤ��ơ��ɤΥơ��֥�η�������Ѥ��뤫��
���ޤ��� @xref{Table types}.
@item
������ɬ�פ�ʪ�ˤ�������ǥå�����������ޤ���
����ǥå����ϸ����ˤ��ɤ��Ǥ��������®����¸���������ˤ��ɤ�����ޤ���
�⤷�ơ��֥��ե�����ɤ��Ȥ߹�碌�ǥ��������뤳�Ȥ��ۤȤ�ɤǤ���С�
�����˥���ǥå�����������ޤ��� �ǽ�Υ���ǥå�������ʬ�ϡ���äȤ�
���Ѥ����ե�����ɤˤ��٤��Ǥ���
If you are
ALWAYS using many columns you should use the column with more duplicates
first to get better compression of the index.
@item
�⤷����ǥå�����Ƭ����β�ʸ�����ǰ��������äƤ���ʤ顢������ʬ�ˤ���
����ǥå�����ĥ�������ɤ��Ǥ��礦�� @strong{MySQL} ��ʸ����ե�����ɤ�
����ʬ���Ф��ƤΥ���ǥå����򥵥ݡ��Ȥ��ޤ���
û������ǥå����ϡ��ǥ��������ڡ��������󤹤�����Ǥʤ���
����ǥå����Υ���å���˼��ޤ�䤹���ʤ뤳�Ȥˤ�ꡢ�ǥ��������������⾯�ʤ��ʤ�Τǡ�
®���ʤ�ޤ��� @xref{Server parameters}.
@item
�����Ĥ��ξ������ǡ��ȤƤ�褯���������ơ��֥�򣲤Ĥ�ʬ�䤹�뤳�Ȥϡ�
���פˤʤ뤳�Ȥ�����ޤ���
This is especially true if it is a dynamic
format table and it is possible to use a smaller static format table that
can be used to find the relevant rows when scanning the table.
@end itemize

@node MySQL indexes, Query Speed, Data size, Performance
@section MySQL �ϤɤΤ褦�˥���ǥå�������Ѥ��뤫��

Indexes are used to find rows with a specific value of one column
fast. 
����ǥå������ʤ���硢@strong{MySQL} �ϡ����Υ쥳���ɤ����Ĥ���ޤǡ�
�ǽ�Υ쥳���ɤ���ơ��֥��ʤ�Ƥ����ޤ��� �礭�ʥơ��֥�Ǥ�¿����
��֤�������ޤ��� �⤷�䤤��碌����˥���ǥå�������ä��ե�����ɤ�
�����硢@strong{MySQL} �����ƤΥǡ�����ߤ뤳�Ȥʤ����ǡ���������ΰ��֤�®��
���뤳�Ȥ��Ǥ��ޤ��� �⤷����ơ��֥뤬1000�쥳���ɻ��äƤ����Ȥ���ȡ�
���֤�Ƭ����ʤ�Ƥ������Ȥ���٤ơ�����Ͼ��ʤ��Ȥ�100��®�����Ȥ�
�ʤ�ޤ��� Note that is you need to access almost all 1000
rows it is faster to read sequentially because we then avoid disk seeks.

���Ƥ� @strong{MySQL} ����ǥå���, @code{PRIMARY}, @code{UNIQUE} ������ @code{INDEX()} 
�� B tree �˳�Ǽ����ޤ���ʸ����ϼ�ưŪ�˻Ϥ�Ƚ���ζ��򤬰��̤���ޤ���
@xref{CREATE INDEX, , @code{CREATE INDEX}}.

Indexes are used to:
@itemize @bullet
@item
@code{WHERE}��˥ޥå������Ԥ����ᤤ����

@item
join ��¹Ԥ����Ȥ���¾�Υơ��֥뤫��ιԤθ���

@item
Ϳ����줿�ե�����ɤ� @code{MAX()} �� @code{MIN()} �ͤγ��Ф�

@item
�ơ��֥�򥽡��Ȥ����롼�ײ�������ǡ�������(���롼�ײ�)�����ֺ�(��Ƭ��)��
��������Ѥ��ƹԤ�����(�㤨�� @code{ORDER BY key_part_1,key_part_2 })��
�⤷ @code{DESC} ���꤬����С����ƤΥ����ϵս���ɤޤ�ޤ���

The index can also be used even if the @code{ORDER BY} doesn't match the index
exactly, as long as all the not used index parts and all the extra
are @code{ORDER BY} columns are constants in the @code{WHERE} clause. The
following queries will use the index to resolve the @code{ORDER BY} part.

@example
SELECT * FROM foo ORDER BY key_part1,key_part2,key_part3;
SELECT * FROM foo WHERE column=constant ORDER BY column, key_part1;
SELECT * FROM foo WHERE key_part1=const GROUP BY key_part2;
@end example

@item 
�ǡ����ե�����򻲾Ȥ��뤳�Ȥʤ��ͤ򸡺������硣
�⤷���Ѥ������ƤΥե�����ɤ����ͤǤ��ġ����ֺ�����(��Ƭ������)��������������硢
�ͤϥ���ǥå����ĥ꡼���鸡�����졢����ϤȤƤ�®���ʤ�ޤ���

@end itemize

�ʲ��Τ褦�� @code{SELECT} ʸ��ȯ�Ԥ����Ȥ��ޤ���

@example
mysql> SELECT * FROM tbl_name WHERE col1=val1 AND col2=val2;
@end example

�⤷ @code{col1} �� @code{col2} ��ʣ���ե�����ɥ���ǥå������������Ƥ����硢
�����˻פä��Ȥ���η�̤������ޤ���
If separate single-column
indexes exist on @code{col1} and @code{col2}, the optimizer tries to
find the most restrictive index by deciding which index will find fewer
rows and using that index to fetch the rows.

@cindex Indexes, leftmost prefix of
@cindex Leftmost prefix of indexes
�⤷�ơ��֥뤬ʣ���ե�����ɥ���ǥå�������Ĥʤ顢����ǥå�������Ƭ�����ֺ�����ʬ
���쥳���ɤ򸫤Ĥ��뤿��κ�Ŭ���˻��Ѥ���ޤ����㤨�С�3�ĤΥե������
 @code{(col1,col2,col3)} ���Ф��ư�ĤΥ���ǥå�������äƤ����Ȥ��ޤ���
����ȡ������ @code{(col1)}, @code{(col1,col2)} ,
@code{(col1,col2,col3)} �ǥ���ǥå���������������ޤ���

�⤷���ֺ��˻��ꤷ�Ƥ���ե�����ɤ�����ǥå�����������Ƥ��ʤ��ʤ顢
@strong{MySQL} ����ʬŪ�ʥ���ǥå�������Ѥ��ޤ���

�ʲ��Τ褦�� @code{SELECT} ʸ��ȯ�Ԥ����Ȥ��ޤ���

@example
mysql> SELECT * FROM tbl_name WHERE col1=val1;
mysql> SELECT * FROM tbl_name WHERE col2=val2;
mysql> SELECT * FROM tbl_name WHERE col2=val2 AND col3=val3;
@end example

�⤷����ǥå����� @code{(col1,col2,col3)} �ˤ���ʤ�С�
��˼������ǽ�Υ��������������ǥå�������Ѥ��ޤ��������ܻ����ܤΥ������
����ǥå�������ĥե�����ɤ�ȯư���ޤ�����
@code{(col2)} �� @code{(col2,col3)} �ϡ�@code{(col1,col2,col3)} ��
��Ƭ�����ֺ��˻��ꤵ��Ƥ��ޤ���

@findex LIKE, and indexes
@findex LIKE, and wildcards
@cindex Indexes, and @code{LIKE}
@cindex Wildcards, and @code{LIKE}
@strong{MySQL} �ϡ��⤷  @code{LIKE} ���磻��ɥ����ɤ���ϤޤäƤ��ʤ��ơ�
�������ꤵ�줿ʸ���ǻϤޤäƤ���ʤ顢
@code{LIKE} ��ɾ���˥���ǥå�������Ѥ��ޤ���
�㤨�С��ʲ��� @code{SELECT} ʸ�ϥ���ǥå�������Ѥ��ޤ�:

@example
mysql> select * from tbl_name where key_col LIKE "Patrick%";
mysql> select * from tbl_name where key_col LIKE "Pat%_ck%";
@end example

����ܤ�ʸ�ϡ�@code{"Patrick" <= key_col < "Patricl"} �Ȥʤ�쥳���ɤ�������θ����ޤ���
����ܤ�ʸ�ϡ�@code{"Pat" <= key_col < "Pau"} �Ȥʤ�쥳���ɤ�������θ����ޤ���

�ʲ��� @code{SELECT} ʸ�ϥ���ǥå�������Ѥ��ޤ���:
@example
mysql> select * from tbl_name where key_col LIKE "%Patrick%";
mysql> select * from tbl_name where key_col LIKE other_col;
@end example

�ǽ��ʸ�ϡ�@code{LIKE} ���磻��ɥ�����ʸ���ǻϤޤäƤ��ޤ���
����ܤ�ʸ�ϡ�@code{LIKE} ������ǤϤ���ޤ���

@findex IS NULL, and indexes
@cindex Indexes, and @code{IS NULL}
Searching using @code{column_name IS NULL} will use indexes if column_name
is an index.

@strong{MySQL} ���̾���־��ʤ��쥳���ɿ��򸫤Ĥ��륤��ǥå�������Ѥ��ޤ���
����ǥå����ϡ��ʲ��˼����黻�Ҥ��Ѥ�����ӤǤ���ե�����ɤ��Ф��ơ����Ѥ���ޤ���
@code{=}, @code{>}, @code{>=}, @code{<}, @code{<=}, @code{BETWEEN} ������
@code{'something%'} ���ͤ�Ƭ�˥磻��ɥ����ɤ��ʤ� @code{LIKE}��

@code{WHERE} ��������Ƥ� @code{AND} �ˤ�����ʤ�����ǥå����ϡ�
����������κ�Ŭ���˻��Ѥ���ޤ���
In other words:  To be able to use an
index, a prefix of the index must be used in every @code{AND} group.

�ʲ��� @code{WHERE} ��ϥ���ǥå�������Ѥ��ޤ���
@example
... WHERE index_part1=1 AND index_part2=2 AND other_column=3
... WHERE index=1 OR A=10 AND index=2      /* index = 1 OR index = 2 */
... WHERE index_part1='hello' AND index_part_3=5
          /* optimized like "index_part1='hello'" */
... WHERE index1=1 and index2=2 or index1=3 and index3=3;
          /* Can use index on index1 but not on index2 or index 3 */
@end example

�ʲ��� @code{WHERE} ��ϥ���ǥå�����@strong{���Ѥ��ޤ���}��
@example
... WHERE index_part2=1 AND index_part3=2  /* index_part_1 is not used */
... WHERE index=1 OR A=10                  /* Index is not used in both AND parts */
... WHERE index_part1=1 OR index_part2=10  /* No index spans all rows */
@end example

@node Query Speed, Tips, MySQL indexes, Performance
@section �ǡ����򥢥��������������륯�����®��

�ǽ�ˡ����ƤΥ�����˱ƶ������Ĥλ�����Τ٤ޤ���
���ʣ���ʸ��¤������Ԥ��ȡ������С��إåɤ�¿���ʤ�ޤ���

�⤷���ʤ��������ʤ� @code{GRANT} ʸ��ԤäƤ��ʤ���С�
@strong{MySQL} �ϥѡ��ߥå����θ����򾯤�������Ŭ�����ʤ��Ǥ��礦��
So if you have a very high volume it
may be worth the time to avoid grants. Otherwise more permission check
results in a larger overhead.

�⤷ @strong{MySQL} �ؿ��Τ����Τ��μ¤����������������Ƥ���Τʤ�С�
��� @strong{MySQL} ���饤�����¦�ϰʲ��Τ褦�ˤʤ�ޤ���

@example
mysql> select benchmark(1000000,1+1);
+------------------------+
| benchmark(1000000,1+1) |
+------------------------+
|                      0 |
+------------------------+
1 row in set (0.32 sec)
@end example

�����Ǥ� @strong{MySQL} �� 1,000,000 @code{+} ���� 0.32 �äǼ¹ԤǤ��Ƥ��ޤ�
(����ʤ� @code{PentiumII 400MHz} �ޥ����)��

���Ƥ� @strong{MySQL} �ؿ��Ϻ�Ŭ������Ƥ��ޤ�����
�����Ĥ����㳰�����뤫�⤷��ޤ���
@code{benchmark(loop_count,expression)}�Ϥ��ʤ��Υ������
����򸫤Ĥ��뤿��ΤȤƤ�褤�ġ���Ǥ���

@menu
* Estimating performance::      Estimating query performance
* SELECT speed::                Speed of @code{SELECT} queries
* Where optimizations::         How MySQL optimizes @code{WHERE} clauses
* LEFT JOIN optimization::      How MySQL optimizes @code{LEFT JOIN}
* LIMIT optimization::          How MySQL optimizes @code{LIMIT}
* Insert speed::                Speed of @code{INSERT} queries
* Update speed::                Speed of @code{UPDATE} queries
* Delete speed::                Speed of @code{DELETE} queries
@end menu

@node Estimating performance, SELECT speed, Query Speed, Query Speed
@subsection ���������ǽɾ��

�ۤȤ�ɤξ�硢�ǥ�������������������뤳�ȤǤ��������Υѥե����ޥ󥹤�ͽ¬�Ǥ��ޤ���
�����ʥơ��֥�Ǥϡ��̾1��Υǥ��������������ǥ쥳���ɤ򸫤Ĥ����Ǥ��礦
(����ǥå��������֤󥭥�å��夵���Τ�)�� �礭�ʥơ��֥�Ǥϡ�
�����褽��ͽ¬�Ȥ��ơ�(B++ �ĥ꡼����ǥå�������Ѥ��Ƥ�����)��
@code{log(row_count) /
log(index_block_length / 3 * 2 / (index_length + data_pointer_length)) +
1} ��������1�쥳���ɤ򸫤Ĥ���Τ�ɬ�פȤʤ�Ǥ��礦��

@strong{MySQL} �Ǥϡ�����ǥå������֥��å����̾� 1024 �Х��Ȥǡ�
�ǡ������ݥ��󥿡����̾� 4 �Х��ȤǤ��� ����ϡ�
����ǥå���Ĺ�� 3 (medium integer) ���ǡ����� 500,000 �쥳���ɤ���ơ��֥�Ǥϡ� 
@code{log(500,000)/log(1024/3*2/(3+4)) + 1} = 4 �������Ȥʤ�ޤ���

As the above index would require about 500,000 * 7 * 3/2 = 5.2M,
(assuming that the index buffers are filled to 2/3 (which is typical) )
you will probably have much of the index in memory and you will probably
only need 1-2 calls to read data from the OS to find the row.

�񤭹��߻��ˤϡ���ξ�硢����������ǥå�����񤭹�������
õ���Ф��Τˡ�4 �����������ꡢ����ˡ��̾����ǥå����򹹿�����
�쥳���ɤ�񤯤Τ� 2 ������ɬ�פǤ���

Note that the above doesn't mean that your application will slowly
degenerate by N log N!  As long as everything is cached by the OS or SQL
server things will only go marginally slower while the table gets
bigger. After the data gets too big to be cached, things will start to
go much slower until your applications is only bound by disk-seeks
(which increase by N log N). To avoid this, increase the index cache as
the data grows. @xref{Server parameters}.

@node SELECT speed, Where optimizations, Estimating performance, Query Speed
@subsection @code{SELECT} �������®��

�̾�٤� @code{SELECT ... WHERE} ��®������ˤϡ�
�ޤ��ǽ�˥���ǥå��������뤫�ɤ���������å����ޤ���@xref{MySQL 
indexes, , @strong{MySQL} indexes}. 
�㤦�ơ��֥�򻲾Ȥ�����ˤϡ����̤ϥ���ǥå�����Ȥ�ʤ��٤��Ǥ���
@code{EXPLAIN} ���ޥ�ɤ���Ѥ���С�@code{SELECT} �ǤɤΥ���ǥå�����
���Ѥ���Ƥ��뤫��ǧ�Ǥ��ޤ���
@xref{EXPLAIN, , @code{EXPLAIN}}.

Some general tips:

@itemize @bullet
@item
To help @strong{MySQL} optimize queries better, run @code{myisamchk
--analyze} on a table after it has been loaded with relevant data. This
updates a value for each index part that indicates the average number of
rows that have the same value.  (For unique indexes, this is always 1,
of course.).  @strong{MySQL} will use this to decide which index to
choose when you connect two tables with 'a non-constant expression'.
You can check the result from the @code{analyze} run by doing @code{SHOW
INDEX FROM table_name} and examining the @code{Cardinality} column.

@item
����ǥå����ȥǡ����򥤥�ǥå�����˽��äƥ����Ȥ���ˤϡ�
@code{myisamchk --sort-index --sort-records=1} ����Ѥ��ޤ�
(�⤷ �����ܤΥ���ǥå�����˥����Ȥ���ʤ�)�� 
If you
have a unique index from which you want to read all records in order
according to that index, this is a good way to make that faster. 
�����������Υ�������ˡ�Ϻ�Ŭ���֤ǤϽ񤫤줺���ޤ��礭�ʥơ��֥�Ǥ�
¿���λ��֤������뤳�Ȥ����դ��Ƥ���������
@end itemize

@cindex Optimizations
@node Where optimizations, LEFT JOIN optimization, SELECT speed, Query Speed
@subsection MySQL �ϤɤΤ褦�� @code{WHERE} ����Ŭ�����뤫��

@code{WHERE} �κ�Ŭ���ϡ�@code{WHERE} ���ۤȤ�� @code{SELECT} �ǻ��Ѥ���뤿�ᡢ
@code{SELECT} ���֤���Ƥ��ޤ��� ��������Ʊ����Ŭ����
@code{DELETE} �� @code{UPDATE} ʸ�Ǥ���Ѥ���ޤ���

���Υ��������κ�Ŭ���������Ϥޤ��Խ�ʬ�Ǥ���
�ʤ��ʤ顢 @strong{MySQL} �ϤȤƤ�¿���κ�Ŭ����ԤäƤ��ꡢ
��������ƤˤĤ��Ƥ�������񤱤���֤����桹�ϤȤ�ޤ���

@strong{MySQL}�ˤ���Ŭ���Τ����Ĥ���ʲ��˼����ޤ�:

@itemize @bullet
@item
��̤ν��� (���Ƥ���ɬ�פʳ�̤Ϻ������ޤ�):
@example
   ((a AND b) AND c OR (((a AND b) AND (c AND d))))
-> (a AND b AND c) OR (a AND b AND c AND d)
@end example
@item
������ݻ�:
@example
   (a<b AND b=c) AND a=5
-> b>5 AND b=c AND a=5
@end example
@item
������ν��� (����ݻ��Τ����ɬ�פȤ���ޤ�):
@example
   (B>=5 AND B=5) OR (B=6 AND 5=5) OR (B=7 AND 5=6)
-> B=5 OR B=6
@end example
@item
����ǥå����˻��Ѥ�������Ƥ�ɽ���ϰ��٤���ɾ������ޤ���
@item
��ĤΥơ��֥��� @code{WHERE} ���ʤ� @code{CONST(*)} �ϡ��ơ��֥뤫��
ľ�ܼ��Ф���ޤ�������Ϥޤ�Ʊ����ﲼ�Ǥ�Ǥ�դ� @code{NOT NULL} ɽ��
�Τ���ˤ�Ԥ��ޤ���
@item
���������ɽ�����᤯���Ф���ޤ���
@strong{MySQL} ���Բ�ǽ��  @code{SELECT} ��ʸ�����᤯���Ĥ���0 �Ԥ��̤Ȥ����֤��ޤ���
@item
@code{GROUP BY} �ޤ��� group �ؿ� (@code{COUNT()}, @code{MIN()}...) ����Ѥ��ʤ����ϡ�
@code{HAVING} �� @code{WHERE} �ȥޡ�������ޤ���
@item
�ƥ��ַ��ˤĤ��Ƥ�®�� @code{WHERE} ɾ�������뤿��ˡ��ޤ�����ǽ�ʸ¤�
�᤯�쥳���ɤ򥹥��åפ��뤿��ˡ��ƥ��ַ��ˤĤ��Ƥ���ñ�� 
@code{WHERE} �����ۤ���ޤ���
@cindex Constant table
@cindex Table, constant
@item
���Ƥ�����ơ��֥�򥯥��꡼���¾�Υơ��֥�������ɤߤޤ���
����ơ��֥�ϼ��Ǥ�:
@itemize @minus
@item
0 �ޤ��� 1 �ԤΥơ��֥롣
@item
@code{WHERE} ��� @code{UNIQUE} ����ǥå����� @code{PRIMARY KEY} �����Ѥ��줿�ơ��֥�ǡ�
���ġ����ƤΥ���ǥå�����������ǻ��Ѥ���Ƥ��ơ�
���ġ�����ǥå����Υѡ��Ȥ� @code{NOT NULL} ���������Ƥ���ơ��֥롣
@end itemize
�ʲ��Υơ��֥�Τ褦�������������Ѥ���ơ��֥�:
@example
mysql> SELECT * FROM t WHERE primary_key=1;
mysql> SELECT * FROM t1,t2
           WHERE t1.primary_key=1 AND t2.primary_key=t1.id;
@end example

@item
�ơ��֥���礹�뤿��˺��ɤη����ȹ礻�򸫤Ĥ��ޤ������Ƥβ�ǽ������ ��
@code{ORDER BY} �ޤ��� @code{GROUP} ������ƤΥե�����ɤ�Ʊ���ơ��֥�ξ��ϡ�
���Υơ��֥�Ϸ����˺ǽ��ͥ�褵��ޤ���
@item
@code{ORDER BY} ��� @code{GROUP BY} �᤬�����硢�ޤ��� @code{ORDER BY} �� @code{GROUP BY} ����祭�塼
��κǽ�Υơ��֥�ǤϤʤ�¾�Υơ��֥뤫��ι��ܤ�ޤ��硢����ơ��֥뤬��������ޤ���
@item
�⤷ @code{SQL_SMALL_RESULT} ����Ѥ���ʤ�, @strong{MySQL} �ϥ��꡼��ΰ켡�ơ��֥��
���Ѥ��ޤ�
@item
@code{DISTINCT} �ϡ����ƤΥե�����ɤ��Ф��� @code{GROUP BY} ���Ѵ�����뤿�ᡢ
@code{ORDER BY} �ȹ�路�� @code{DISTINCT} ��¿���ξ��ǰ���ơ��֥뤬
ɬ�פˤʤ�ޤ���
@item
�ƥơ��֥�Υ���ǥå����ϥ����ꤵ�졢������Ԥ� 30% ̤�����������ʤ����ɤΥ���ǥå��������Ѥ���ޤ���
���Τ褦�ʥ���ǥå��������Ĥ����ʤ���硢���ᤤ�ơ��֥������(quick table scan)�����Ѥ���ޤ���
@item
Ʊ���褦�ˡ�@strong{MySQL} �ϥǡ����ե������������Ĵ�٤Ϥ��ʤ�����ǥå�������
�쥳���ɤ��ɤळ�Ȥ���ǽ�Ǥ����⤷���ƤΥե�����ɤ����ͷ��Υ���ǥå����ʤ顢
����ǥå����ĥ꡼������������β��˻��Ѥ���ޤ���
@item
�ƥ쥳���ɤ����Ϥ�������ˡ�@code{HAVING} ���Ŭ�礹���Τ򥹥��åפ��ޤ���
@end itemize

�ʲ��ϤȤƤ�®�����������Ǥ�:

@example
mysql> SELECT COUNT(*) FROM tbl_name;
mysql> SELECT MIN(key_part1),MAX(key_part1) FROM tbl_name;
mysql> SELECT MAX(key_part2) FROM tbl_name
           WHERE key_part_1=constant;
mysql> SELECT ... FROM tbl_name
           ORDER BY key_part1,key_part2,... LIMIT 10;
mysql> SELECT ... FROM tbl_name
           ORDER BY key_part1 DESC,key_part2 DESC,... LIMIT 10;
@end example

�ʲ��Υ�����ϥ���ǥå����ĥ꡼�Τߤ���Ѥ��ޤ�(����ǥå���������Ƥ���ե�����ɤ�
���ͷ��Ȳ��ꤷ�ޤ�)��

@example
mysql> SELECT key_part1,key_part2 FROM tbl_name WHERE key_part1=val;
mysql> SELECT COUNT(*) FROM tbl_name
           WHERE key_part1=val1 AND key_part2=val2;
mysql> SELECT key_part2 FROM tbl_name GROUP BY key_part1;
@end example

�ʲ��Υ�����ϡ������Ȥ��줿�Ԥθ����˥���ǥå�������Ѥ��ޤ���

@example
mysql> SELECT ... FROM tbl_name ORDER BY key_part1,key_part2,...
mysql> SELECT ... FROM tbl_name ORDER BY key_part1 DESC,key_part2 DESC,...
@end example

@node LEFT JOIN optimization, LIMIT optimization, Where optimizations, Query Speed
@subsection MySQL �ϤɤΤ褦�� @code{LEFT JOIN} ���Ŭ�����뤫��

@code{A LEFT JOIN B} �� @strong{MySQL} �˰ʲ��Τ褦���Ȥߤ��ޤ�Ƥ��ޤ���

@itemize @bullet
@item
The table @code{B} is set to be dependent on table @code{A} and all tables
that @code{A} is dependent on.
@item
�ơ��֥� @code{A} �� @code{LEFT JOIN} �����˻��Ѥ�������ƤΥơ��֥�
�ʤ����� @code{B} �Ͻ����ˤ˰�¸����ȡ����åȤ���ޤ���
@item
���Ƥ� @code{LEFT JOIN} ��郎 @code{WHERE} ��˰�ư����ޤ���
@item
All standard join optimizations are done, with the exception that a table is
always read after all tables it is dependent on.  If there is a circular
dependence then @strong{MySQL} will issue an error.
@item
���Ƥ� @code{WHERE} ��κ�Ŭ�����Ԥ��ޤ���
@item
@code{WHERE} ��˥ޥå�����쥳���ɤ� @code{A} �ˤ��ꡢ
@code{LEFT JOIN} ���˥ޥå�����쥳���ɤ� @code{B} �ˤʤ���硢
���ƤΥե�����ɤ� @code{NULL} �˥��åȤ��줿 @code{B} �Υ쥳���ɤ�
��������ޤ��� 
@item
If you use @code{LEFT JOIN} to find rows that doesn't exist in some
table and you have the following test: @code{column_name IS NULL} in the
@code{WHERE} part, where column_name is a column that is declared as
@code{NOT NULL}, then @code{MySQL} will stop searching after more rows
(for a particular key combination) after it has found one row that
matches the @code{LEFT JOIN} condition.
@end itemize

The table read order forced by @code{LEFT JOIN} and @code{STRAIGHT JOIN} will help
the join optimizer (which calculates in which order tables should be joined) to do
its work much more quickly as there are fewer table permutations to check.

Note that the above means that if you do a query of type:

@example
SELECT * FROM a,b LEFT JOIN c ON (c.key=a.key) LEFT JOIN d (d.key=a.key) WHERE b.key=d.key
@end example

Then @strong{MySQL} will do a full scan on @code{b} as the @code{LEFT JOIN} will
force it to be read before @code{d}.

The fix in this case is to change the query to:

@example
SELECT * FROM b,a LEFT JOIN c ON (c.key=a.key) LEFT JOIN d (d.key=a.key) WHERE b.key=d.key
@end example

@node LIMIT optimization, Insert speed, LEFT JOIN optimization, Query Speed
@subsection MySQL �ϤɤΤ褦�� @code{LIMIT} ���Ŭ�����뤫��

In some cases @strong{MySQL} will handle the query differently when you are
using @code{LIMIT #} and not using @code{HAVING}:

@itemize @bullet
@item
�⤷ @code{LIMIT} ����Ѥ��Ƹ��ꤷ�������� select ��Ԥ��ʤ顢 @strong{MySQL} �ϡ�
�����硢�ơ��֥����������������⡢����ǥå�������Ѥ��褦�Ȥ��ޤ���
@item
�⤷ @code{LIMIT #} �� @code{ORDER BY} �ȶ��˻��Ѥ���ʤ�, @strong{MySQL} ��
�ǽ�� @code{#} �Ԥ򸫤Ĥ����餹���ˡ����ơ��֥�Υ����ȤϹԤ鷺�ˡ�
�����Ȥ򽪤�餻�ޤ��� 
@item
@code{LIMIT #} �� @code{DISTINCT} �ȶ��˻��Ѥ���ʤ�, @strong{MySQL} ��
@code{#} �Ĥΰ�դʥ쥳���ɤ򸫤Ĥ��������ǽ����ޤ���
@item
In some cases a @code{GROUP BY} can be resolved by reading the key in order 
(or do a sort on the key) and then calculate summaries until the
key value changes.  In this case @code{LIMIT #} will not calculate any
unnecessary @code{GROUP BY}'s.
@item
@strong{MySQL} �ϡ��ǽ�� @code{#} �Ԥ򥯥饤����Ȥ����ä�����ľ�ˡ�
����������Ǥ��ޤ���
@item
@code{LIMIT 0} �Ͼ�����᤯���η�̤��֤��ޤ���
����ϥ�����Υ����å����̤Ȥ���������ե�����ɤη������뤿������ѤǤ��ޤ���
@item
����ơ��֥���礭���ϡ���������褹�뤿��ˤɤ줰�餤�Υ��ڡ��������뤫��
�׻�����Τˡ�@code{LIMIT #} ����Ѥ��ޤ���
@end itemize

@node Insert speed, Update speed, LIMIT optimization, Query Speed
@subsection @code{INSERT} �������®��

�쥳���ɤ�����������֤Ϥ����褽������ʤ�ޤ�:

@itemize @bullet
@item
��³:                    (3)
@item
������򥵡��Ф�����:    (2)
@item
��������:            (2)
@item
�쥳���ɤ�����:          (1 x size of record)
@item
����ǥå���������:      (1 x number of indexes)
@item
��������:                (1)
@end itemize

������ (����) ��������֤Ǥ�������ϡ��ơ��֥�Υ����ץ�ˤ������������С��إ�
��(�����Ʊ����ư���ƥ��������1��Ԥʤ��ޤ�)�Ϲ�θ����Ƥ��ޤ���

�ơ��֥�Υ������ϥ���ǥå����������� N log N ���٤����ޤ� (B-tree)��

INSERT ��®�����뤤���Ĥ�����ˡ��

@itemize @bullet
@item
�⤷Ʊ�����饤����Ȥ���¿���Υ쥳���ɤ�Ʊ���˥��󥵡��Ȥ���ʤ顢
ʣ�����ͤ��񤱤� @code{INSERT} ʸ����Ѥ��ޤ��� ����ϸġ��� @code{INSERT} ʸ
��ȯ�Ԥ��������٤ơ��ȤƤ�®���ʤ�ޤ���
@item
�⤷�㤦���饤����Ȥ���¿���Υ쥳���ɤ�Ʊ���˥��󥵡��Ȥ���ʤ顢
 @code{INSERT DELAYED} ʸ�λ��Ѥǡ����®���ʤ�Ǥ��礦�� @xref{INSERT,
, @code{INSERT}}.
@item
@code{MyISAM} �Ǥϡ�ʣ���� @code{SELECT} �����äƤ���ơ��֥���Ф��ơ�
Ʊ���ˡ��쥳���ɤ������Ǥ��ޤ��� ���������Υơ��֥���Ф���
�쥳���ɤκ�����ʤ����ˡ�
@item
�ƥ����ȥե����뤫��ơ��֥�˥ǡ����򤤤����ϡ� @code{LOAD DATA INFILE} ��
���Ѥ��ޤ��� ����Ϥ�������� @code{INSERT} ʸ��ȯ�Ԥ���٤��̾� 20�� ����
®���ʤ�ޤ�
@xref{LOAD DATA, , @code{LOAD DATA}}.
@item
�ơ��֥뤬¿���Υ���ǥå�������äƤ����硢������ˡ�ǡ� @code{LOAD DATA INFILE} ��
�¹Ԥ�®�����뤳�Ȥ���ǽ�Ǥ���
�ʲ��μ��ǹԤ��ޤ���

@enumerate
@item
Optionally create the table with @code{CREATE TABLE}. For example using
@code{mysql} or Perl-DBI.

@item 
@code{FLUSH TABLES} �μ¹ԡ� ���뤤�� @code{mysqladmin flush-tables} 
���ޥ�ɤμ¹ԡ�

@item 
@code{myisamchk --keys-used=0 -rq /path/to/db/tbl_name} �λ��ѡ�
����ϻ��ꤵ�줿�ơ��֥뤫�����ƤΥ���ǥå����������ޤ���

@item
���Υơ��֥�� @code{LOAD DATA INFILE} ����Ѥ��ƥǡ���������ޤ�. 
����Ϥ����ʤ륤��ǥå����⹹�����ʤ��Ǥ��礦�������Τ��ᡢ®����ʤ�Ǥ��礦��

@item
�⤷ @code{myisampack} �򤪻����ǡ��ơ��֥�򰵽̤������ʤ顢
@code{myisampack} ��¹Ԥ��ޤ�. @xref{Compressed format}.

@item
@code{myisamchk -r -q /path/to/db/tbl_name} �ǥ���ǥå�����ƹ���. 
����� disk �˽񤭹������˥���ǥå��������˺������ޤ���
�����¿���Υǥ��������������򤱤뤳�Ȥ������ΤǤȤƤ�®���ʤ�ޤ���
�Ǥ��夬�ä�����ǥå����ĥ꡼�ϡ��Х�󥹤Τ褤��Τˤʤ�ޤ���

@item
@code{FLUSH TABLES} �μ¹ԡ� ���뤤�� @code{mysqladmin flush-tables} 
���ޥ�ɤμ¹ԡ�
@end enumerate

���μ��ϡ������ MySQL �� @code{LOAD DATA INFILE} ���Ȥ߹��फ�⤷��ޤ���
@item
�ơ��֥����å����뤳�Ȥǡ�������®�����뤳�Ȥ��ǽ�Ǥ���

@example
mysql> LOCK TABLES a WRITE;
mysql> INSERT INTO a VALUES (1,23),(2,34),(4,33);
mysql> INSERT INTO a VALUES (8,26),(6,29);
mysql> UNLOCK TABLES;
@end example

���®�ٺ��ϡ����Ƥ� @code{INSERT} ��ʸ�ǥ���ǥå����Хåե������٤����ǥ������˥�
��å��夵��뤳�ȤǤ����̾��  @code{INSERT} ��ʸ������Τ�Ʊ�����餤¿���Υ���ǥ�
�����Хåե��ե�å��夬����ޤ���ñ�칽ʸ�����ƤΥ쥳���ɤϡ����å��ʤ��������Ǥ��ޤ���

���å���ʣ����³�ƥ��Ȥι�׻��֤��㤯���ޤ����������Ĥ��Υ���åɤκ���
�Ԥ����֤Ͼ夬��ޤ�(���å����ԤäƤ��뤫��)��
�㤨��:

@example
thread 1 does 1000 inserts
thread 2, 3, and 4 does 1 insert
thread 5 does 1000 inserts
@end example

���å�����Ѥ��ʤ���硢2, 3 ������ 4 �� 1 �� 5 �����˽���ޤ������å���
���Ѥ����硢2,3,4 �� 1 �� 5 �����˽���뤳�ȤϤ����餯����ޤ��󤬡���
�׻��֤��� 40 % ®���ʤ�ޤ���

@code{INSERT}, @code{UPDATE} , @code{DELETE} �ϡ� @strong{MySQL} �ǤϤȤƤ�®���Τǡ�
1 �Ԥ��� 5 �İʾ塢�ͤ� ���������� �򤹤������Ф��ơ�
���å����ɲä���С�����Ū�ˤ���ɤ���ǽ�������ޤ���
�ȤƤ�¿�� insert ��Ԥʤ���硢
¾�Υ���åɤˤ��Υ��å������ơ��֥�ؤΥ���������Ϳ���뤿��� ��
�������� 1000 �쥳���ɤ��Ȥ˰��١�@code{UNLOCK TABLES} �������
 @code{LOCK TABLES} ��Ԥ��ޤ��� ����Ǥ�ޤ��ɤ���ǽ�������ޤ���

������� @code{LOAD DATA INFILE} �ϤȤƤ�®���Ǥ���
@end itemize

@code{LOAD DATA INFILE} �� @code{INSERT} �򶦤�®�����뤿��ˤϡ�
�����Хåե������䤷�ޤ��� @xref{Server parameters}.

@node Update speed, Delete speed, Insert speed, Query Speed
@subsection @code{UPDATE} �������®��

@code{UPDATE} ������� @code{SELECT} ������Τ褦�˺�Ŭ������ޤ�����
�񤭹��ߤΥ����С��إåɤ��ä��ޤ���
�񤭹���®�٤ϡ����������ǡ������礭������������륤��ǥå�������
�ͤ�ޤ��� �ѹ�����ʤ�����ǥå����Ϲ�������ޤ���

Also another way to get fast updates is to delay updates and then do
many updates in a row later. 
��ʸ��¿���ι�����Ԥ��С��⤷�ơ��֥뤬���å�����Ƥ���С�
��ʸ�ǰ�ĤŤĹ���������⡢�ȤƤ�®���ʤ�ޤ���

Note that, with dynamic record format, updating a record to
a longer total length may split the record.  So if you do this often
it is very important to @code{OPTIMIZE TABLE} sometimes.
@xref{OPTIMIZE TABLE, , @code{OPTIMIZE TABLE}}.

@node Delete speed,  , Update speed, Query Speed
@subsection @code{DELETE} �������®��

1�쥳���ɤ���������֤ϡ����礦�ɥ���ǥå����ο������㤷�ޤ���
���®���쥳���ɤ����������ʤ顢����ǥå���������å����
���䤷�ޤ��� @xref{Server parameters}.

�ơ��֥��椫��쥳���ɤ��礭����ʬ��ä����⡢
���ƤΥ쥳���ɤ�ä��ۤ������ȤƤ�®���Ǥ���

@node Tips, Benchmarks, Query Speed, Performance
@section ��Ŭ���˴ؤ��뤽��¾�ν���

Unsorted tips for faster systems:

@itemize @bullet
@item
���ͥ�����󥪡��С��إåɤ��򤱤뤿��ˡ��ǡ����١������Ф��ơ�
�༡���ͥ���������Ȥ��ʤ��褦�ˡ������³���ݤ��ޤ���
If you can't use persistent connections and you are doing a
lot of new connections to the database, you may want to change the value
of the @code{thread_cache_size} variable. @xref{Server parameters}.
@item
���ʤ��Υ����꤬�ơ��֥�Υ���ǥå�������Ѥ��Ƥ��뤫�����Ĥ�����å����ޤ���
@strong{MySQL} �Ǥ� @code{EXPLAIN} ���ޥ�ɤǤ��줬�Ԥ���ޤ���
@xref{EXPLAIN, Explain, Explain, manual}.
@item
���������ѹ������褦�ʥơ��֥���Ф��ơ�ʣ���� @code{SELECT} �������
�򤱤�褦�˻�ߤޤ��� ����ϥơ��֥롦���å���������򤱤뤿��Ǥ���
@item
������ @code{MyISAM} �ơ��֥�Ǥϡ�����ơ��֥�˥쥳���ɤ�����(�����̵����)
����Ƥ������ˡ�Ʊ���ˡ�Ʊ���ơ��֥뤫��ǡ������ɤळ�Ȥ���ǽ�Ǥ���
���줬���ʤ��ˤȤäƽ��׹��ܤǤ���ʤ顢
�쥳���ɤκ����ɬ�פΤʤ���ˡ�䡢¿���Υ쥳���ɤ���������� @code{OPTIMIZE TABLE} ��
�¹Ԥ��뤳�Ȥ򡢹�θ���٤��Ǥ���
@item
In some cases it may make sense to introduce a column that is 'hashed'
based on information from other columns. If this column is short and
reasonably unique it may be much faster than a big index on many
columns. In @strong{MySQL} its very easy to use this extra column:
@code{SELECT * from table where hash='calculated hash on col1 and col2'
and col_1='constant' and col_2='constant' and ..}
@item
¿�����ѹ����ʤ����ơ��֥���Ф��Ƥϡ����Ƥ� @code{VARCHAR} �� @code{BLOB} 
�ե�����ɤ��򤱤�褦�˻�ߤ�٤��Ǥ���
You will get dynamic row length as soon as you
are using a single @code{VARCHAR} or @code{BLOB} columns. @xref{Table
types}.
@item
�̾����ơ��֥��㤦�ơ��֥��ʬ���뤳�Ȥϡ��쥳���ɤ��礭���ʤ�
�������Ω���ޤ���
�쥳���ɤ˥�����������ݡ����Υ쥳���ɤκǽ�ΥХ��Ȥ򸫤Ĥ��뤿���
�ǥ��������������������֤�����ޤ���
After finding
the data most new disks can read the whole row fast enough for most
applications. The only cases it really matters to split up a table is if
its a dynamic row size table (see above) that you can change to a fixed
row size. Or if you very often need to scan the table and don't need
most of the columns. @xref{Table types}.
@item
�⤷��¿���Υ쥳���ɤ���ξ���򸵤ˤ����׻�(�����ΤΥ�����ȤȤ�)��
����ä��夦�Ԥ�ɬ�פ�����ʤ顢�������ơ��֥���Ѱդ����༡�����󥿡���
������������¿ʬ�ɤ��Ǥ��礦��
@code{UPDATE table set count=count+1 where index_column=constant} �����
�ȤƤ�®���Ǥ���

����ϡ�@strong{MySQL} �Τ褦�ʥơ��֥롦���å���
(multiple readers / single writers)���ĥǡ����١�����
�Ȥ���ǡ������˽��פʤ��ȤǤ���
This will
also give better performance with most databases as the row locking
manager in this case will have less to do.
@item
�⤷����������礭�ʥơ��֥뤫�����פ��������ɬ�פ�����ʤ顢
���ơ��֥��������������ˡ����ޥ꡼�ơ��֥����Ѥ��ޤ���
Maintaing the summarys should be
much faster than trying to do statistics 'live'. It's much faster to
re-generate new summary tables from the logs when things changes
(depending on business decisions) than to have to change the running
application!
@item
If possible one should classify reports as 'live' or 'statistical',
where data needed for statistical reports are only generated based on
summary tables that are generated from the actual data.
@item
�ե�����ɤˤϥǥե�����ͤ�����Ȥ����������Ѥ��Ʋ�������
�ͤ��ǥե���ȤȤϰ㤦���˸¤ꡢ�ͤ��������ޤ���
����� @strong{MySQL} ��ɬ�פȤ���ʬ�Ϥ򾯤ʤ��������󥵡��Ȥ�®�٤����夷�ޤ���
@item
������Ǥϡ�BLOB �˥ǡ�����ѥå�������¸����Τ������Ǥ���
���ξ�硢BLOB �����줿�ͤ� �ѥå�������ѥå� ���뤿��Υ����ɤ�
���ʤ��Υ��ץꥱ���������Ȥ߹��ޤʤ��ƤϤʤ�ޤ���
����������ϡ�¿���Υ�����������������Ǥ��礦��
����ϡ���Ū(����Ĺ)�ơ��֥빽¤��Ŭ���ʤ��ǡ�������äƤ������
���Ѥˤʤ�ޤ���
@item
�̾���ʤ������ƤΥǡ������Ĺ��̵���褦��(�ǡ����١���������
�裳������ , 3rd Normal Form , 3NF �ȸƤФ��)
���褦�Ȥ��뤫�⤷��ޤ��󤬡�����������ꥹ�ԡ��ɤ������ϡ�
��ʣ�䥵�ޥ꡼�ơ��֥�κ����򤪤���ƤϤ����ޤ���
@item
���ȥ��ɡ��ץ��������� �� UDF (�桼��������ؿ�) �Ϥ��ѥե����ޥ󥹤�����
����ˤϤ褤��ˡ���⤷��ޤ���
In this case you should however always have a way
to do this some other (slower) way if you use some database that doesn't
support this.
@item
You can always gain something by caching queries/answers in your
application and trying to do many inserts/updates at the same time.  If
your database supports lock tables (like @strong{MySQL} and Oracle),
this should help to ensure that the index cache is only flushed once
after all updates.
@item
�ǡ����򤹤��ˤϽ�ɬ�פ��ʤ��Ȥ���@code{INSERT /*! DELAYED */} ����Ѥ��ޤ���
����ϡ����Υǥ������ؤν񤭹��ߤǡ�¿���Υ쥳���ɤ��������Τǡ�
®���ʤ�ޤ���
@item
SELECT �������פʾ�硢@code{INSERT /*! LOW_PRIORITY */} ����Ѥ��ޤ���
@item
���塼��̵�뤷�� SELECT ��ͥ��Ū�˹Ԥ������Ȥ���
@code{SELECT /*! HIGH_PRIORITY */} ����Ѥ��ޤ���
����ϡ����Ȥ�ï�����񤭹��ߤ��ԤäƤ����Ȥ��Ƥ⡢���� SELECT ��
�¹Ԥ���ޤ���
@item
ʣ���� @code{INSERT} ʸ�λ��ѡ� �����¿���Υ쥳���ɤ��Ĥ� SQL ���ޥ�ɤ�
�������뤳�Ȥ�����ޤ���
(¿���� SQL �����С�������򥵥ݡ��Ȥ��Ƥ��ޤ�)
@item
�礭�ʥǡ������ɤ߹��ߤˤ� @code{LOAD DATA INFILE} ����Ѥ��ޤ���
This if
faster than normal inserts and will be even faster when @code{myisamchk}
is integrated in @code{mysqld}.
@item
��դ��ͤ��뤿��ˡ� @code{AUTO_INCREMENT} ����Ѥ��ޤ���
@item
ưŪ�ơ��֥�ե����ޥåȤλ��ѻ��ˤϡ��ե饰���ơ��������򤱤뤿��ˡ�
@code{OPTIMIZE TABLE} ��������Ѥ��ޤ���
@xref{OPTIMIZE TABLE, , @code{OPTIMIZE TABLE}}.

@item
��ǽ�ʤ�� @code{HEAP} �ơ��֥�򥹥ԡ��ɥ��åפΤ���˻��Ѥ��ޤ�. @xref{Table
types}.
@item
�̾�� Web �����С�������ʤ�С����᡼���ϥե��������¸���٤��Ǥ���
�ǡ����١����ˤϡ������ե�����λ���(�ѥ��Ȥ�)�Τߤ�����ޤ���
���μ����ͳ�ϡ��̾�� Web �����С��ϥǡ����١������⥳��ƥ�Ĥ�
���褯����å��夷�Ƥ���뤫��Ǥ��� ����ǥե��������Ѥ���ʤ顢
®�������ƥ�����ñ�����뤳�Ȥ��Ǥ��ޤ���
@item
���פǤʤ��ǡ����ǡ��褯�������������ʪ�ϡ�����ơ��֥�ˤ���ޤ���
(like
information about the last shown banner for users that doesn't have
cookies)
@item
Columns with identical information in different tables should be
declared identical and have identical names. Before version 3.23 you
got slow joins otherwise.

̾����ñ��ˤ��Ƥ���������customer �ơ��֥�Ǥ� @code{customer_name} ��
������ @code{name} ��Ȥ��Ȥ��ˡ� ¾�� SQL �����С��ؤΰܿ����θ����ʤ顢
̾���� 18 ʸ�����û�����٤��Ǥ���
@item
�⤷�����˥ϥ������ԡ��ɤ�ɬ�פʤ顢SQL �����С������ݡ��Ȥ��Ƥ���ʪ�Ȥ�
�㤦��������٥�Υǡ�����¸�Υ��󥿡��ե����������ܤ��٤��Ǥ���
�㤨�С� @strong{MySQL} @code{MyISAM} ��ľ�ܥ����������뤳�Ȥϡ�
SQL ���󥿡��ե�������𤷤ƥ�������������⡢2��5��®���ʤ�Ǥ��礦��
������ǽ�ˤ���ˤϡ����Υǡ����ϡ����ץꥱ��������Ʊ���ޥ����ˤʤ��ƤϤʤ餺��
�̾��ĤΥץ����������ǥ������������٤��Ǥ���
(�ʤ��ʤ顢�����ե�������å��ϡ��ȤƤ��٤�����)��
�������ϡ�@strong{MySQL} �����С���� @code{MyISAM} �Υ�����٥�Υ��ޥ�ɤ�
Ƴ���Dz��Ǥ���Ǥ��礦�� (����Ϥ��褤�ѥե����ޥ󥹤����뤳�Ȥν���롢
��ñ����ˡ�ΰ�ĤǤ�)�� By carefully designing the database interface
it should be quite easy to support this types of optimisations.
@item
¿���ξ�硢�ǡ����١�������ǡ����򥢥�������������(��³��ݻ����Ƥ����)��
�ƥ����ȥե����뤫��ǡ����򥢥������������®���Ǥ��� �ʤ��ʤ顢
�ǡ����١����ϥƥ����ȥե�������⥳��ѥ��Ȥˤʤ�ʿ��ͥǡ����ξ��ˡ�
���Τ��ᡢ�ǥ������������������ʤ��ʤ뤫��Ǥ���
�ޤ����Ԥ���ܤ򸫤Ĥ��뤿��ˡ��ƥ����ȥե��������Ϥ���ɬ�פ�ʤ��ޤ���
@item
ʣ���⥹�ԡ��ɥ��åפ˻��ѤǤ���Ǥ��礦�� @xref{Replication}.
@item
@code{DELAY_KEY_WRITE=1} ��������줿�ơ��֥�ϡ�����ǥå����ι�����®���ʤ�ޤ���
����Ϥ��Υ���ǥå������ե����뤬�Ĥ�����ޤǥǥ������˵�Ͽ����ʤ�����Ǥ���
�������äơ��ʤˤ�������� @code{mysqld} �򥭥뤷�Ƥ�ơ��֥뤬����פʤ褦�ˤ��뤿�ᡢ
@code{mysqld} ��ư�������ˤϡ�@code{myisamchk} �򤽤��Υơ��֥���Ф��Ƽ¹Ԥ��٤��Ǥ���
As the key information can always be generated
from the data you should not lose anything by using @code{DELAY_KEY_WRITE}.
@end itemize

@node Benchmarks, Design, Tips, Performance
@section Using your own benchmarks

You should definately benchmark your application and database to find
out where the bottlenecks are.  By fixing it (or by replacing the
bottleneck with a 'dummy module') you can then easily identify the next
bottleneck (and so on).  Even if the overall performance for your
application is sufficient you should at least make a plan for each
bottleneck, and decide how to solve it if someday you really need the
extra performance.

For an example of portable benchmark programs look at the @strong{MySQL}
benchmark suite. @xref{MySQL Benchmarks, , @strong{MySQL} Benchmarks}. You
can take any program from this suite and modify it for your needs. By doing this,
you can try different solutions to your problem and test which is really the
fastest solution for you.

It is very common that some problems only occur when the system is very
heavily loaded. We have had many customers who contact us when they
have a (tested) system in production and have encountered load problems. In
every one of these cases so far it has been problems with basic design
(table scans are NOT good at high load) or OS/Library issues. Most of
this would be a @strong{LOT} easier to fix if the systems were not
already in production.

To avoid problems like this you should put some effort into benchmarking
your whole application under the worst possible load! You can use Sasha's
recent hack for this -
@uref{http://www.mysql.com/Contrib/mysql-bench-0.6.tar.gz, mysql-super-smack}.
As the name suggests, it can bring your system down to its knees if you ask it,
so make sure to use it only on your developement systems.

@node Design, Design Limitations, Benchmarks, Performance
@section Design choices

@code{MySQL} �ϡ��쥳���ɤΥǡ����ȥ���ǥå������̤Υե��������¸���ޤ���
¾��¿����(�ۤȤ������)�ǡ����١����Ǥϡ�Ʊ���ե�����˥ǡ����ȥ���ǥå�����
���ߤ�������¸���ޤ��� �桹�ϡ��Ƕ�Υ����ƥ�ˤϡ�@strong{MySQL} �����������
�ɤ��ȿ����Ƥ��ޤ���

Another way to store the row data is to keep the information for each
column in a separate area (examples are SDBM and Focus). This will cause a
performance hit for every query that accesses more than one column. Because
this degenerates so quickly when more than one column is accessed,
we believe that this model is not good for general purpose databases.

The more common case is that the index and data are stored together
(like in Oracle/Sybase et al). In this case you will find the row
information at the leaf page of the index. The good thing with this
layout is that it, in many cases, depending on how well the index is
cached, saves a disk read.  The bad things with this layout is:

@table @bullet
@item
Table scanning is much slower because you have to read through the indexes
to get at the data.
@item
You lose a lot of space as you must duplicate indexes from the nodes
(as you can't store the row in the nodes).
@item
Deletes will degenerate the table over time (as indexes in nodes are
usually not updated on delete).
@item
You can't use only the index table to retrieve data for a query.
@item
The index data is harder to cache.
@end table

@node Design Limitations, Portability, Design, Performance
@section MySQL design limitations/tradeoffs

Because @strong{MySQL} uses extremely fast table locking (multiple readers /
single writers) the biggest remaining problem is a mix of a steady stream of
inserts and slow selects on the same table.

We belive that for a huge number of systems the extremely fast
performance in other cases make this choice a win. This case is usually
also possible to solve by having multiple copies of the table, but it
takes more effort and hardware.

We are also working on some extensions to solve this problem for some
common application niches.

@node Portability, Internal use, Design Limitations, Performance
@section Portability

Because all SQL servers implement different parts of SQL, it takes work to
write portable SQL applications. For very simple selects/inserts it is
very easy but the more you need the harder it gets. If you want an
application that is fast with many databases it becomes even harder!

To make a complex application portable you need to choose a number of
SQL servers that it should work with.

You can use the @strong{MySQL} crash-me program/web-page
@uref{http://www.mysql.com/crash-me-choose.htmy} to find functions,
types and limits you can use with a selection of database
servers. Crash-me now tests far from everything possible but it
is still comprehensive with about 450 things tested.

For example, you shouldn't have column names longer than 18 characters
if you want to be able to use Informix or DB2.

Both the @strong{MySQL} benchmarks and crash-me programs are very
database-independent.  By taking a look at how we have handled this, you
can get a feeling of what you have to do to write your application
database-independent.  The benchmarks themselves can be found in the
@file{sql-bench} directory in the @strong{MySQL} source
distribution. They are written in Perl with DBI database interface
(which solves the access part of the problem).

See @uref{http://www.mysql.com/benchmark.html} the results from this
benchmark.

As you can see in these results all databases have some weak points. That
is, they have different design compromises that lead to different
behavior.

If you strive for database independence you need to get a good feeling
of each SQL server's bottlenecks. @strong{MySQL} is VERY fast in
retrieving and updating things, but will have a problem in mixing slow
readers/writers on the same table. Oracle on the other hand has a big
problem when you try to access rows that you have recently updated
(until they are flushed to disk). Transaction databases in general are
not very good at generating summary tables from log tables as in this
case row locking is almost useless.

To get your application @emph{really} database-independent you need to define
an easy extendable interface through which you manipulate your data. As
C++ is available on most systems, it makes sense to use a C++ classes
interface to the databases.

If you use some specific feature for some database (like the
@code{REPLACE} command in @strong{MySQL}), you should code a method for
the other SQL servers to implement the same feature (but slower).  With
@strong{MySQL} you can use the @code{/*!  */} syntax to add
@strong{MySQL} specific keywords to a query.  The code inside
@code{/**/} will be treated as a comment (ignored) by most other SQL
servers.

If REAL high performance is more important than exactness, like in some
web applications, a possibility is to create an application layer that
caches all results to give you even higher performance. By letting
old results 'expire' after a while you can keep the cache reasonably
fresh.  This is quite nice in case of extremely high load, in which case
you can dynamically increase the cache and set the expire timeout higher
until things get back to normal.

In this case the table creation information should contain information
of the initial size of the cache and how often the table should normally
be refreshed.

@node Internal use,  , Portability, Performance
@section What have we used MySQL for?

@strong{MySQL} �ν���γ�ȯ���ˤϡ�@strong{MySQL} �ϲ桹�Τ�äȤ�����θܵҤ˹礦�褦��
��ǽ����������ޤ����� ���ϡ������Ĥ��Υ��������ǥ�����ξ����ȼ�
�Τ���ˡ��Ҹˤ�����Ƥ���ʾ��ʡ˥ǡ������갷���ޤ���

�桹�ϡ����٤Ƥ�Ź���顢���ܡ��ʥ��������ɼ谷��Ρ����ν��֤ޤȤ�����ޤ���
�����ơ�����Ź�Υ����ʤˤȤä�ͭ�פʾ��󡢤���Ź�ι��𥭥��ڡ���
���Ҥˤɤ����ٱƶ���ڤܤ��������󶡤��뤳�Ȥ����桹�˵����Ƥ��ޤ���

���Υǡ����ϡ��ȤƤ��礭���� (��700��/�� ��μ�갷��)��
�桹�Ϥ��θܵҤ��󶡤���ɬ�פΤ���ǡ����� 4��10ǯʬ�����äƤ��ޤ���
�桹�ϡ��������ޡ����顢��餬���Υǡ�������Ǥ��뿷������ݡ��Ȥ�
��¨���ˡɥ��������������Ȥ������׵������ޤ�����

�桹�Ϥ�������Ƥη�Ȥξ���򰵽̤��� 'transaction' �ơ��֥��
��¸���뤳�ȤDz�褷�ޤ�����
We have a set of simple macros (script) that
generates summary tables grouped by different criteria (product group,
customer id, store ...) from the transaction tables. 
���Υ�ݡ��Ȥ� Web �ڡ����ǡ�����Ͼ����� perl ������ץȤ�ưŪ��
��������ޤ��� ���� perl script �� Web Page ��ʬ�Ϥ���SQL ʸ��
�¹Ԥ�����̤��������ޤ���
We would have used PHP or mod_perl instead but they were
not available at that time.

�����ǡ����Τ���ˡ��桹�ϴ�ñ�ʥġ���� @code{C} �Ǥ����ޤ�����
����� SQL �Υ�����η�̤򸵤�(��̤ˤ����Ĥ������򤷤�) GIF ���󶡤��ޤ���
�����ưŪ�� perl ������ץ�(@code{HTML} �ե������ʬ�Ϥ���)����¹Ԥ���ޤ���

In most cases a new report can simply be done by copying an existing
script and modifying the SQL query in it.  In some cases we will need to
add more fields to an existing summary table or generate a new one, but
this is also quite simple as we keep all transactions tables on disk.
(Currently we have at least 50G of transactions tables and 200G of other
customer data).

We also let our customers access the summary tables directly with ODBC
so that the advanced users can themselves experiment with the data.

�桹�Ϥ�����  Sun Ultra SPARCstation (2x200 Mz) �ǰ��äƤ��ޤ�����
�ʤ������⤢��ޤ���
We recently upgraded one of our servers to a 2
CPU 400 Mhz UltraSPARC and we are now planning to start handling
transactions on the product level, which would mean a ten-fold increase
of data. We think we can keep up with this by just adding more disk to
our systems.

We are also experimenting with Intel-Linux to be able to get more CPU
power cheaper.  ���ߡ��桹�ϥХ��ʥ�ߴ��Υǡ����١����ե����ޥåȤ���äƤ���
(new in 3.23) ���桹�Ϥ���򥢥ץꥱ�������Τ����Ĥ�����ʬ�˻��Ѥ��Ϥ������Ǥ��礦��

Our initial feelings are that Linux will perform much better on low to
medium load but Solaris will perform better when you start to get a
high load because of extreme disk IO, but we don't yet have anything
conclusive about this. After some discussion with a Linux Kernel
developer this might be a side effect of Linux giving so much resources
to the batch job that the interactive performance gets very low. This
makes the machine feel very slow and unresponsive while big batches are
going. Hopefully this will be better handled in future Linux Kernels.

@node MySQL Benchmarks, Tools, Performance, Top
@chapter @strong{MySQL} �٥���ޡ�����������

�����ˤ� @strong{MySQL} �٥���ޡ�����������(�� @code{crash-me})��
���Ѿ�β��⤬�񤫤��Ϥ��Ǥ������ޤ��񤫤�Ƥ��ޤ���
���ߡ��٥���ޡ����Υ����ɤȷ�̤ϥ���������� @file{sql-bench} �ǥ��쥯�ȥ�ˤ���ޤ���
(������� Web �ڡ��� @uref{http://www.mysql.com/crash-me-choose.htmy} �ˤ�)

�ʤ�� SQL �����Υѥե����ޥ󥹤��ɤ��Τ������Τ��򡢤ɤ�ʥ桼�������Ф��Ƥ�
�����Τ��٥���ޡ����Ǥ���

Note that this benchmark is single threaded so it measures the minimum
time for the operations.

For example (run on the same NT 4.0 machine):

@multitable @columnfractions .6 .2 .2 
@strong{Reading 2000000 rows by index} @tab @strong{Seconds} @tab @strong{Seconds}
@item mysql             @tab 367 @tab 249
@item mysql_odbc       @tab 464
@item db2_odbc         @tab 1206
@item informix_odbc    @tab 121126
@item ms-sql_odbc      @tab 1634
@item oracle_odbc      @tab 20800
@item solid_odbc       @tab 877
@item sybase_odbc      @tab 17614
@end multitable

@multitable @columnfractions .6 .2 .2 
@strong{Inserting (350768) rows} @tab @strong{Seconds} @tab @strong{Seconds}
@item mysql            @tab 381 @tab 206
@item mysql_odbc       @tab 619
@item db2_odbc         @tab 3460
@item informix_odbc    @tab 2692
@item ms-sql_odbc      @tab 4012
@item oracle_odbc      @tab 11291
@item solid_odbc       @tab 1801
@item sybase_odbc      @tab 4802
@end multitable

In the above test @strong{MySQL} was run with a 8M index cache. 

Note that Oracle is not included because they asked to be removed. All
Oracle benchmarks has to be passed by Oracle! We believe that makes
Oracle benchmarks @strong{VERY} biased because the above bechmarks are
supposed to show what a standard installation can do for a single
client.

@code{crash-me} �ϡ��ǡ����١��������ݡ��Ȥ��뵡ǽ��ǽ�ϡ����¤ˤĤ��ơ�
�ºݤ˥���������餻�Ƴ�ǧ���ޤ���
�㤨�С��ʲ��Τ褦�ʻ��ˤĤ���Ĵ�٤ޤ���

@itemize @bullet
@item
���ݡ��Ȥ��Ƥ�����ܤη��Ϥʤˤ�
@item
���ݡ��Ȥ��륤��ǥå����κ������
@item
�ɤΤ褦�ʴؿ�������Τ�
@item
������륯������礭���Ϥɤ��ޤǤ�
@item
@code{VARCHAR} ���Ϥɤ��ޤ��礭���Ǥ���Τ�
@end itemize

@node Tools, Maintenance, MySQL Benchmarks, Top
@chapter @strong{MySQL} �桼�ƥ���ƥ�

@menu
* Programs::                    �¹ԥե����뤬�Ԥʤ����Ȥϡ�
* mysql::                       ���ޥ�ɥ饤��ġ���
* mysqladmin::                  Administering a @strong{MySQL} server
* mysqldump::                   Dumping the structure and data from @strong{MySQL} databases and tables
* mysqlimport::                 Importing data from text files
* mysqlshow::
* myisampack::                  The @strong{MySQL} compressed read-only table generator
@end menu

@cindex Environment variables
@node Programs, mysql, Tools, Tools
@section �͡��� @strong{MySQL} �ץ������γ���

�����Ф��̿����� @code{mysqlclient} �饤�֥�����Ѥ��Ƥ������Ƥ� 
@strong{MySQL} ���饤����Ȥϼ��δĶ��ѿ�����Ѥ��ޤ�:

@tindex MYSQL_UNIX_PORT environment variable
@tindex Environment variable, MYSQL_UNIX_PORT
@tindex MYSQL_TCP_PORT environment variable
@tindex Environment variable, MYSQL_TCP_PORT
@tindex MYSQL_PWD environment variable
@tindex Environment variable, MYSQL_PWD
@tindex MYSQL_DEBUG environment variable
@tindex Environment variable, MYSQL_DEBUG
@multitable @columnfractions .25 .75
@item @strong{Name} @tab @strong{Description}
@item @code{MYSQL_UNIX_PORT} @tab �ǥե���ȤΥ����å�; @code{localhost} �ؤ���³�˻��Ѥ����
@item @code{MYSQL_TCP_PORT}  @tab �ǥե���Ȥ� TCP/IP �ݡ���
@item @code{MYSQL_PWD} @tab �ǥե���ȤΥѥ����
@item @code{MYSQL_DEBUG} @tab �ǥХå����ץ����
@item @code{TMPDIR} @tab ��� tables/files �����������ǥ��쥯�ȥ�
@end multitable

@code{MYSQL_PWD} �λ��Ѥϰ����ǤϤ���ޤ���
@xref{Connecting}.

@tindex MYSQL_HISTFILE environment variable
@tindex Environment variable, MYSQL_HISTFILE
@tindex HOME environment variable
@tindex Environment variable, HOME
@cindex History file
@cindex Command line history
@tindex .mysql_history file
@file{mysql} ���饤����Ȥϡ�@code{MYSQL_HISTFILE} �Ķ��ѿ���
���ꤵ��Ƥ���ե�����˥��ޥ�ɥ饤��������񤭽Ф��ޤ���
�ǥե���Ȥ�����ե�����ϡ� @file{$HOME/.mysql_history} �ǡ�@code{$HOME} ��
 @code{HOME} �Ķ��ѿ����ͤǤ��� @xref{Environment variables}.

���Ƥ� @strong{MySQL} �ץ�������¿�����͡��ʥ��ץ���������ޤ����
�Υ��ץ����δ���������������ˤϥ����å� @code{--help} ����Ѥ��Ƥ�����������
����@code{mysql --help} ���Ƥ���������

���ץ����ե�����ǡ����Ƥ�ɸ�९�饤����ȤΥǥե���ȤΥ��ץ�����
�ѹ����뤳�Ȥ���ǽ�Ǥ���
@ref{Option files}.

@strong{MySQL} �ץ�������ʲ��˼����ޤ�:

@table @code

@cindex @code{myisamchk}
@item myisamchk
@strong{MySQL} �ơ��֥������å�, ��Ŭ�������ƽ������ޤ���
@code{myisamchk} �ˤ�¿���ε�ǽ������Τǡ���ϳ�����Ƥ��������Ƥ��ޤ���
@xref{Maintenance}.

@cindex @code{make_binary_release}
@item make_binary_release
����ѥ��뤵�줿 @strong{MySQL} �ΥХ��ʥ��꡼����������ޤ��������¾
�� MySQL �桼�������ؤΤ���ˡ�ftp �� @code{ftp.tcx.se} ��  @file{/pub/mysql/Incoming}
�����뤳�Ȥ��Ǥ��ޤ���

@cindex @code{msql2mysql}
@item msql2mysql
@code{mSQL} �ץ������� @strong{MySQL} ���Ѵ����륷���륹����ץȡ�����
�Υ������ǽ����Ǥ���櫓�ǤϤ���ޤ��󤬡��Ѵ������ɤ��������Ȥ�Ϳ���ޤ���

@cindex Scripts
@cindex @code{mysql}
@item mysql
@code{mysql} �ϴ�ñ�� SQL ������ (GNU @code{readline} �Ĥ�) �Ǥ������������Ū�ʻ��Ѥ�
�����÷��䤤��碌�򥵥ݡ��Ȥ��ޤ�������Ū�˻��Ѥ����ȡ�ASCII �ơ��֥�
�����Ƿ�̤�Ϳ�����ޤ����ե��륿�Ȥ��ƻ��Ѥ����ȡ����Ϥϥ��֤Ƕ��ڤ�
��ޤ��ʤ���ϵ�ư���Υ��ץ�����¾�Τ�Τ��ѹ��Ǥ��ޤ��ˡ�
���ʤ��ϰʲ��Τ褦�˴�ñ�˥�����ץȤ�¹ԤǤ��ޤ�:

@example
shell> mysql database < script.sql > output.tab
@end example

���饤����ȤΥ��꤬��ʬ�Ǥʤ����Ȥˤ�����꤬������ϡ�
@code{--quick} �����å�����Ѥ��Ƥ��������� ����Ϸ�̤���Ф��Τ� 
 @code{mysql_store_result()} ������� @code{mysql_use_result()} �����
����褦�� @code{mysql} �˶��������ޤ���

@cindex @code{mysqlaccess}
@item mysqlaccess
�ۥ���, �桼�������ƥǡ����١������ȹ礻�Ǹ��¤�����å����뤿��Υ�����
�ץȡ�

@cindex @code{mysqladmin}
@item mysqladmin
�����桼�ƥ���ƥ����ǡ����١����κ���/�˴���reload (�������桼�����ɤ�
����) �� refresh (�ǥ������ؤΥơ��֥�Υե�å���, �����ե�����κƥ���
�ץ�)�������ФΥС������Ƚ����Ⱦ��־����Ϳ���ޤ���
@xref{mysqladmin, , @code{mysqladmin}}.

@cindex @code{mysqlbug}
@item mysqlbug
@strong{MySQL} �Х���ݡ��ȥ�����ץȡ�
���Υ�����ץȤ� @strong{MySQL} �᡼��󥰥ꥹ�Ȥ˥Х���ݡ��Ȥ�Ф��ݡ�
��˻��Ѥ��ޤ���

@cindex @code{mysqld}
@item mysqld
SQL �ǡ���󡣤���Ͼ�˼¹Ԥ���Ƥޤ���

@cindex @code{mysqldump}
@item mysqldump
@strong{MySQL} �ǡ����١����� SQL ���ơ��ȥ��Ȥޤ��ϥ��֤Ƕ��ڤ�줿��
�����ȤΥե�����˥���פ��ޤ���Igor Romanenko �ˤ�ä�����Ū�˥���ϥ�
�����줿�ե꡼��������
@xref{mysqldump, , @code{mysqldump}}.

@cindex @code{mysqlimport}
@item mysqlimport
��Ĥޤ���ʣ���Υƥ����ȥե�����򤽤줾��Υơ��֥���ɤ߹��ߤޤ���@code{LOAD
DATA INFILE} �ǥ��ݡ��Ȥ�������Ƥη�������ѤǤ��ޤ��� @xref{mysqlimport, , @code{mysqlimport}}.

@cindex @code{mysqlshow}
@item mysqlshow
�ǡ����١���, �ơ��֥�, ���ܤ����ƥ���ǥå����ˤĤ��Ƥξ����ɽ�����ޤ���

@cindex @code{mysql_install_db}
@item mysql_install_db
@strong{MySQL} ��ǧ�ơ��֥��ǥե���Ȥθ��¤Ǻ������ޤ���������̾��
��� @strong{MySQL} ��꡼���򿷤��������ƥ��˥��󥹥ȡ��뤹����˰��
�����¹Ԥ���ޤ���

@cindex @code{replace}
@item replace
@code{msql2mysql} �ǻ��Ѥ����Х��ʥꡣ�ե�������ޤ���ɸ�����Ͼ��ʸ�������
������桼�ƥ���ƥ��ץ�����ࡣ���Ĺ��ʸ����˺ǽ��Ŭ�礹�뤿��ͭ�¾�
�֥ޥ������Ѥ��ޤ���ʸ�����򴹤��뤿��˻��ѤǤ��ޤ����㤨�С�
@code{a} �� @code{b} ��Ϳ����줿�ե�������Ǹ򴹤��ޤ�:

@example
shell> replace a b b a -- file1 file2 ...
@end example

@cindex @code{safe_mysqld}

@item safe_mysqld
@code{mysqld} �ǡ����򤤤��Ĥ��ΰ����ʵ�ǽ�dz��Ϥ��ޤ������顼���ˤϺƵ�ư����
�¹Ի����������ե�����ص������ޤ���
@end table

@cindex Scripts
@cindex @code{mysql}
@node mysql, mysqladmin, Programs, Tools
@section ���ޥ�ɥ饤��ġ��롡�� @code{mysql} ��

@code{mysql} �ϥ���ץ�� SQL shell �Ǥ�(GNU @code{readline} ����äƤ��ޤ�).
��������å⡼�ɤȡ������å⡼�ɤ���äƤ��ޤ��� ���å⡼�ɤǻ��Ѥ��줿��硢
������η�̤� ASCII �ơ��֥�Υե����ޥåȤ�Ϳ�����ޤ���
�����å⡼�ɤǻ��Ѥ��줿���(�㤨�Хե��륿���Ȥ���)����̤ϥ��ֶ��ڤ��
�ե����ޥåȤ��֤�ޤ���
(���ϥե����ޥåȤϥ��ޥ�ɥ饤��Υ��ץ������ѹ��Ǥ��ޤ�)
�ʲ��Τ褦�ˤ��ƥ�����ץȤ�¹ԤǤ��ޤ���

@example
shell> mysql database < script.sql > output.tab
@end example

�⤷���饤����Ȥǥ��꡼��­�����꤬�Ф���硢@code{--quick} ���ץ�����
���Ѥ��ޤ��� ����� @code{mysql} �ˡ���̥��åȤ��������ݤˡ�
@code{mysql_store_result()} �ǤϤʤ� @code{mysql_use_result()} ��
���Ѥ����ޤ���

@code{mysql} �λ��ѤϤȤƤ��ñ�Ǥ���
@code{mysql database} �� @code{mysql --user=user_name --password=your_password d
atabase} �Τ褦�ˤ��ƤϤ���ޤ���
SQL ʸ�����Ϥ�����ʸ�� @samp{;}, @samp{\g} or @samp{\G} �ǽ�����
return/enter �򲡤��ޤ���

@code{mysql} �ϰʲ��Υ��ץ����򥵥ݡ��Ȥ��ޤ���

@table @code
@item -?, --help
help ��ɽ�����ƽ�λ
@item -A, --no-auto-rehash
��ư��ϥå���򤷤ʤ��� �ơ��֥�ȥե�����ɤμ����ˤ� 'rehash' ����Ѥ��ʤ��Ƥ�
�ʤ�ޤ��� ����� @code{mysql} �ε�ư��®�����ޤ���
@item -B, --batch
��̤򥿥ֶ��ڤꡢ���쥳���ɤϣ��Ԥǽ��Ϥ��ޤ��� history �ե�����ϻ��Ѥ��ޤ���
@item -C, --compress
�����С������饤����ȴ֤��̿��򰵽̤��ޤ�
@item -#, --debug[=...]
�ǥХå������� �ǥե���Ȥ� 'd:t:o,/tmp/mysql.trace'
@item -D, --database=.. 
���Ѥ���ǡ����١����� ����� @code{my.cnf} �ե����뤬�����Ǥ�
@item -e, --execute=...
���ޥ�ɤ�¹Ԥ��ƽ�λ�� (Output like with --batch)
@item -E, --vertical
��ľ�˥쥳���ɤ���Ϥ��ޤ��� ���Υ��ץ�������ꤷ�Ƥ��ʤ��Ƥ⡢
SQL ʸ�� @code{\G} �ǽ�λ������硢Ʊ���褦�˿�ľ�˽��Ϥ��ޤ���
@item -f, --force
SQL ���顼���������Ȥ��Ƥ⡢������³���ޤ�
@item -i, --ignore-space
�ؿ�̾�θ���ˤĤ������ڡ�����̵�뤷�ޤ�
@item -h, --host=...
���ꤷ���ۥ��Ȥ���³���ޤ�
@item -H, --html
��̤� HTML �ե����ޥåȤ��֤��ޤ�
@item -L, --skip-line-numbers
���顼�ε������Ԥ��ֹ��񤭤ޤ��� ����ϥ��顼��å�������ޤ����̤�
��Ӥ�����������Ǥ���
@item -n, --unbuffered
���줾��Υ�������˥Хåե���ե�å��夷�ޤ�
@item -N, --skip-column-names
��̤ˡ��ե������̾��񤭽Ф��ޤ���
@item -O, --set-variable var=option
�ѿ����ͤ򥻥åȤ��ޤ��� @code{--help} lists variables
@item -o, --one-database
�ǥե���ȤΥǡ����١����Τ߹������ޤ��� ����� update �����ե������
���Ѥ��ƹ��������硢¾�Υǡ����١����ι������򤱤������������Ǥ���
@item -p[password], --password[=...]
�����С�����³����ݤΥѥ���ɡ� �⤷�ѥ���ɤ����ޥ�ɥ饤���
���ꤵ��Ƥ��ʤ��ä���硢tty ��ǥѥ���ɤ��䤤��蘆��ޤ���
@code{-p} ����Ѥ����硢���Υ��ץ����ȥѥ���ɤδ֤ˤ�
���ڡ��������פ��Ȥ������Ȥ����դ��Ƥ���������
@item -P  --port=...
��³�˻��Ѥ��� TCP/IP �ݡ����ֹ�
@item -q, --quick
��̤򥭥�å��夻������쥳���ɤŤĽ��Ϥ��ޤ���
����Ϥ⤷���Ϥ���ߤ�����硢�����С����٤����ޤ���
�ҥ��ȥ�ե�����ϻ��Ѥ��ޤ���
@item -r, --raw
���������׽����򤷤ʤ����ͤ�񤭽Ф��ޤ��� @code{--batch} �ȤȤ�˻��Ѥ���ޤ�
@item -s, --silent
�Žͥ⡼��
@item -S  --socket=...
��³�˻��Ѥ��� �����åȥե�����
@item -t  --table
ɽ�η����ǽ��Ϥ��ޤ��� ����� batch �⡼�ɰʳ��ǤΥǥե���ȤǤ���
@item -T, --exit-info
Only used when debugging.  --exit-info=0 will print some usage information
one exit.
@item -u, --user=#
��������桼����̾
@item -U, --safe-updates[=#], --i-am-a-dummy[=#]
��������Ѥ��� @code{UPDATE} and @code{DELETE} �Τߤ�Ԥ��ޤ���
����ϸ�Ҥ��ޤ��� ���Υ��ץ�����⤷ @code{my.cnf} �˽񤤤Ƥ�����ϡ�
@code{--safe-updates=0} �Ǥ��Υ��ץ�����ꥻ�åȤǤ��ޤ���
@item -v, --verbose
��Ĺ���ϡ� (-v -v -v ��ɽ�����ν��Ϥ�Ϳ����)
@item -V, --version
�С�������ɽ�����ƽ�λ
@item -w, --wait
�⤷��³���������硢���Ǥ��ʤ��ǡ��Ԥäơ��ƻ�Ԥ��ޤ���
@end table

�⤷���ޥ�ɥ饤��� 'help' ���Ǥä���硢@code{mysql} �ϥ��ݡ��Ȥ���
���ޥ�ɤ�ɽ�����ޤ���

@example
mysql> help

MySQL commands:
help    (\h)    Display this text
?       (\h)    Synonym for `help'
clear   (\c)    Clear command
connect (\r)    Reconnect to the server. Optional arguments are db and host
edit    (\e)    Edit command with $EDITOR
exit    (\q)    Exit mysql. Same as quit
go      (\g)    Send command to mysql server
ego     (\G)    Send command to mysql server; Display result vertically
print   (\p)    Print current command
quit    (\q)    Quit mysql
rehash  (\#)    Rebuild completion hash
source  (\.)    Execute a SQL script file. Takes a file name as an argument
status  (\s)    Get status information from the server
use     (\u)    Use another database. Takes database name as argument
@end example

@code{status} ���ޥ�ɤϡ������Ѥ��Ƥ���
��³�ȥ����С��ˤĤ��Ƥξ���򤤤��Ĥ�ɽ�����ޤ���
�⤷ @code{--safe-updates} �⡼�ɤǻ��Ѥ��Ƥ����硢 @code{status} ��
���ʤ��Υ�����˱ƶ����� @code{mysql} �ѿ����ͤ�ɽ�����ޤ���

�鿴�Ԥ������ʵ�ư���ץ����(@strong{MySQL} 3.23.11 ��Ƴ������ޤ���)�ϡ�
@code{--safe-mode} (���뤤�� @code{--i-am-a-dummy}) �ǡ�
����� @code{DELETE FROM table_name} �� @code{WHERE} ���˺���
�¹Ԥ��褦�Ȥ������Τ���ˤ���ޤ���
���Υ��ץ���󤬻��Ѥ����ȡ� @code{mysql} ����³���� @strong{MySQL} �����С���
�ʲ��Τ褦�ʥ��ޥ�ɤ�����ޤ���

@example
SET SQL_SAFE_UPDATES=1,SQL_SELECT_LIMIT=#select_limit#,
    SQL_MAX_JOIN_SIZE=#max_join_size#"
@end example

������ @code{#select_limit#} �� @code{#max_join_size#} ���ѿ���
������ @code{mysql} ���ޥ�ɤ��饻�åȲ�ǽ�Ǥ���
@xref{SET OPTION, @code{SET}}.

���θ��̤ϡ�

@itemize bullet
@item
�⤷ @code{WHERE} ��ǥ�������Ѥ��Ƥ��ʤ���С�@code{UPDATE} �� @code{DELETE}
�ϵ��Ĥ���ޤ��� �������� @code{LIMIT} ����Ѥ���� @code{UPDATE/DELETE} ��
�����¹ԤǤ��ޤ���
@example
UPDATE table_name SET not_key_column=# WHERE not_key_column=# LIMIT 1;
@end example
@item
���Ƥ�¿���ʷ�̤ϼ�ưŪ�� @code{#select_limit#} �쥳���ɤޤǤ��ޤ����ޤ���
@item
ɾ���� @code{#max_join_size} �ʾ�ιԤ�ɬ�פȤ���Ǥ����� @code{SELECT} ��
���Ǥ���ޤ���
@end itemize

@node mysqladmin, mysqldump, mysql, Tools
@section @strong{MySQL} �����С��δ�����( @code{mysqladmin} )

�������ڥ졼������¹Ԥ��뤿��Υ桼�ƥ���ƥ������󥿥å�����: 

@example
shell> mysqladmin [OPTIONS] command [command-option] command ...
@end example

@code{mysqladmin --help} �ˤ�äơ����ץ����ΰ������ˤ���뤳�Ȥ��Ǥ��ޤ���

���ߤ� @code{mysqladmin} �ϰʲ��Υ��ޥ�ɤ򥵥ݡ��Ȥ��ޤ���

@multitable @columnfractions .3 .7
@item create databasename @tab �ǡ����١����κ���
@item drop databasename  @tab �ǡ����١����ȥơ��֥���������
@item extended-status @tab �����С������ĥ���ơ������������
@item flush-hosts @tab ����å��夵��Ƥ������ۥ��Ȥ�ե�å��塣
@item flush-logs @tab ���ƤΥ�����ե�å���
@item flush-tables @tab ���ƤΥơ��֥��ե�å���
@item flush-privileges @tab ���ĥơ��֥�κ��ɤ߹��� (reload ��Ʊ��)
@item kill id,id,...  @tab mysql ����åɤ� kill.
@item password new-password @tab �Ť��ѥ���ɤ� new-password ���ѹ�
@item ping @tab mysqld �������Ƥ��뤫�����å�
@item processlist @tab ���߳�ư��� mysql ����åɤ�ɽ��
@item reload @tab ���ĥơ��֥�κ��ɤ߹���
@item refresh @tab ���ơ��֥��ե�å��夷�������ե����������Ĥ��Ƴ����ޤ���
@item shutdown @tab �����С�������󤵤��ޤ���
@item slave-start @tab Start slave replication thread
@item slave-stop @tab Stop slave replication thread
@item status @tab �����С�����û�����ơ����������ޤ���
@item variables @tab �ѿ���ɽ��
@item version @tab �����С�����С����������ޤ���
@end multitable

���ƤΥ��ޥ�ɤϡ���ˡ����ʥץ�ե��å����Ǿ�ά��ǽ�Ǥ���
�㤨�С�

@example
shell> mysqladmin proc stat
+----+-------+-----------+----+-------------+------+-------+------+
| Id | User  | Host      | db | Command     | Time | State | Info |
+----+-------+-----------+----+-------------+------+-------+------+
| 6  | monty | localhost |    | Processlist | 0    |       |      |
+----+-------+-----------+----+-------------+------+-------+------+
Uptime: 10077  Threads: 1  Questions: 9  Slow queries: 0  Opens: 6  Flush tables: 1  Open tables: 2  Memory in use: 1092K  Max memory used: 1116K
@end example

@code{mysqladmin status} ���ޥ�ɤη�̤ϡ��ʲ��ι��ܤ�����ޤ�:

@multitable @columnfractions .3 .7
@item Uptime @tab @strong{MySQL} �����С��ε�ư�ÿ�
@item Threads @tab ��Ư��Υ���åɿ� (clients)
@item Questions @tab @code{mysqld} �����Ϥ��Ƥ���Υ��饤����Ȥ���Υ������
@item Slow queries @tab @code{long_query_time} �ä����֤Τ����ä�������ο�
@item Opens @tab @code{mysqld} ���������ơ��֥��
@item Flush tables @tab @code{flush ...}, @code{refresh} and @code{reload} ���ޥ�ɤμ¹Բ��
@item Open tables @tab ���߳�����Ƥ���ơ��֥�ο�
@item Memory in use @tab mysqld �Υ����ɤˤ�ä�ľ�ܳ�����Ƥ�줿���� (only available when @strong{MySQL} is compiled with --with-debug)
@item Max memory used @tab mysqld �Υ����ɤˤ�ä�ľ�ܳ�����Ƥ��������꡼�� (only available when @strong{MySQL} is compiled with --with-debug)
@end multitable

If you do @code{mysqladmin shutdown} on a socket (in other words, on a
the computer where @code{mysqld} is running), @code{mysqladmin} will
wait until the @code{MySQL} @code{pid-file} is removed to ensure that
the @code{mysqld server} has stopped properly.

@node mysqldump, mysqlimport, mysqladmin, Tools
@section @strong{MySQL} �ǡ����١����ȥơ��֥뤫�顢��¤�ȥǡ��������ס�( @code{mysqldump} )

�ǡ����١��������뤤�ϡ�
�Хå����åס�¾��SQL�����С��ؤΥǡ������ư����Ū�Ȥ����ǡ����ΤޤȤޤꡢ
���������פ��뤿��Υ桼�ƥ���ƥ���
����פϡ��ơ��֥�κ����Τ���� SQL ʸ��ޤߤޤ���

@example
shell> mysqldump [OPTIONS] database [tables]
OR     mysqldump [OPTIONS] --databases [OPTIONS] DB1 [DB2 DB3...]
OR     mysqldump [OPTIONS] --all-databases [OPTIONS]
@end example

�⤷�ơ��֥����ꤻ����@code{--databases} �� @code{--all-databases} ��
���Ѥ��ʤ��ä��ʤ顢�ǡ����١��������ƤΥơ��֥뤬����פ���ޤ���

@code{mysqldump --help} �ˤ�äơ����ץ����ΰ������ˤ���뤳�Ȥ��Ǥ��ޤ���

�⤷ @code{mysqldump} �� @code{--quick} �� @code{--opt} �ʤ��Ǽ¹Ԥ���ʤ�С�
@code{mysqldump} �Ϸ�̤�ɽ���������ˡ���̤��������ƥ����ɤ��뤳�Ȥ�
���դ��Ƥ���������
������礭�ʥǡ����١��������פ���ݤ�����ˤʤ�Ǥ��礦��

@code{mysqldump} �ϰʲ��Υ��ץ����򥵥ݡ��Ȥ��ޤ���

@table @code
@item --add-locks
�ơ��֥�Υ���פ����� @code{LOCK TABLES} ʸ���ɲä���
�ơ��֥�Υ���׸�� @code{UNLOCK TABLE} ʸ���ɲä��ޤ���
( ���Ȥ� @strong{MySQL} ����������Ȥ��ˤ����®���ʤ�ޤ� ).
@item --add-drop-table
�ơ��֥�� create ʸ�����ˡ�@code{drop table} ʸ���ɲä��ޤ���
@item -A, --all-databases 
Dump all the databases. This will be same as @code{--databases} with all
databases selected.
@item -a, --all
Include all @strong{MySQL} specific create options.
@item --allow-keywords
�������(ͽ���) ��Ʊ��̾�����ĥե�����ɤκ���������ޤ���
����ϡ����줾��Υե�����ɤ����ˡ��ơ��֥�̾���դ�­���ޤ���
@item -c, --complete-insert
������ INSERT ʸ(�ե������̾��񤤤�ʸ) ����Ѥ��ޤ���
@item -C, --compress
�⤷�����С��ȥ��饤����Ȥ����������̤򥵥ݡ��Ȥ��Ƥ���ʤ�С�
ξ�Ԥδ֤ǹԤ����̿������ư��̤��ޤ���
@item -B, --databases
To dump several databases. Note the difference in usage; In this case
no tables are given. All name arguments are regarded as databasenames.
@code{USE db_name;} will be included in the output before each new database.
@item --delayed
@code{INSERT DELAYED} ���ޥ�ɤ���Ѥ��ƥ쥳���ɤ� INSERT ���ޤ���
@item -e, --extended-insert
�������ޥ���饤�� @code{INSERT} ��ʸ����Ѥ��ޤ���(����Ϥ��Ȥ���������ݡ�
��ꥳ��ѥ��Ȥ���®���ʤ�ޤ���)
@item -#, --debug[=option_string]
Trace usage of the program (for debugging).
@item --help
Display a help message and exit.
@item --fields-terminated-by=...
@itemx --fields-enclosed-by=...
@itemx --fields-optionally-enclosed-by=...
@itemx --fields-escaped-by=...
@itemx --lines-terminated-by=...
�����Υ��ץ����� @code{-T} �ȤȤ�˻��Ѥ��졢
@code{LOAD DATA INFILE} ��Ʊ�ͤΰ�̣��ʤ��ޤ���
@xref{LOAD DATA, , @code{LOAD DATA}}.
@item -F, --flush-logs
����פ������ˡ� @strong{MySQL} �����С��Υ����ե������ե�å��夷�ޤ���
@item -f, --force,
����פ������ SQL ���顼��ȯ�����Ƥ⡢����פ�³���ޤ���
@item -h, --host=..
���ꤵ�줿�ۥ��Ȥ� @strong{MySQL} �����С��������פ��ޤ���
�ǥե���ȤΥۥ��Ȥ� @code{localhost}.
@item -l, --lock-tables.
����פ򳫻Ϥ���Ȥ����ƤΥơ��֥����å����ޤ��� The tables are locked with
@code{READ LOCAL} to allow concurrent inserts in the case of @code{MyISAM}
tables.
@item -n, --no-create-db
'CREATE DATABASE /*!32312 IF NOT EXISTS*/ db_name;' will not be put in the
output. The above line will be added otherwise, if --databases or
--all-databases option was given.
@item -t, --no-create-info
�ơ��֥�κ�������( @code{CREATE TABLE} ʸ) ��񤭽Ф��ޤ���
@item -d, --no-data
�ơ��֥���Υ쥳���ɤ�񤭽Ф��ޤ���
����ϥơ��֥�ι�¤��������Ф������Ȥ��ˤȤƤ������Ǥ���
@item --opt
@code{--quick --add-drop-table --add-locks --extended-insert --lock-tables} ��Ʊ��.
@strong{MySQL} �����С������ɤ߽Ф����֤��û�ˤ��Ƥ���ޤ���
@item -pyour_pass, --password[=your_pass]
�����С�����³����ݤΥѥ���ɤ�Ϳ���ޤ���
�⤷ @samp{=your_pass} ��ʬ��Ϳ���ʤ��ä����ϡ�
@code{mysqldump} �ϥѥ���ɤΥץ���ץȤ�����ޤ���
@item -P port_num, --port=port_num
�����С�����³����ݤ˻��Ѥ��� TCP/IP �ݡ����ֹ档
 (����� @code{localhost} �ʳ��Υۥ��Ȥؤ���³�˻��Ѥ���ޤ���
 @code{localhost} �ξ��ϡ�Unix �����åȤ����Ѥ���ޤ���)
@item  -q, --quick
�������Хåե��ˤ�����ߤޤ���stdout ��ľ�ܽФ��ޤ���
@code{mysql_use_result()} �򤳤�˻��Ѥ��Ƥ��ޤ���
@item -S /path/to/socket, --socket=/path/to/socket
@code{localhost} ����³����ݤΥ����åȥե�����λ��� (�ǥե���Ȥ� /tmp/mysql.sock )
@item --tables
Overrides option --databases (-B).
@item  -T, --tab=path-to-some-directory
Ϳ����줿�ơ��֥���ˡ�
SQL CREATE ʸ��ޤ� @code{table_name.sql} �ե����롢
�ǡ�����ޤ� @code{table_name.txt} �ե������������ޤ���
@strong{NOTE}: 
����� @code{mysqld} �ǡ�������äƤ���ޥ����� @code{mysqldump} ��
�¹Ԥ�����ˤ�����ư��ޤ���
 @code{.txt} �ե�����Υե����ޥåȤϡ�
 @code{--fields-xxx} �� @code{--lines--xxx} ���ץ����˽����ޤ���
@item -u user_name, --user=user_name
�����С�����³����ݤ� @strong{MySQL} �桼����̾��
�ǥե���ȤǤϡ�Unix �Υ�������̾�ˤʤ�ޤ���
@item -O var=option, --set-variable var=option
�ѿ����ͤ򥻥åȡ� ��ǽ���ѿ��ϸ�Ǽ������ޤ���
@item -v, --verbose
��Ĺ�⡼�ɡ� �ץ�����ब����ԤäƤ��뤫���ɽ�����ޤ���
@item -V, --version
�С������򼨤��ƽ�λ��
@item -w, --where='where-condition'
���򤵤줿�쥳���ɤΤߤ����ס� �������Ȥ�ɬ�ܤǤ���

@example
"--where=user='jimf'" "-wuserid>1" "-wuserid<1"
@end example
@item -O net_buffer_length=#, where # < 24M
When creating multi-row-insert statements (as with option
@code{--extended-insert} or @code{--opt}), @code{mysqldump} will create
rows up to @code{net_buffer_length} length. If you increase this
variable, you should also ensure that the @code{max_allowed_packet}
variable in the @strong{MySQL} server is bigger than the
@code{net_buffer_length}.
@end table

@code{mysqldump} �����̤λ��Ѥϥǡ����١����ΥХå����åפǤ��礦�� @xref{Backup}.

@example
mysqldump --opt database > backup-file.sql
@end example

¾�� @strong{MySQL} �����С��إǡ����١����򥳥ԡ�������ˤ������Ǥ���

@example
mysqldump --opt database | mysql ---host=remote-host -C database
@end example

It is possible to dump several databases with one command:

@example
mysqldump --databases database1 [database2 database3...] > my_databases.sql
@end example

If all the databases are wanted, one can use:

@example
mysqldump --all-databases > all_databases.sql
@end example


@node mysqlimport, mysqlshow, mysqldump, Tools
@section �ƥ����ȥե����뤫��ǡ���������ࡡ( @code{mysqlimport} )

@code{mysqlimport} �ϡ�@code{LOAD DATA INFILE} SQL ��ʸ��
���ޥ�ɥ饤�󥤥󥿡��ե��������󶡤��ޤ���
@code{mysqlimport} �Υ��ץ����ΤۤȤ�ɤ���
 @code{LOAD DATA INFILE} �ؤ�Ʊ�����ץ������б����ޤ���
@xref{LOAD DATA, , @code{LOAD DATA}}.

@code{mysqlimport} �μ¹Ԥϰʲ��Τ褦�ˤ��ޤ�:

@example
shell> mysqlimport [options] database textfile1 [textfile2....]
@end example

@code{mysqlimport} �ϡ����ޥ�ɥ饤��ΰ�����Ϳ����줿�ե�����̾�γ�ĥ�Ҥ��ꡢ
��ĥ�Ҥ��ä����̾���򡢥ե���������Ƥ������ơ��֥��̾���Ȥ��ޤ���
�㤨�С�@file{patient.txt}, @file{patient.text}, @file{patient} �Ȥ���
�ե���������ơ�@code{patient} �ȤȤ���̾���Υơ��֥�˼����ޤ�ޤ���

@code{mysqlimport} �ϰʲ��Υ��ץ����򥵥ݡ��Ȥ��ޤ�:

@table @code
@item -c, --columns=... 
This option takes a comma separated list of field names as an argument.
The field list is passed to LOAD DATA INFILE MySQL sql command, which
mysqlimport calls MySQL to execute. For more information, please see
@code{LOAD DATA INFILE}. @xref{LOAD DATA, , @code{LOAD DATA}}.
@item -C, --compress
���饤����Ȥȥ����С���ξ�������̤򥵥ݡ��Ȥ��Ƥ���ʤ顢
���饤����ȡ������С��֤Ǥ���ꤵ������Ƥξ���򰵽̤��ޤ���

@item -#, --debug[=option_string]
�ץ������Υȥ졼��(�ǥХå�)

@item -d, --delete
�ƥ����ȥե��������������˥ơ��֥����ˤ��ޤ���

@item --fields-terminated-by=...
@itemx --fields-enclosed-by=...
@itemx --fields-optionally-enclosed-by=...
@itemx --fields-escaped-by=...
@itemx --lines-terminated-by=...
�����Υ��ץ����ϡ�@code{LOAD DATA INFILE} ���б�����ʸ���Ʊ����̣�ˤʤ�ޤ���
@xref{LOAD DATA, , @code{LOAD DATA}}.

@item -f, --force
���顼��̵�뤷�ޤ����㤨�С��ƥ����ȥե�����������ơ��֥뤬�ʤ���硢
�Ĥ�Υե�����ν����˰ܤ�ޤ��� @code{--force} ���ʤ���С�
�ơ��֥뤬�ʤ���� @code{mysqlimport} �Ͻ�λ���ޤ���

@item --help
�إ�פ�ɽ�����ƽ�λ��

@item -h host_name, --host=host_name
̾������ꤵ�줿 @strong{MySQL} �����С��˥ǡ�����������ޤ���
�ǥե���ȤǤ� @code{localhost}.

@item -i, --ignore
@code{--replace} ���ץ����������򸫤Ƥ���������

@item -l, --lock-tables
���줾��Υƥ����ȥե����������������ˡ��񤭹��ޤ��
@strong{���Ƥ�}�ơ��֥����å����ޤ���
����ϳμ¤ˡ����٤ƤΥơ��֥�򥵡��о��Ʊ�������ޤ���

@item -L, --local
���饤����Ȥ�������ϥե�������ɤߤޤ���
�ǥե���ȤǤϡ�@code{localhost} ����³������硢�ƥ����ȥե������
�����С���ˤ���Ȳ��ꤵ��ޤ���(@code{localhost} �ϥǥե������)

@item -pyour_pass, --password[=your_pass]
�����С�����³����Ȥ��˻��Ѥ���ѥ���ɡ�
�⤷ @samp{=your_pass} �ΤȤ����˥ѥ���ɤ�񤫤ʤ���С�
@code{mysqlimport} �ϥѥ���ɤΤ���Υץ���ץȤ�����ޤ���

@item -P port_num, --port=port_num
�ۥ��Ȥ���³���뤿��� TCP/IP �ݡ����ֹ档
(����� @code{localhost} ������ۥ��Ȥؤ���³�˻��Ѥ��ޤ���
@code{localhost} �ؤϡ�UNIX �����åȤ���Ѥ��ޤ���)

@item -r, --replace
@code{--replace} �� @code{--ignore} ���ץ����ϡ�
���Ϥ���Ƥ���쥳���ɤΥ�ˡ����������ͤ���
����¸�ߤ��Ƥ���쥳���ɤΥ�ˡ����������ͤ�Ʊ����硢
�������Ϥ���Ƥ���ǡ����μ�갷������ꤷ�ޤ���
�⤷ @code{--replace} �����ꤵ��Ƥ���ʤ顢
���ˤ���쥳���ɤϿ������ɤޤ줿�쥳���ɤ��֤��������ޤ���
�⤷ @code{--ignore} �����ꤵ��Ƥ���ʤ顢
���Ϥ��줿ʪ��̵�뤵��ޤ���
�ɤ���Υ��ץ�������ꤷ�Ƥ��ʤ���硢
�������ͤ��ŤʤäƤ���ȥ��顼��ȯ����
�ƥ����ȥե�����λĤ����ʬ��̵�뤵��ޤ���

@item  -s, --silent
�Žͥ⡼�ɡ����顼�������Ϥ��ޤ���

@item -S /path/to/socket, --socket=/path/to/socket
@code{localhost} �ؤ���³���˻��Ѥ��륽���åȥե��������ꤷ�ޤ���

@item -u user_name, --user=user_name
�����С�����³�˻��Ѥ��� @strong{MySQL} �桼����̾�λ��ꡣ
�ǥե���Ȥϡ�Unix �Υ�������̾��

@item -v, --verbose
��Ĺ�⡼�ɡ��ץ�����ब���Ƥ�����ˤĤ���¿�����Ϥ��ޤ���

@item -V, --version
�С�������ɽ�����ƽ�λ��
@end table

Here follows a sample run of using @code{mysqlimport}:

@example
$ mysql --version
mysql  Ver 9.33 Distrib 3.22.25, for pc-linux-gnu (i686)
$ uname -a
Linux xxx.com 2.2.5-15 #1 Mon Apr 19 22:21:09 EDT 1999 i586 unknown
$ mysql -e 'CREATE TABLE imptest(id INT, n VARCHAR(30))' test
$ ed
a
100     Max Sydow
101     Count Dracula
.
w imptest.txt
32
q
$ od -c imptest.txt
0000000   1   0   0  \t   M   a   x       S   y   d   o   w  \n   1   0
0000020   1  \t   C   o   u   n   t       D   r   a   c   u   l   a  \n
0000040
$ mysqlimport --local test imptest.txt
test.imptest: Records: 2  Deleted: 0  Skipped: 0  Warnings: 0
$ mysql -e 'SELECT * FROM imptest' test
+------+---------------+
| id   | n             |
+------+---------------+
|  100 | Max Sydow     |
|  101 | Count Dracula |
+------+---------------+
@end example

@node mysqlshow, myisampack, mysqlimport, Tools
@section Showing databases, tables and columns����@code{mysqlshow}��

@code{mysqlshow} can be used to quickly look at which databases exist,
their tables, and the table's columns.

With the @code{mysql} program you can get the same information with the
@code{SHOW} commands.  @xref{SHOW}.

@code{mysqlshow} is invoked like this:

@example
shell> mysqlshow [OPTIONS] [database [table [column]]]
@end example

@itemize @bullet
@item
If no database is given, all matching databases are shown.
@item
If no table is given, all matching tables in database are shown.
@item
If no column is given, all matching columns and column types in table
are shown.
@end itemize

Note that in newer @strong{MySQL} versions you only see those
database/tables/columns for which you have some privileges.

If the last argument contains a shell or SQL wildcard (@code{*}, @code{?},
@code{%} or @code{_}) then only what's matched by the wildcard is shown.
This may cause some confusion when you try to display the columns for a
table with a @code{_} as in this case @code{mysqlshow} only shows you
the table names that matches the pattern.  This is easily fixed by
adding an extra @code{%} last on the command line (as a separate
argument).

@cindex @code{myisampack}
@cindex @code{pack_isam}
@node myisampack,  , mysqlshow, Tools
@section @strong{MySQL} �ΰ��̤��줿�ɤ߹������ѥơ��֥른���ͥ졼����( @code{myisampack} �� @code{pack_isam} )

@code{myisampack} is used to compress MyISAM tables and @code{pack_isam} 
is used to compress ISAM tables. Because ISAM tables are deprecated, we
will only discuss @code{myisampack} here.

@code{myisampack} �ϡ�
1 @strong{MySQL} �饤���󥹰ʾ�ޤ��� @strong{MySQL} ���ݡ��Ȥ���ʸ����������
�������̤ʥ桼�ƥ�ƥ��Ǥ��������ϥХ��ʥ���������ۤΤ��ᡢ
�����Ĥ��Υץ�åȥե������Ǥ�����ͭ���Ǥ���

In the following we only talk about @code{myisampack}, but everything
is also true for @code{pack_isam}.

@code{myisampack} �ϥơ��֥���γƹ��ܤ��̡��˰��̤���褦��Ư���ޤ���Ÿ���Τ���
�ξ���ϡ��ơ��֥뤬�����ץ󤵤줿���˥�����ɤޤ�ޤ�������ϡ����Τ�1�쥳��
�ɤ�����Ÿ������ɬ�פ�����褦�ʡ��ġ��Υ쥳���ɤؤΥ����������ˤȤƤ���
����ǽ��Ϳ���ޤ���MSDOS ��� Stacker ���ѻ��Τ褦�ˡ��ǥ������֥��å���
����ʤ��礭������ޤ���
�̾@code{myisampack} �ϥǡ����ե������ 40��70% �˥ѥå����ޤ���

@strong{MySQL} �ϰ��̤��줿�ơ��֥�ǥ���ޥå� (@code{mmap()}) ����Ѥ��ޤ���
@code{mmap()} ��Ư���ʤ����ϡ��̾�Υե�������ɤ߽񤭤���Ѥ��ޤ���

���� @code{myisampack} �ˤ�2�Ĥ����¤�����ޤ�:
@itemize @bullet
@item
�ѥå��塢�ơ��֥���ɤ߹������Ѥˤʤ�ޤ���
@item
@code{myisampack} can also pack @code{BLOB} or @code{TEXT} columns. The
older @code{pack_isam} could not do this.
@end itemize

���������¤ν����� TODO �ˤ���ޤ�����ͥ���٤��㤤�Ǥ���

@code{myisampack} �ϰʲ��Τ褦�ˤ��Ƶ�ư���ޤ�:

@example
shell> myisampack [options] filename ...
@end example

���줾��Υե�����̾�ϥ���ǥå����ե�����(@file{.MYI})��̾���Ǥ���
�⤷�ǡ����ǥ��쥯�ȥ�˥����ȥǥ��쥯�ȥ���ư���Ƥ��ʤ��ʤ顢
�ե�����Υѥ�����ꤷ�ʤ��ƤϤʤ�ޤ���@file{.MYI} ��ĥ�Ҥ�
��ά���뤳�Ȥ���ǽ�Ǥ���

@code{myisampack} �ϰʲ��Υ��ץ����򥵥ݡ��Ȥ��ޤ�:

@table @code
@item -b, --backup
@code{tbl_name.OLD} �Ȥ��ƥХå����åפ�������ޤ�.

@item -#, --debug=debug_options
�ǥХå����ϡ�@code{debug_options} �� @code{'d:t:o,filename'}.

@item -f, --force
����ե����뤬¸�ߤ��Ƥ��褦�������������礭���ʤ�����������Ū�˥ơ��֥��
�ѥå����ޤ���
@code{myisampack} �ϥơ��֥�򰵽̤��Ƥ���֡�
����ե������ @file{tbl_name.TMD} �Ȥ���̾���Ǻ������ޤ���
�⤷ @code{myisampack} ������� kill ������硢 @file{.TMD} �ե����뤬�ä����
���ʤ���������ޤ����̾@code{myisampack} �� @file{tbl_name.TMD} �ե����뤬
����¸�ߤ�����ϥ��顼�ǽ�λ���ޤ��� @code{--force} ����Ѥ���ȡ�
@code{myisampack} �Ϥ��Τ褦�ʾ��Ǥ�ơ��֥��ѥå����ޤ���

@item -?, --help
�إ�ץ�å���������Ϥ��ƽ�λ��

@item -j big_tbl_name, --join=big_tbl_name
���ƤΥơ��֥�򥳥ޥ�ɥ饤��ǻ��ꤷ�� @code{big_tbl_name} ��Ĥ�
�ޤȤ�ޤ�����礵������ƤΥơ��֥������Ʊ���Ǥʤ���Фʤ�ޤ���
(Ʊ������̾��Ʊ�����ܷ���Ʊ������ǥå�������)

@item -p #, --packlength=#
Specify the record length storage size, in bytes.  The value should be 1, 2
or 3.  (@code{myisampack} stores all rows with length pointers of 1, 2 or 3
bytes.  In most normal cases, @code{myisampack} can determine the right length
value before it begins packing the file, but it may notice during the packing
process that it could have used a shorter length. In this case,
@code{myisampack} will print a note that the next time you pack the same file,
you could use a shorter record length.)

@item -s, --silent
Silent mode.  Write output only when errors occur.

@item -t, --test
Don't pack table, only test packing it.

@item -T dir_name, --tmp_dir=dir_name
Use the named directory as the location in which to write the temporary table.

@item -v, --verbose
Verbose mode.  Write info about progress and packing result.

@item -V, --version
Display version information and exit.

@item -w, --wait
Wait and retry if table is in use.
If the @code{mysqld} server was invoked with the @code{--skip-locking}
option, it is not a good idea to invoke @code{myisampack} if the table might
be updated during the packing process.
@end table

The sequence of commands shown below illustrates a typical table compression
session:

@example
shell> ls -l station.*
-rw-rw-r--   1 monty    my         994128 Apr 17 19:00 station.ISD
-rw-rw-r--   1 monty    my          53248 Apr 17 19:00 station.ISM
-rw-rw-r--   1 monty    my         994128 Apr 17 19:00 station.MYD
-rw-rw-r--   1 monty    my          53248 Apr 17 19:00 station.MYI
-rw-rw-r--   1 monty    my           5767 Apr 17 19:00 station.frm

shell> myisamchk -dvv station

MyISAM file:     station
Isam-version:  2
Creation time: 1996-03-13 10:08:58
Recover time:  1997-02-02  3:06:43
Data records:              1192  Deleted blocks:              0
Datafile: Parts:           1192  Deleted data:                0
Datafile pointer (bytes):     2  Keyfile pointer (bytes):     2
Max datafile length:   54657023  Max keyfile length:   33554431
Recordlength:               834
Record format: Fixed length

table description:
Key Start Len Index   Type                       Root  Blocksize    Rec/key
1   2     4   unique  unsigned long              1024       1024          1
2   32    30  multip. text                      10240       1024          1

Field Start Length Type
1     1     1
2     2     4
3     6     4
4     10    1
5     11    20
6     31    1
7     32    30
8     62    35
9     97    35
10    132   35
11    167   4
12    171   16
13    187   35
14    222   4
15    226   16
16    242   20
17    262   20
18    282   20
19    302   30
20    332   4
21    336   4
22    340   1
23    341   8
24    349   8
25    357   8
26    365   2
27    367   2
28    369   4
29    373   4
30    377   1
31    378   2
32    380   8
33    388   4
34    392   4
35    396   4
36    400   4
37    404   1
38    405   4
39    409   4
40    413   4
41    417   4
42    421   4
43    425   4
44    429   20
45    449   30
46    479   1
47    480   1
48    481   79
49    560   79
50    639   79
51    718   79
52    797   8
53    805   1
54    806   1
55    807   20
56    827   4
57    831   4

shell> myisampack station.MYI
Compressing station.MYI: (1192 records)
- Calculating statistics

normal:     20  empty-space:      16  empty-zero:        12  empty-fill:  11
pre-space:   0  end-space:        12  table-lookups:      5  zero:         7
Original trees:  57  After join: 17
- Compressing file
87.14%

shell> ls -l station.*
-rw-rw-r--   1 monty    my         127874 Apr 17 19:00 station.ISD
-rw-rw-r--   1 monty    my          55296 Apr 17 19:04 station.ISM
-rw-rw-r--   1 monty    my         127874 Apr 17 19:00 station.MYD
-rw-rw-r--   1 monty    my          55296 Apr 17 19:04 station.MYI
-rw-rw-r--   1 monty    my           5767 Apr 17 19:00 station.frm

shell> myisamchk -dvv station

MyISAM file:     station
Isam-version:  2
Creation time: 1996-03-13 10:08:58
Recover time:  1997-04-17 19:04:26
Data records:              1192  Deleted blocks:              0
Datafile: Parts:           1192  Deleted data:                0
Datafilepointer (bytes):      3  Keyfile pointer (bytes):     1
Max datafile length:   16777215  Max keyfile length:     131071
Recordlength:               834
Record format: Compressed

table description:
Key Start Len Index   Type                       Root  Blocksize    Rec/key
1   2     4   unique  unsigned long             10240       1024          1
2   32    30  multip. text                      54272       1024          1

Field Start Length Type                         Huff tree  Bits
1     1     1      constant                             1     0
2     2     4      zerofill(1)                          2     9
3     6     4      no zeros, zerofill(1)                2     9
4     10    1                                           3     9
5     11    20     table-lookup                         4     0
6     31    1                                           3     9
7     32    30     no endspace, not_always              5     9
8     62    35     no endspace, not_always, no empty    6     9
9     97    35     no empty                             7     9
10    132   35     no endspace, not_always, no empty    6     9
11    167   4      zerofill(1)                          2     9
12    171   16     no endspace, not_always, no empty    5     9
13    187   35     no endspace, not_always, no empty    6     9
14    222   4      zerofill(1)                          2     9
15    226   16     no endspace, not_always, no empty    5     9
16    242   20     no endspace, not_always              8     9
17    262   20     no endspace, no empty                8     9
18    282   20     no endspace, no empty                5     9
19    302   30     no endspace, no empty                6     9
20    332   4      always zero                          2     9
21    336   4      always zero                          2     9
22    340   1                                           3     9
23    341   8      table-lookup                         9     0
24    349   8      table-lookup                        10     0
25    357   8      always zero                          2     9
26    365   2                                           2     9
27    367   2      no zeros, zerofill(1)                2     9
28    369   4      no zeros, zerofill(1)                2     9
29    373   4      table-lookup                        11     0
30    377   1                                           3     9
31    378   2      no zeros, zerofill(1)                2     9
32    380   8      no zeros                             2     9
33    388   4      always zero                          2     9
34    392   4      table-lookup                        12     0
35    396   4      no zeros, zerofill(1)               13     9
36    400   4      no zeros, zerofill(1)                2     9
37    404   1                                           2     9
38    405   4      no zeros                             2     9
39    409   4      always zero                          2     9
40    413   4      no zeros                             2     9
41    417   4      always zero                          2     9
42    421   4      no zeros                             2     9
43    425   4      always zero                          2     9
44    429   20     no empty                             3     9
45    449   30     no empty                             3     9
46    479   1                                          14     4
47    480   1                                          14     4
48    481   79     no endspace, no empty               15     9
49    560   79     no empty                             2     9
50    639   79     no empty                             2     9
51    718   79     no endspace                         16     9
52    797   8      no empty                             2     9
53    805   1                                          17     1
54    806   1                                           3     9
55    807   20     no empty                             3     9
56    827   4      no zeros, zerofill(2)                2     9
57    831   4      no zeros, zerofill(1)                2     9
@end example

The information printed by @code{myisampack} is described below:

@table @code
@item normal
The number of columns for which no extra packing is used.

@item empty-space
The number of columns containing
values that are only spaces; these will occupy 1 bit.

@item empty-zero
The number of columns containing
values that are only binary 0's; these will occupy 1 bit.

@item empty-fill
The number of integer columns that don't occupy the full byte range of their
type; these are changed to a smaller type (for example, an @code{INTEGER}
column may be changed to @code{MEDIUMINT}).

@item pre-space
The number of decimal columns that are stored with leading space. In this
case, each value will contain a count for the number of leading spaces.

@item end-space
The number of columns that have a lot of trailing space.  In this case, each
value will contain a count for the number of trailing spaces.

@item table-lookup
The column had only a small number of different values, and that were
converted to an @code{ENUM} before Huffman compression.

@item zero
The number of columns for which all values are zero.

@item Original trees
The initial number of Huffman trees.

@item After join
The number of distinct Huffman trees left after joining
trees to save some header space.
@end table

After a table has been compressed, @code{myisamchk -dvv} prints additional
information about each field:

@table @code
@item Type
The field type may contain the following descriptors:

@table @code
@item constant
All rows have the same value.

@item no endspace
Don't store endspace.

@item no endspace, not_always
Don't store endspace and don't do end space compression for all values.

@item no endspace, no empty
Don't store endspace. Don't store empty values.

@item table-lookup
The column was converted to an @code{ENUM}.

@item zerofill(n)
The most significant @code{n} bytes in the value are always 0 and are not
stored.

@item no zeros
Don't store zeros.

@item always zero
0 values are stored in 1 bit.
@end table

@item Huff tree
The Huffman tree associated with the field.

@item Bits
The number of bits used in the Huffman tree.
@end table

After you have run @code{pack_isam}/@code{myisampack} you must run
@code{isamchk}/@code{myisamchk} to recreate the index.  At this time you
can also sort the index blocks and create statistics that is needed for
the @strong{MySQL} optimizer to work more efficiently.

@example
myisamchk -rq --analyze --sort-index table_name.MYI
isamchk   -rq --analyze --sort-index table_name.ISM
@end example

After you have installed the packed table into the @strong{MySQL} database
directory you should do @code{mysqladmin flush-tables} to force @code{mysqld}
to start using the new table.

@node Maintenance, Adding functions, Tools, Top
@chapter Maintaining a @strong{MySQL} installation

@menu
* Table maintenance::           Using @code{myisamchk} for table maintenance and crash recovery
* Maintenance regimen::         Setting up a table maintenance regimen
* Table-info::                  Getting information about a table
* Crash recovery::              Using @code{myisamchk} for crash recovery
* Log files::                   Log file maintenance
@end menu

@node Table maintenance, Maintenance regimen, Maintenance, Maintenance
@section �ơ��֥�Υ��ƥʥ󥹡�����å��夫��ν����Τ���� @code{myisamchk} ����

Starting with @strong{MySQL} 3.23.13, you can check tables MyISAM with the
@code{CHECK TABLE} command. @xref{CHECK TABLE}.  You can repair tables
with the @code{REPAIR TABLE} command. @xref{REPAIR TABLE}.

MyISAM �ơ��֥� (@code{.MYI} and @code{.MYD}) �θ����������ˤ� @code{myisamchk} ��
���Ѥ��ޤ���
ISAM �ơ��֥� (@code{.ISM} and @code{.ISD}) �θ����������ˤ� @code{isamchk} ��
���Ѥ��ޤ���
@xref{Table types}.

�ʲ���ʸ�� @code{myisamchk} �ˤĤ��ƽҤ٤Ƥ��ޤ�����@code{isamchk} �ˤ⤹�٤�
���ƤϤޤ�ޤ���

@code{myisamchk} �桼�ƥ���ƥ��ϡ��ǡ����١����Υơ��֥�ξ���������ꡢ
�����å������ꡢ�ơ��֥�ν������Ŭ���˻��Ѥ��ޤ���
�ʲ��Υ��������Ǥϡ� @code{myisamchk} �ε�ư��ˡ(���ץ�����������ޤ�)��
�ơ��֥���ݼ饹�����塼��Τ�������
@code{myisamchk} �ο����ʵ�ǽ�λȤ�����Ҥ٤ޤ���

�⤷ @code{mysqld} �� @code{--skip-locking} �����餻�Ƥ���ʤ顢
(����� Linux �ʤɡ������Ĥ��Υ����ƥ�ǥǥե���ȤǤ�)��
@code{mysqld} ������ơ��֥����Ѥ��Ƥ���Ȥ������ʤ���Ʊ���ơ��֥���Ф���
 @code{myisamchk} �dzμ¤˸����Ǥ��ޤ��󡣤⤷ @code{myisamchk} ��ˡ�
����� @code{mysqld} ���̤��Ƥ��Υơ��֥�򥢥��������ʤ��Τ��μ¤ʤ顢
�ơ��֥�򸡺��������� @code{mysqladmin flush-tables} ��Ԥ��٤��Ǥ���
�����Ǥʤ���硢�ơ��֥�θ������ @code{mysqld} ����Ȥ��٤��Ǥ���
�⤷ @code{mysqld} ���ơ��֥�򹹿���� @code{myisamchk} ��¹Ԥ�����硢
�ơ��֥뤬�ѹ����줿�ݤΥ�˥󥰤��Ǥ�Ǥ��礦��

�⤷ @code{--skip-locking} ����Ѥ��Ƥ��ʤ��ʤ顢���ĤǤ� @code{myisamchk} ��
���ѤǤ��ޤ��������¹Ԥ��Ƥ���֡����ƤΥơ��֥�򹹿����륯�饤����Ȥ�
@code{myisamchk} �������Ǥ���ޤ��Ԥ��ޤ���

�⤷ @code{myisamchk} ��ơ��֥�ν�������Ŭ���˻��Ѥ���ʤ顢���κ���ˡ�
@code{mysqld} �����Υơ��֥�����Ф˻��Ѥ��ʤ��褦�ˤ��ʤ����
�ʤ�ޤ��󡣤���� @code{--skip-locking} ����Ѥ��Ƥ�����˵����ꤨ�ޤ���
�⤷ @code{mysqld} ������󤵤��Ƥ��ʤ��ʤ顢���� @code{myisamchk} �¹����ˡ�
 @code{mysqladmin flush-tables} ��¹Ԥ��٤��Ǥ���

�ơ��֥�ν����Ⱥ�Ŭ���Τ���ˡ��ۤȤ�ɤξ�硢 @code{OPTIMIZE TABLES} 
���ޥ�ɤ����ѤǤ��ޤ�������������� @code{myisamchk} ����٤ơ�
�٤��Ƴμ¤Ǥ⤢��ޤ���(fatal errorȯ�����ξ��)�������
����ȿ�̡�������ˡ����ñ�ǥơ��֥�Υե�å���򵤤ˤ�����ɬ�פ�����ޤ���
@xref{OPTIMIZE TABLE, , @code{OPTIMIZE TABLE}}.

@menu
* myisamchk syntax::              @code{myisamchk} ��ư��ʸ
* myisamchk memory::              @code{myisamchk} �������
@end menu

@node myisamchk syntax, myisamchk memory, Table maintenance, Table maintenance
@section @code{myisamchk} ��ư��ʸ

@code{myisamchk} �ϰʲ��Τ褦�ˤ��Ƶ�ư���ޤ�:

@example
shell> myisamchk [options] tbl_name
@end example

@code{options} �ˡ����ʤ��� @code{myisamchk} �ˤ����������Ȥ���ꤷ�ޤ���
���������ϸ�Ҥ��ޤ���(@code{myisamchk --help} �ȼ¹Ԥ���С����ץ����ΰ��������ޤ�)��
���ץ���󤬤ʤ���С� @code{myisamchk} ��ñ�˥ơ��֥�򸡺���������Ǥ���
���¿���ξ���������������뤤�ϡ� @code{myisamchk} �˸��������ι�ư���餻����ˤĤ��Ƥϡ���Ҥ��ޤ���

@code{tbl_name} �ϸ����������ơ��֥�̾�Ǥ���
�⤷�ɤ����㤦�ǥ��쥯�ȥ�ˤ���ǡ����١������Ф��� @code{myisamchk} �����餻�����ʤ顢
 @code{myisamchk} �ˤϥե����뤬�ɤ��ˤ��뤫�狼��ʤ��Τǡ�
�ե�����Υѥ�����ꤷ�ʤ���Фʤ�ޤ���
�ºݡ� @code{myisamchk} �Ϥ��ʤ������Ѥ��Ƥ���ե����뤬�ǡ����١����Υǥ��쥯�ȥ�ˤ��뤫�ɤ����Ϲ�θ���ޤ���
�ۤ��ξ��˥ǡ����١����ơ��֥�Υե�����򥳥ԡ��������Υ��ԡ������ե�������Ф���
��������¹Ԥ��뤳�Ȥ��Ǥ��ޤ���

@code{myisamchk} ���ޥ�ɥ饤��ˤϡ�ʣ���Υơ��֥�̾������Ǥ��ޤ���
�ޤ�������ǥå����ե�����̾(@file{.MYI} ������ΤĤ����ե�����)�����Ǥ���
����� @file{*.MYI} �Ȥ���С��ǥ��쥯�ȥ�������ƤΥơ��֥뤬����Ǥ��ޤ���
�㤨�С����ߤΥ����ȥǥ��쥯�ȥ꤬�ǡ������١����ǥ��쥯�ȥ�ʤ�С�
���Υǥ��쥯�ȥ�������ƤΥơ��֥�ϡ��ʲ��Τ褦�ˤ��Ƹ����Ǥ��ޤ���

@example
shell> myisamchk *.MYI
@end example

�ǡ����١����ǥ��쥯�ȥ�����äƤ��ʤ���硢
�ѥ�����ꤹ�뤳�Ȥˤ�����ƤΥơ��֥뤬�����Ǥ��ޤ���

@example
shell> myisamchk /path/to/database_dir/*.MYI
@end example

@strong{MySQL} �ǡ����ǥ��쥯�ȥ�Υѥ��˥磻��ɥ����ɤ���Ѥ��뤳�Ȥˤ�ꡢ
�ǡ����١��������ƤΥơ��֥�⸡���Ǥ��ޤ���

@example
shell> myisamchk /path/to/datadir/*/*.MYI
@end example

@code{myisamchk} �ϰʲ��Υ��ץ���������ޤ�:

@table @code
@item -a, --analyze	
������ʬ��(����)��ʬ�Ϥ��ޤ���
����� @strong{MySQL} �Τ����Ĥ��η���®�����ޤ���

@item -#, --debug=debug_options
�ǥХå������ν��ϡ�
@code{debug_options} �Ϥ褯 @code{'d:t:o,filename'} �Ȥ���ޤ���

@item -d, --description
�ơ��֥�˴ؤ��뤤���餫�ξ����ɽ�����ޤ�

@item -e, --extend-check
�ơ��֥������Ű��Ū�˸������ޤ���
��ü�ʾ��ˤ�����ɬ�פȤ���ޤ���
�̾� @code{myisamchk} �ϡ����Υ��ץ����ʤ������ƤΥ��顼�򸫤Ĥ���Ϥ��Ǥ���

@item -f, --force
�Ť����Ū�ʥե�������񤭤��ޤ���
@code{myisamchk} �� @code{-r} �ʤ������餻�ƥơ��֥�򸡺����Ƥ���Ȥ��ˡ�
@code{-f} ����Ѥ���ʤ�С�
@code{myisamchk} �ϥ���å��ǥ��顼���Ф��ơ��֥���Ф��ơ�
��ưŪ�� @code{-r} ��ȼ�äơ�������Ƴ����ޤ���

@item --help
�إ�פ�ɽ�����ƽ�λ��

@item -i, --information
�������줿�ơ��֥�����׾����ɽ����

@item -k #, --keys-used=#
@code{-r} �ȶ��˻��Ѥ��ޤ���
NISAM �ơ��֥�ϥ�ɥ顼�˺ǽ�� @code{#} ����ǥå��������򹹿�����褦�˻ؼ����ޤ���
If you are using MyISAM tells which keys to use, where each
binary bit stands for one key (First key is bit 0).
����ϥ��󥵡��Ȥ�®�����ޤ���
�󥢥��ƥ��֤ˤʤä�����ǥå����ϡ�@code{myisamchk -r} ����Ѥ���кƤӥ����ƥ��֤ˤʤ�ޤ���

@item -l, --no-symlinks
�������˥���ܥ�å���󥯤��ɤ��ޤ���
�̾@code{myisamchk} �ϥ���ܥ�å���󥯤��ؤ������ơ��֥�⽤�����ޤ���

@item -q, --quick
@code{-r} �ȶ��˻��Ѥ��졢�������᤯�Ԥ��ޤ���
�̾���ꥸ�ʥ�Υǡ����ե�����ϸ�������ޤ���
��� @code{-q} ����ꤹ��ȡ�����Ū�˥��ꥸ�ʥ�Υǡ����ե��������Ѥ��ޤ���

@item -r, --recover
�����⡼�ɡ�
Can fix almost anything except unique keys that aren't unique
(which is a extremely unlikely error with ISAM/MyISAM tables).
If you want to recover a table, this is the option to try first. Only if
myisamchk reports that the table can't be recovered by @code{-r}, you
should then try @code{-o}.  (Note that in the unlikely case that @code{-r}
fails, the data file is still intact).

@item -o, --safe-recover
�����⡼�ɡ�
�Ť�������ˡ����Ѥ��ޤ� (reads through all rows in order and updates
all index trees based on the found rows)��
����� @code{-r} �����٤��Ǥ����� @code{-r} �������ʤ���Τⰷ���ޤ���
Normally one should always first repair with
@code{-r} and only if this fails use @code{-o}.

@item -O var=option, --set-variable var=option
�ѿ����ͤ�����ޤ�����ǽ���ѿ��ϸ�Ҥ��ޤ���

@item -s, --silent
�Žͥ⡼�ɡ�
���顼�Τߤ���Ϥ��ޤ���
���� @code{-s} ����ꤹ���(@code{-ss})��@code{myisamchk} ��
�ۤȤ�ɽ��Ϥ򤷤ʤ��ʤ�ޤ���

@item -S, --sort-index
����ǥå����֥��å��Υ����ȡ�
����ϡ����ץꥱ�������Ǥ� ``read-next'' ��®�����ޤ���

@item -R index_num, --sort-records=index_num
����ǥå����˽��äƥ����ȡ�
����Ϥ��ʤ��Υǡ�������褯���֤������Υ���ǥå����ؤ�
 @code{SELECT}, @code{ORDER BY} ���ڥ졼������®�����ޤ���
(�������κǽ�Υ����Ȥ������٤��ʤ뤫�⤷��ޤ���)
�ơ��֥�Υ���ǥå������ֹ��ߤĤ���ˤ� @code{SHOW INDEX} ����Ѥ��ޤ�����
����� @code{myisamchk} ���ơ��֥�Υ���ǥå����򸫤Ĥ���Τ�Ʊ������ǹԤ��ޤ���
����ǥå����ֹ�� 1 ����Ϥޤ�ޤ���

@item -u, --unpack
@code{pack_isam} �ǥѥå����줿�ơ��֥�򥢥�ѥå����ޤ���

@item -U, --update-status
Store in the @file{.MYI} file when the table was checked and if the table was
crashed.  This should be used to get full benefit of the @code{--fast}
option, but you shouldn't use this if option if the @code{mysqld} server is
using the table and you are running @code{mysqld} with
@code{--skip-locking}.

@item -v, --verbose
��Ĺ�⡼�ɡ����¿���������Ϥ��ޤ���
@code{-d} �� @code{-e} ���ץ����ȶ��˻��ѤǤ��ޤ���
@code{-v} ��ʣ�����ꤹ���(@code{-vv}, @code{-vvv})����äȽ��Ϥ�¿���ʤ�ޤ���

@item -V, --version
@code{myisamchk} �С�������ɽ�����ƽ�λ��

@item -w, --wait
�ơ��֥뤬���å�����Ƥ������Ԥ��ޤ���
@end table

@code{--set-variable} (@code{-O}) ���ץ����Dz�ǽ���ѿ���

@example
key_buffer_size       current value: 16776192
read_buffer_size      current value: 262136
write_buffer_size     current value: 262136
sort_buffer_size      current value: 2097144
sort_key_blocks       current value: 16
decode_bits           current value: 9
@end example

@code{key_buffer_size} is only used when you check the table with @code{-e} or
repair it with @code{-o}.
@code{sort_buffer_size} is used when you repair the table with @code{-r}.

If you want a faster repair, set the above variables to about 1/4 of your
available memory.  You can set both variables to big values as only one
of the above buffers will be used at at time.

@node myisamchk memory, , myisamchk syntax, Table maintenance
@section @code{myisamchk} �������

@code{myisamchk} �����餹��ǥ��꡼����ʬ�Ͻ��פǤ���
@code{myisamchk} �� @code{-O} ���ץ�������������ʾ�Υ���ϻ��Ѥ��ޤ���
�ȤƤ��礭�ʥե�����Τ������� @code{myisamchk} �򤫤������ʤ顢
���꡼��ɤ줯�餤���Ѥ��뤫��ǽ�˷��ʤ��ƤϤʤ�ޤ���
�ǥե���Ȥϸ������ 3M ��������Ѥ��ޤ����礭���ͤ���Ѥ��뤳�Ȥǡ�
@code{myisamchk} ����®��ư��Ǥ��ޤ���
�㤨�С�32MBytes��RAM������ʤ顢�ʲ��Τ褦�˻���Ǥ��ޤ�
(¾�Υ��ץ�������ꤷ��):

@example
shell> myisamchk -O sort=16M -O key=16M -O read=1M -O write=1M ...
@end example

@code{-O sort=16M} �λ��Ѥ�¿���ξ�礪���餯��ʬ�Ǥ��礦��

��������@code{myisamchk} �� @code{TMPDIR} ��˰���ե��������Ѥ��ޤ���
@code{TMPDIR} ������ե����륷���ƥ��ؤ��Ƥ�����ϡ���ñ�� out of
memory ���顼������Ǥ��礦��
If this happens, set @code{TMPDIR} to point at some directory
with more space and restart @code{myisamchk}


@node Maintenance regimen, Table-info, Table maintenance, Maintenance
@section �ơ��֥���ݼ�����������

���꤬ȯ������ޤ��ԤĤ�ꡢ���Ū�˥ơ��֥�򸡺������������褤�ͤ��Ǥ���
�ݼ���Ū�ˤϡ�@code{myisamchk -s} �ǥơ��֥�򸡺�����Τ��褤�Ǥ��礦��
@code{-s} ���ץ����ϥ������ȥ⡼�ɤʤΤǡ����顼�����������ˤ�����å���������Ϥ��ޤ���

@tindex .pid (process ID) file
�����С��򳫻Ϥ���Ȥ��˥ơ��֥�򸡺�����Τ�褤�ͤ��Ǥ���
�㤨�С���������˥ޥ��󤬥�֡��Ȥ��줿�ʤ顢���ƤΥơ��֥�˴ؤ���
���αƶ����ʤ�����������ɬ�פ�����ޤ����ʤ����``expected crashed table''�Ǥ���
��֡��ȸ�ˤ⤷�Ť� @file{.pid} �ե�����(�ץ�����ID) ������ʤ�С�
24���ְ�����ѹ����줿�ơ��֥���Ф��� @code{myisamchk} �����餻�Ƹ���������褦�ˡ�
@code{safe_mysqld} �˥ƥ��Ȥ��ɲä��Ƥ⹽���ޤ���
(@file{.pid} �ե������ @code{mysqld} ��ư���˺��졢�̾、λ���˾ä���ޤ���
�������Ȼ��� @file{.pid} �ե����뤬¸�ߤ���ʤ� @code{mysqld} ���۾ェλ�������Ȥ򼨤��ޤ���)

�ɤ��ƥ��Ȥϡ�@file{.pid} �ե�����κ������ְʹߤ��ѹ����줿
���ƤΥơ��֥�򸡺�����ƥ��ȤǤ���

�̾�Υ����ƥ౿����ˤ�ơ��֥�򸡺����٤��Ǥ���
TcX �Ǥϡ����˰��١� @code{cron} ����Ѥ��ƽ��פʥơ��֥�򸡺����Ƥ��ޤ���
@file{crontab} �ե�����ˤϰʲ��Τ褦�˵��Ҥ��ޤ���

@example
35 0 * * 0 /path/to/myisamchk -s /path/to/datadir/*/*.MYI
@end example

����ϲ��줿�ơ��֥�ξ������Ϥ��ޤ��Τǡ�ɬ�פȤ���и������������Ԥ���櫓�Ǥ���

ͽ�۳��λ��ΤDz��줿�ơ��֥�(�ϡ��ɥ������Υȥ�֥뤬����������)�������
2,3ǯ�֡��ơ��֥�ϲ��줿���ȤϤ���ޤ���(����������������Ǥ�)��
�Τǡ��콵�֤˰��٤Υ����å��Ǥ⽽ʬ�Ǥ���

24���ְ�����ѹ����줿���ƤΥơ��֥���Ф��ơ�
@code{myisamchk -s} �����ռ¹Ԥ�����򴫤�ޤ���
��������С����ʤ��ϲ桹��Ʊ�����餤�� @strong{MySQL} ��
���ꤹ�뤳�Ȥˤʤ�ޤ���


@node Table-info, Crash recovery, Maintenance regimen, Maintenance
@section �ơ��֥�������

�ơ��֥뤫��ܺ�/���פ����뤿��ˤϡ�������ˡ����Ѥ��ޤ�����Ǥ���˾ܺ٤ʾ�
��򤤤��Ĥ��������ޤ���

@table @code
@item myisamchk -d tbl_name
@code{myisamchk} �� ``describe mode'' �Ǽ¹Ԥ����ơ��֥���������Ҥ���ޤ���
@code{--skip-locking} ����ꤷ�� @strong{MySQL} �����С���ư������硢
@code{myisamchk} �� myisamchk �¹���˹������줿�ơ��֥�ˤĤ��ƥ��顼����𤷤ޤ�.
������ @code{myisamchk} �� describe mode �Ǥϥơ��֥���Ѥ��ʤ��Τǡ�
�ǡ������˲�����������Ϥ���ޤ���

@item myisamchk -d -v tbl_name
@code{myisamchk} �����Ƥ��뤳�Ȥ˴ؤ��롢���¿���ξ������Ф��ˤϡ�
@code{-v} ��Ĥ��ƾ�Ĺ�⡼�ɤ����餻��褦�ˤ��ޤ���

@item myisamchk -eis tbl_name
�ơ��֥뤫��Ǥ���פʾ�������򼨤��ޤ���
�ơ��֥����Τ��ɤޤʤ���Фʤ�ʤ��Τǡ��٤��Ǥ���

@item myisamchk -eiv tbl_name
@code{-eis} �Ȼ��Ƥ��뤬������ԤäƤ��뤫��ɽ�����ޤ���
@end table

@code{myisamchk -d} ���Ϥ���:
@example
ISAM file:     company.MYI
Data records:           1403698  Deleted blocks:         0
Recordlength:               226
Record format: Fixed length

table description:
Key Start Len Index   Type
1   2     8   unique  double
2   15    10  multip. text packed stripped
3   219   8   multip. double
4   63    10  multip. text packed stripped
5   167   2   multip. unsigned short
6   177   4   multip. unsigned long
7   155   4   multip. text
8   138   4   multip. unsigned long
9   177   4   multip. unsigned long
    193   1           text
@end example


@code{myisamchk -d -v} ���Ϥ���:
@example
ISAM file:     company.MYI
Isam-version:  2
Creation time: 1996-08-28 11:44:22
Recover time:  1997-01-12 18:35:29
Data records:           1403698  Deleted blocks:              0
Datafile: Parts:        1403698  Deleted data:                0
Datafilepointer (bytes):      3  Keyfile pointer (bytes):     3
Max datafile length: 3791650815  Max keyfile length: 4294967294
Recordlength:               226
Record format: Fixed length

table description:
Key Start Len Index   Type                      Root Blocksize Rec/key
1   2     8   unique  double                15845376      1024       1
2   15    10  multip. text packed stripped  25062400      1024       2
3   219   8   multip. double                40907776      1024      73
4   63    10  multip. text packed stripped  48097280      1024       5
5   167   2   multip. unsigned short        55200768      1024    4840
6   177   4   multip. unsigned long         65145856      1024    1346
7   155   4   multip. text                  75090944      1024    4995
8   138   4   multip. unsigned long         85036032      1024      87
9   177   4   multip. unsigned long         96481280      1024     178
    193   1           text
@end example


@code{myisamchk -eis} ���Ϥ���:
@example
Checking ISAM file: company.MYI
Key:  1:  Keyblocks used:  97%  Packed:    0%  Max levels:  4
Key:  2:  Keyblocks used:  98%  Packed:   50%  Max levels:  4
Key:  3:  Keyblocks used:  97%  Packed:    0%  Max levels:  4
Key:  4:  Keyblocks used:  99%  Packed:   60%  Max levels:  3
Key:  5:  Keyblocks used:  99%  Packed:    0%  Max levels:  3
Key:  6:  Keyblocks used:  99%  Packed:    0%  Max levels:  3
Key:  7:  Keyblocks used:  99%  Packed:    0%  Max levels:  3
Key:  8:  Keyblocks used:  99%  Packed:    0%  Max levels:  3
Key:  9:  Keyblocks used:  98%  Packed:    0%  Max levels:  4
Total:    Keyblocks used:  98%  Packed:   17%

Records:          1403698    M.recordlength:     226   Packed:             0%
Recordspace used:     100%   Empty space:          0%  Blocks/Record:   1.00
Recordblocks:     1403698    Deleteblocks:         0
Recorddata:     317235748    Deleted data:         0
Lost space:             0    Linkdata:             0

User time 1626.51, System time 232.36
Maximum resident set size 0, Integral resident set size 0
Non physical pagefaults 0, Physical pagefaults 627, Swaps 0
Blocks in 0 out 0, Messages in 0 out 0, Signals 0
Voluntary context switches 639, Involuntary context switches 28966
@end example

@code{myisamchk -eiv} ���Ϥ���:
@example
Checking ISAM file: company.MYI
Data records: 1403698   Deleted blocks:       0
- check file-size
- check delete-chain
index  1:
index  2:
index  3:
index  4:
index  5:
index  6:
index  7:
index  8:
index  9:
No recordlinks
- check index reference
- check data record references index: 1
Key:  1:  Keyblocks used:  97%  Packed:    0%  Max levels:  4
- check data record references index: 2
Key:  2:  Keyblocks used:  98%  Packed:   50%  Max levels:  4
- check data record references index: 3
Key:  3:  Keyblocks used:  97%  Packed:    0%  Max levels:  4
- check data record references index: 4
Key:  4:  Keyblocks used:  99%  Packed:   60%  Max levels:  3
- check data record references index: 5
Key:  5:  Keyblocks used:  99%  Packed:    0%  Max levels:  3
- check data record references index: 6
Key:  6:  Keyblocks used:  99%  Packed:    0%  Max levels:  3
- check data record references index: 7
Key:  7:  Keyblocks used:  99%  Packed:    0%  Max levels:  3
- check data record references index: 8
Key:  8:  Keyblocks used:  99%  Packed:    0%  Max levels:  3
- check data record references index: 9
Key:  9:  Keyblocks used:  98%  Packed:    0%  Max levels:  4
Total:    Keyblocks used:   9%  Packed:   17%

- check records and index references
[LOTS OF ROW NUMBERS DELETED]

Records:          1403698    M.recordlength:     226   Packed:             0%
Recordspace used:     100%   Empty space:          0%  Blocks/Record:   1.00
Recordblocks:     1403698    Deleteblocks:         0
Recorddata:     317235748    Deleted data:         0
Lost space:             0    Linkdata:             0

User time 1639.63, System time 251.61
Maximum resident set size 0, Integral resident set size 0
Non physical pagefaults 0, Physical pagefaults 10580, Swaps 0
Blocks in 4 out 0, Messages in 0 out 0, Signals 0
Voluntary context switches 10604, Involuntary context switches 122798
@end example

��ǻ��Ѥ��줿�ơ��֥�Υǡ����ե����륵�����򤳤��˼����ޤ�:

@example
-rw-rw-r--   1 monty    tcx     317235748 Jan 12 17:30 company.ISD
-rw-rw-r--   1 davida   tcx      96482304 Jan 12 18:35 company.ISM
-rw-rw-r--   1 monty    tcx     317235748 Jan 12 17:30 company.MYD
-rw-rw-r--   1 davida   tcx      96482304 Jan 12 18:35 company.MYI
@end example

@code{myisamchk} ��������������������ʲ��˼����ޤ���
``keyfile'' �ϥ���ǥå����ե�����Ǥ���
``Record'' �� ``row'' ��Ʊ���Ǥ���

@table @code
@item ISAM file
ISAM (index) �ե������̾��

@item Isam-version
ISAM �����ΥС�����󡣸��ߤϾ�� 2 ��

@item Creation time
�ǡ����ե����뤬�������줿����

@item Recover time
����ǥå���/�ǡ����ե����뤬�Ǹ�˺ƹ��ۤ��줿����

@item Data records
�쥳����/�Ԥο���

@item Deleted blocks
ͽ�󤵤줿�ΰ��ޤ����äƤ������֥��å�����
���Υ��ڡ�����Ǿ��ˤ��뤿��˼�ʬ�Υơ��֥���Ŭ�����뤳�Ȥ��Ǥ��ޤ���
@xref{Optimization}.

@item Datafile: Parts
ưŪ�ʥ쥳���ɷ����ˤ����ĤΥǡ����֥��å������뤫��ɽ�����ޤ���
ʬ��ʤ��Ǻ�Ŭ�����줿�ơ��֥�Ǥ� @code{Data records} ��Ʊ���Ǥ���

@item Deleted data
��������Ƥ��ʤ�����ǡ����ΥХ��ȿ���
���Υ��ڡ�����Ǿ��ˤ��뤿��˼�ʬ�Υơ��֥���Ŭ�����뤳�Ȥ��Ǥ��ޤ���
@xref{Optimization}.

@item Datafile pointer
�ǡ����ե�����ݥ��󥿤��礭��(�Х��ȿ�)����������� 2, 3, 4 �ޤ��� 5 ��
���ȤǤ���¿���Υơ��֥�� 2 �Х��ȤǴ�������ޤ���������Ϥޤ� 
@strong{MySQL} ��������Ǥ��ޤ��󡣸���ơ��֥�ǤϤ���ϥ쥳���ɥ��ɥ�
���Ǥ���ưŪ�ơ��֥�ǤϤ���ϥХ��ȥ��ɥ쥹�Ǥ���

@item Keyfile pointer
�ǡ����ե�����ݥ��󥿤ΥХ��ȿ������������ 1, 2 �ޤ��� 3 �Х��ȤǤ���
¿���Υơ��֥�� 2 �Х��ȤǴ�������ޤ���������� @strong{MySQL} �Ǥϼ�ưŪ��
�׻�����ޤ�������Ͼ�˥֥��å����ɥ쥹�Ǥ���

@item Max datafile length
�ơ��֥�Υǡ����ե����� (@code{.MYD} �ե�����) �������Ǥ���Ĺ�� (�Х��ȿ�)��

@item Max keyfile length
�ơ��֥�Υ����ե����� (@code{.MYI} �ե�����) �������Ǥ���Ĺ�� (�Х��ȿ�)��

@item Recordlength
�ƥ쥳����/�Ԥ����Ѥ����ΰ���礭��(�Х��ȿ�)��

@item Record format
�ƥơ��֥�ιԤ����ķ�����������Ǥ� @code{Fixed length} ����Ѥ��ޤ���
¾���ͤDz�ǽ��ʪ��@code{����}��@code{�ѥå�}���ޤ���

@item table description
�ơ��֥�������ƤΥ����Υꥹ�ȡ��ƥ����ˤĤ��ơ������Ĥ������٥�����󶡤�
��ޤ�:

@table @code
@item Key
���Υ����ֹ档

@item Start
���Υ���ǥå����������Ϥ���쥳����/����ΰ��֡�

@item Len
����ǥå�������Ĺ�����ѥå����줿���ͤǤϡ�����Ͼ�˹��ܤδ�����Ĺ���ˤʤ�ޤ���

ʸ�����ˤ����Ƥϡ�ʸ�����ι��ܤ�Ƭ����ʬ�˥���ǥå������Ĥ����ˤʤ�ޤ��Τǡ�
����ǥå������ܤκ���Ĺ�����⤳���ͤ�û���ʤ�Ǥ��礦��

@item Index
@code{unique} or @code{multip.} (multiple). ���Υ���ǥå�����Ǥ�1�Ĥ��ͤ�ʣ��
��¸�ߤ����ޤ���

@item Type
���Υ���ǥå����������ĥǡ�������
����� NISAM �ǡ������ǡ�
@code{packed}, @code{stripped} �� @code{empty} ���ץ���������ޤ���

@item Root
�롼�ȥ���ǥå����֥��å��Υ��ɥ쥹��

@item Blocksize
�ƥ���ǥå����֥��å��Υ�����������ϥǥե���ȤǤ� 1024 �Ǥ����������
��������ѹ��Ǥ��ޤ���

@item Rec/key
����ϥ��ץƥ��ޥ����ˤ�äƻ��Ѥ���������ͤǤ������Υ������ͤ��ȤΥ쥳��
�ɿ����Τ餻�ޤ�����ˡ��������Ͼ��1���ͤ�����ޤ�������ϥơ��֥뤬�����ɤ�
�줿(�ޤ����礭���ѹ����줿)��� @code{myisamchk -a} �ǹ�������ޤ�������
��������������ʤ����ϥǥե�����ͤ� 30 ��Ϳ�����ޤ���
@end table

@item
��κǽ����Ǥϡ�9���ܤΥ�����2�Ĥ���ʬ���ä��ޥ���ѡ��ȥ����Ǥ���

@item Keyblocks used
���Ѥ��줿�����֥��å��Υѡ�����ơ��������Υơ��֥�� @code{myisamchk} �Ǻ�����
����뤿�ᡢ�ͤϤȤƤ�⤯�ʤ�ޤ� (����Ū�ʺ���ˤȤƤ�᤯�ʤ�ޤ�)��

@item Packed
@strong{MySQL} �ϰ��̤��������ǥ����Υѥå����ߤޤ��������
@code{CHAR}/@code{VARCHAR}/@code{DECIMAL} �����Ǥ������ѤǤ��ޤ���̾����
�褦��Ĺ��ʸ����Ǥϡ�����ϻ����ΰ�����˸��餷�ޤ�����λ����ܤ���Ǥ�4����
�Υ�����10ʸ��Ĺ�ǡ��ΰ��60%�θ��������ޤ���

@item Max levels
���Υ����� Btree �ο�����Ĺ������������礭�ʥơ��֥�Ϲ⤤�ͤ����ޤ���

@item Records
�ơ��֥뤬���äƤ���Կ���

@item M.recordlength
ʿ�Ѥι�Ĺ������ơ��֥�Ǥϡ�����ϥ쥳����Ĺ�Ǥ���

@item Packed
@strong{MySQL} ��ʸ����κǸ夫����������ޤ�������ˤ�ä����󤵤줿
�ѡ�����ơ����� @code{Packed} �ϼ����ޤ���

@item Recordspace used
�ǡ����ե����뤬���Ѥ��줿�ѡ�����ơ�����

@item Empty space
�ǡ����ե����뤬���Ѥ���Ƥ��ʤ��ѡ�����ơ�����

@item Blocks/Record
�쥳������Υ֥��å��� (i.e., ���Ҳ��쥳���ɤι�����)��
����ϸ�������ơ��֥�ǤϾ��1�Ǥ��������ͤϲ�ǽ�ʸ�
�� 1.0 ��α�ޤ�ޤ������줬�礭��������ϡ�@code{myisamchk} �ǥơ��֥������֤Ǥ��ޤ���
@xref{Optimization}.

@item Recordblocks
���Ѥ��줿�֥��å� (links) �������귿���ǤϤ���ϥ쥳���ɿ���Ʊ���Ǥ���

@item Deleteblocks
������줿�֥��å� (links) ����

@item Recorddata
�ǡ����ե�������ˤ���ºݤΥ桼���ǡ����ΥХ��ȿ���

@item Deleted data
�ǡ����ե�������ˤ��������줿(unused)�ǡ����ΥХ��ȿ��� 

@item Lost space
�쥳���ɤ����û��Ĺ���˹������줿��硢�����Ĥ����ΰ褬�����ޤ�������
�Ϥ��Τ褦�ʾü������Ƥι�פǤ���in bytes.

@item Linkdata
ưŪ�����λ��ѻ����֥��å��ϥݥ���(4��7�Х���)�˥�󥯤���ޤ���@code{Linkdata}��
���Υݥ��󥿤����Ƥι�פǤ���
@end table

�ơ��֥뤬 @code{pack_isam} �ǰ��̤���Ƥ���ʤ顢@code{myisamchk -d} ��
���줾��Υơ��֥륳���˴ؤ����ɲþ������Ϥ��ޤ���
@ref{myisampack, ,@code{myisampack}}. �򻲾Ȥ��Ƥ���������
���ξ�������������Ҥΰ�̣������ޤ���

@node Crash recovery, Log files, Table-info, Maintenance
@section Using @code{myisamchk} for crash recovery

@strong{MySQL} ���ǡ�����Ǽ�˻��Ѥ���ե���������ϡ�
���ϰϤˤ錄�äƥƥ��Ȥ���ޤ����������ǡ����١����Υơ��֥뤬
�˲�����뤫�⤷��ʤ���Ū����������ޤ�:

@itemize @bullet
@item
@code{mysqld} �ץ��������񤭹��ߺ���� killed ���줿���
@item
ͽ�����̥���ԥ塼�������(�㤨���Ÿ����ڤ�줿���)
@item
�ϡ��ɥ��������顼
@end itemize

����Ǥϡ�@strong{MySQL} �Υǡ����ΰ���������������ˡ��Ҥ٤ޤ���
�⤷�ơ��֥뤬�����������ˤʤ�ΤǤ���С�
���ʤ��ϡ�������ͳ�򸫤Ĥ���褦��ߤ�٤��Ǥ�!
@xref{Debugging server}.

�˲�����ν����򤹤��硢�ɥǡ����١�����Τ��줾��Υơ��֥� @code{tbl_name} �ϡ�
�ǡ����١����ǥ��쥯�ȥ���ˤ��뻰�ĤΥե�����˰��פ���ɡ���������򤹤����
�ȤƤ���פǤ���

@multitable @columnfractions .2 .8
@item @strong{File} @tab @strong{Purpose}
@item @file{tbl_name.frm} @tab Table definition (form) file
@item @file{tbl_name.MYD} @tab Data file
@item @file{tbl_name.MYI} @tab Index file
@end multitable

����黰�ĤΥե�������͡�����ˡ���˲���������������ޤ�����
���ξ��Ǥ����꤬������䤹���Τϡ��ǡ����ե�����ȥ���ǥå����ե�����Ǥ���

@code{myisamchk} �� @file{.MYD} �ե�����(�ǡ���)�Υ��ԡ����԰�Ԥ����ʤ��ޤ���
���ν��������κǸ�ˡ��Ť� @file{.MYD} �ե������ä����������ե�����򥪥ꥸ�ʥ��̾�����ѹ����ޤ���
�⤷ @code{--quick} ���ץ�������Ѥ����ʤ顢@code{myisamchk} ��
 @file{.MYD} �ե�����ΰ���ե��������ޤ��󡣤��Τ���ꡢ@file{.MYD} �ե�����
���������Ȳ��ꤷ�ƿ���������ǥå����ե������������ޤ���
���λ� @file{.MYD} �ե�����Ϥ�����ޤ���
���ξ�硢@code{myisamchk} �ϼ�ư�� @file{.MYD} �ե�����δְ㤤�򸡽Ф���
��������ߤ���Τǡ������Ǥ���

@code{myisamchk} ����� @code{--quick} ���ץ�������ꤹ�뤳�Ȥ�Ǥ��ޤ���
���ξ�硢@code{myisamchk} �Ϥ����Ĥ��Υ��顼(�����ν�ʣ�Ȥ�)�Ǥ���ߤϤ��ޤ���
������ @file{.MYD} �ե�������ѹ����ޤ���

�̾�ν�����¹Ԥ��뤿��˥ǥ������Υ��ڡ����ζ�������������̵�����˸¤äơ�
 @code{--quick} �������꤬���Ω���ޤ���
���ξ��,���ʤ��� @code{myisamchk} �����餻�����˥Хå����åפ�
���ʤ��Ȥ�Ȥ�٤��Ǥ���

@menu
* Check::                       �ơ��֥�Υ��顼�����å���ˡ
* Repair::                      �ơ��֥�ν�����ˡ
* Optimization::                �ơ��֥�κ�Ŭ��
@end menu

@cindex Checking tables for errors
@node Check, Repair, Crash recovery, Crash recovery
@subsection �ơ��֥�Υ��顼�����å���ˡ

�ơ��֥������å�����ˤ�,�ʲ��Υ��ޥ�ɤ���Ѥ��Ƥ�������:

@table @code
@item myisamchk tbl_name
����Ϥ��٤Ƥθ����99.99%�򸫤Ĥ��ޤ���
���줬���Ĥ��뤳�Ȥ��Ǥ��ʤ�ʪ�ϡ��ǡ����ե�������˲�@strong{����}�Ǥ�
(��������ˤޤ�)���⤷�ơ��֥������å��������ʤ顢���ץ����ʤ���
 @code{myisamchk} �����餹����@code{-s} or @code{--silent} ���ץ�����Ĥ��ޤ���

@item myisamchk -m tbl_name
This finds 99.999% of all errors. It checks first all index for errors and
then it reads through all rows. It calculates a checksum for all keys in
the rows and verifies that they checksum matches the checksum for the keys
in the index tree.

@item myisamchk -e tbl_name
��������ƤΥǡ���������Ű��Ū�˥����å����ޤ���
(@code{-e} �� ``extended check'' �ΰ�)��
���ƤΥ����ˤĤ��ơ�����餬�����Ԥ������������ǧ���뤿��ˡ�
�ɤ߹��ߥ����å���Ԥ��ޤ���
����Ϥ�������Υ����������礭�ʥơ��֥�Ǥϡ��������֤�������ޤ���
@code{myisamchk} ���̾�ǽ�Υ��顼�����Ĥ��ä������ǻߤޤ�ޤ���
�⤷�������������ʤ顢@code{--verbose} (@code{-v}) ���ץ�����ä��ޤ���
����� @code{myisamchk} �򥨥顼��20�ĽФ�ޤ�ư���³���ޤ���
���̤˻��Ѥ�����ϡ�@code{myisamchk} �����ǽ�ʬ�Ǥ���(�ơ��֥�̾�ʳ��ΰ����ϰ���̵��)

@item myisamchk -e -i tbl_name
���Υ��ޥ�ɤȻ��Ƥ��ޤ����� @code{-i} ���ץ����� @code{myisamchk} �ˤ����餫��
���׾����Ф�����褦�ˤ��ޤ���
@end table

@node Repair, Optimization, Check, Crash recovery
@subsection �ơ��֥�ν�����ˡ

�ơ��֥��˲��������Ȥ��ơ������꤬ͽ���������Ǥ����ꡢ�ʲ��Τ褦�ʥ��顼���Ф��ꤷ�ޤ���

@itemize @bullet
@item
@file{tbl_name.frm} is locked against change
@item
Can't find file @file{tbl_name.MYI} (Errcode: ###)
@item
Got error ### from table handler (Error 135 is an exception in this case)
@item
Unexpected end of file
@item
Record file is crashed
@end itemize

�����ξ�硢���ʤ��ϼ�ʬ�Υơ��֥�������ʤ���Фʤ�ޤ���
@code{myisamchk} �ϤۤȤ�ɤ�����򸫤Ĥ��Ф��������ޤ���

���������ϰʲ��ǵ��Ҥ������4�Ĥ��ʳ���Ƨ�ߤޤ���
�����Ϥ�����ˡ����ʤ��ϥǡ����١����ǥ��쥯�ȥ�� @code{cd} ����
�ơ��֥�ե�����Υѡ��ߥå������ǧ���٤��Ǥ���
�����ե������ @code{mysqld} ��¹Ԥ��Ƥ���Unix�桼�������ɤ߹��߲�ǽ
�Ǥ���褦�ˤ��Ƥ�������(�����Τ���Τˤ��ʤ��˥ե�����Υ�����������ɬ��)��
�⤷�ե�������ѹ��򤹤�ɬ�פ�����ʤ�С��ե�����ؤν񤭹��ߵ��Ĥ�ɬ�פǤ���

If you are using @strong{MySQL} 3.23.16 and above you can (and should) use the
@code{CHECK} and @code{REPAIR} commands to check and repair @code{MyISAM}
tables. @xref{CHECK TABLE}. @xref{REPAIR TABLE}. 

The manual section about table maintenence includes the options to
@code{isamchk}/@code{myisamchk}. @xref{Table maintenance}.

The following section is for the cases where the above command fails or
if you want to use the extended features that isamchk/myisamchk provides.

If you are going to repair a table from the command line, you must first
take down the @code{mysqld} server. Note that when you do
@code{mysqladmin shutdown} on a remote server, the @code{mysqld} server
will still be alive for a while after @code{mysqladmin} returns until
all queries are stopped and all keys have been flushed to disk.

@noindent
@strong{Stage 1: �ơ��֥������å�����}

@code{myisamchk *.MYI} (���֤������äƤ�褤�ʤ� @code{myisamchk -e *.MYI})
��¹Ԥ��ޤ���
@code{-s} (silent) ���ץ��������פʾ���ν��Ϥ򤪤����ޤ���

If the mysqld server is done you should use the --update option to tell
@code{myisamchk} to mark the table as 'checked'.

@code{myisamchk} �����顼���֤������ˤ������ơ��֥��������ɬ�פ�����ޤ���
���ξ�硢Stage 2 �ؿʤߤޤ���

�����å����˴�̯�ʥ��顼(@code{out of memory} ���顼�Τ褦��) ����������硢
���뤤�� @code{myisamchk} ���������硢Stage 3 �˿ʤ�Ǥ���������

@noindent
@strong{Stage 2: ��ñ�ǰ����ʽ���}

�ޤ��ǽ�� @code{myisamchk -r -q tbl_name} ���ߤƤ�������
(@code{-r -q} �� ``quick recovery mode''�ΰ�)��
����ϥǡ����ե�����˿���ʤ��ǥ���ǥå����ե�����ν������ߤޤ���
�⤷�ǡ����ե����뤬���Ƥȥǡ����ե�����������������Ǥκ����󥯥ݥ���Ȥ�
�ޤ�Ǥ���ʤ顢�����ư��ƥơ��֥�������ޤ���
�����塢���Υơ��֥�ν����˿ʤ�Ǥ���������
���Ԥ������ϡ��ʲ��μ��ǻ�ߤƤ���������

@enumerate
@item
³�������˥ǡ����ե������Хå����åפ��Ƥ���������

@item
@code{myisamchk -r tbl_name} ����Ѥ��ޤ�(@code{-r} �� ``recovery mode''�ΰ�)��
����������ʥ쥳���ɤȺ�����줿�쥳���ɤ�ǡ����ե����뤫��õ��
����ǥå����ե�����(.MYI)��ƹ��ۤ��ޤ���

@item
�嵭�����Ԥ�����硢@code{myisamchk --safe-recover tbl_name} ����Ѥ��Ʋ�������
Safe recovery �⡼�ɤϸŤ���ˡ����Ѥ��ƽ������ޤ���
��������̤ν����⡼�ɤǤϹԤ�ʤ����򤤤��Ĥ���äƤ��ޤ���(�٤��Ǥ���)
@end enumerate

�����å��ޤ��Ͻ������ˡ�������­�Τ褦��̯�ʥ��顼���Ǥ���硢�ޤ��� 
@code{myisamchk} ������å��夷�����ϡ�Stage 3 �˿ʤ�Ǥ���������

@noindent
@strong{Stage 3: �񤷤�����}

����ǥå����ե�����(.MYI)�κǽ�� 16K �֥��å����˲����줿��硢
�ޤ��������ʾ����ޤ��硢�ޤ��ϥ���ǥå����ե����뤬�ʤ����ˤ�����
�ܽ����ʳ���Фޤ���
���ξ�硢����������ǥå����ե�����ե�������������ɬ�פ�����ޤ���
���Τ褦�ˤ��Ƥ�������:

@enumerate
@item
�ǡ����ե����� .MYD �ե������ɤ����������˰�ư���ޤ���

@item
���������Υǡ����ȥ���ǥå����ե�������뤿��ˡ�
�ơ��֥�ǥ�������ץ��ե��������Ѥ��ޤ���

@example
shell> mysql db_name
mysql> DELETE FROM tbl_name;
mysql> quit
@end example

@item
�Ť��ǡ����ե�����򿷤�����ä��ǡ����ե�����˥��ԡ����ޤ���
(�Ť��ǡ����ե������ move ���ƤϤ����ޤ��󡨤ʤ��Ƭ�����꤬�����ޤ�)
@end enumerate

Stage 2 ����äƤ��������� @code{myisamchk -r -q} �ϴ���ư��ޤ���
(�����̵�¥롼�פˤϤʤ�ޤ���).

@noindent
@strong{Stage 4: �ȤƤ��񤷤�����}

����ϡ��ǥ�������ץ��ե�����(.frm)�⥯��å��夷�����ˤ���ȯ�����ޤ���
�����ȯ�����뤳�ȤϤ���ޤ��󡣤ʤ��ʤ�ǥ�������ץ��ե������
�ơ��֥뤬�������줿��˽񤫤�뤳�ȤϤʤ�����Ǥ���

@enumerate
@item
�ǥ�������ץ��ե������Хå����åפ���ꥹ�ȥ����ơ�Stage 3 ����äƤ���������
����ǥå����ե�����Υꥹ�ȥ���Ǥ��ޤ��������� Stage 2 ����äƤ���������
��Ԥξ�硢@code{myisamchk -r} �dz��Ϥ��٤��Ǥ���

@item
�Хå����åפ���äƤ��ʤ��Ƥ⡢�ơ��֥뤬�ɤΤ褦�˺������줿�������Τ��Τä�
����С�¾�Υǡ����١�����˥ơ��֥�Υ��ԡ����������ޤ���
�������ǡ����ե��������������ۤɺ�ä��ǡ����١��������
�ǥ�������ץ��ե�����ȥ���ǥå����ե�����򡢲��줿�ǡ����١������
��ư���ޤ�������Ͽ������ǥ�������ץ��ե�����ȥ���ǥå����ե������
Ϳ���뤳�Ȥˤʤ�ޤ������ǡ����ե�����Ϥ��Τޤ޻ĤäƤ��ޤ���
Stage 2 �˿ʤߡ�����ǥå����ե�����ν�����ԤäƤ���������
@end enumerate

@node Optimization,  , Repair, Crash recovery
@subsection �ơ��֥�κ�Ŭ��

���Ҳ����줿�쥳���ɤη��ȡ�
�쥳���ɤκ���ȹ�������������̵�̤ʥ��ڡ������ӽ���
�����Ԥ��ˤϡ������⡼��(recovery mode)�� @code{myisamchk} ��¹Ԥ��ޤ���

@example
shell> myisamchk -r tbl_name
@end example

SQL @code{OPTIMIZE TABLE} �Ǥ�Ʊ�ͤ˥ơ��֥���Ŭ���Ǥ��ޤ���
@code{OPTIMIZE TABLE} �ϴ�ñ�Ǥ����� @code{myisamchk} ������®���Ǥ���


@code{myisamchk} �ˤϡ����ʤ����ơ��֥����ǽ����夵����Τ˻��Ѥ��뤳�Ȥ��Ǥ���
¾��¿���Υ��ץ���󤬤���ޤ�:

@table @code
@item -S, --sort-index
����ǥå����ĥ꡼�֥��å��Υ����ȡ��߽�˥����Ȥ��ޤ���
����ϥ�����(seek)���Ŭ��������������Ѥ����ơ��֥������(scan)��®�����ޤ���

@item -R index_num, --sort-records=index_num
����ǥå����ˤ�륽���ȡ�����Ϥ��ʤ��Υǡ��������ɤ����֤���
���Υ���ǥå�������Ѥ��� @code{SELECT} , @code{ORDER BY} ����®�����ޤ���
(�ǽ�ˤ����¹Ԥ��ƥ����Ȥ���Ȥ��ϻ��֤��ȤƤ⤫����ޤ���)
�ơ��֥�Υ���ǥå����ֹ�򸫤Ĥ��뤿��ˡ� @code{SHOW INDEX} ����Ѥ��ޤ���
����� @code{myisamchk} ���Ԥ��Τ�Ʊ�ͤν�ǥơ��֥�Υ���ǥå�����ɽ�����ޤ���
����ǥå����ֹ�� 1 ���鳫�Ϥ���ޤ���

@item -a, --analyze
�ơ��֥���Υ������֤�ʬ�ϡ�
���Υơ��֥뤫��쥳���ɤ��������ݤˡ�
���(join)�Υѥե����ޥ󥹤���夵���ޤ���
@end table

For a full description of the option see @ref{myisamchk syntax}.

@node Log files,  , Crash recovery, Maintenance
@section Log file maintenance

@strong{MySQL} ������ե�����ȤȤ�˻��Ѥ����硢
���ʤ��ϡ������Ť������ե������ ��ࡼ��/�Хå����å� ����
 @strong{MySQL} �˿������ե�����˥�������褦�˻ؼ��������Ȼפ����ȤǤ��礦��
@xref{Update log}.

@code{Redhat} Linux �ˤ����Ƥϡ�@code{mysql-log-rotate} ������ץȤ�
����˻��ѤǤ��ޤ��� �⤷ RPM �ǥ����ȥ�ӥ塼������ @strong{MySQL} ��
���󥹥ȡ��뤷���ʤ顢���Υ�����ץȤϼ�ư�ǥ��󥹥ȡ��뤵��Ƥ���Ϥ��Ǥ���

¾�Υ����ƥ�Ǥϡ���ʬ���Ȥ�û��������ץȤ򥤥󥹥ȡ��뤷�ޤ���
@code{cron} �ǥ����ե�����򰷤��褦�ˤ��ޤ���

@code{mysqladmin flush-logs} ���ޥ�ɤ� @code{FLUSH LOGS} SQLʸ�ǡ�
@strong{MySQL} �˿����������ե��������Ѥ����뤳�Ȥ�����ޤ���
�⤷���ʤ��� @strong{MySQL} 3.21 ����Ѥ��Ƥ���ʤ顢
 @code{mysqladmin refresh} ����Ѥ��ʤ��ƤϤʤ�ޤ���

�嵭�Υ��ޥ�ɤϡ��ʲ��Τ褦��ư��ޤ���

@itemize @bullet
@item
�⤷�̾�Υ��� (@code{--log}) �����Ѥ���Ƥ���ʤ�С����Υ����ե������
�����Ĥ��Ƥ���Ƥӳ����ޤ���
(@file{mysql.log} ���ǥե���ȤΥ����ե�����).
@item
�⤷�������� (@code{--log-update}) ����Ѥ��Ƥ���ʤ顢
�����������Ĥ��������������ե�����򳫤��ޤ������Τ�����
�����ե�����ˤĤ��Ƥ����ֹ�������ޤ���
@end itemize

�⤷����������������Ѥ��Ƥ���ʤ顢���ʤ��ϡ������� flush ��������Ǥ褯�ơ�
���λ����Хå����åפΤ���Ť����������ե�������ư���ޤ���
 �⤷���̤Υ�����ȤäƤ���С����ʤ��ϰʲ��Τ褦�ˤ��뤳�Ȥ��Ǥ��ޤ�: 

@example
shell> cd mysql-data-directory
shell> mv mysql.log mysql.old
shell> mysqladmin flush-tables
@end example

�������Ƥ����ơ�@file{mysql.old} ��Хå����åפ�������ޤ���.

@node Adding functions, Adding procedures, Maintenance, Top
@chapter @strong{MySQL} �ؤο������ؿ����ɲ�

@strong{MySQL}�˿������ؿ����ɲä���ˤ�2�Ĥ���ˡ������ޤ�:

@itemize @bullet
@item �桼������ؿ�(UDF:user-definable function)���󥿥ե��������̤��ƴؿ����ɲäǤ��ޤ���
�桼������ؿ��ϡ�@code{CREATE FUNCTION} �� @code{DROP FUNCTION} ���ơ�
�ȥ��Ȥ���Ѥ��ơ�ưŪ���ɲá��������ޤ���
@xref{CREATE FUNCTION, , @code{CREATE FUNCTION}}.

@item �ͥ��ƥ���(�ӥ�ȥ���) @strong{MySQL} �ؿ��Ȥ��ƴؿ����ɲäǤ��ޤ���
�ͥ��ƥ��ִؿ��� @code{mysqld} �����Ф����礵�졢����Ū��ͭ���ˤʤ�ޤ���
@end itemize

���줾�����ˡ�ˤϡ�ͭ����������������������ޤ�:

@itemize @bullet
@item
�桼������ؿ���񤯾�硢�����м��Ȥ��ɲä��륪�֥������ȥե�����򥤥�
���ȡ��뤹��ɬ�פ�����ޤ����ؿ��򥵡��Ф����礹���礢�����Ԥʤ�ɬ��
�Ϥ���ޤ���
@item
UDF ��Х��ʥ� @strong{MySQL} ���ۤ��ɲä��뤳�Ȥ��Ǥ��ޤ����ͥ��ƥ��ִ�
���ϥ��������ۤ��ѹ���ɬ�פǤ���
@item
@strong{MySQL} ���ۤ򥢥åץ��졼�ɤ����硢���˥��󥹥ȡ��뤵�줿 UDF 
�λ��Ѥ��³�Ǥ��ޤ����ͥ��ƥ��ִؿ��Ǥϡ����åץ��졼�ɤ��٤��ѹ��򷫤�
�֤�ɬ�פ�����ޤ���
@end itemize

�������ؿ����ɲä��뤿��ˤɤ������ˡ����Ѥ��Ƥ⡢@code{ABS()} �� 
@code{SOUNDEX()} �Τ褦�ʥͥ��ƥ��ִؿ���Ʊ���褦�˻��Ѥ��뤳�Ȥ��Ǥ���
����

@menu
* Adding UDF::                  �������桼������ؿ����ɲ�
* Adding native function::      �������ͥ��ƥ��ִؿ����ɲ�
@end menu

@cindex Adding user-definable functions
@cindex User-definable functions, adding
@cindex Functions, user-definable, adding
@node Adding UDF, Adding native function, Adding functions, Adding functions
@section �������桼������ؿ����ɲ�

@menu
* UDF calling sequences::       UDF calling sequences
* UDF arguments::               Argument processing
* UDF return values::           Return values and error handling
* UDF compiling::               Compiling and installing user-definable functions
@end menu

UDF ������ư��뤿��ˤϡ��ؿ��� C �� C++ �ǽ񤫤��ɬ�פ����ꡢOS ��
ưŪ�����ǥ��󥰤򥵥ݡ��Ȥ���ɬ�פ�����ޤ���@strong{MySQL} ����������
�� @file{sql/udf_example.cc} ��ޤ�Ǥ��ơ�����ϣ��Ĥο������ؿ������
���Ƥ��ޤ���UDF �θƤӽФ���ˡ���ɤΤ褦��Ư�����Ϥ��Υե�����򻲹ͤˤ�
�Ƥ���������

SQL ���ơ��ȥ��Ȥǻ��Ѥ��������줾��δؿ��ˤĤ��ơ��б����� C (�ޤ��� 
C++) �ؿ���������٤��Ǥ������������Ǥϡ�̾�� ``xxx'' ������ץ�ؿ�̾��
���ƻ��Ѥ���Ƥ��ޤ���SQL �� C/C++ ����ˡ�� distinquish ���뤿��ˡ�
@code{XXX()} (��ʸ��) �� SQL �ؿ��ƤӽФ���ɽ�路��@code{xxx()} (��ʸ��) 
�� C/C++ �ؿ��ƤӽФ���ɽ�路�ޤ���

@code{XXX()} �Υ��󥿥ե�������������뤿��˽� C/C++ �ؿ���:

@table @asis
@item @code{xxx()} (ɬ��)
�ᥤ��ؿ�������ϴؿ���̤��׻������Ȥ����Ǥ���SQL ���� C/C++ �ؿ���
����ͷ����б��ϼ��˼����ޤ�:

@multitable @columnfractions .2 .8
@item @strong{SQL ��} @tab @strong{C/C++ ��}
@item @code{STRING}     @tab @code{char *}
@item @code{INTEGER}    @tab @code{long long}
@item @code{REAL}       @tab @code{double}
@end multitable

@item @code{xxx_init()} (���ץ����)
@code{xxx()} �ν�����ؿ�������ϼ��Τ褦�˻��Ѥ���ޤ�:

@itemize @bullet
@item
@code{XXX()} �ΰ����ο��Υ����å�
@item
�������׵ᤵ��뷿���ɤ����Υ����å����ޤ����ᥤ��ؿ����ƤФ�����˾��
���˰�����������褦�� @strong{MySQL} ��������
@item
�ᥤ��ؿ���ɬ�פȤ������γ������
@item
��̤κ���Ĺ�λ���
@item
(@code{REAL} �ؿ��Ǥ�) �������κ������λ���
@item
��̤� @code{NULL} �ˤʤ����뤫�ɤ����λ���
@end itemize

@item @code{xxx_deinit()} (���ץ����)
@code{xxx()} �ν�λ�ؿ�(deinitialization function)������Ͻ�����ؿ��ˤ��
�Ƴ�����Ƥ�줿�����������٤��Ǥ���
@end table

SQL ���ơ��ȥ��Ȥ� @code{XXX()} ��ƤӽФ��Ȥ���@strong{MySQL} �ϰ���
�����å�����������ƤΤ褦�ˡ�ɬ�פʥ��åȥ��åפ�Ԥʤ碌�뤿��ˡ�
������ؿ� @code{xxx_init()} ��ƤӽФ��ޤ���@code{xxx_init()} �����顼
���֤���硢SQL ���ơ��ȥ��Ȥϥ��顼��å������ȶ��˰۾ェλ�����ᥤ��
�ؿ��Ƚ�λ�ؿ��ϸƤӽФ���ޤ��󡣤����Ǥʤ���С��ᥤ��ؿ� 
@code{xxx()} ���ƹ���˸ƤӽФ���ޤ������ƤιԤ��������줿�塢��λ�ؿ� 
@code{xxx_deinit()} ����ɬ�פ��ݽ���Ԥʤ�����ˡ��ƤӽФ���ޤ���

���Ƥδؿ��ϥ���åɰ����Ǥʤ��ƤϤ����ޤ���(�ᥤ��ؿ������Ǥʤ������
���ؿ��Ƚ�λ�ؿ���Ʊ�ͤǤ�)��������ѹ����줦�륰�����Х��ѿ�����Ū�ѿ�
�������Ƥ뤳�Ȥϵ�����ʤ����Ȥ��̣���ޤ��� ���꤬ɬ�פʾ��ϡ�
@code{xxx_init()} �dz�����ơ�@code{xxx_deinit()} �Ǥ����������٤��Ǥ���

@node UDF calling sequences, UDF arguments, Adding UDF, Adding UDF
@subsection UDF �ƤӽФ���������

�ᥤ��ؿ��ϲ��˼����褦����������٤��Ǥ�������ͷ��Ȱ����ϡ�
@code{CREATE FUNCTION} ���ơ��ȥ��Ȥǡ�SQL �ؿ� @code{XXX()} �������
��@code{STRING}, @code{INTEGER}, @code{REAL} �Τɤ��������뤫�˰�¸��
�ưۤʤ뤳�Ȥ����դ��Ƥ�������:

@noindent
@code{STRING} �ؿ��Ǥ�:

@example
char *xxx(UDF_INIT *initid, UDF_ARGS *args,
              char *result, unsigned long *length,
              char *is_null, char *error);
@end example

@noindent
@code{INTEGER} �ؿ��Ǥ�:

@example
long long xxx(UDF_INIT *initid, UDF_ARGS *args,
              char *is_null, char *error);
@end example

@noindent
@code{REAL} �ؿ��Ǥ�:

@example
double xxx(UDF_INIT *initid, UDF_ARGS *args,
              char *is_null, char *error);
@end example

������Ƚ�λ�ؿ��ϼ��Τ褦��������ޤ�:

@example
my_bool xxx_init(UDF_INIT *initid, UDF_ARGS *args, char *message);

void xxx_deinit(UDF_INIT *initid);
@end example

@code{initid} �����ϣ��Ĥδؿ����Ƥ��Ϥ���ޤ�������� @code{UDF_INIT} 
��¤�Τ򼨤����ؿ��֤Ǿ������ã���뤿��˻��Ѥ���ޤ���@code{UDF_INIT} 
��¤�ΤΥ��Фϲ��˰������ޤ���������ؿ����ѹ����������ƤΥ��Ф����
��٤��Ǥ���(���Ф˥ǥե���Ȥ���Ѥ���ˤϡ�̤�ѹ��Τޤޤˤ��Ƥ�����
����)

@table @code
@item my_bool maybe_null
@code{xxx()} �� @code{NULL} ���֤���硢@code{xxx_init()} �� 
@code{maybe_null} �� @code{1} �����ꤹ�٤��Ǥ����ǥե�����ͤϡ������Τ�
���줫�� @code{maybe_null} �Ȥ���������줿��硢@code{1} �Ǥ���

@item unsigned int decimals
�������η�����ǥե�����ͤϥᥤ��ؿ����Ϥ��������ξ������κ�������
����(�㤨�С��ؿ��� @code{1.34}, @code{1.345}, @code{1.3} ���Ϥ��줿��硢
�ǥե���Ȥ� 3 �Ǥ���@code{1.345} �� 3 ��ξ���������Ĥ���Ǥ���)

@item unsigned int max_length
ʸ�����̤κ���Ĺ���ǥե�����ͤϴؿ�������ͷ��˰�¸���ưۤʤ�ޤ���ʸ
����ؿ��Ǥϡ��ǥե���ȤϺǤ�Ĺ��������Ĺ���Ǥ��������ؿ��Ǥϡ��ǥե���
�Ȥ� 21 ��Ǥ����¿��ؿ��Ǥϡ��ǥե���Ȥ� 13 �� @code{initid->decimals} 
�Ǽ�����뾮�����η����ä�����ΤǤ���(���ʹؿ��Ǥϡ�Ĺ�������Ⱦ���
��ʸ����ޤߤޤ���)

@item char *ptr
���켫�Ȥ���Ū�Τ���˴ؿ������ѤǤ���ݥ��󥿤Ǥ����㤨�С��ؿ��ϳ����
�Ƥ������ؿ��֤���ã���뤿��ˡ�@code{initid->ptr} ����ѤǤ��ޤ���
@code{xxx_init()} �Ǥϡ����������������Υݥ��󥿤˳�����Ƥޤ�:

@example
initid->ptr = allocated_memory;
@end example

@code{xxx()} �� @code{xxx_deinit()} �Ǥϡ�@code{initid->ptr} �򻲾Ȥ��ơ�
�������Ѥޤ��ϲ������ޤ���
@end table

@node UDF arguments, UDF return values, UDF calling sequences, Adding UDF
@subsection ��������

@code{args} �����ϼ��˼������Ф���� @code{UDF_ARGS} ��¤�ΤؤΥݥ���
���Ǥ�:

@table @code
@item unsigned int arg_count
�����ο����ؿ�������ΰ����ο��ǸƤӽФ���뤳�Ȥ���Ԥ�����ϡ������
�ؿ��Ǥ����ͤ�����å����Ƥ����������㤨��:

@example
if (args->arg_count != 2)
@{
    strcpy(message,"XXX() requires two arguments");
    return 1;
@}
@end example


@item enum Item_result *arg_type
�����η�����ǽ�ʷ����ͤ� @code{STRING_RESULT}, @code{INT_RESULT},
@code{REAL_RESULT} �Ǥ���

������Ϳ����줿���Ǥ��뤳�Ȥȡ������Ǥʤ���票�顼���֤����Ȥ�μ¤ˤ�
�뤿��ˡ�������ؿ��� @code{arg_type} ���������å����Ƥ����������㤨
��:

@example
if (args->arg_type[0] != STRING_RESULT
      && args->arg_type[1] != INT_RESULT)
@{
    strcpy(message,"XXX() requires a string and an integer");
    return 1;
@}
@end example

�ؿ��ΰ���������η����׵᤹�뤿�����ƤȤ��ơ�������ؿ�����Ѥ��ơ�
@code{arg_type} ���Ǥ���뷿������Ǥ��ޤ�������� @strong{MySQL} ��
@code{xxx()} �γƸƤӽФ��ˤ����η�������˶�������褦�ˤ����ޤ�����
���С��ǽ�Σ��Ĥΰ�����ʸ�����������������褦�˻��ꤹ��ˤϡ�
@code{xxx_init()} �Ǽ���ԤʤäƤ�������:

@example
args->arg_type[0] = STRING_RESULT;
args->arg_type[1] = INT_RESULT;
@end example

@item char **args
@code{args->args} �ϡ��ؿ����ƤФ����ΰ����ΰ���Ū�������ˤĤ��ơ�����
�������ؿ�����ã���ޤ���������� @code{i} �ˤĤ��ơ�
@code{args->args[i]} �ϰ����ͤΤ�ݥ���Ȥ��ޤ���(�ͤؤ�����������������
ˡ�ˤĤ��Ƥϸ�ҡ�)����������ˤĤ��ơ�@code{args->args[i]} �� @code{0} 
�Ǥ�����������������������Ѥ���ɽ���ǡ�@code{3}, @code{4*7-2},
@code{SIN(3.14)} �ʤɤǤ�������������ϹԤ���Ԥ��ѹ�������ͤ򻲾Ȥ���
ɽ���ǡ�����̾������������ǸƤӽФ����ؿ��ʤɤǤ���

�ᥤ��ؿ��Τ��줾��θƤӽФ��ˤĤ��ơ�@code{args->args} �ϸ��߽�������
�Ƥ���Ԥ��Ϥ����ºݤΰ�����ޤ�Ǥ��ޤ���

�ؿ��ϼ��Τ褦�˰��� @code{i} �򻲾ȤǤ��ޤ�:

@itemize @bullet
@item
@code{STRING_RESULT} ���ΰ����ϡ��Х��ʥ�ǡ����ޤ���Ǥ�դ�Ĺ���Υǡ���
�ν�����������ᡢʸ����ݥ��󥿡�Ĺ���Ȥ���Ϳ�����ޤ���ʸ�������Ƥ� 
@code{args->args[i]} �Ȥ���ͭ���ǡ�ʸ����Ĺ�� @code{args->lengths[i]} ��
����ʸ����� NULL ��ü�Ȥߤʤ��٤��ǤϤ���ޤ���

@item
@code{INT_RESULT} ���ΰ����ˤĤ��ơ�@code{args->args[i]} �� 
@code{long long} �ͤ˥��㥹�Ȥ���ɬ�פ�����ޤ�:

@example
long long int_val;
int_val = *((long long*) args->args[i]);
@end example

@item
@code{REAL_RESULT} ���ΰ����ˤĤ��ơ�@code{args->args[i]} �� 
@code{double} �ͤ˥��㥹�Ȥ���ɬ�פ�����ޤ�:

@example
double    real_val;
real_val = *((double*) args->args[i]);
@end example
@end itemize

@item unsigned long *lengths
������ؿ��Ǥϡ�@code{lengths} ����ϳư����ˤĤ��Ƥκ���ʸ����Ĺ�򼨤�
�ޤ����ᥤ��ؿ��γƸƤӽФ��ˤĤ��Ƥϡ�@code{lengths} �ϡ����߽�������
�Ƥ���Ԥ��Ϥ����Ǥ�դ�ʸ��������μºݤ�Ĺ����ޤ�Ǥ��ޤ���
@code{INT_RESULT}, @code{REAL_RESULT} ���ΰ����ˤĤ��Ƥϡ�@code{lengths} 
�Ϥޤ������κ���Ĺ��ޤ�Ǥ��ޤ�(������ؿ��ˤĤ��Ƥ�)��
@end table

@node UDF return values, UDF compiling, UDF arguments, Adding UDF
@subsection ����ͤȥ��顼����

������ؿ��ϡ����顼��̵������ @code{0} �򡢤����Ǥʤ���� @code{1} ��
�֤��٤��Ǥ������顼��ȯ��������ϡ�@code{xxx_init()} �� NULL ��ü���顼
��å������� @code{message} �ѥ�᡼���˳�Ǽ���٤��Ǥ������Υ�å�������
���饤����Ȥ��֤���ޤ�����å������Хåե��� @code{MYSQL_ERRMSG_SIZE} 
ʸ��Ĺ�Ǥ�����80 ʸ����꾮�����ݤĤ褦�˻�ߤ�٤��Ǥ���ɸ��Ū��ü����
�̤����˥ե��åȤ���褦�ˤǤ���

�ᥤ��ؿ� @code{xxx()} ���֤��ͤ� @code{long long} �� @code{double} ��
���ˤĤ��Ƥϴؿ��ͤǤ���ʸ����ؿ��ˤĤ��Ƥϡ�@code{result} �� 
@code{length} ������ʸ�����֤���ޤ���@code{result} �Ͼ��ʤ��Ȥ� 255 
�Х���Ĺ�ΥХåե��Ǥ������������Ƥ�����ͤ�Ĺ�������ꤷ�Ƥ�����������
����:

@example
memcpy(result, "result string", 13);
*length = 13;
@end example

ʸ����ؿ����̾�Ϸ�̤�ݥ���Ȥ����ͤ��֤��ޤ���

�ᥤ��ؿ��� @code{NULL} �ͤ�����ͤ򼨤��ˤϡ�@code{is_null} �� 
@code{1} �����ꤷ�Ƥ�������:

@example
*is_null = 1;
@end example

�ᥤ��ؿ��ǥ��顼������ͤ򼨤��ˤϡ�@code{error} �ѥ�᡼���� @code{1} 
�����ꤷ�ޤ�:

@example
*error = 1;
@end example

@code{xxx()} ��Ǥ�դιԤˤĤ��� @code{*error} �� @code{1} �����ꤹ���硢
�ؿ��ͤϸ��ߤιԤˤĤ��Ƥȡ����θ�� @code{XXX()} ���ƤӽФ���륹�ơ���
���Ȥˤ�äƽ��������Ǥ�դιԤˤĤ��� @code{NULL} �Ǥ���(@code{xxx()} 
��³���ԤˤĤ��ƤϸƤӽФ���������ޤ���) @strong{����:} 3.22.10 ���
���� @strong{MySQL} �С������Ǥϡ�@code{*error} �� @code{*is_null} ��
ξ�������ꤹ�٤��Ǥ�:

@example
*error = 1;
*is_null = 1;
@end example

@node UDF compiling,  , UDF return values, Adding UDF
@subsection �桼������ؿ��Υ���ѥ���ȥ��󥹥ȡ���

UDF ���������ե�����ϥ����Ф�ư���ۥ��Ⱦ�ǥ���ѥ��뤵�쥤�󥹥ȡ�
�뤵��ʤ�����Фʤ�ޤ��󡣤��ν����ϥ���ץ� UDF �ե����� 
@file{udf_example.cc} �ˤĤ��Ƽ����������ޤ�������� @strong{MySQL} ����
�����ۤ˴ޤޤ�Ƥ��ޤ������Υե�����ϼ��δؿ���ޤߤޤ�:

@itemize @bullet
@item
@code{metaphon()} ��ʸ��������� metaphon ʸ������֤��ޤ�������ϻ��ˤ� 
soundex ʸ����Ǥ���������˱Ѹ��Ѥ�Ĵ������Ƥ��ޤ���
@item
@code{myfunc_double()} �ϰ�����ʸ���� ASCII �ͤι�פ������Ĺ���ι�פ�
��ä��ͤ��֤��ޤ���
@item
@code{myfunc_int()} �ϰ�����Ĺ���ι�פ��֤��ޤ���
@item
@code{lookup()} �ϥۥ���̾�� IP �ֹ���֤��ޤ���
@item
@code{reverse_lookup()} �� IP �ֹ�Υۥ���̾���֤��ޤ������δؿ���ʸ���� 
@code{"xxx.xxx.xxx.xxx"} �ޤ��ϣ��Ĥο��ͤȤȤ�˸ƤФ�ޤ���
@end itemize

ưŪ�����ɲ�ǽ�ե�����ϡ����Τ褦�ʲ��餫�Υ��ޥ�ɤ���Ѥ��ơ���ͭ����
�������ȥե�����Ȥ��ƥ���ѥ��뤵���٤��Ǥ�:

@example
shell> gcc -shared -o udf_example.so myfunc.cc
@end example

@strong{MySQL} �������ĥ꡼�� @file{sql} �ǥ��쥯�ȥ���Ǽ��Υ��ޥ�ɤ�
�¹Ԥ��뤳�Ȥˤ�ꡢ�����ƥ�Υ���ѥ��饪�ץ������ñ�����������Ĥ���
�����Ȥ��Ǥ��ޤ�:

@example
shell> make udf_example.o
@end example

@code{make} ��ɽ�������Τ˻�������ѥ��륳�ޥ�ɤ�¹Ԥ��٤��Ǥ�������
���᤯�� @code{-c} ���ץ�����������ơ�@code{-o udf_example.so} ���
���ˤĤ��Ƥ���������(�����Ĥ��Υ����ƥ�Ǥϡ����ޥ�ɤ� @code{-c} ��Ĥ�
ɬ�פ�����ޤ���)

UDF ��ޤඦͭ���֥������Ȥ򥳥�ѥ��뤹��ȡ�����򥤥󥹥ȡ��뤷�Ƥ���
���Ȥ� @strong{MySQL} ���Τ餻��ɬ�פ�����ޤ���@file{udf_example.cc} ��
��ζ�ͭ���֥������ȤΥ���ѥ���ϡ�@file{udf_example.so} �Τ褦�ʲ�����
�ե�����̾���󶡤��ޤ�(�ºݤ�̾���ϥץ�åȥե�����ˤ�ä��Ѥ��ޤ�)��
���Υե������ @file{/usr/lib} �Τ褦�� @code{ld} ��õ���ɤ����Υǥ��쥯
�ȥ�˥��ԡ����Ƥ���������¿���Υ����ƥ�Ǥϡ�@code{LD_LIBRARY} �ޤ��� 
@code{LD_LIBRARY_PATH} �Ķ��ѿ������ꤷ�ơ�UDF �ؿ��ե����뤬����ǥ���
���ȥ�򼨤����Ȥ��Ǥ��ޤ���@code{dlopen} �ޥ˥奢��ڡ����ϥ����ƥ���
���Ѥ��٤��ѿ��򶵤��Ƥ���ޤ�������� @code{mysql.server} �ޤ��� 
@code{safe_mysqld} �����ꤷ��@code{mysqld} ��Ƶ�ư���٤��Ǥ���

�饤�֥�꤬���󥹥ȡ��뤵�줿�塢@code{mysqld} �˿������ؿ��ˤĤ��Ƽ���
���ޥ�ɤ����Τ��٤��Ǥ�:

@example
mysql> CREATE FUNCTION metaphon RETURNS STRING SONAME "udf_example.so";
mysql> CREATE FUNCTION myfunc_double RETURNS REAL SONAME "udf_example.so";
mysql> CREATE FUNCTION myfunc_int RETURNS INTEGER SONAME "udf_example.so";
mysql> CREATE FUNCTION lookup RETURNS STRING SONAME "udf_example.so";
mysql> CREATE FUNCTION reverse_lookup RETURNS STRING SONAME "udf_example.so";
@end example

�ؿ��� @code{DROP FUNCTION} ����Ѥ��ƺ���Ǥ��ޤ�:

@example
mysql> DROP FUNCTION metaphon;
mysql> DROP FUNCTION myfunc_double;
mysql> DROP FUNCTION myfunc_int;
mysql> DROP FUNCTION lookup;
mysql> DROP FUNCTION reverse_lookup;
@end example

@code{CREATE FUNCTION} �� @code{DROP FUNCTION} ���ơ��ȥ��Ȥ� 
@code{mysql} �ǡ����١�����Υ����ƥ�ơ��֥� @code{func} �򹹿����ޤ���
�ؿ���̾����������ͭ�饤�֥��̾�ϥơ��֥����¸����ޤ����������˴���ǽ
�Τ���ˤϡ�@code{mysql} �ǡ����١����� @strong{insert} �� 
@strong{delete} ���¤����ɬ�פ�����ޤ���

�����������Ƥ���ؿ����ɲä��뤿��� @code{CREATE FUNCTION} ����Ѥ��٤�
�ǤϤ���ޤ��󡣴ؿ��κƥ��󥹥ȡ��뤬ɬ�פʾ��ϡ�@code{DROP FUNCTION} 
�Ǥ�������������줫�� @code{CREATE FUNCTION} �Ǻƥ��󥹥ȡ��뤹�٤���
�����㤨�С��ؿ��ο������С������κƥ���ѥ���򤷤���硢
@code{mysqld} ���������С����������뤿��ˡ������Ԥʤ�ɬ�פ�����Ǥ���
���������Ǥʤ���С������ФϸŤ��С������λ��Ѥ��³���ޤ���

@code{mysqld} �� @code{--skip-grant-tables} ���ץ����ǵ�ư���ʤ��Ƥ⡢
ͭ���ʴؿ��ϥ����Фγ�����˺��ɤ߹��ߤ���ޤ������ξ�硢UDF ���������
�Ф��졢UDF ��̵���ˤʤ�ޤ���(ͭ���ʴؿ��� @code{CREATE FUNCTION} �ǥ���
�ɤ���Ƥ����Τǡ�@code{DROP FUNCTION} �Ǻ������Ƥ��ʤ���ΤǤ���)

@cindex Adding native functions
@cindex Native functions, adding
@cindex Functions, native, adding
@node Adding native function,  , Adding UDF, Adding functions
@section �������ͥ��ƥ��ִؿ����ɲ�

�ͥ��ƥ��ִؿ����ɲä��뤿��Υץ��������ʲ��˼����ޤ����Х��ʥ����ۤ�
�ϥͥ��ƥ��ִؿ����ɲäǤ��ʤ����Ȥ����դ��Ƥ����������ץ�������� 
@strong{MySQL} �����������ɤ��ѹ���ɬ�פȤ��뤿��Ǥ���@strong{MySQL} ��
���������ۤ��鼫ʬ�ǥ���ѥ��뤹��ɬ�פ�����ޤ����ޤ���@strong{MySQL} 
��¾�ΥС������˰ܹԤ�����(�㤨�С��������С�����󤬥�꡼�����줿
��)���������С������Ǥ��Υץ�������򷫤��֤�ɬ�פ�����ޤ���

�������ͥ��ƥ��� @strong{MySQL} �ؿ����ɲä��뤿��ˤϡ����Υ��ƥåפ˽���
�Ƥ�������:

@enumerate
@item
@code{sql_functions[]} ������Ǵؿ�̾��������Ƥ��� @file{lex.h} �ˣ���
�ɲä��Ƥ���������
@item
@file{sql_yacc.yy} �ˣ����ɲä��Ƥ�����������Ĥϡ�@code{yacc} �������
�٤��ץ�ץ����å�����ܥ��ؼ����ޤ�(����ϥե��������Ƭ���ɲä��٤�
�Ǥ�)�����줫��ؿ��ѥ�᡼����������������Υѥ�᡼���ȤȤ�� 
``item'' �� @code{simple_expr} �ѡ�����§���ɲä��ޤ����㤨�С����줬��
�Τ褦��ư��뤫�򸫤�ˤϡ�@file{sql_yacc.yy} ��� @code{SOUNDEX} ��
���Ƥν����������å����Ƥ���������
@item
@file{item_func.h} ��ǡ��ؿ������ͤޤ���ʸ����Τɤ�����֤����˰�¸��
�ơ�@code{Item_num_func} �ޤ��� @code{Item_str_func} ����Ѿ����륯�饹
��������Ƥ���������
@item
@file{item_func.cc} ��ǡ����ͤޤ���ʸ����Τɤ���δؿ���������뤫�˰�
¸���ơ���������ΰ�Ĥ��ɲä��Ƥ�������:
@example
double   Item_func_newname::val()
longlong Item_func_newname::val_int()
String  *Item_func_newname::Str(String *str)
@end example
@item
�����餯���δؿ���������٤��Ǥ�:
@example
void Item_func_newname::fix_length_and_dec()
@end example
���δؿ���Ϳ����줿�����˴�Ť��ƾ��ʤ��Ȥ� @code{max_length} ��׻���
�٤��Ǥ���@code{max_length} �ϴؿ����֤�����ʸ���κ�����Ǥ������δؿ��ϡ�
�ᥤ��ؿ��� @code{NULL} �ͤ��֤����Ȥ��ʤ����ϡ�@code{maybe_null = 0} 
�����ꤹ�٤��Ǥ����ؿ��ϡ������� @code{maybe_null} �ѿ�������å����뤳
�Ȥǡ��ؿ���Ǥ�դΰ����� @code{NULL} ���֤����뤫�ɤ���������å��Ǥ���
����
@end enumerate

���Ƥδؿ��ϥ���åɰ����Ǥ���ɬ�פ�����ޤ���

ʸ����ؿ��ˤĤ��Ƥϡ����Τ����Ĥ����ɲø�Ƥ���ब����ޤ�:
@itemize @bullet
@item
@code{String *str} �����ϡ���̤��ݻ����뤿��˻��Ѥ����ʸ����Хåե�
���󶡤��ޤ���
@item
�ؿ��Ϸ�̤��ݻ�����ʸ������֤��٤��Ǥ���
@item
���Ƥθ��ߤ�ʸ����ؿ��ϡ����Ф�ɬ�פǤʤ��¤ꡢ���������Ƥ��򤱤��
���˻�ߤƤ���������
@end itemize

@node Adding procedures, ODBC, Adding functions, Top
@chapter Adding new procedures to MySQL

In @strong{MySQL}, you can define a procedure in C++ that can access and
modify the data in a query before it is sent to the client.  The modification
can be done on row by row or @code{GROUP BY} level.

We have created an example procedure in @strong{MySQL} 3.23 to
show you what can be done.

@menu
* procedure analyse::           Procedure analyse
* Writing a procedure::         Writing a procedure.
@end menu

@node procedure analyse, Writing a procedure, Adding procedures, Adding procedures
@section Procedure analyse

@code{analyse([max elements,[max memory]])}

This procedure is defined in the @file{sql/sql_analyse.cc}.  This
examines the result from your query and returns an analysis of the
results.

@itemize @bullet
@item
@code{max elements} (default 256) is the maximum number of distinct values
@code{analyse} will notice per column.  This is used by @code{analyse} to check if
the optimal column type should be of type @code{ENUM}.
@item
@code{max memory} (default 8192) is the maximum memory @code{analyse} should
allocate per column while trying to find all distinct values.
@end itemize

@example
SELECT ... FROM ... WHERE ... PROCEDURE ANALYSE([max elements,[max memory]])
@end example

@node Writing a procedure,  , procedure analyse, Adding procedures
@section Writing a procedure.

For the moment, the only documentation for this is the source. :(

You can find all information about procedures by examining the following files:

@itemize @bullet
@item @file{sql/sql_analyse.cc}
@item @file{sql/procedure.h}
@item @file{sql/procedure.cc}
@item @file{sql/sql_select.cc}
@end itemize

@cindex ODBC
@cindex Windows
@cindex MyODBC
@node ODBC, Common programs, Adding procedures, Top
@chapter @strong{MySQL} ODBC Support

@menu
* Which ODBC OS::               Operating systems supported by @strong{MyODBC}
* ODBC administrator::          How to fill in the various fields in the ODBC administrator program
* ODBC Problems::               How to report problems with @strong{MySQL} ODBC
* MyODBC clients::              Programs known to work with @strong{MyODBC}
* ODBC and last_insert_id::     How to get the value of an @code{AUTO_INCREMENT} column in ODBC
* MyODBC bug report::           Reporting problems with MyODBC
@end menu

@strong{MySQL} �� @strong{MyODBC} �ץ������� ODBC ��ǽ���󶡤��ޤ���

@node Which ODBC OS, ODBC administrator, ODBC, ODBC
@section Operating systems supported by @strong{MyODBC}

@strong{MyODBC} �� 32-bit ODBC (2.50) level 0 driver �ǡ�
ODBC �����줿���ץꥱ������� @strong{MySQL} ����³������˻��Ѥ��ޤ���
@strong{MyODBC} �ϡ�Windows95, Windows98, NT �ȤۤȤ�ɤ� Unix ��ư���ޤ���

�̾@strong{MyODBC} �� Windows �ޥ���ˤ��������󥹥ȡ��뤷�ޤ���
�����ʤ��Υץ�����ब ColdFusion �Τ褦�˥ǡ����١����ؤ���³��
ODBC ��������Ѥ�����˸¤ꡢUNIX �� @strong{MyODBC} ��ɬ�פǤ���

@strong{MyODBC} �ϥѥ֥�å����ɥᥤ��ǡ��ǿ���ʪ�ϰʲ��ˤ���ޤ���
@uref{http://www.mysql.com/download_myodbc.html}.

���ܸ�ʸ�������ɤ��б�������ʪ�ϡ�
@uref{http://www.SoftAgency.co.jp/}.

�⤷��UNIX �� @strong{MyODBC} �򥤥󥹥ȡ��뤷�����ʤ顢 @strong{ODBC} 
�ޥ͡����㡼��ɬ�פǤ��礦�� @strong{MyODBC} �� UNIX �� ODBC �ޥ͡����㡼
�Ǥ�ư��뤳�Ȥ��Τ��Ƥ��ޤ��� @strong{MySQL} useful links page ��
@strong{ODBC}-related links ��ˡ����Ĥ��뤳�Ȥ��Ǥ��ޤ���
@xref{Useful Links}.

Windows/NT �ξ�硢@strong{MyODBC} �򥤥󥹥ȡ�����ˤ����Τ褦��
���顼�ˤʤ뤫�⤷��ޤ���:

@example
An error occurred while copying C:\WINDOWS\SYSTEM\MFC30.DLL. Restart Windows
and try installing again (before running any applications which use ODBC)
@end example

The problem in this case is that some other program is using ODBC and
because of how windows is designed, one cannot in this case install new
ODBC drivers with Microsoft's ODBC setup program. :(
������褹��ˤϡ����� �ǥ����ե⡼�ɡǤǥ���ԥ塼����Ω���夲ľ����
(windows ��֡��Ȼ��ˡ�F8�����򲡤����Ȥǡ������ե⡼�ɤ����򤬲�ǽ�Ǥ�)
@strong{MyODBC} �򥤥󥹥ȡ��뤷�ơ���֡��Ȥ��ޤ���

@itemize @bullet
@item
Windows �ޥ��󤫤� UNIX �� ODBC ���ץꥱ����������Ѥ�����³����ˤϡ�
�ޤ��ǽ�� Windows �ޥ���� @strong{MyODBC} �򥤥󥹥ȡ��뤷�ʤ��Ƥ�
�ʤ�ޤ���
@item
UNIX ��� @strong{MySQL} �����С����Ф��ơ��桼������ Windows �ޥ����
�����������Ĥ�Ϳ���ޤ��� ����ϡ� @code{GRANT} ���ޥ�ɤDz�ǽ�Ǥ���
@xref{GRANT,,@code{GRANT}}.
@item
ODBC DSN ��ʲ��Τ褦�ˤ��ƺ������ʤ��ƤϤʤ�ޤ���

@itemize @bullet
@item
Windows �ޥ���Υ���ȥ�����ѥͥ�򳫤�
@item
ODBC �����������֥륯��å�
@item
"�桼����DSN" �򥯥�å�
@item
"�ɲ�..." �ܥ���򥯥�å�
@item
�������ǡ��������� �β��̤��顢@strong{MySQL} �����ӡ���λ�ܥ���򥯥�å���
@item
TCX @strong{MySQL} Driver �Υǥե�������꤬����ޤ���
@xref{ODBC administrator}.
@end itemize

@item
���ץꥱ��������ư��������ȥ�����ѥͥ�����ꤷ�� ODBC DSN �����Ӥޤ�
@end itemize

MyODBC ��������̤ˤϡ�@strong{MySQL} ��³���Υ��ץ���󤬤����Ĥ�
����Ǥ���褦�ˤʤäƤ��ޤ���
�⤷���꤬������ϡ��������ޤ���


@node ODBC administrator, ODBC Problems, Which ODBC OS, ODBC
@section  ODBC �����ץ������γƼ���ܤ�����ˤϡ�

Windows95 ��Υ�����̾�ε��Ҥˤ�3�Ĥβ�ǽ��������ޤ�:

@itemize @bullet
@item
�����Ф� IP ���ɥ쥹�λ���
@item
�ե����� @file{\windows\lmhosts} �ؤμ��ξ�����ɲ�:

@example
ip hostname
@end example

�㤨�С�

@example
194.216.84.21 my
@end example

@item
DNS ����Ѥ���褦�����ꤷ�ޤ���
@end itemize

@code{ODBC setup} ��������ˡ����:
@example
Windows DSN name:   test
Description:        This is my test database
MySql Database:     test
Server:             194.216.84.21
User:               monty
Password:           my_password
Port:
@end example

@code{Windows DSN name} ���ܤ��ͤϡ����ʤ���windows ODBC setup �ˤ�����
��դ�̾���Ǥ���

ODBC setup ���̤ǡ�@code{Server}, @code{User}, @code{Password}, @code{Port}
 �ե�����ɤ����ꤹ��ɬ�פϤ���ޤ���
������������������򤹤�ȡ���ǥ����С�����³����ݤˡ�
���ꤷ���ͤ��ǥե�����ͤȤ��ƻ��Ѥ���ޤ���
���ѻ����ͤ��ѹ����륪�ץ����Ϥ���ޤ���

�ݡ����ֹ椬���ꤵ��Ƥ��ʤ��ʤ顢�ǥե���ȥݡ��� (@value{default_port}) �����Ѥ���ޤ���

�⤷���ץ����� @code{Read options from C:\my.cnf} �ˤ����, 
@code{client} �� @code{odbc} ���롼�פ� @file{C:\my.cnf} �ե����뤫���ɤޤ�ޤ���
@code{mysql_options()} �ǻ��ѤǤ������ƤΥ��ץ�������Ѳ�ǽ�Ǥ���
@xref{mysql_options}.


@node ODBC Problems, MyODBC clients, ODBC administrator, ODBC
@section @strong{MyODBC}�Ǥ������ɤΤ褦����𤹤٤�����

@strong{MyODBC} �ϰʲ��ǥƥ��Ȥ���ޤ����� Access, Admndemo.exe, C++-Builder,
Borland Builder 4, Centura Team Developer (formerly Gupta SQL/Windows),
ColdFusion (on Solaris and NT with svc pack 5), Crystal Reports,
DataJunction, Delphi, ERwin, Excel, iHTML, FileMaker Pro, FoxPro, Notes
4.5/4.6, SBSS, Perl DBD-ODBC, Paradox, Powerbuilder, Powerdesigner 32
bit, VC++ and Visual Basic.

@strong{MyODBC} ��ư���¾�Υ��ץꥱ�������ˤĤ��Ƥ��ΤäƤ���ʤ顢
@email{myodbc@@lists.mysql.com} �ޤǥ᡼��򤯤�������

With some programs you may get an error like:
@code{Another user has modifies the record that you have modified}. In most
cases this can be solved by doing one of the following things:

@itemize @bullet
@item
Add a primary key for the table if there isn't one already.
@item
Add a timestamp column if there isn't one already.
@item
Only use double float fields. Some programs may fails when they comparing
single floats.
@end itemize

If the above doesn't help, you should do a @code{MyODBC} trace file and
from this try to figure out why things goes wrong.

@node MyODBC clients, ODBC and last_insert_id, ODBC Problems, ODBC
@section @strong{MyODBC}��ư��뤳�Ȥ��Τ��Ƥ���ץ������

¿���Υץ�����ब  @strong{MyODBC} ��ư��ޤ��������ϲ桹���Ȥ��ƥ��Ȥ�������
�ޤ��ϲ��ͤ���¾�Υ桼������ư���Ȥ����ξڤ�������ΤǤ�:

@table @asis
@item @strong{Program}
@strong{Comment}
@item Access
Access ��ư�����ˤ�:
@itemize @bullet
@item
�ơ��֥�˥ץ饤�ޥꥭ�������ꤷ�ʤ���Фʤ�ޤ���
@item
������ǽ�ʥơ��֥�����Ƥˡ�timestamp ��������ʤ���Фʤ�ޤ���
@item
���֥�ե����ȷ�������(�¿���)���ѤǤ��ޤ���Access�Ǥϥ��󥰥�ե����Ȥ���Ӥϼ��Ԥ��ޤ���
@item
@strong{MySQL} ����³����ݤϡ�'Return matching rows' ���ץ����򥻥åȤ��ޤ���
@item
NT ��� Access �� @code{BLOB} �ե�����ɤ� @code{OLE OBJECTS} ��ǧ�����ޤ���
�⤷ @code{MEMO} �ե�����ɤ�����˻��Ѥ������ʤ顢 @code{ALTER TABLE} ��Ȥäơ�
@code{TEXT} ���˥ե�����ɤ��ѹ����ʤ��ƤϤʤ�ޤ���
@item
Access �� @code{DATE} �ե�����ɤ򤤤Ĥ��������������Ȥ�����ޤ���
�⤷���������꤬���ä���硢�ե�����ɷ��� @code{DATETIME} ���Ѥ��Ƥ���������
@end itemize
@item
���������ϡ�@strong{MySQL} ������Ǥ��ʤ��ְ�ä� SQL �������
�������뤫�⤷��ޤ��� ����ϥ��������Υ�˥塼����
@code{"Query|SQLSpecific|Pass-Through"} �����򤹤��
ľ�����Ȥ���ǽ�Ǥ���
@item Borland Builder 4
When you start a query you can use the property @code{Active} or use the
method @code{Open}.  Note that @code{Active} will start by automatically issue
a @code{SELECT * FROM ...} query that may not be a good thing if your tables
are big!

@item ColdFusion (On Unix)
The following information is taken from the ColdFusion documentation:

Use the following information to configure ColdFusion Server for Linux
to use the unixODBC driver with @strong{MyODBC} for @strong{MySQL} data
sources.  Allaire has verified that @strong{MyODBC} version 2.50.26
works with @strong{MySQL} version 3.22.27 and ColdFusion for Linux. (Any
newer version should also work). You can download @strong{MyODBC} at
@uref{http://www.mysql.com/download_myodbc.html}

ColdFusion 4.5.1 allows you to us the ColdFusion Administrator to add
the @strong{MySQL} data source. However, the driver is not included with
ColdFusion 4.5.1. Before the @strong{MySQL} driver will appear in the ODBC
datasources drop-down list, you must build and copy the @strong{MyODBC} driver
to @file{/opt/coldfusion/lib/libmyodbc.so}.

@item DataJunction 
You have to change it to output @code{VARCHAR} rather than @code{ENUM}, as
it exports the latter in a manner that causes @strong{MySQL} grief.
@item Excel
ư�Some tips:
@itemize @bullet
@item
���դ����꤬��������硢@code{CONCAT()} �ؿ�����Ѥ���ʸ���Ȥ��� SELECT ���ƤߤƤ���������
�㤨�С�
@example
select CONCAT(rise_time), CONCAT(set_time)
    from sunrise_sunset;
@end example
������ˡ��ʸ���Ȥ����֤äƤ����ͤ�Excel97 �ǻ��֤Ȥ��ư����褦�ˤ��٤��Ǥ���

������� @code{CONCAT()} ����Ū�ϡ��ե�����ɤη���ʸ����Ǥ���� ODBC ����ޤ����ȤǤ���
@code{CONCAT()} ���ʤ���С�ODBC �ϥե�����ɤη������դȤ狼��Τǡ�
Excel �����٤Ϥ��������Ǥ��ʤ��ʤ�ޤ���

����� Excel �ΥХ��Ǥ����ʤ��ʤ�ʸ����ư�����դ�ľ���ΤǤ����顣
�����ñ�˥ƥ����ȥե�����ξ���򰷤����ʤ�Ф����ΤǤ�����
�ƹ��ܤη����Τ餻�� ODBC ��³�ξ���򰷤����ϡ��ȤƤ�򤫤���ˡ�Ǥ���
@end itemize
@item odbcadmin
ODBC �Υƥ��ȥץ������.
@item Delphi
DBE 3.2 �ʾ��ɬ�����Ѥ��Ƥ���������
@strong{MySQL} ����³����ݤˤϡ�'Don't optimize column width' ���ץ����򥻥åȤ��ޤ���

ODBC����ȥ��BDE����ȥ��ξ���򥻥åȥ��åפ��뤪������Ω�ĤǤ�����
 Delphi �Υ�������򼨤��ޤ�
( BDE �� Delphi Super Page ����̵���������� BDE Alias Editor ��ɬ�פǤ�)��
:  (Thanks to Bryan Brunton @email{bryan@@flesherfab.com} for this)

@example
fReg:= TRegistry.Create;
  fReg.OpenKey('\Software\ODBC\ODBC.INI\DocumentsFab', True);
  fReg.WriteString('Database', 'Documents');
  fReg.WriteString('Description', ' ');
  fReg.WriteString('Driver', 'C:\WINNT\System32\myodbc.dll');
  fReg.WriteString('Flag', '1');
  fReg.WriteString('Password', '');
  fReg.WriteString('Port', ' ');
  fReg.WriteString('Server', 'xmark');
  fReg.WriteString('User', 'winuser');
  fReg.OpenKey('\Software\ODBC\ODBC.INI\ODBC Data Sources', True);
  fReg.WriteString('DocumentsFab', 'MySQL');
  fReg.CloseKey;
  fReg.Free;

  Memo1.Lines.Add('DATABASE NAME=');
  Memo1.Lines.Add('USER NAME=');
  Memo1.Lines.Add('ODBC DSN=DocumentsFab');
  Memo1.Lines.Add('OPEN MODE=READ/WRITE');
  Memo1.Lines.Add('BATCH COUNT=200');
  Memo1.Lines.Add('LANGDRIVER=');
  Memo1.Lines.Add('MAX ROWS=-1');
  Memo1.Lines.Add('SCHEMA CACHE DIR=');
  Memo1.Lines.Add('SCHEMA CACHE SIZE=8');
  Memo1.Lines.Add('SCHEMA CACHE TIME=-1');
  Memo1.Lines.Add('SQLPASSTHRU MODE=SHARED AUTOCOMMIT');
  Memo1.Lines.Add('SQLQRYMODE=');
  Memo1.Lines.Add('ENABLE SCHEMA CACHE=FALSE');
  Memo1.Lines.Add('ENABLE BCD=FALSE');
  Memo1.Lines.Add('ROWSET SIZE=20');
  Memo1.Lines.Add('BLOBS TO CACHE=64');
  Memo1.Lines.Add('BLOB SIZE=32');

  AliasEditor.Add('DocumentsFab','MySQL',Memo1.Lines);
@end example

@item C++Builder
BDE 3.0��,�ƥ��Ȥ���ޤ�����ͣ����Τ�줿����ϡ�
�ơ��֥륹�����ޤ��Ѳ��������������ե�����ɤ���������ʤ����ȤǤ���
BDE �ϡ�index PRIMARY ������ǧ�������ץ饤�ޥ꡼������ǧ�����Ƥ��ʤ��褦�˻פ��ޤ�������Ϥ��ۤ�����ǤϤʤ��Ǥ�����
@item Visual Basic
�ơ��֥�ι������ǽ�ˤ��뤿�ᡢ�ơ��֥�˥ץ饤�ޥ꡼������������ʤ��ƤϤʤ�ޤ���

Visual Basic with ADO can't handle big integers;  This means that some queries
like @code{SHOW PROCESSLIST} will not work properly.  The fix is to set
add the option @code{OPTION=16834} in the ODBC connect string or set
the @code{Change BIGINT columns to INT} option in the MyODBC connect screen.
@end table

@node ODBC and last_insert_id, MyODBC bug report, MyODBC clients, ODBC
@section @code{AUTO_INCREMENT} �ե�����ɤ��ͤ� ODBC ��������ˡ

���̤�����ϡ�@code{INSERT} �Ǽ�ưŪ�����������ID���ͤ����뤳�ȤǤ���
ODBC�Ǥϡ��ʲ��Τ褦�ˤ��ޤ�( ����� @code{auto} �� @code{AUTO_INCREMENT} �ե�����ɤǤ�)��

@example
INSERT INTO foo (auto,text) VALUES(NULL,'text');
SELECT LAST_INSERT_ID();
@end example

�⤷���ϡ�¾�Υơ��֥��ID��������������ʤ�ʲ��Τ褦�ˤ��ޤ���

@example
INSERT INTO foo (auto,text) VALUES(NULL,'text');
INSERT INTO foo2 (id,text) VALUES(LAST_INSERT_ID(),'text');
@end example

�����Ĥ���ODBC���ץꥱ�������(���ʤ��Ȥ�Delphi��Access)�ϡ�
�������������줿�Ԥ򸫤Ĥ���Τˡ��ʲ��Υ����꤬���ѤǤ��ޤ���
@example
SELECT * FROM tbl_name WHERE auto IS NULL;
@end example

@node MyODBC bug report,  , ODBC and last_insert_id, ODBC
@section Reporting problems with MyODBC

�⤷ @strong{MyODBC} ���ѻ����񤷤�����ˤ����ä���硢
ODBC �ޥ͡�����Υ����ե����� (ODBCADMIN ����ꥯ�����Ȥ����Ȥ��Υ���)
�� @strong{MyODBC} �Υ�������Ϥ��٤��Ǥ���
����Ϥ����ʤ�����ˤ���λ���ˤʤ�Ϥ��Ǥ���
@strong{MyODBC} ��������ˤϡ� @strong{MyODBC} connect/configure ���̤�
 'Trace MyODBC' ���ץ���������å����ޤ���
������ @file{C:\myodbc.log} �˽񤭽Ф���ޤ���
���Υ��ץ�������Ѥ���������ꡢ @code{MYSQL2.DLL} �ǤϤʤ���
 @code{MYSQL.DLL} ����Ѥ��ʤ��ƤϤʤ�ޤ���

MyODBC �� @strong{MySQL} �����С������äƤ��륯������ǧ���ޤ���
����� @file{myodbc.log} �ե�������ˡ�@code{>mysql_real_query} ��
����ʸ���󤬴ޤޤ�Ƥ���ԤǤ���

�ޤ���MyODBC �� @strong{MySQL} �Υ��顼�򸫤Ĥ��뤿��ˤϡ�
Ʊ�����ޥ�ɤ�@code{mysql} ���ޥ�ɤ� @code{admndemo} �Ǥ��٤��Ǥ���

�⤷�������ȯ�������ʤ顢�ط�����Ԥ�ʺ���40�ԡ� @email{myodbc@@lists.mysql.com} ��
���äƤ��������� MyODBC �� ODBC �Υ����ե��������Ƥ�����ʤ��褦��
���Ƥ���������

�⤷����򸫤Ĥ��뤳�Ȥ�����ʤ��ä���硢MyODBC �����ե����롢
ODBC �����ե����롢������������� README �ե������ޤ��
����������(tar �� zip) ��������ޤ���
����� @uref{ftp://www.mysql.com/pub/mysql/secret}. ������ޤ���
TCX �����������åץ����ɤ��줿�ե�����˥��������Ǥ��ޤ���

�⤷����򸫤뤿��Υץ��������äƤ���ʤ顢�����Ʊ��������ޤ���

�⤷���Υץ�����ब¾�� SQL �����С���ư���ʤ顢
¾�� SQL �����С���Ʊ�����Ȥ򤷤����� ODBC �����ե������������٤��Ǥ���

¿���ξ���򤢤ʤ����󶡤���С��桹��������褷�䤹���ʤ뤳�Ȥ�
ǰƬ�ˤ����Ƥ���������

@node Common programs, Problems, ODBC, Top
@chapter �����Ĥ��ΰ���Ū�ʥץ������Ǥ� @code{MySQL} �λ���

@menu
* Apache::                      Apache �Ǥ� MySQL �λ���
@end menu

@node Apache,  , Common programs, Common programs
@section Apache �Ǥ� MySQL �λ���

Contrib �ˤϡ�
@strong{MySQL} �ǡ����١�������Ͽ���Ƥ���桼������
ǧ�ڤ������褦�ˤʤ�ץ������ȡ�
������ @strong{MySQL} �ơ��֥�˽񤭹���ץ�����ब
�ޤޤ�Ƥ��ޤ��� @xref{Contrib}.

�ʲ��Τ褦�� Apache ������ե�����˵��Ҥ���С�
Apache �Υ����Υե����ޥåȤ�@code{MySQL} ���ɤߤ䤹��ʪ���ѹ��Ǥ��ޤ���

@example
LogFormat \
        "\"%h\",%@{%Y%m%d%H%M%S@}t,%>s,\"%b\",\"%@{Content-Type@}o\",  \
        \"%U\",\"%@{Referer@}i\",\"%@{User-Agent@}i\""
@end example

��������С�@strong{MySQL} �ǡ��ʲ��Τ褦�ˤǤ��ޤ���

@example
LOAD DATA INFILE '/local/access_log' INTO TABLE table_name 
FIELDS TERMINATED BY ',' OPTIONALLY ENCLOSED BY '"' ESCAPED BY '\\'
@end example

@node Problems, Common problems, Common programs, Top
@chapter ����Ȥ褯���륨�顼

@menu
* What is crashing::            How to determinate what is causing problems
* Crashing::                    What to do if @strong{MySQL} keeps crashing
* Common errors::               Some common errors when using @strong{MySQL}
* Full disk::                   How @strong{MySQL} handles a full disk
* Multiple sql commands::       How to run SQL commands from a text file
* Temporary files::             Where @strong{MySQL} stores temporary files
* Problems with mysql.sock::    How to protect @file{/tmp/mysql.sock}
* Error Access denied::         @code{Access denied} error
* Changing MySQL user ::        How to run @strong{MySQL} as a normal user
* Resetting permissions::       How to reset a forgotten password.
* File permissions ::           Problems with file permissions
* Not enough file handles::     File not found
* Using DATE::                  Problems using @code{DATE} columns
* Timezone problems::           Timezone problems
* Case sensitivity::            Case sensitivity in searches
* Problems with NULL::          Problems with @code{NULL} values
* Problems with alias::         Problems with @code{alias}
* Deleting from related tables::  Deleting rows from related tables
* No matching rows::            Solving problems with no matching rows
* ALTER TABLE problems::        Problems with @code{ALTER TABLE}.
* Change column order::         How to change the order of columns in a table
@end menu

@menu
* Crashing::                    What to do if @strong{MySQL} keeps crashing
@end menu

@node What is crashing, Crashing, Problems, Problems
@section How to determinate what is causing problems

When you run into problems, the first thing you should do is to find out
which program / piece of equipment is causing problems.

@itemize @bullet
@item
If you have one of the following symptoms, then it is probably a hardware
(like memory, motherboard, CPU, or harddisk) or kernel problem:
@itemize @bullet
@item
The keyboard doesn't work.  This can normally be checked by pressing
Caps Lock;  If the Caps Lock light doesn't change you have to replace
your keyboard.  (Before doing this, you should however try to reboot
your computer and check all cables to the keyboard :)
@item
The mouse pointer doesn't move.
@item
The machine doesn't answer to a remote machine's pings.
@item
Different, unrelated programs don't behave correctly.
@item
If your system rebooted unexpectedly (a faulty user level program should
NEVER be able to take down your system).
@end itemize

In this case you should start by checking all your cables and run some
diagnostic tool to check your hardware!
You should also check if there are any patches, updates or service
packs for your operating system that could likely solve your problems.
Check also that all your libraries (like glibc) are up to date.

It's always good to use a machine with ECC memory to discover
memory problems early!
@item
If your keyboard is locked up, you may be able to fix this by 
logging into your machine from another machine and execute
@code{kbd_mode -a} on it.

@item
Please examine your system log file, (/var/log/messages or similar) for
reasons for your problems.  If you think the problem is in @strong{MySQL}
then you should also examine @strong{MySQL}'s log files. @xref{Update log}.

@item
If you don't think you have hardware problems, you should try to find
out which program is causing problems.

Try using @code{top}, @code{ps}, @code{taskmanager} or some similar program,
to check which program is taking all CPU, or is locking the machine.

@item
Check with @code{top}, @code{df} or a similar programs if you are out of
memory, disk space, open files or some other critical resource.

@item
If the problem is some runaway process, you can always try to kill if. If it
doesn't want to die, this is probably a bug in the operating system.
@end itemize

If after you have examined all other possibilities and you have
concluded that its the @strong{MySQL} server or a @strong{MySQL} client
that is causing the problem, it's time to do a bug report for our
mailing list or our support team.  In the bug report, try to describe
very detailed how the system is behaving and what you think is
happening. You should also state why you think it's @strong{MySQL} that
is causing the problems.  Take in consideration all the situations in
this chapter. State any problems exactly how they appear when you
examine your system.. Use the 'cut and paste' method for any output
and/or error messages from programs and/or log files!

Try to describe very detailed which program is not working and all
symptoms you see!  We have in the past got many bug reports that just
states "the system doesn't work".  This doesn't provide us with any
information of what could be the problem.

If a program fails, it's always useful to know:

@itemize @bullet
@item
Has the program in question made a segmentation fault (core dumped)?
@item
Is the program taking the whole CPU? Check with @code{top}. Let the
program run for a while, it may be evaluating something heavy.
@item
If it's the @code{mysqld} server that is causing problems; Can you
do @code{mysqladmin -u root ping}, or @code{mysqladmin -u root processlist}?
@item
What does a client program say (try with @code{mysql} for example)
when you try to connect to the @strong{MySQL} server?
Does the client jam?  Do you get any output from the program?
@end itemize

When send a bug report, you should of course follow the outlines
described in this manual. @xref{Asking questions}.

@node Crashing, Common errors, What is crashing, Problems
@subsection @strong{MySQL} ������å��夹����˹Ԥ�����

���Ƥ� @strong{MySQL} �С������ϥ�꡼��������¿���Υץ�åȥե������
�ƥ��Ȥ���ޤ��� ����� @strong{MySQL} �ˤ����ʤ�Х���ʤ��Ȥ������Ȥ�
��̣���ޤ�����ȯ������Τ�����ǡ��鷺���ʥХ������뤫�⤷��ޤ���
�⤷���꤬���ä���硢���������ƥ�򥯥�å��夷�Ƥ��뤫�򸫤Ĥ��褦�Ȥ�����ϡ�
������᤯�������뤿��Τ���ɤ�����Ǥ⤢��ޤ���

�ޤ��ǽ��, ��������� @code{mysqld} �ǡ���󤬻�ʤʤ���Фʤ�ʤ����ɤ�����, �ޤ�
�Ϥ������꤬���饤����Ȥǽ������ʤ���Фʤ�ʤ����ɤ�����Ĵ�٤�٤��Ǥ���
@code{mysqladmin version} ��¹Ԥ��뤳�Ȥˤ�ꡢ @code{mysqld} �����С���
�ɤ줰�餤��Ư���Ƥ������狼��ޤ��� �⤷ @code{mysqld} �����Ǥ����ʤ顢
��¹Ԥ��뤳�Ȥˤ�äƤ���Τ�������å����뤳�Ȥ��Ǥ��ޤ�. mysqld�������ʤ顢
���θ����� @file{mysql-data-directory/'hostname'.err} �Ǹ��Ĥ���뤫�⤷��ޤ���

Many crashes of @strong{MySQL} is caused by corrupted index / data
files.  @strong{MySQL} will update the data on disk, with the
@code{write()} system call, after every SQL statement and before the
client is notified about the result (this is not true if you are running
with @code{delayed_key_writes}, in which case only the data is written).
This means that the data is safe even if mysqld crashes as the OS will
ensure that the not flushed data is written to disk.
You can force @strong{MySQL} to sync everything to disk by starting
@code{mysqld} with @code{--flush}.

The above means that normally you shouldn't get corrupted tables unless:

@itemize @bullet
@item
Someone/something killed @code{mysqld} or the machine in the middle
of an update.
@item
You have found a bug in @code{mysqld} that caused it to die in the
middle of an update.
@item
Someone is manipulating the data/index files outside of @strong{mysqld}
without locking the table properly.
@item
If you are running many @code{mysqld} servers on the same data on a
system that doesn't support good file system locks (normally handled by
the @code{lockd} deamon.) or if you are running 
multiple servers with @code{--skip-locking}
@item
You have a crashed index/data file that contains very wrong data that
got mysqld confused.
@item
You have found a bug in the data storage code. This isn't that likely,
but it's at least possible.  In this case you can try to change the file
type to another database handler by using @code{ALTER TABLE} on a
repaired copy of the table!
@end itemize

����������å��夹����ͳ���Τ�Τ������񤷤��Τǡ��ޤ���¾�οͤ�ư����
�Τ����ʤ��ǥ���å��夹��Τ��ɤ���������å����Ƥ������������Τ��Ȥ�Ԥ�
�Ƥ���������

@itemize @bullet
@item
@code{mysqld} �ǡ����� @code{mysqladmin shutdown} ����ߤ�, ���ƤΥơ��֥��
@code{myisamchk --silent --force */*.MYI} ��¹Ԥ��������� @code{mysqld} �ǡ�����
�Ƶ�ư���ޤ�.  ����Ϥ��줤�ʾ��֤��鳫�Ϥ��뤳�Ȥˤʤ�ޤ���
@xref{Maintenance}.

@item
@code{mysqld --log} ����Ѥ��������ξ��󤫤�����Υ����꤬�����С��򥭥뤷�Ƥ��뤫��
���Ĥ��Ф��Ƥ��������� 95% �ΥХ�������Υ�����˴ط�������ޤ���
�̾盧��ϡ� @strong{MySQL} ���Ƶ�ư��������Ρ������ե�����κǸ�Υ�����ΰ�ĤǤ���

����򡢰ʲ��μ��dz�ǧ���뤳�Ȥ����ޤ���

@itemize @bullet
@item
@strong{MySQL} �ǡ����� ( @code{mysqladmin shutdown} ��) ��ߡ�
@item
@strong{MySQL} �ǡ����١����ǥ��쥯�ȥ��Хå����åס�
(As the server is stopped, you can just copy the files to some other
directory)
@item
���ƤΥơ��֥뤬�������Τ���@code{myisamchk -s */*.MYI} �ǥ����å���
�⤷�ơ��֥뤬����Ƥ���褦�ʤ顢
@code{myisamchk -r path-to-table.MYI} �Ǥ��������
You should take the backup
before checking the tables as the problem could be related to corrupted
tables.
@item
�����ե������ @strong{MySQL} �ǡ����ǥ��쥯�ȥ꤫���� (�� ��ư)��
@item
@code{safe_mysqld --log-update} �� @code{safe_mysql --log --log-update} �ǥ����С���ư��
@item
If @code{mysqld} now dies, you have two options:
@itemize @bullet
@item
First take a backup of your backup database. (Just copy the file(s)
somewhere again). This is because we want to keep the original start
situation untouched. Start a mysqld process on the other backup database
(you can do this with option @code{--datadir=/path/to/backup/}).
@item
Just restore the backup on your original database and restart @code{mysqld}.
You will not any lose information, because you have the @code{log-update} file.
@end itemize
@item

Now you can test if the problem is a specific update statement by executing
@code{mysql database_name < path-to-log-update-file}.

You can also use the script @code{mysql_find_rows} to just execute some of the
update statements if you want to narrow down the problem.

If mysqld now crashes, then you have something repeatable
available. Please mail @email{bugs@@lists.mysql.com}, or
@email{developers@@mysql.com}, or (if you are a support customer) to
@email{support@@mysql.com} about the problem and the @strong{MySQL} team
will fix it as soon as possible.
@end itemize

@item
�٥���ޡ������ޤ������� ����� @strong{MySQL} �����ɤ��ƥ��Ȥ���
�������ʤ��Υ��ץꥱ�������򥷥ߥ�졼�Ȥ��륳���ɤ��ɲä��뤳�Ȥ�Ǥ�
�ޤ����٥���ޡ����ϥ��������ۤǤ� @strong{MySQL} ���󥹥ȡ���ǥ��쥯��
���۲��� @file{bench} �ǥ��쥯�ȥ�ˡ��Х��ʥ����ۤǤ� @file{sql-bench} 
�ǥ��쥯�ȥ�˸��Ĥ����ޤ���

@item
@code{fork_test.pl} �� @code{fork2_test.pl} ���ޤ���

@item
���顼���ʤ�����@file{mysql-data-directory/'hostname'.err} �ե�������ǧ���ޤ���

@item
�ǥХå��Ѥ� @strong{MySQL} �򥳥�ե�������ȡ������������ʤ���˥��顼
�򸫤Ĥ��Ф��Τ�����ñ�ˤʤ�ޤ���@code{configure} �� 
@code{--with-debug} ���ץ�����Ĥ��� @strong{MySQL} ��ƥ���ե�������
�ƥ���ѥ��뤷�Ƥ���������@xref{Debugging server}.

@item
�ǥХå��Ѥ� @strong{MySQL} �򥳥�ե�������ȡ������Ĥ��Υ��顼�򸡽Ф�
��������ʥ��������Ƥ�ޤ�ޤ�������ϲ��������Ƥ��뤫�ˤĤ��Ƥ�¿��
�ν��Ϥ��󶡤��ޤ���

@item
���ʤ��� OS �κǿ��Υѥå���Ŭ�Ѥ��ޤ�������

@item
@code{--skip-locking} ���ץ����� @code{mysqld} �˻��Ѥ��Ƥ�����������
���Ĥ��Υ����ƥ��Ǥϡ�@code{lockd} ���å��ޥ͡������������ư���ޤ���;
@code{--skip-locking} ���ץ����� @code{mysqld} �˳������å��󥰤����
���ʤ��褦�������ޤ���(�����Ʊ���ǡ������2�Ĥ� @code{mysqld} �����Ф�
ư�����Ȥ��Ǥ�����@code{myisamchk} �λ��ѻ������դ��ʤ���Ф����ʤ����Ȥ�
��̣���ޤ������������ƥ��ȤȤ��Ƥ��Υ��ץ��������Ȥϻؼ��Ǥ��ޤ���)

@item
@code{mysqld} ��ư���Ƥ���Τ˱������ʤ��褦�˸������� 
@code{mysqladmin -u root processlist} ���ޤ������� ���� 
@code{mysqld} �Ϥ����פ��Ƥ���Ǥ��ޤ�����������Ƥ���³��������Ǥ�
�뤳�Ȥ��������Ĥ����������å����꤬���뤳�ȤǤ���@code{mysqladmin
processlist} ���̾盧���ξ��Ǥ���³���뤳�Ȥ��Ǥ������ߤ���³����
�����ξ��֤ˤĤ��Ƥ�ͭ�Ѥʾ�����󶡤Ǥ��ޤ���

@item
�̤Υ�����ɥ��ǡ����׽��ϤΤ���˥��ޥ�� @code{mysqladmin -i 5 status} 
�򥯥����桢�ԤäƤ���������

@item
�����Ƥ�������:
@enumerate
@item
@code{gdb} (�ޤ���¾�ΥǥХå�) ���� @code{mysqld} �򳫻Ϥ��Ƥ���������

@item
���ʤ��Υƥ��ȥ�����ץȤ�¹Ԥ��Ƥ���������

@item
Print the backtrace and the local variables at the 3 lowest levels. In gdb you
can do this with the following commands when @code{mysqld} has crashed inside
gdb:

@example
backtrace
info local
up
info local
up
info local
@end example

With gdb you can also examine which threads there exists with @code{info
threads} and switch to a specific thread with @code{thread #}, where
@code{#} is the thread id.
@end enumerate

@item
@strong{MySQL} �˥���å���ޤ��ϴְ�ä������񤤤򤵤��뤢�ʤ��Υ��ץ�
���������Υ��ߥ�졼�Ȥ� Perl ������ץȤǻ�ߤƤ���������

@item
�ޤ����̾�ΥХ���ݡ��Ȥ����äƤ���������@xref{Bug reports}���������̾�
���⤵��˾ܺ٤ˤ��Ƥ���������@strong{MySQL} ��¿���οͤΤ����Ư����
���뤿�ᡢ����å���Ϥ��ʤ��Υ���ԥ塼��������¸�ߤ��벿��(�㤨�С���
�ʤ������̤ʥ����ƥ�饤�֥��˴�Ϣ�������顼)���������Ƥ���Ȼפ���
����
@item
�⤷����Ĺ�Υ쥳���ɤ򰷤��ơ��֥�����꤬���ä���硢
�⤷��@code{BLOB/TEXT} �ե�����ɤϻ��Ѥ��Ƥ��餺��@code{VARCHAR} �ե������
�������Ѥ��Ƥ���ʤ顢���Ƥ� @code{VARCHAR} �ե�����ɤ�
 @code{ALTER TABLE} �� @code{CHAR} ���ѹ����ƤߤƤ���������
����� @strong{MySQL} �˸���Ĺ�쥳���ɤ���Ѥ�����褦�ˤ��ޤ���
����Ĺ�쥳���ɤϾ���;ʬ���ΰ��Ȥ�ޤ�������ꥨ�顼���Ф���
�����ʤ�ޤ���

���ߤβ���Ĺ�Υ쥳���ɤΥ����ɤ� TCX �Ǿ��ʤ��Ȥ⣳ǯ�ʾ�����ʤ�
���Ѥ���Ƥ��ޤ��� ����������Ĺ�Υ쥳���ɤϤ�ꥨ�顼�η��������ꡢ
�嵭�λ��������Ȥ��ɤ������ǥ��Ǥ���
@end itemize

@node Common errors, Full disk, Crashing, Problems
@section @strong{MySQL}���ѻ��Τ褯���뤤���Ĥ��Υ��顼

@menu
* Gone away::                   @code{MySQL server has gone away} error
* Can not connect to server::   @code{Can't connect to [local] MySQL server} error
* Blocked host::                @code{Host '...' is blocked} error
* Too many connections::        @code{Too many connections} error
* Out of memory::               @code{Out of memory} error
* Packet too large::            @code{Packet too large} error
* Full table::                  @code{The table is full} error
* Commands out of sync::        @code{Commands out of sync} error in client
* Ignoring user::               @code{Ignoring user} error
* Cannot find table::           @code{Table 'xxx' doesn't exist} error
@end menu

@node Gone away, Can not connect to server, Common errors, Common errors
@subsection @code{MySQL server has gone away} ���顼

������������ @code{Lost connection to server
during query} ���顼�˴ؤ��뤳�Ȥ⥫�С����ޤ���

@code{MySQL server has gone away} ���顼�Τ�äȤ����Ū����ͳ�ϡ�������
�������ॢ���Ȥ���³�򥯥������������ȤǤ����ǥե���ȤǤϡ����ⵯ���ʤ�
��硢�����Ф� 8 ���ָ����³�򥯥��������ޤ���
���λ��֤� mysqld ��ư���� @code{wait_timeout} �ѿ���Ϳ���뤳�Ȥˤ�ꡢ�ѹ��Ǥ��ޤ���

@code{mysqladmin version} ��¹Ԥ��뤳�Ȥ� @strong{MySQL} �����Ǥ��뤫�ɤ�����
�ޤ� uptime �Ϥɤ줰�餤���������å��Ǥ��ޤ���

������ץȤξ��ϡ���ưŪ�˺���³���뤿��˥��饤����Ȥ��饯������ȯ
�Ԥ���ɬ�פ�����ޤ���

���ξ�硢�̾盧���Υ��顼�����ɤ����ޤ�:
(OS ��¸�Ǥ�):

@multitable @columnfractions .3 .7
@item @code{CR_SERVER_GONE_ERROR} @tab ���饤����Ȥ������С����䤤��碌�����뤳�Ȥ��Ǥ��ʤ��ä�
@item @code{CR_SERVER_LOST} @tab  ���饤����Ȥ������С��˽񤭹��ߤ�Ԥä��Ȥ��ˤϥ��顼��̵���ä�����ɤ⡢�䤤��碌���Ф��ƴ����˲������֤äƤ��ʤ�
@end multitable

�ְ�äƤ��뤫�礭�����륯����򥵡��Ф����ä����ˤ⤳�Υ��顼��ȯ����
�ޤ���@code{mysqld} ���ְ�ä��֥��å���������硢���饤����Ȥβ������ְ�ä�
�ȸ��ʤ�����³�򥯥��������ޤ����礭�ʥ����꤬ɬ�פʾ�硢�㤨���礭�� 
@code{BLOB} ��Ư��������ϡ�@code{mysqld} �򥪥ץ���� @code{-O max_query_size=#}
(�ǥե���� 1M) �ǵ�ư���뤳�Ȥǥ��������¤����äǤ��ޤ�����ĥ����
���׵�ˤ�äƳ�����Ƥ��ޤ������Τ��ᡢ@code{mysqld} ���礭�ʥ������ȯ�Ԥ�
�������礭�ʷ�̹Ԥ��֤�ɬ�פΤ����������¿���Υ������Ѥ��ޤ���


@node Can not connect to server, Blocked host, Gone away, Common errors
@subsection @code{Can't connect to [local] MySQL server} ���顼

UNIX ��� @strong{MySQL} ���饤����Ȥ�  @code{mysqld} �����Ф�2�Ĥΰۤʤ���ˡ����³�Ǥ���
��: Unix �����å�, ����ϥե����륷���ƥ��Υե�����(�ǥե���� 
@file{/tmp/mysql.sock})���̤�����³���ޤ����ޤ��� TCP/IP, ����ϥݡ�����
����̤�����³���ޤ���Unix �����åȤ� TCP/IP ����®���Ǥ����������Ф�
Ʊ������ԥ塼��������³����������Ȥ��ޤ���Unix �����åȤϡ��ۥ���̾
����ꤷ�ʤ���礫�����̤ʥۥ���̾ @code{localhost} ����ꤷ�����˻��Ѥ���
�ޤ���

On Windows you can connect only with TCP/IP if the @code{mysqld} server
is running on Win95/Win98. If it's running on NT, you can also connect
with named pipes.  The name of the named pipe is @code{MySQL}.  If you
don't give a hostname when connecting to @code{mysqld}, a @strong{MySQL} client
will first try to connect to the named pipe and if this doesn't work it
will connect to the TCP/IP port.  You can force the use of named pipes
on Windows by using @code{.} as the hostname. 

(2002) @code{Can't connect to ...} ���顼�ϡ��̾@strong{MySQL} �����С���
�����ƥ������äƤ��ʤ��������ʤ������ְ�ä������åȥե������
TCP/IP �ݡ��Ȥ���Ѥ��� @code{mysqld} ����³���褦�Ȥ�����ˤ����ޤ���

Start by check 
�����С���� @code{mysqld} �Ȥ����ץ����������äƤ��뤫 ( @code{ps} ����Ѥ��ơ� Windows �ξ��ϥ������ޥ͡�����Ǥߤ�)
��ǧ���뤳�Ȥ��鳫�Ϥ��Ƥ���������
@xref{Starting server}.

@code{mysqld} �ץ����������äƤ���ʤ顢�㤦��³�����Ȥǥ����С���
��ǧ���뤳�Ȥ��Ǥ��ޤ��ʤ�����󡢥ݡ����ֹ�ȥ����åȤΥѥ��Ϥ��ʤ���
���åȥ��åפ�����ΤȤϰ㤦�Ǥ��礦�ˡ�

@example
shell> mysqladmin version
shell> mysqladmin variables
shell> mysqladmin -h `hostname` version variables
shell> mysqladmin -h `hostname` --port=3306 version
shell> mysqladmin -h 'ip for your host' version
shell> mysqladmin --socket=/tmp/mysql.sock version
@end example

@code{hostname} ���ޥ�ɤϥե���ɥ������ȤǤʤ��Хå������ơ�������
�Ϥ�Ǥ��뤳�Ȥ����դ��Ƥ��������� ����� @code{�ۥ���̾} (�����ȤΥۥ���̾) 
�� @code{mysqladmin} ���ޥ�ɤ�Ϳ���ޤ���

@code{Can't connect to local MySQL server} ���顼�������ꤦ����ͳ�Ȥ��ơ�

@itemize @bullet
@item @code{mysqld} is not running.
@item MIT-pthreads ����Ѥ��륷���ƥ��Ǽ¹Ԥ��Ƥ��롣
�ͥ��ƥ��֥���åɤ�����ʤ������ƥ��Ǽ¹Ԥ��Ƥ����� @code{mysqld} ��  MIT-pthreads �ѥå���������Ѥ��ޤ���
@xref{Which OS}.
MIT-pthreads ����åɤϥ����åȤ򥵥ݡ��Ȥ��ޤ���
���Τ��ᡢ�����Ф���³������Ͼ�˥ۥ���̾��Ϳ����ɬ�פ�����ޤ���
�����С��ؤ���³������å����뤿��ˡ��ʲ����Ƥ���������
@example
shell> mysqladmin -h `hostname` version
@end example

@item ï���� @code{mysqld} �����Ѥ��� unix �����å� �������� (default @file{/tmp/mysqld.sock}).
���줫�� @code{cron} �� @strong{MySQL} �����åȤ������Ƥ��뤫�⤷��ޤ���(�㤨�� @file{/tmp} �ǥ��쥯�ȥ꤫��Ť��ե������������褦�ʥ��������)��
���ĤǤ� @code{mysqladmin version} ��¹Ԥ���
@code{mysqladmin} �����Ѥ��륽���åȤ�������¸�ߤ��뤫������å��Ǥ��ޤ���
���ξ��ν����ϡ�@file{mysqld.sock} ��ä��ʤ��褦�� @code{cron} ���ѹ����뤫���ޤ��ϥ����åȤ�ɤ���¾�ξ��˰ܤ����ȤǤ���

@strong{MySQL} �� ./configure ������˥����åȤ���ꤹ��ˤϰʲ��Τ褦�ˤ��ޤ�:
@example
shell> ./configure --with-unix-socket-path=/path/to/socket
@end example

�ޤ���@code{safe_mysqld} �� @code{--socket=/path/to/socket} ���ץ�������ꤷ�Ƶ�ư���Ƥ⹽���ޤ��󤷡�
@code{MYSQL_UNIX_PORT} �Ķ��ѿ��򥻥åȤ��� @strong{MySQL} ���饤����Ȥ�¹Ԥ��Ƥ⤫�ޤ��ޤ���

@item @code{--socket=/path/to/socket} ���ץ����� @code{mysqld} �����С���ư�Ǥ��ޤ���
�⤷�����С��Υ����åȤΥѥ����Ѥ�����硢@strong{MySQL} ���饤����Ȥˡ��������ѥ��򶵤��ʤ���Фʤ�ޤ���
���ξ�硢 @code{MYSQL_UNIX_PORT} �Ķ��ѿ������ꤹ�뤳�Ȥˤ���ǽ�Ǥ���
�����åȤΥƥ��Ȥ򤹤��硢�ʲ��Τ褦�ˤ��ޤ���

@example
shell> mysqladmin --socket=/path/to/socket version
@end example

@item
Linux ����Ѥ��Ƥ��ƥ���åɤ���Ļ����Ȥ��ʥ�������פ����ˡ�
���ξ�硢¾�� @code{mysqld} ����åɤ򥭥뤷�ʤ���Фʤ�ޤ���
���Ȥ��С�@code{mysql_zap} ������ץȤ򡢿����� @strong{MySQL} �����С���
��ư�������˼¹Ԥ��ޤ��� @xref{Crashing}.
@end itemize

�⤷ @code{Can't connect to MySQL server on some_hostname} ���顼�ξ��,
��������ʤΤ��򸫤Ĥ��뤿��ˡ��ʲ��μ���Ƨ�ߤޤ���

@itemize @bullet
@item 
�⤷ @code{telnet your-host-name tcp-ip-port-number} ��¹Ԥ����
�����С������åפ���ʤ顢 @code{RETURN} �򲿲󤫤������Ƥ���������
�⤷���Υݡ��Ȥ� @strong{MySQL} �����С������äƤ���ʤ顢
���äƤ��� @strong{MySQL} �����С��ΥС������ʥ�С���ޤ��
�쥹�ݥ󥹤�������Ϥ��Ǥ���
�⤷ @code{telnet: Unable to connect to remote host: Connection refused} �Τ褦��
���顼�ˤʤä��ʤ�С����Υݡ��Ȥ���Ѥ��Ƥ��륵���С��Ϥ���ޤ���

@item
��������Υޥ���� @code{mysqld} �ǡ�������³���ƤߤƤ���������
@code{mysqld} �����Ѥ���褦�˻��ꤵ�줿 TCP/IP �ݡ��Ȥ�����å����Ƥ���������
��@code{mysqladmin variables} �������� @code{port} �ѿ���

@item
@code{mysqld} �����С��� @code{--skip-networking} ���ץ����ǵ�ư����Ƥ��ʤ���
��ǧ���Ƥ���������
@end itemize

@node Blocked host, Too many connections, Can not connect to server, Common errors
@subsection @code{Host '...' is blocked} ���顼

�ʲ��Υ��顼�ξ�硧

@example
Host 'hostname' is blocked because of many connection errors.
Unblock with 'mysqladmin flush-hosts'
@end example

����� @code{mysqld} ��¿���� @code{'hostname'} �ۥ��Ȥ������³���顼(@code{max_connect_errors})
�����������ȯ�����ޤ���
���� @code{max_connect_errors} ����ȯ���塢@code{mysqld} �ϲ���(����å����ˤ�륵���С��ؤΥ����å��ʤ�)�������ä���Ƚ�Ǥ������Υۥ��Ȥ������³�򤤤ä������ݤ���褦�ˤ��ޤ���
�����������ˤϡ�@code{mysqladmin flush-hosts} ���ޥ�ɤ�¹Ԥ��ޤ���

�ǥե���ȤǤϡ�10�����³���顼��ȯ���������ˡ�@code{mysqld} �Ϥ��Υۥ��Ȥ���ݤ��ޤ���
�����ͤϰʲ��Τ褦�ˤ��ƴ�ñ���ѹ��Ǥ��ޤ���

@example
shell> safe_mysqld -O max_connect_errors=10000 &
@end example

�⤷���Υ��顼������ۥ��Ȥ��Ф���ȯ������ʤ�С��ޤ��ǽ�ˤ��Υۥ��Ȥ���� TCP/IP ��³���Զ�礬�ʤ��������å����Ƥ���������
�⤷ TCP/IP ��³��ư��Ƥ��ʤ��褦�ʤ顢 @code{max_connect_errors} �ͤ����䤹���ȤϤ褯�ʤ����ȤǤ���

@node Too many connections, Out of memory, Blocked host, Common errors
@subsection @code{Too many connections} ���顼

�⤷ @strong{MySQL} ����³���褦�Ȥ��� @code{Too many connections} �Ȥʤä���硢
����ϴ��� @code{max_connections} ʬ�����饤����Ȥ��� @code{mysqld} �����С��ؤ�
��³���Ԥ��Ƥ��ޤ���

�⤷�ǥե���Ȥ�100����¿����³��ɬ�פȤ���ʤ�С�
@code{max_connections} �ѿ���¿�����ͤ�Ϳ���ơ�@code{mysqld} ��
�ꥹ�����Ȥ��ʤ��ƤϤʤ�ޤ���

�ºݤϡ�@code{mysqld} �� (@code{max_connections}+1) �ĤΥ��饤����Ȥ������³������Ƥ��ޤ���
�Ǹ�Σ��Ĥϡ� @code{process} ���¤��ĥ桼�����Τ���˼�äƤ���ޤ���
By not giving this privilege to normal users (they shouldn't need this), an
administrator with this privilege can login and use @code{SHOW PROCESSLIST}
to find out what could be wrong. @xref{SHOW}.

@node Out of memory, Packet too large, Too many connections, Common errors
@subsection @code{Out of memory} ���顼

�������Ԥäơ����Υ��顼�Τ褦�ʤ�Τ��������:

@example
mysql: Out of memory at line 42, 'malloc.c'
mysql: needed 8136 byte (8k), memory in use: 12481367 bytes (12189k)
ERROR 2008: MySQL client ran out of memory
@end example

���顼�� @strong{MySQL} ���饤����� @code{mysql} �˴ط����뤳�Ȥ����դ��Ƥ�����������
�顼����ͳ��ñ��ǡ����饤����Ȥ�������Τ��Ǽ����Τ˽�ʬ�ʥ�������
�Ƥ��ʤ����ȤǤ���

����������褹��ˤ����ꡢ�ޤ��ǽ�˥����꡼������������ǧ���Ƥ���������
���Υ����꡼�����̤η�̤��֤���ΤǤ��礦����
�⤷�����ʤ顢@code{mysql --quick} ����Ѥ��Ƥ���������
����Ϸ�̤���Ф������ @code{mysql_use_result()} ����Ѥ��ޤ���
����ϥ��饤����ȤΥ�������­���䤤�ޤ�(�����С����¿���ΰ�ϼ��ޤ���)��

@node Packet too large, Full table, Out of memory, Common errors
@subsection @code{Packet too large} ���顼

@strong{MySQL} ���饤����Ȥ� @code{max_allowed_packet} �����礭�ʥ֥��å��� @code{mysqld} �����С�������������@code{Packet too large} ���顼��ȯ���ޤ���

@code{mysql} ���饤����Ȥ���Ѥ����硢@code{mysql --set-variable=max_allowed_packet=8M}
 �ǥ��饤����Ȥ򳫻Ϥ��뤳�Ȥǡ��Хåե����礭������Ǥ��ޤ���

�⤷(@code{DBI} �Τ褦��)����ѥ��åȥ����������Ǥ��ʤ����饤����Ȥ���Ѥ��Ƥ����硢
�ѥ��åȥ���������ꤷ�ƥ����С���Ω���夲ľ���ޤ���
����� @code{mysqld} �Υ��ץ����� @code{max_allowed_packet} ���礭���ͤ����ꤹ�뤳�ȤǹԤ��ޤ���
�㤨�С� @code{BLOB} ���ε����ϰϤ��äѤ��Υǡ�����ơ��֥��������硢
@code{--set-variable=max_allowed_packet=24M} ���ץ�������ꤷ�ƥ����С���ư����ɬ�פ�����ޤ���

@cindex The table is full
@node Full table, Commands out of sync, Packet too large, Common errors
@subsection @code{The table is full} ���顼

���Υ��顼�ϡ��Ť� @strong{MySQL} �С������ˤ����ơ�
���������ơ��֥뤬 @code{tmp_table_size} �����礭���ʤ�
������ȯ�����ޤ��������������򤹤뤿��ˡ�@code{mysqld} �Υ��ץ���� @code{-O
tmp_table_size=#} �����á��ޤ��ϡ�SQL ���ץ���� @code{SQL_BIG_TABLES} 
������Υ���������˻��ѤǤ��ޤ���@xref{SET OPTION, , @code{SET OPTION}}.

@code{mysqld} �� @code{--big-tables} ���ץ������ꤷ�Ƶ�ư���ޤ���
��������ƤΥ����꡼���Ф��� @code{SQL_BIG_TABLES} ����Ѥ���Τ�Ʊ���Ǥ���

In @strong{MySQL} 3.23 in-memory temporary tables will automaticly be
converted to a disk based @code{MyISAM} table after the table size gets
bigger than @code{tmp_table_size}.

@cindex Commands out of sync
@node Commands out of sync, Ignoring user, Full table, Common errors
@subsection @code{Commands out of sync} error in client

@code{Commands out of sync; You can't run this command now} �򥯥饤����
�ȥ��������������硢���饤����ȴؿ���ְ�ä����֤ǸƤӽФ��ޤ�����

������㤨�С�@code{mysql_use_result()} ����Ѥ��Ƥ��ơ�@code{mysql_free_result()}
��Ԥ����˿�����������μ¹Ԥ��ߤ�����ȯ�����ޤ�������Ϥޤ����ǡ���
���֤����ĤΥ�����μ¹Ԥ򡢴֤� @code{mysql_use_result()} �� 
@code{mysql_store_result()} ̵���ǻ�ߤ����ˤ�ȯ�����ޤ���


@node Ignoring user, Cannot find table, Commands out of sync, Common errors
@subsection @code{Ignoring user} ���顼

�ʲ��Υ��顼�ξ�硧

@code{Found wrong password for user: 'some_user@@some_host'; Ignoring user}

����� @code{mysqld} �γ��Ϥޤ��� 'reload' ���� @code{user} �ơ��֥�����������ѥ��
�ɤ�����ʤ�����ȥ�򸫤Ĥ������Ȥ��̣���ޤ���
�����ñ�˥���ȥ꤬���ĥ����ƥ�˵��ݤ���Ƥ�������Ǥ���

���������뤳�ȤȤ��β��:

@itemize @bullet
@item
�������С������� @code{mysqld} �򡢸Ť��С�������Ѥ� @code{user} �ơ��֥�����餻�Ƥ���Τ��⤷��ޤ���
@code{mysqlshow mysql user} ��Ԥ����Ȥˤ�äƤ���򸡾ڤǤ��ޤ���
�ѥ���ɥե�����ɤ� 16 ʸ������û�����ɤ���������å����Ƥ���������
�⤷�����ʤ顢����������뤿��ˡ�@code{scripts/add_long_password} ������ץȤ�¹Ԥ��Ƥ���������

@item
�桼�������Ť��ѥ����(����8ʸ��) ����Ѥ��Ƥ��ơ�@code{mysqld} �� @code{--old-protocol} ���ץ����ǵ�ư���Ƥ��ʤ��Τ��⤷��ޤ���
�������ѥ���ɤ� @code{user} �ơ��֥���Υ桼���򹹿����뤫��@code{--old-protocol}
�դ��� @code{mysqld} ��Ƶ�ư���Ƥ���������

@item
@findex PASSWORD()
@code{user} �ơ��֥�Υѥ���ɤ�@code{PASSWORD()} �ؿ�����Ѥ��ʤ�����Ͽ�����Τ��⤷��ޤ���
���ξ�硢@code{user} �ơ��֥�Υѥ���ɤ�@code{mysql} ����Ѥ��ƹ������ޤ���
@code{PASSWORD()} �ؿ��ϰʲ��Τ褦�ˤ��ƻ��Ѥ��ޤ���

@example
mysql> update user set password=PASSWORD('your password')
           where user='XXX';
@end example
@end itemize

@node Cannot find table,  , Ignoring user, Common errors
@subsection @code{Table 'xxx' doesn't exist} error

�⤷ @code{Table 'xxx' doesn't exist} �� @code{Can't find file: 'xxx' (errno: 2)}
 ���顼���Ф���硢���Ѥ��Ƥ���ǡ����١�����  @code{xxx} �Ȥ���̾���Υơ��֥뤬
���դ���ʤ��ä����Ȥ򼨤��ޤ�

�ǡ����١����ȥơ��֥����¸�ˡ�@strong{MySQL} �ϥǥ��쥯�ȥ�ȥե��������Ѥ���
�ǡ����١����ȥơ��֥��̾����@strong{��������¸}�Ǥ�!
(Win32 �Ǥϥǡ����١����ȥơ��֥�̾�ϥ��������¸�Ǥ���
��������Υơ��֥���Ф����䤤��碌�����ơ�Ʊ���������ǽ񤫤ʤ��ƤϤʤ�ޤ���)

@code{SHOW TABLES} ����Ѥ��ƥǡ����١����Υơ��֥���ǧ�Ǥ��ޤ�. @xref{SHOW, , @code{SHOW}}.

@cindex Full disk
@cindex Disk full
@node Full disk, Multiple sql commands, Common errors, Problems
@section @strong{MySQL} �ϥե�ǥ�������ɤΤ褦�˰�������

@noindent
�ǥ������ե뤬��������� @strong{MySQL} �ϼ��Τ��Ȥ�Ԥ��ޤ�:

@itemize @bullet
@item
���ߤιԤ�񤯤Τ˽�ʬ���ΰ褬���뤫�ɤ�����1ʬ���1������å����ޤ�����
ʬ�ʥǥ�������������ϡ����ⵯ���ʤ��ä��褦�˷�³���ޤ���
@item
6ʬ��˥����ե�����˥ǥ������ե��ٹ𤹤륨��ȥ��񤭽Ф��ޤ���
@end itemize

@noindent
��������ξ�硢�ʲ��Τ褦�ˤ��ޤ���

@itemize @bullet
@item
��³���뤿��ˤϡ����ƤΥ쥳���ɤ���������Τ˽�ʬ���ΰ���������ɬ�פ�
����ޤ���
@item
����åɤ򥢥ܡ��Ȥ��뤿��ˤϡ�@code{mysqladmin kill} �򥹥�åɤ�����
ɬ�פ�����ޤ�������åɤϼ���(1ʬ)�ǥ�����������å��������˥��ܡ��Ȥ�
�ޤ���
@item
¾�Υ���åɤ� ``disk full'' ��ȯ�������ơ��֥���Ԥ�����뤳�Ȥ����դ���
����������¿���� ``locked'' ����åɤ������硢disk full ���Ԥİ�ĤΥ����
�ɤ� kill ���뤳�Ȥǡ�¾�Υ���åɤη�³������ޤ���
@end itemize


@node Multiple sql commands, Temporary files, Full disk, Problems
@section �ƥ����ȥե����뤫�� SQL ���ޥ�ɤ�¹�

@code{mysql} ���饤����Ȥϰʲ��Τ褦�ˤ�������Ū�˻��Ѥ��ޤ���

@example
shell> mysql database
@end example

������ SQL ���ޥ�ɤ�ե�����˽񤤤Ƥ���������� @code{mysql} ���ɤ߹��ޤ��뤳�Ȥ��Ǥ��ޤ���
�ƥ����ȥե����� @file{text_file} �˼¹Ԥ��������ޥ�ɤ�񤤤Ƥ�����
�ʲ��Τ褦�ˤ��� @code{mysql} ��ư���ޤ���

@example
shell> mysql database < text_file
@end example

�ƥ����ȥե��������Ƭ�� @code{USE db_name} ��ʸ��񤯤��Ȥ�Ǥ��ޤ���
���ξ�硢�ǡ����١���̾�򥳥ޥ�ɥ饤���Ϳ����ɬ�פ�̵�����ʲ��Τ褦�ˤǤ��ޤ���

@example
shell> mysql < text_file
@end example

@xref{Programs}.


@node Temporary files, Problems with mysql.sock, Multiple sql commands, Problems
@section @strong{MySQL} ������ե�������Ǽ������

@strong{MySQL} �ϰ���ե�������Ǽ������Ȥ��� @code{TMPDIR} �Ķ��ѿ����ͤ�
���Ѥ��ޤ���@code{TMPDIR} �����ꤷ�Ƥ��ʤ���С�@strong{MySQL} �ϥ����ƥ�Υǥե�
��Ȥ���Ѥ��ޤ����̾�� @file{/tmp} �ޤ��� @file{/usr/tmp} �Ǥ���@code{TMPDIR} ������
�������硢@code{safe_mysqld} ���Խ����ơ���ʬ���ΰ褬����¾�Υǥ��쥯�ȥ���
���褦�� @code{TMPDIR} �����ꤹ�٤��Ǥ���
@code{--tmpdir} ���ץ����� @code{mysqld} ��Ϳ���뤳�Ȥǡ�����ե�����ǥ��쥯�ȥ����ꤹ�뤳�Ȥ��ǽ�Ǥ���

@strong{MySQL} �����Ƥΰ���ե������ ``�����ե�����'' �Ȥ����������ޤ���
����� @code{mysqld} ����λ�������ˡ�����ե����뤬�������ʤ����Ȥ�μ¤ˤ�
�ޤ��������ե��������Ѥ��� '����' ¦�̤ϡ��������������ǥ����������
�ˤ����礭�ʰ���ե�����򸫤Ĥ����ʤ����ȤǤ���

�����Ȼ� (@code{ORDER BY} �ޤ��� @code{GROUP BY})��@strong{MySQL} ���̾��Ĥޤ������
�ΰ���ե��������Ѥ��ޤ���ɬ�פʺ���Υǥ��������̤�:

@example
(length of what is sorted + sizeof(database pointer))
* number of matched rows
* 2
@end example

@code{sizeof(database_pointer)} ���̾�Ǥ����������������礭�ʥơ��֥�
�Τ�����礭���ʤ뤳�Ȥ⤢��ޤ���

�����Ĥ��� @code{SELECT} ������ϰ��Ū�� SQL �ơ��֥���������ޤ��������ϱ�
���ե�����ǤϤʤ���@file{SQL_*} �Ȥ���̾���Ǥ���

@code{ALTER TABLE} , @code{OPTIMIZE TABLE} �ϰ���ơ��֥�򥪥ꥸ�ʥ�ơ��֥��Ʊ���ǥ��쥯�ȥ�
����������ޤ���


@node  Problems with mysql.sock, Error Access denied, Temporary files, Problems
@section @file{/tmp/mysql.sock} ������������ˡ

�⤷ï���� @strong{MySQL} �Υ����åȥե����� @file{/tmp/mysql.sock} ���ä����ʤ顢
�ۤȤ�ɤ� Unix �������Ǥ���褦�ˡ� @file{/tmp} �� @code{sticky} �ӥåȤ򤿤Ƥ��ݸ�ޤ���
@code{root} �ǥ������󤷤ơ��ʲ��Τ褦�ˤ��ޤ���

@example
shell> chmod +t /tmp
@end example

����ϥե�����Υ����ʡ��ȥ����ѡ��桼����(@code{root}) �Τߤ���
 @file{/tmp} �Υե������ä����Ȥ��Ǥ��ޤ���

@code{sticky} �ӥåȤ�Ω�äƤ��뤫��ǧ����ˤϡ� @code{ls -ld /tmp} ��Ԥ��ޤ���
�ѡ��ߥå����κǸ�ΥӥåȤ� @code{t} �ʤ�С����åȤ���Ƥ��ޤ���

@node Error Access denied, Changing MySQL user , Problems with mysql.sock, Problems
@section @code{Access denied} ���顼

@xref{Privileges}.��@xref{Access denied}.


@node Changing MySQL user , Resetting permissions, Error Access denied, Problems
@section ���̥桼���� @strong{MySQL} ��ư������ˡ

@code{mysqld} (@strong{MySQL} ������) ��ï�ǤⳫ�Ϥ��¹Ԥ��뤳�Ȥ��Ǥ��ޤ���
@code{mysqld} ��桼�� @code{user_name} �Ǽ¹Ԥ���褦���ѹ����뤿��ˤϡ�����Ԥʤ�ɬ�פ�
����ޤ�:

@enumerate
@item
�����С���ߤ�ޤ� (use @code{mysqladmin shutdown}).

@item
@code{user_name} ���ɤ߽񤭤Ǥ���褦�ˡ��ǡ����١����ǥ��쥯�ȥ�Ȥ�����Υե�����Υѡ��ߥå������ѹ����ޤ���(����� Unix @code{root} �桼�����Ǽ¹Ԥ���ɬ�פ�����Ǥ��礦)��

@example
shell> chown -R user_name /path/to/mysql/datadir
@end example

@strong{MySQL} �ǡ����١����ǥ��쥯�ȥ�Υǥ��쥯�ȥ꡼��ե����뤬����ܥ�å���󥯤ξ�硢
������󥯤���Υǥ��쥯�ȥ�ȥե�������ѹ����ޤ���@code{chown -R} �ϥ���ܥ�å��������ѹ����Ƥ���ޤ���

@item
�桼�� @code{user_name} �ǥ����Ф�ư���ޤ����ޤ��� @strong{MySQL} 3.22 �ʹߤ���Ѥ���
���ϡ�@code{mysqld} �� Unix @code{root} �ǵ�ư�� @code{--user=user_name} �����å�����Ѥ��ޤ���
@code{mysqld} �ϡ���³����Ĥ������ˡ�Ϳ����줿 Unix user @code{user_name} �Ǽ¹Ԥ���褦���ڤ��ؤ��ޤ���

@item
�����ƥ�Ƶ�ư���� @code{mysql.server} ����Ѥ��� @code{mysqld} ��ư�����硢�桼�� 
@code{user_name} �ؤ� @code{su} ��Ԥʤ��褦�ˤޤ��� @code{--user} �����å�����Ѥ��� @code{mysqld} ��ư����褦�� @code{mysql.server} �� �ѹ����٤��Ǥ���
(No changes to @code{safe_mysqld} are necessary.)
@end enumerate

���λ����ǡ����ʤ��� @code{mysqld} �ץ������� Unix user @code{user_name} �������ư��ޤ���

��ĤΤ��Ȥ��Ѥ��ޤ��󡣤���ϸ��µ��ĥơ��֥�Ǥ����ǥե���� 
(�ѡ��ߥå����ơ��֥륤�󥹥ȡ��륹����ץ�@code{mysql_install_db}�¹Ը�θ���) �Ǥϡ�@code{mysql}�ǡ����١����ؤΥ���������ǡ����١����κ������˴��ϥ桼�� @strong{MySQL} user @code{root} �����Ǥ���
������ѹ����ʤ��ȡ�����Ϥ��ΤޤޤǤ���
@code{root} �ʳ���Unix user�ǥ������󤷤Ƥ�����Ǥ⡢���ʤ��� 
@strong{MySQL} @code{root} user �Ȥ��ƥ��������ϲ�ǽ�Ǥ� - �����ץ������� @code{-u root} �򥯥饤����ȥץ������˥��ץ������ꤹ������Ǥ���

@strong{MySQL} �� @code{root} �Ȥ��ƥ�����������ˤϡ�
���ޥ�ɥ饤��� @code{-u root} ����Ѥ�������Ǥ������Ȥ����դ��Ƥ���������
Unix @code{root} user �� @strong{MySQL} �����餻�Ƥ��� Unix �桼�����Ǥ���ɬ�פ�@emph{�ʤ�}���Ȥ����դ��Ƥ���������
@strong{MySQL} �Υ��������ѡ��ߥå�����@strong{MySQL} �Υ桼���ϡ�
UNIX �桼���Ȥϴ������̤Τ�ΤǤ���UNIX �桼���˴ط�����Τϡ����饤����
�Ȥ� @code{-u} ���ץ�������Ѥ��ʤ��������Ǥ������ξ�硢���饤����Ȥ�
@strong{MySQL} �ؤΥ�������򡢤��ʤ��� UNIX ��������̾�ǻ�ߤޤ���

���ʤ��� UNIX �ޥ��󤽤켫�Ȥ������Ǥʤ����ϡ����ʤ��Ȥ� @strong{MySQL} ��
�������ơ��֥�� @strong{MySQL} @code{root} �桼���ˤϥѥ���ɤ����ꤹ�٤��Ǥ���
�ɤ�����ï���� @code{mysql -u root db_name} ��Ԥʤ����ब˾�ळ�Ȥ����Ƥ�¹ԤǤ��Ƥ��ޤ�����Ǥ���


@node Resetting permissions, File permissions , Changing MySQL user , Problems
@section ˺�줿�ѥ���ɤ�ꥻ�åȤ���

�⤷ @strong{MySQL} �� @code{root} �桼�����Υѥ���ɤ�˺�줿��硢
�����ʲ��Τ褦�ˤ�������ľ�����Ȥ���ǽ�Ǥ���

@enumerate
@item
@code{mysqld} �����С��� @code{kill} ����Ȥ���
(@code{kill -9} �ǤϤ���ޤ���)
PID �ֹ���̾� @strong{MySQL} �ǡ����ǥ��쥯�ȥ�� @code{.pid} �ե�����Ȥ���
�񤫤�Ƥ��ޤ���

@example
kill `cat /mysql-data-directory/hostname.pid`
@end example
 
����� UNIX @code{root} �桼��������@strong{MySQL} �����С���¹Ԥ���
�桼�����ǹԤ��ޤ���
 
@item
@code{mysqld} �� @code{--skip-grant-tables} ���ץ����ǵ�ư��

@item
@code{mysql -h hostname mysql} ��@code{mysqld} �����С�����³����
@code{GRANT} ���ޥ�ɤǥѥ���ɤ��ѹ����ޤ��� @xref{GRANT,,@code{GRANT}}.
@code{mysqladmin -h hostname -u user password 'new password'} 
�Ǥ��ѹ���ǽ�Ǥ���

@item
���ĥơ��֥���ɤ߹��ߤޤ���
@code{mysqladmin -h hostname flush-privileges} ����SQL ʸ��
@code{FLUSH PRIVILEGES} ��¹Ԥ��ޤ���
@end enumerate


@node File permissions , Not enough file handles, Resetting permissions, Problems
@section �ե�����ѡ��ߥå���������

�ե�����ѡ��ߥå��������꤬�����硢
�㤨�С��ơ��֥���������� @code{mysql} ��������Ϥ�����:

@example
ERROR: Can't find file: 'path/with/filename.frm' (Errcode: 13)
@end example

@tindex UMASK environment variable
@tindex Environment variable, UMASK
����� @code{UMASK} �Ķ��ѿ��� @code{mysqld} ��ư���˴ְ�äƥ��åȤ���Ƥ���ȹͤ����ޤ���
�ǥե���Ȥ� umask �� @code{0660} �Ǥ�. 
����ϰʲ��Τ褦�ˤ��� @code{safe_mysqld} Ω���夲�����ѹ��Ǥ��ޤ�:

@example
shell> UMASK=384  # = 600 in octal
shell> export UMASK
shell> /path/to/safe_mysqld &
@end example

@tindex UMASK_DIR environment variable
@tindex Environment variable, UMASK_DIR
By default @strong{MySQL} will create database and @code{RAID}
directories with permission type 0700.  You can modify this behaviour by
setting the the @code{UMASK_DIR} variable. If you set this, new
directories are created with the combined @code{UMASK} and
@code{UMASK_DIR}. For example, if you want to give group access to
all new directories, you can do:

@example
shell> UMASK_DIR=504  # = 770 in octal
shell> export UMASK_DIR
shell> /path/to/safe_mysqld &
@end example

@xref{Environment variables}.

@node Not enough file handles, Using DATE, File permissions , Problems
@section File not found

@code{ERROR '...' not found (Errcode: 23)}, @code{Can't open file: ... (errno: 24)}
 �� @code{errcode 23} @code{errno 24} �Υ��顼�� @strong{MySQL} ����������硢
����� @strong{MySQL} �˽�ʬ�ʥե����뵭�һҤ�������Ƥ��ʤ��ä����Ȥ��̣���ޤ���
@code{perror #} �Ϥ�����ɤߤ䤹�������Υ��顼��å�������Ϳ���ޤ�:

@example
shell> perror 23
File table overflow
shell> perror 24
Too many open files
@end example

����� @code{mysqld} ��¿���Υե�����򳫤����Ȥ������Ȥ˵������ޤ���
@code{mysqld} �˰��٤˳����ե��������¿�������ʤ��褦�����ꡢ���뤤�ϡ�
@code{mysqld} ��������ե����뵭�һҤο���Ϳ������Ǥ��ޤ���

@code{mysqld} �����٤˳����ե�����ο��򾯤ʤ�����ˤϡ�@code{-O table_cache=32} ���ץ����(�ǥե���Ȥ�64)�� @code{safe_mysqld} ��Ϳ���뤳�ȤDz�ǽ�Ǥ���
�ޤ���@code{max_connections} ����(�ǥե���Ȥ�90)�򾯤ʤ�����ʤ�С������ե�������⾯�ʤ��Ǥ��ޤ���

@tindex ulimit
@code{mysqld} ����갷����ե����뵭�һҤο����ѹ�����ˤϡ� @code{safe_mysqld} ���Խ����ޤ���
������� @code{ulimit -n 256} �������ȥ����Ȥ���Ƥ��ޤ���
���Υ����Ȥ�Ϥ���(@code{'#'}ʸ����ä�)��256 �� @code{mysqld} �����������ѹ����Ƥ���������

@code{ulimit} �ϥ��ڥ졼�ƥ��󥰥����ƥ��������Ǥ����ե����뵭�һҤο������Ǥ��ޤ���
�⤷ OS �����°ʾ�˥ե����뵭�һҤΥ����ץ�������䤷������硢
���Ȥ��Υ��ڥ졼�ƥ��󥰥����ƥ�Υɥ�����Ȥ򸫤��н褷�Ƥ���������

@code{tcsh} ����Ѥ��Ƥ������ @code{ulimit} ��ư���ʤ����Ȥ����դ��Ƥ���������
@code{tcsh} �ϸ��ߤ����¤򤢤ʤ����䤤��碌�Ƥ⡢��ä��ͤ���𤹤�Ǥ��礦��
���ξ�硢@code{safe_mysqld} �� @code{sh} �ǵ�ư���٤��Ǥ���


@node Using DATE, Timezone problems, Not enough file handles, Problems
@section @code{DATE} �ե�����ɻ��ѻ�������

���� @code{DATE} �η����� @code{'YYYY-MM-DD'} �Ǥ���ANSI SQL �˽��äƼºݤˤ�¾�Τϵ������
���󡣹����ޤ��� @code{SELECT} ʸ��� WHERE ����ǤϤ��η�������Ѥ��٤��Ǥ������ʤ��:

@example
mysql> SELECT * FROM tbl_name WHERE date >= '1997-05-05';
@end example

���ؤΤ��� @strong{MySQL} �ϡ����դ����ͤ�ʸ̮�ǻ��Ѥ����ȡ����դ�ưŪ�˿�
�ͤ��Ѵ����ޤ�������ˤ�ꡢ������ @code{TIMESTAMP}, @code{DATE} �ޤ��� 
@code{DATETIME} �ե�����ɤǤ� @code{WHERE} ���ˡ����ȼ�ͳ�����դ���ꤹ�뤳�Ȥ��Ǥ��ޤ���
(���ε��Ҥ�������ᡢ���ɵ�������դΥ��ѥ졼�����Ȥ��ƻ��Ѥ��ޤ���
�㤨�С�@code{'1998-08-15'} �� @code{'1998#08#15'} ��Ʊ��Ǥ�.)
�⤷���󥻥ѥ졼�����Τʤ�����(�㡧@code{'19980815'})�����դȤ����Ѵ����Ƥ���ޤ���

���̤����� @code{'0000-00-00'} �� @code{'0000-00-00'} �Ȥ��Ƴ�Ǽ������Ф���ޤ���
@strong{MyODBC} ���̤��� @code{'0000-00-00'} ���դ���Ѥ������@strong{MyODBC} 2.50.12 �ʾ�Ǥϼ�
ưŪ�� @code{NULL} ���Ѵ�����ޤ���ODBC �Ϥ������դμ���򰷤��ʤ�����Ǥ���

����ϼ���ư�����Ȥ��̣���ޤ�:

@example
mysql> INSERT INTO tbl_name (idate) VALUES (19970505);
mysql> INSERT INTO tbl_name (idate) VALUES ('19970505');
mysql> INSERT INTO tbl_name (idate) VALUES ('97-05-05');
mysql> INSERT INTO tbl_name (idate) VALUES ('1997.05.05');
mysql> INSERT INTO tbl_name (idate) VALUES ('1997 05 05');
mysql> INSERT INTO tbl_name (idate) VALUES ('0000-00-00');

mysql> SELECT idate FROM tbl_name WHERE idate >= '1997-05-05';
mysql> SELECT idate FROM tbl_name WHERE idate >= 19970505;
mysql> SELECT mod(idate,100) FROM tbl_name WHERE idate >= 19970505;
mysql> SELECT idate FROM tbl_name WHERE idate >= '19970505';
@end example

@noindent
����ư���ޤ���:

@example
mysql> SELECT idate FROM tbl_name WHERE STRCMP(idate,'19970505')=0;
@end example

@code{STRCMP()} ��ʸ����ؿ��ǡ�@code{idate} ��ʸ�����Ѵ����ơ�ʸ����Ӥ�Ԥ��ޤ���
@code{'19970505'} �����դˤ��Ѵ����Ƥ��줺�����դ���Ӥ�Ԥ��ޤ���

@strong{MySQL} �����դ����������ɤ���������å����ʤ����Ȥ����դ��Ƥ���
�������ְ�ä�����(�㤨�� @code{'1998-2-31'})���Ǽ����ȡ����δְ�ä����դ���Ǽ
����ޤ������դ�����Ū���Բ�ǽ�ʾ�硢@code{0} �� @code{DATE} �ե�����ɤ˳�Ǽ����ޤ���
����ϼ��®�٤�����ǡ����դΥ����å��ϥ����ФǤϤʤ����ץꥱ�������ǤȲ桹
�Ϲͤ��Ƥ��ޤ���

@cindex Timezone problems
@tindex TZ environment variable
@tindex Environment variable, TZ
@node Timezone problems, Case sensitivity, Using DATE, Problems
@section Timezone problems

�⤷ @code{SELECT NOW()} �����ʤ��Υ���������֤ǤϤʤ� GMT ���֤��ʤ顢
 @code{TZ} �Ķ��ѿ�����������Timezone �����ꤷ�ʤ��ƤϤʤ�ޤ���
�Ķ��ѿ�������ϡ������С���¹Ԥ������˹Ԥ��ʤ��ƤϤʤ�ޤ���
���Ȥ��С�@code{safe_mysqld} �� @code{mysql.server} ������ץȤ�
�Ԥ��ޤ���


@cindex Case sensitivity, in searches
@cindex Chinese
@cindex Big5 Chinese character encoding
@node Case sensitivity, Problems with NULL, Timezone problems, Problems
@section �������Υ�������¸

�ǥե���ȤǤ� @strong{MySQL} �ե�����ɤϥ��������¸�Ǥ� (�����������������
¸�ˤʤ�ʤ������Ĥ���ʸ�����åȤϤ���ޤ�such as @code{czech})��
����ϡ�@code{col_name LIKE 'a%'}
�Ǹ���������硢@code{A} �ޤ��� @code{a} �ǻϤޤ����ƤΥե�����ɤ����뤳�Ȥ�
��̣���ޤ��������򥱡�����¸�ˤ������Τʤ顢�Ϥޤ������å�����ˤ�
@code{INDEX(column, "A")=0} �Τ褦�ʤ��Ȥ򡢤ޤ���ʸ�������Τ�Ʊ�����ɤ�
���ˤ� @code{STRCMP(column, "A") = 0} ����Ѥ��Ƥ���������

ñ��������� @code{>=, >, =, <, <=}�������Ȥ����ƥ��롼�ײ��ϡ�ʸ�� ``sort value''
��ǹԤ��ޤ���Ʊ���������ͤ�ʸ�� (like E, e and @'e)��Ʊ��ʸ����
���ư����ޤ���

@code{LIKE} ��Ӥϳ�ʸ������ʸ���ǹԤ��ޤ�
(E == e but E <> @'e)

@code{column} �򤤤ĤǤ⥱������¸�ǰ����������ϡ������ @code{BINARY} 
�Ȥ���������Ƥ���������@xref{CREATE TABLE, , @code{CREATE TABLE}}.

big5 ���󥳡��ǥ��󥰤ȸƤФ������ǡ�������Ѥ��Ƥ�����ϡ����Ƥ�
ʸ�����ܤ� @code{BINARY} �ˤ��Ƥ�������������ϡ�big5 ���󥳡��ǥ���ʸ
���Υ����Ƚ礬 ascii �����ɤ���ˤʤäƤ��뤿�ᡢ��ǽ���ޤ���


@cindex NULL values vs. empty values
@tindex NULL
@node Problems with NULL, Problems with alias, Case sensitivity, Problems
@section @code{NULL} �ͤǤ�����

SQL �ν鿴�ԤΤ��꤬���ʺ���ϡ�@code{NULL} �ͤ���ʸ����  @code{''} ��Ʊ��ʪ���ȹͤ��뤳
�ȤǤ������������������ޤ��� �㤨�С����Υ��ơ��ȥ��Ȥ������̤Τ�
�ΤǤ�:

@example
mysql> INSERT INTO my_table (phone) VALUES (NULL);
mysql> INSERT INTO my_table (phone) VALUES ("");
@end example

ξ����ʸ�Ȥ� @code{phone} �ե�����ɤ��ͤ��������Ƥ��ޤ�����
���Τ� @code{NULL} �ͤ��������������ܤΤ϶�ʸ������������Ƥ��ޤ���
���Τ� ``�����ֹ���Τ�ʤ�'' �ȸ��ʤ��졢�����ܤΤ� ``��������ä�
���äƤ��ʤ�'' �ȸ��ʤ���ޤ���

SQL �Ǥϡ�  @code{NULL} ��¾�����Ƥ���(���Ȥ�  @code{NULL} �Ǥ�)����Ӥ������ˡ���˵���
�ʤ��ͤǤ��� @code{NULL} ��ޤ༰�ϡ��ä��Ǥ꤬�ʤ���С����  @code{NULL} �ͤ���������
�������ι��ܤ�����  @code{NULL} ���֤��ޤ�:

@example
mysql> SELECT NULL,1+NULL,CONCAT('Invisible',NULL);
@end example

@code{NULL} �ͤ����åȤ���Ƥ�����ܤ򸡺������硢
 @code{=NULL} �ƥ��Ȥ�Ԥ�ʤ��Ǥ���������
����� @code{expr = NULL} �� FALSE �ʤΤǡ��ʤ�ιԤ��֤��ޤ���
�㤨�аʲ����㡧

@example
mysql> SELECT * FROM my_table WHERE phone = NULL;
@end example

@code{NULL} �ͤ���ĥե�����ɤ򸡺����������ϡ�@code{IS NULL} �ƥ��Ȥ���Ѥ��ʤ��ƤϤ�����
���󡣼��� @code{NULL} �����ֹ�ȶ��������ֹ�򸫤Ĥ�����ˡ�򼨤��Ƥ��ޤ�:

@example
mysql> SELECT * FROM my_table WHERE phone IS NULL;
mysql> SELECT * FROM my_table WHERE phone = "";
@end example

@strong{MySQL} �Ǥϡ�¾��¿���� SQL �����ФΤ褦�ˡ�@code{NULL} �ͤ����
����ǥå����ե�����ɤ���Ƥޤ��󡣤����Υե�����ɤ� @code{NOT NULL} ���������
���ƤϤ����ޤ���
����ǥå����ե�����ɤˤϡ�@code{NULL} �����ꤹ�뤳�ȤϤǤ��ޤ���

@findex LOAD DATA INFILE
@code{LOAD DATA INFILE} �ǥǡ������ɤ߹���Ȥ��ϡ����Υե�����ɤ� @code{''} �ǹ�������ޤ���
���ܤ� @code{NULL} �ͤˤ��������ϡ��ƥ����ȥե�������� @code{\N} ����Ѥ��٤��Ǥ���
��ƥ��Ȥ��Ƥ� @code{'NULL'} �줬������������ǻ��Ѥ���Ƥ��ޤ���
@xref{LOAD DATA, , @code{LOAD DATA}}.

@code{ORDER BY} ���ѻ�, @code{NULL} �ͤϺǽ���󼨤���ޤ�.
@code{DESC} ����Ѥ��ƹ߽�˥����Ȥ������@code{NULL} �ͤϺǸ�ˤʤ�ޤ���
@code{GROUP BY} ���ѻ�, ���Ƥ� @code{NULL} �ͤ��������ȸ��ʤ���ޤ���

@code{NULL} �������������뤿�ᡢ���δؿ�����ѤǤ��ޤ�:
@code{IS NULL}, @code{IS NOT NULL}, @code{IFNULL()}.

@cindex @code{TIMESTAMP}, and @code{NULL} values
@cindex @code{AUTO_INCREMENT}, and @code{NULL} values
@cindex @code{NULL} values, and @code{TIMESTAMP} columns
@cindex @code{NULL} values, and @code{AUTO_INCREMENT} columns
�����Ĥ��ι��ܷ��Ǥϡ�@code{NULL} �ͤϥϥ�ɥ�Ȥ��ư����ޤ���
�⤷�ơ��֥���κǽ�� @code{TIMESTAMP} ��� @code{NULL} ����������ʤ顢
���ߤ����դȻ��郎��������ޤ����⤷ @code{AUTO_INCREMENT} ���@code{NULL} �ͤ���������ʤ顢
���Υ��������ֹ椬��������ޤ���

@tindex alias
@node Problems with alias, Deleting from related tables, Problems with NULL, Problems
@section @code{alias} ������

@code{GROUP BY}, @code{ORDER BY}, @code{HAVING} ��ˤ�����
���ܤ򻲾Ȥ���������ꥨ���ꥢ�������ѤǤ��ޤ���
�����ꥢ���Ϲ��ܤȤ��Ƥ���ɤ�̾�Τ�Ϳ����Τ˻��Ѥ���ޤ���

@example
SELECT SQRT(a*b) as rt FROM table_name GROUP BY rt HAVING rt > 0;
SELECT id,COUNT(*) AS cnt FROM table_name GROUP BY id HAVING cnt > 0;
SELECT id AS "Customer identity" FROM table_name;
@end example

 ANSI SQL �� @code{WHERE} ����ǥ����ꥢ���򻲾Ȥ��뤳�Ȥ�
���Ĥ��Ƥ��ʤ����Ȥ����դ��Ƥ�������������� @code{WHERE} ���¹Ԥ���������
���ܤ��ͤ��ޤ����ꤵ��Ƥ��ʤ�����Ǥ����㤨�С��ʲ��Υ������ @strong{����ޤ�Ǥ�}��

@example
SELECT id,COUNT(*) AS cnt FROM table_name WHERE cnt > 0 GROUP BY id;
@end example

�ɤιԤ� @code{GROUP BY} �˴ޤޤ�뤫����뤿��� @code{WHERE} ��ʸ��
�¹Ԥ��������ǡ�
����줿��̤ΤɤιԤ�Ȥ������ꤹ�뤿��� @code{HAVING} �����Ѥ���ޤ���


@node Deleting from related tables, No matching rows, Problems with alias, Problems
@section Deleting rows from related tables

@strong{MySQL} �ϸ��� sub-select ��̤���ݡ��Ȥǡ��ޤ�
 @code{DELETE} ��ʸ��ʣ���Υơ��֥�򰷤����⥵�ݡ��Ȥ��Ƥ��ޤ���
�������äơ����ĤΥơ��֥�˴�Ϣ����쥳���ɤ�ä��ˤϡ��ʲ��Τ褦�ˤ��ƹԤ��ޤ���

@enumerate
@item
�����Ĥ��� @code{WHERE} ������Ѥ��ơ����ܤȤʤ�ơ��֥뤫��Ԥ� @code{SELECT}
@item
Ʊ����ﲼ�ǡ����ܤȤʤ�ơ��֥�˴ޤޤ��Ԥ� @code{DELETE}
@item
@code{DELETE FROM related_table WHERE related_column IN (selected_rows)}
@end enumerate

@code{related_column} �Υ�����ι��ʸ��������1,048,576 (�ǥե���Ȥ� @code{max_allowed_packet} ����) �򤳤����硢
����򤤤��Ĥ���ʬ�䤷�ơ�ʣ���� @code{DELETE} ��ʸ�ˤ��ʤ��ƤϤʤ�ޤ���

@code{related_column} ������ǥå����ǡ�100-1000 ��@code{related_column}������ä���硢
���Ϥ䤯 @code{DELETE} �Ǥ��ޤ���
�⤷ @code{related_column} ������ǥå����Ǥʤ���硢����®�٤� @code{IN} ��ΰ����ο���̵�ط��ˤʤ�ޤ���


@node No matching rows, ALTER TABLE problems, Deleting from related tables, Problems
@section Solving problems with no matching rows

ʣ���ʥ����꡼��Ԥäơ��⤷�ʤ�η�̤��֤��ʤ���С�
���Υ����꡼�β����������򸫤Ĥ��뤿�ᡢ�ʲ��μ�³����Ԥ��ޤ���

@enumerate
@item
@code{EXPLAIN} ����Ѥ��ƥ����꡼��ƥ��Ȥ�������ʴְ㤤�򸫤Ĥ��ޤ���
@xref{EXPLAIN, , @code{EXPLAIN}}.

@item 
@code{WHERE} ��ǻ��Ѥ���Ƥ���ե�����ɤ����� Select ���Ƥߤޤ�

@item
��̤��֤äƤ���ޤǡ���İ�ĥ����꡼����ơ��֥��������Ƥ����ޤ���
�ơ��֥뤬�礭����硢@code{LIMIT 10} �򥯥��꡼�ǻ��Ѥ��뤳�Ȥ��ɤ�����ޤ���

@item
�Ԥ˥ޥå����٤��Ǥ�������� @code{SELECT} ���Ƥߤޤ���
���ξ�硢select ����Τϡ��嵭�ǺǸ�˼��������ơ��֥���Ф��ƹԤ��ޤ���

@item
�⤷ @code{FLOAT} �� @code{DOUBLE} ���Τ�Τ��������Ӥ���ʤ顢
 @code{=} �ϻ��Ѥ��ʤ��Ǥ�������������ϤۤȤ�ɤΥ���ԥ塼������ˤ����ơ�
��ư���������ͤϤԤä�����ͤˤʤ�ʤ�����Ǥ���

@example
mysql> SELECT * FROM table_name WHERE float_column=3.5;
   ->
mysql> SELECT * FROM table_name WHERE float_column between 3.45 and 3.55;
@end example

In most cases, changing the @code{FLOAT} to a @code{DOUBLE} will fix this!

@item
�⤷�ʤˤⰭ���Ȥ����򸫤Ĥ��뤳�Ȥ��Ǥ��ʤ��ä���硢
�����ʥƥ��Ȥ�Ĥ��ä� @code{mysql test < query.sql} ��ԤäƤߤƤ���������
@code{mysqldump --quick database tables > query.sql} �ǥƥ��ȥե����������Ǥ��ޤ���
���Υե�����򥨥ǥ��������Խ����������Ĥ���insert�Ԥ�(¿������ʤ�)�ä��ޤ���
�����ƥե�����κǸ��select��ʸ���դ�­���ޤ���

�ƥ��Ȥ�Ԥ��ˤϡ�

@example
shell> mysqladmin create test2
shell> mysql test2 < query.sql
@end example

@code{mysqlbug} ����Ѥ��� @email{mysql@@lists.mysql.com} �˥ƥ��Ȥ���Ƥ��Ƥ���������
@end enumerate

@node ALTER TABLE problems, Change column order, No matching rows, Problems
@section Problems with @code{ALTER TABLE}.

�⤷ @code{ALTER TABLE} ���ʲ��Τ褦�ʥ��顼�ǻ�����硧

@example
Error on rename of './database/name.frm' to './database/B-a.frm' (Errcode: 17)
@end example

����ϰ����� @code{ALTER TABLE} �� @strong{MySQL} ������å��夷�Ƥ��ꡢ
@file{A-something} �� @file{B-something} �Ȥ���̾���Ρ����ä������ή���Ƥ���
�Ť��ơ��֥뤬¸�ߤ��Ƥ��ޤ���
���ξ�硢@strong{MySQL} �ǡ����ǥ��쥯�ȥ�����ꡢ@code{A-} �� @code{B-} �ǻϤޤ�
̾������ĥե���������ƾä��ޤ���
(�ä�����ˤɤ����˰�ư���Ƥ⹽���ޤ���)

@code{ALTER TABLE} �ϰʲ��Τ褦��ư��ޤ�:

@itemize @bullet
@item �ѹ��׵�Τ��ä� @file{A-xxx} �Ȥ���̾���ο������ơ��֥�������
@item ���Υơ��֥�������ƤιԤ� @file{A-xxx} �˥��ԡ���
@item ���Υơ��֥�� @file{B-xxx} ��̾���ѹ���
@item @file{A-xxx} �ϸ��Υơ��֥�̾��̾���ѹ�����롣
@item @file{B-xxx} �Ͼõ��롣
@end itemize

�⤷̾���ѹ��κݤ����꤬����ȡ�@strong{MySQL} ���ѹ�����ä��褦��ư���ޤ���
��̿Ū�����꤬���������(���ꤨ�ޤ���)��@strong{MySQL} �ϸ��θŤ��ơ��֥��
 @file{B-xxx} �Ȥ���̾���Τޤޤˤ��Ƥ����ޤ���ñ��̾���ѹ�����Хǡ��������ޤ���

@node Change column order,  , ALTER TABLE problems, Problems
@section How to change the order of columns in a table

The whole point of SQL is to abstract the application from the data
storage format.  You should always specify the order in wish you wish to
retrieve your data.  For example:

@example
SELECT col_name1, col_name2, col_name3 FROM tbl_name;
@end example

will return columns in the order @code{col_name1}, @code{col_name2}, @code{col_name3}, whereas:

@example
SELECT col_name1, col_name3, col_name2 FROM tbl_name;
@end example

will return columns in the order @code{col_name1}, @code{col_name3}, @code{col_name2}.

You should @strong{NEVER}, in an application, use @code{SELECT *} and
retrieve the columns based on their position, because the order in which columns are
returned @strong{CANNOT} be guaranteed over time; A simple change to
your database may cause your application to fail rather dramatically.

If you want to change the order of columns anyway, you can do it as follows:

@enumerate
@item
Create a new table with the columns in the right order.
@item
Execute
@code{INSERT INTO new_table SELECT fields-in-new_table-order FROM old_table}.
@item
Drop or rename @code{old_table}
@item
@code{ALTER TABLE new_table RENAME old_table}
@end enumerate
 
@node Common problems, Clients, Problems, Top
@chapter Solving some common problems with @strong{MySQL}

@cindex Replication
@menu
* Log Replication::             ������������Ѥ����ǡ����١�����ʣ��
* Backup::                      �ǡ����١����ΥХå����å�
* Update log::                  The update log
* Multiple servers::            Ʊ��ޥ�����ʣ���� @strong{MySQL} �����С������餻��
@end menu

@cindex Database replication
@cindex Log Replication, database
@node Log Replication, Backup, Common problems, Common problems
@section ������������Ѥ����ǡ����١�����ʣ��

Now that master-slave internal replication is available starting in 3.23.15, this is the recommended way.
However, it is still possible to replicate a database by using the update log.
@xref{Update log}. ����ϡ���ĤΥǡ����١������ޥ�����(��)�Ȥ���ư��դ�ޤäƤ���
(���ƤΥǡ����ѹ��������ǹԤ��ޤ�)�����ġ���İʾ��¾�Υ����С������졼��(��)��
����ư��Ƥ��뤳�Ȥ��׵ᤷ�ޤ���
���졼�֤򹹿�����ˤ� 
@code{mysql < update_log} ��¹Ԥ�������Ǥ���
���졼�֥ǡ����١����Υۥ��ȡ��桼�������ѥ���ɤ򥳥ޥ�ɤΥ��ץ�����Ϳ����
�ޥ�����������������������������Ϥ˻��Ѥ��ޤ���

�⤷���ơ��֥뤫��ʤˤ������ʤ���硢 @code{TIMESTAMP} �ե�����ɤ���Ѥ���С�
�Ǹ��ʣ�����ʸ�ˡ��������������줿��Τ��ѹ����줿��Τ�����
�ߥ顼�����С��˥��ԡ��Ǥ��ޤ���(�Ǹ��ʣ����Ԥä����֤���Ӥ������ФǤ��ޤ�)

��������(����Τ���)�ȥ����ॹ�����(ξ¦��)��ξ������Ѥ���2�Ĥ���ˡ��
���������ƥ���뤳�Ȥ��Ǥ��ޤ������������ξ��ϡ�Ʊ���ǡ�����ξ¦����
�����줿���ˡ����ʤ������ͤ����Ǥ��ʤ���Фʤ�ޤ��󡣤��ʤ��Ϥ����餯
�����������줿������ꤹ��Τ�����뤿��ˡ��Ť��С��������ݻ���������
���礦��

���λ��Ԥ�ʣ���ˤ� SQL ���ơ��ȥ��ȤǹԤ��뤿�ᡢ�ǡ����١����򹹿���
�륹�ơ��ȥ�����Ǽ��δؿ��ϻȤäƤϤ����ޤ��󡣤�����¾�� 
���ԡ����Υ����ФȤϰ㤦�ͤ��֤�����Ǥ�:

@itemize @bullet
@item @code{DATABASE()}
@item @code{GET_LOCK()} and @code{RELEASE_LOCK()}
@item @code{RAND()}
@item @code{USER()}, @code{SYSTEM_USER()} or @code{SESSION_USER()}
@item @code{VERSION()}, @code{CONNECT_ID()}
@end itemize

���Ƥλ���ؿ��ϡ�ɬ�פʾ��˥ߥ顼�˥����ॹ����פ�����褦�ˤ��ơ���
���˻��ѤǤ��ޤ���@code{LAST_INSERT_ID()} ������˻��ѤǤ��ޤ���


@cindex Backups
@node Backup, Update log, Log Replication, Common problems
@section �ǡ����١����ΥХå����å�

@strong{MySQL} �ơ��֥�ϥե�����Ȥ��Ƴ�Ǽ����뤿�ᡢ�Хå����åפ��
���Τϴ�ñ�Ǥ���̷��Τʤ��Хå����åפ����뤿��ˤϡ�@code{LOCK TABLES} 
���Ϣ����ơ��֥�ǹԤäƤ���������@xref{LOCK TABLES, , @code{LOCK TABLES}}.
�ɤ߹��ߥ��å���
����ɬ�פʤΤǡ����Υơ��֥�ǥǡ����١����ǥ��쥯�ȥ�Υե�����Υ��ԡ�
���Ԥ��Ƥ���֤⡢¾�Υ���åɤϥ�������³�Ǥ��ޤ����⤷���ϡ��ơ��֥��
SQL ��٥�ǥХå����åפ������ΤǤ���С�@code{SELECT INTO OUTFILE} ���
�ѤǤ��ޤ���

¾����ˡ�� @code{mysqldump} �ץ���������Ѥ��뤳�ȤǤ�:

@enumerate
@item
�ե�Хå����åפ�Ȥ�ˤϡ�

@example
shell> mysqldump --tab=/path/to/some/dir --opt --full
@end example

�㤷�����С������ä����ǡ������ѹ��򤷤ʤ��ΤǤ���С�
ñ�����ƤΥơ��֥�ե�����(@file{*.frm}, @file{*.MYD}, @file{*.MYI} files)��
���ԡ���������Ǥ⹽���ޤ���
The script @code{mysqlhotcopy} does use this method.

@item
@cindex Log file, names
@code{mysqld} ��ߤᡢ������ @code{--log-update[=file_name]} ���ץ�����Ĥ��Ƶ�ư���ޤ���
@xref{Update log}.  �����ե�����ϡ� @code{mysqldump} �¹Ը�˹Ԥ�줿�ǡ����١������ѹ���
ʣ�����뤿��ξ����Ϳ���Ƥ���ޤ���
@end enumerate

�⤷�ꥹ�ȥ��򤷤ʤ���Фʤ�ʤ���硢�ޤ��ǽ�� @code{myisamchk -r} ��¹Ԥ���
�ơ��֥�ν������ߤƤ���������
�ۤȤ�ɤξ�硢99.9% �����ϤǤ���Ϥ��Ǥ���
�⤷ @code{myisamchk} �����Ԥ�����硢�ʲ��Τ褦�ˤ��ޤ���
(This will only work if you have started @strong{MySQL} with
@code{--log-update}. @xref{Update log}.)

@enumerate
@item
���ꥸ�ʥ�� @code{mysqldump} �Хå����åץǡ�����ꥹ�ȥ����ޤ���
@item
�ʲ��Υ��ޥ�ɤΤ褦�ˤ��ơ����������˵�Ͽ����Ƥ����ѹ���Ŭ�Ѥ��ޤ���
@example
shell> ls -1 -t -r hostname.[0-9]* | xargs cat | mysql
@end example
@end enumerate

@code{ls} �ϡ����Ƥι��������ե������������������뤿��˹Ԥ��ޤ���

@code{SELECT * INTO OUTFILE 'file_name' FROM tbl_name} �Ǥ�����Ū�Хå����åפ� 
@code{LOAD DATA FROM INFILE 'file_name' REPLACE ...} �ǤΥꥹ�ȥ���Ԥ�
���Ȥ�Ǥ��ޤ�����ʣ�쥳���ɤ��򤱤뤿��ˤϡ��ơ��֥���� @code{PRIMARY KEY}
 or a @code{UNIQUE} ��ɬ�פǤ���@code{REPLACE} �ϡ�'��ʣ����ǥå���' ���ͤ����ä���硢
�������쥳���ɤ�����������˸Ť��쥳���ɤ���������Τ��֤��������뤳�Ȥ��̣���ޤ���

@cindex Update log
@node Update log, Multiple servers, Backup, Common problems
@section ��������

@code{--log-update=file_name}���ץ�������Ѥ���@code{mysqld}��ư����ȡ�
�ǡ����򹹿��������Ƥ�SQL���ޥ�ɤ�����ե�����˽񤭤ޤ���
�⤷ file_name ��Ϳ�����ʤ��ä����ϡ��ۥ���̾���ǥե���Ȥǻ��Ѥ���ޤ���
�⤷ file_name �˥ǥ��쥯�ȥ�ѥ����ޤޤ�ʤ��ä����ϡ�
���Υե�����ϥǡ����ǥ��쥯�ȥ�˽񤫤�ޤ���
�⤷ file_name ����ĥ������ʤ��ä��ʤ顢@code{mysqld} ��
@code{file_name.#} �Ȥ������ǥ����ե������������ޤ���
���Υ����ե�����ϥǡ����ǥ��쥯�ȥ�ˤ����졢
����̾���� @code{file_name.#} �Ȥ���������̾���ˤʤäƤ��ޤ���

@code{#} �� @code{mysqladmin refresh} �� @code{mysqladmin flush-logs} ��¹Ԥ����٤ˡ�
���뤤�� @code{FLUSH LOGS} ��ʸ��¹Ԥ����ꡢ�����С���ꥹ�����Ȥ����٤�
��ưŪ������������Ǥ���

�⤷ @code{--log} �� @code{-l} ���ץ�������Ѥ�����硢�����ե������̾����
@code{mysqld} �������Υ����� @file{hostname.log} �˽񤭽Ф��ޤ���
���ξ�硢�ꥹ�����Ȥ��ե�å����ԤäƤ⿷���������ե��������ޤ���
(���٥����������ƺ��٥����ץ󤷤ޤ�����)
�ǥե���ȤǤϡ�@code{mysql.server} ������ץȤ� @code{-l} ���ץ������ղä���
@strong{MySQL} �����С���ư���ޤ���
�⤷ @strong{MySQL} �Υѥե����ޥ󥹤򤢤������ִĶ��ʤɤǻ��Ѥ�������硢
@code{mysql.server} ������ץȤ��� @code{-l} ���ץ����򳰤��Ƥ���������

���������ϡ��ºݤ˹������줿�ǡ����Υ��ơ��ȥ��Ȥ�����񤯤��ᡢ���Ӥ��Ӥ�ư��ޤ���
@code{WHERE} ����Ѥ��� @code{UPDATE} �� @code{DELETE} �Ƿ�̤������ʤ��ä���硢
�����Ͻ񤭽Ф���ޤ���
���Ǥ˥��åȤ���Ƥ����ͤˡ��⤦���ٹ��ܤ򹹿�����褦�� @code{UPDATE} �⥹���åפ���ޤ���

�����ե�����ι����˽��äƥǡ����١����򹹿����������ϡ�����Ԥ��ޤ�
(���������ե�����̾�� @file{file_name.#} �Ȳ��ꤷ�ޤ�):

@example
shell> ls -1 -t -r file_name.[0-9]* | xargs cat | mysql
@end example

@code{ls} �����ƤΥ����ե�������������¤٤뤿��˻��Ѥ��Ƥ��ޤ���

����ϡ�����å����˥Хå����åפ������֤ޤ���ꤿ�������뤤�ϡ�
�Хå����åפ����夫�饯��å��夹��ޤǤδ֤Υǡ����ι�����Ԥ�������
����ʾ��˻Ȥ��ޤ���

@cindex Database replication
@cindex Replication, database
@cindex Database mirroring
@cindex Mirroring, database
�����ϰ㤦�ۥ��ȤΥǡ����١����Υߥ顼��ޥ������ǡ����١�����ʣ��������ˤ����ѤǤ��ޤ���
@xref{Replication}.

@cindex Multiple servers
@node Multiple servers,  , Update log, Common problems
@section Ʊ��ޥ�����ʣ���� @strong{MySQL} �����С������餻��

Ʊ���ޥ�����ʣ���Υ����С������餻������礬����ޤ���
�㤨�С����Ǥ�¸�ߤ��Ƥ��륵���С��Ϥ��Τޤޤˤ��Ƥ����ơ������� @strong{MySQL} ��ƥ��Ȥ��������䡢
���뤤�ϡ����󥿡��ͥåȥץ��Х�������Ĥ�Ǥ��ơ�@strong{MySQL} �򤽤줾��θܵ��Ѥ��󶡤��������ʤɡ�

ʣ���Υ����С��򤿤��������硢��ñ����ˡ�Ȥ��ơ�
TCP/IP �ݡ��ȡ������åȥե�������Ѥ��ơ������С��򥳥�ѥ��뤹����ˡ������ޤ���

���Ǥ����äƤ��륵���С����ǥե���ȤΥݡ����ֹ�ȥ����åȥե������ư��Ƥ���Ȥ��ޤ���
�����������С�����ˤϡ��ʲ��Τ褦�� @code{configure} ���ޤ���

@example
shell> ./configure  --with-tcp-port=port_number \
             --with-unix-socket=file_name \
             --prefix=/usr/local/mysql-3.22.9
@end example

@code{port_number} �� @code{file_name} �ˤϡ��ǥե���ȤΥݡ����ֹ桢�����åȥե�����Ȥϰ㤦��Τ���ꤷ�ޤ���
������ @code{--prefix} �򡢤��Ǥ����äƤ��� @strong{MySQL} �Υ��󥹥ȡ�����Ȥϰ㤦�ǥ��쥯�ȥ꡼�˻��ꤷ�ޤ���

�������äƤ��� @strong{MySQL} �����С��Υ����åȤȥݡ��Ȥ��Τ�ˤϡ��ʲ��Τ褦�ˤ��ޤ���

@example
shell> mysqladmin -h hostname --port=port_number variables
@end example

���ʤ������Ѥ��Ƥ���ݡ��Ȥ� @strong{MySQL} �����С������äƤ���С�
������ѹ���ǽ�� @strong{MySQL} �ѿ���(�����åȥե������̾����ޤ��)���Ϥ��ޤ���

Ω���夲������ץ�(�����餯 @file{mysql.server} �ե�����)���Խ�����
ʣ���� @strong{MySQL} �����С���Ω�������Ƥ⹽���ޤ���

���ξ�硢 @strong{MySQL} �����С���ƥ���ѥ��뤹��ɬ�פϤ���ޤ���
@code{safe_mysqld} �Υ��ץ�������ꤷ�ƥ����С���ư����С��ݡ��Ȥȥ����åȤ��ѹ��Ǥ��ޤ���

@example
shell> /path/to/safe_mysqld --socket=file-name --port=port_number
@end example

�⤷��¾�Υ����С��������󥰤�ԤäƤ���ǥ��쥯�ȥ��Ʊ���ǡ����١����ǥ��쥯�ȥ��
�����������С��ǻ��Ѥ���ΤǤ���С������ե������̾������ꤹ�٤��Ǥ���
( @code{safe_mysqld} �� @code{--log} �� @code{--log-update} ����ꤹ��)
�������ʤ��ȡ�ξ���Υ����С���Ʊ�������ե�����˽񤭹��⤦�Ȥ��뤫��Ǥ���

@strong{Warning}: �̾��ĥ����С���Ʊ���ǡ����١����������ƤϤ����ޤ���
�⤷���Ѥ��Ƥ��� OS �� fault-free system locking �򥵥ݡ��Ȥ��Ƥ��ʤ��ȡ�
������Ỵ�ʤ��Ȥˤʤ�Ǥ��礦��

�⤷����ܤΥ����С��˰㤦�ǡ����١����ǥ��쥯�ȥ����Ѥ���������硢
 @code{safe_mysqld} �� @code{--datadir=path} ���ץ�������ꤷ�ޤ���

@example
shell> /path/to/safe_mysqld --datadir=/new/path/to/datadir \
                --socket=file-name --port=file-name
@end example

�⤷�㤦�ݡ��Ȥ����äƤ��� @strong{MySQL} �����С��ˡ�
����ޤ��㤦�ݡ��Ȥ���Ѥ���褦�˺��줿���饤����Ȥ�����³��������硢
�ʲ��Τ褦�ˤ��ޤ���

@itemize @bullet
@item
���饤����Ȥ� @code{--host 'hostname' --port=port_numer} ��
@code{[--host localhost] --socket=file_name} ���ץ����ǵ�ư���ޤ���

@item
C ���뤤�� Perl �ץ������ξ�硢�ݡ��Ȥȥ����åȤ�Ϳ���뤳�Ȥ��Ǥ��ޤ���

@item
@tindex MYSQL_UNIX_PORT environment variable
@tindex MYSQL_TCP_PORT environment variable
@tindex Environment variable, MYSQL_UNIX_PORT
@tindex Environment variable, MYSQL_TCP_PORT
@code{MYSQL_UNIX_PORT} �� @code{MYSQL_TCP_PORT} �Ķ��ѿ��� UNIX �����åȥե������
 TCP/IP �Υݡ����ֹ�ȥ��åȤ������饤����Ȥ�Ω�������ޤ���
�⤷�����Υݡ����ֹ�䥽���åȥե�������˻��Ѥ���ΤǤ���С�
 @file{.login} �ե����뤫�ʤˤ��˴Ķ��ѿ��򥻥åȤ���褦�˽񤤤Ƥ����Ф褤�Ǥ��礦��
@xref{Environment variables}. @xref{Programs}.

@item
@tindex .my.cnf file
���ʤ��Υۡ���ǥ��쥯�ȥ�� @file{.my.cnf} �ե�����ˡ�
�̾���Ѥ���ݡ����ֹ�ȥ����åȥե������񤯤��Ȥ�Ǥ��ޤ���
@xref{Option files}.
@end itemize

@node Clients, Comparisons, Common problems, Top
@chapter @strong{MySQL} ���饤����ȥġ���� API

@menu
* C::                           @strong{MySQL} C API
* C API datatypes::             C API �ǡ�����
* C API function overview::     C API �ؿ�����
* C API functions::             C API �ؿ�����
* Perl::                        @strong{MySQL} Perl API
* Eiffel::                      @strong{MySQL} Eiffel wrapper
* Java::                        @strong{MySQL} Java connectivity (JDBC)
* PHP::                         @strong{MySQL} PHP API
* Cplusplus::                   @strong{MySQL} C++ APIs
* Python::                      @strong{MySQL} Python APIs
* Tcl::                         @strong{MySQL} Tcl APIs
* Ruby::                        @strong{MySQL} Ruby API
@end menu

@node C, C API datatypes, Clients, Clients
@section @strong{MySQL} C API

C API �����ɤ� @strong{MySQL} �ȤȤ�����ۤ���ޤ�������� 
@code{libmysqlclient} �饤�֥��˴ޤޤ졢C �ץ�����फ��ǡ����١�����
�Υ�������������ޤ���

MySQL �������ǥ����ȥ�ӥ塼�������Υ��饤����Ȥ�¿���� C �ǽ񤫤�Ƥ��ޤ���C API �λ�
��ˡ�򼨤����õ���ʤ顢�����Υ��饤����Ȥ�Ĵ�٤Ƥ���������

¾�Υ��饤����� API ��¿��(Java ���������)�ϡ�@strong{MySQL} �����Ф�
���̿��ˤ��Υ饤�֥�����Ѥ��ޤ������Τ��ᡢ�㤨�С�¾�Υ��饤����ȥ�
�������ǻ��Ѥ����Τ�Ʊ���Ķ��ѿ���¿�������������뤳�Ȥ��Ǥ��ޤ�����
���ϥ饤�֥�꤫�黲�Ȥ���뤫��Ǥ����������ѿ��Υꥹ�ȤˤĤ��Ƥ� 
@ref{Programs} �򻲾Ȥ��Ʋ�������

���饤����ȤϺ����̿��Хåե�������������ޤ����ǽ�˳�����Ƥ���Х�
�ե��Υ�����(16K �Х���)�ϼ�ưŪ�˺��祵����(�ǥե���Ȥ� 24M)�ޤ����ä�
�ޤ����Хåե���������ɬ�פ˱��������ä��뤿�ᡢñ��˥ǥե���Ȥκ�����
�¤����ä��Ƥ⡢����������ǻ񸻤���Ѥ��뤳�ȤϤ���ޤ��󡣤��Υ�����������
���ϼ�˴ְ�ä���������̿��ѥ��åȤΤ���Υ����å��Ǥ���

�̿��Хåե��ϰ�Ĥ� SQL ���ơ��ȥ���(���饤����Ȥ��饵���Фؤ��̿�)�ȡ�
�֤����ǡ���(�����Ф��饯�饤����Ȥؤ��̿�)�Σ��쥳���ɤ�ޤ�Τ�
��ʬ�礭���ʤ��ƤϤ����ޤ��󡣳ƥ���åɤ�
�̿��Хåե��ϡ�Ǥ�դΥ쥳���ɤ䥯�����������뤿��ˡ����ꤵ�줿���¤ޤ�ưŪ
�����礷�ޤ����㤨�С����� 16M �Υǡ�����ޤ� @code{BLOB} �ͤ������硢
���ʤ��Ȥ� 16M ���̿��Хåե����¤Ȥ��ƻ���ɬ�פ�����ޤ�(�����Фȥ��饤
����Ȥ�ξ����)��
���饤����ȤΥǥե���Ȥκ����ͤ� 24M �Ǥ����������Фκ����ͤΥǥե���Ȥ�
1M �Ǥ�������ϥ����е�ư���ˡ�@code{max_allowed_packet} �ѥ�᡼����
�ͤ��ѹ����뤳�Ȥˤ�ꡢ���䤹���Ȥ�����ޤ���
@xref{Server parameters}.

@strong{MySQL} �����Фϡ��ƥ������˳��̿��Хåե��� 
@code{net_buffer_length} �Х��Ȥ˽̾����ޤ���
���饤����ȤǤϡ���³�˳�����Ƥ�줿�Хåե��Υ������ϡ���³���Ĥ�����ޤǸ������ޤ���
���饤����ȥ������³�������������줿����Ĵ������ޤ���

����åɥץ�����ߥ󥰤�Ԥʤ����ϡ�@strong{MySQL} C API �� 
@code{--with-thread-safe-client} �դ��ǥ���ѥ��뤹�٤��Ǥ�������� C
API ����³��Υ���åɰ����ˤ��ޤ������ξ��˸¤ꡢ���ĤΥ���åɤ�Ʊ����
³��ͭ�Ǥ��ޤ�:

@table @asis
@item
���ĤΥ���åɤ�Ʊ����³���Ʊ���� @strong{MySQL} �˥�������������뤳�Ȥ�
�Ǥ��ޤ����ä� @code{mysql_query()} �� @code{mysql_store_result()} �δ�
�ǡ�¾�Υ���åɤ�Ʊ����³����Ѥ��ʤ����Ȥ�μ¤ˤ���ɬ�פ�����ޤ���
@item
¿���Υ���åɤ� @code{mysql_store_result()} �Ǽ��Ф��줿�̡��η�̥���
�Ȥ˥��������Ǥ��ޤ���
@item
@code{mysql_use_result} ����Ѥ����硢��̥��åȤ��������������ޤǡ�¾
�Υ���åɤ�Ʊ����³��Dz���Ҥͤʤ����Ȥ�μ¤ˤ���ɬ�פ�����ޤ���
@end table

@node C API datatypes, C API function overview, C, Clients
@section C API �ǡ�����
@table @code

@tindex MYSQL C type
@item MYSQL
���ι�¤�Τϰ�ĤΥǡ����١�����³�Υϥ�ɥ��ɽ�路�ޤ�������ϤۤȤ������
�� @strong{MySQL} �ؿ��˻��Ѥ���ޤ���

@tindex MYSQL_RES C type
@item MYSQL_RES
���ι�¤�Τϥ쥳���ɤ��֤�������(@code{SELECT}, @code{SHOW}, @code{DESCRIBE}, @code{EXPLAIN})�η�̤�ɽ��
���ޤ��������꤫���֤�������ϡ�������λĤ�Ǥ�@emph{��̥��å�}�ȸ�
�Ф�ޤ���

@tindex MYSQL_ROW C type
@item MYSQL_ROW
����ϥǡ����Σ��쥳���ɤΰ����ʷ�ɽ���Ǥ�������ϸ��ߥХ���ʸ���������Ȥ��Ƽ�
������Ƥ��ޤ���(�ե�������ͤ��Х��ʥ�ǡ�����ޤळ�Ȥ������硢����� NULL 
��üʸ����Ȥ��ư������ȤϤǤ��ޤ��󡣤��Τ褦���ͤ������� NULL �Х��Ȥ��
�ळ�Ȥ����뤫��Ǥ���) @code{mysql_fetch_row()} �θƤӽФ��ˤ��쥳���ɤ�����
����ޤ���

@tindex MYSQL_FIELD C type
@item MYSQL_FIELD
���ι�¤�Τϥե�����ɤˤĤ��Ƥξ��󡢤Ĥޤ�ե�����ɤ�̾��������������
����ޤ�Ǥ��ޤ������Υ��Фϸ�Ǥ���˾ܺ٤���������Ƥ��ޤ���
@code{mysql_fetch_field()} �򷫤��֤��ƤӽФ����Ȥˤ�ꡢ�ƥե�����ɤ� 
@code{MYSQL_FIELD} ��¤�Τ����뤳�Ȥ��Ǥ��ޤ���
�ե�������ͤϤ��ι�¤�Τΰ����ǤϤ���ޤ���; ����� @code{MYSQL_ROW} ��¤
�Τ˴ޤޤ�Ƥ��ޤ���

@tindex MYSQL_FIELD_OFFSET C type
@item MYSQL_FIELD_OFFSET
����ϡ�@strong{MySQL} �ե�����ɥꥹ�ȤؤΥ��ե��åȤΰ����ʷ�ɽ���Ǥ���
(@code{mysql_field_seek()} �ǻ��Ѥ���ޤ���)���ե��åȤϥ쥳������Υե������
�ֹ�ǡ�0 ����Ϥޤ�ޤ���

@tindex my_ulonglong C type
@tindex my_ulonglong values, printing
@item my_ulonglong
�쥳���ɿ��� @code{mysql_affected_rows()},
@code{mysql_num_rows()} ������ @code{mysql_insert_id()} �˻��Ѥ���뷿�Ǥ���
���η��� @code{0} ���� @code{1.84e19} ���ϰϤ�Ϳ���ޤ���

�����ƥ�ˤ�äƤϡ�@code{my_ulonglong} �����ͤ�ɽ�����褦�Ȥ��Ƥ⡢ư��
���ʤ����Ȥ�����ޤ��������ͤ�ɽ������ˤϡ�@code{unsigned long} ���Ѵ�
����@code{%lu} ���Ͻ񼰤���Ѥ��Ƥ�����������:
@example
printf (Number of rows: %lu\n", (unsigned long) mysql_num_rows(result));
@end example
@end table

@noindent
@code{MYSQL_FIELD} ��¤�Τϼ��Υ��Ф�ޤߤޤ�:

@table @code
@item char * name
�ե�����ɤ�̾����null��üʸ����

@item char * table
���Υե�����ɤ�ޤ�ơ��֥��̾�����׻����줿�ե�����ɤǤʤ����Τ�ͭ
���Ǥ����׻����줿�ե�����ɤǤϡ�@code{table} �ͤ϶�ʸ����Ǥ���

@item char * def
���Υե�����ɤΥǥե�����͡�null��üʸ����
����� @code{mysql_list_fields()} ���ѻ��ˤ������ꤵ��ޤ���

@item enum enum_field_types type
�ե�����ɤη���
@code{type} �ͤϼ��ΰ�ĤǤ�:

@multitable @columnfractions .3 .55
@item @strong{������}                     @tab @strong{���ΰ�̣}
@item @code{FIELD_TYPE_TINY}            @tab @code{TINYINT} �ե������
@item @code{FIELD_TYPE_SHORT}           @tab @code{SMALLINT} �ե������
@item @code{FIELD_TYPE_LONG}            @tab @code{INTEGER} �ե������
@item @code{FIELD_TYPE_INT24}           @tab @code{MEDIUMINT} �ե������
@item @code{FIELD_TYPE_LONGLONG}        @tab @code{BIGINT} �ե������
@item @code{FIELD_TYPE_DECIMAL}         @tab @code{DECIMAL} �ޤ��� @code{NUMERIC} �ե������
@item @code{FIELD_TYPE_FLOAT}           @tab @code{FLOAT} �ե������
@item @code{FIELD_TYPE_DOUBLE}          @tab @code{DOUBLE} �ޤ��� @code{REAL} �ե������
@item @code{FIELD_TYPE_TIMESTAMP}       @tab @code{TIMESTAMP} �ե������
@item @code{FIELD_TYPE_DATE}            @tab @code{DATE} �ե������
@item @code{FIELD_TYPE_TIME}            @tab @code{TIME} �ե������
@item @code{FIELD_TYPE_DATETIME}        @tab @code{DATETIME} �ե������
@item @code{FIELD_TYPE_YEAR}            @tab @code{YEAR} �ե������
@item @code{FIELD_TYPE_STRING}          @tab ʸ���� (@code{CHAR} �ޤ��� @code{VARCHAR}) �ե������
@item @code{FIELD_TYPE_BLOB}            @tab @code{BLOB} �ޤ��� @code{TEXT} �ե������ (����Ĺ����ꤹ��ˤ� @code{max_length} ����Ѥ��Ʋ�����)
@item @code{FIELD_TYPE_SET}             @tab @code{SET} �ե������
@item @code{FIELD_TYPE_ENUM}            @tab @code{ENUM} �ե������
@item @code{FIELD_TYPE_NULL}            @tab @code{NULL}�� �ե������
@item @code{FIELD_TYPE_CHAR}            @tab ��侩; @code{FIELD_TYPE_TINY} ������˻��Ѥ��Ƥ�������
@end multitable

@code{IS_NUM()} �ޥ����ǡ��ե�����ɤ����ͥ����פ��ɤ�����ƥ��ȤǤ��ޤ���
�ե�����ɤ����ͤξ�硢@code{type} ���Ф� @code{IS_NUM()} ���Ϥ���
TRUE ��ɾ�����ޤ�:

@example
if (IS_NUM(field->type))
    printf("Field is numeric\n");
@end example

@item unsigned int length
�ե�����ɤ���������ϥơ��֥�����ǻ��ꤵ�줿��ΤǤ���

@item unsigned int max_length
��̥��åȤΥե�����ɤκ�����(�ºݤη�̥��åȤ���Υ쥳���ɤκ�Ĺ�ե��������
��Ĺ��)��@code{mysql_store_result()} �ޤ��� @code{mysql_list_fields()} ��
���Ѥ�����ϡ�����ϥե�����ɤκ������ˤʤ�ޤ���
@code{mysql_use_result()} ����Ѥ�����ϡ������ѿ����ͤ� 0 �ˤʤ�ޤ���

@item unsigned int flags
�ե�����ɤμ�Υӥåȥե饰��@code{flags} �ͤ� 0 �ޤ��ϼ��ΥӥåȤΰ��
�ʾ���Ȥ߹�碌�Ǥ�:

@multitable @columnfractions .3 .55
@item @strong{�ե饰����}          @tab @strong{�ե饰�ΰ�̣}
@item @code{NOT_NULL_FLAG}       @tab �ե�����ɤ� @code{NULL} �ˤǤ��ʤ�
@item @code{PRI_KEY_FLAG}        @tab �ե�����ɤϥץ饤�ޥꥭ���ΰ����Ǥ���
@item @code{UNIQUE_KEY_FLAG}     @tab �ե�����ɤϥ�ˡ��������ΰ����Ǥ���
@item @code{MULTIPLE_KEY_FLAG}   @tab �ե�����ɤ����ˡ��������ΰ����Ǥ���
@item @code{UNSIGNED_FLAG}       @tab �ե�����ɤ� @code{UNSIGNED} °������äƤ���
@item @code{ZEROFILL_FLAG}       @tab �ե�����ɤ� @code{ZEROFILL} °������äƤ���
@item @code{BINARY_FLAG}         @tab �ե�����ɤ� @code{BINARY} °������äƤ���
@item @code{AUTO_INCREMENT_FLAG} @tab �ե�����ɤ� @code{AUTO_INCREMENT} °������äƤ���
@item @code{ENUM_FLAG}           @tab �ե�����ɤ� @code{ENUM} �Ǥ��� (��侩)
@item @code{BLOB_FLAG}           @tab �ե�����ɤ� @code{BLOB} �ޤ��� @code{TEXT} �Ǥ��� (��侩)
@item @code{TIMESTAMP_FLAG}      @tab �ե�����ɤ� @code{TIMESTAMP} �Ǥ��� (��侩)
@end multitable

@code{BLOB_FLAG}, @code{ENUM_FLAG}, @code{TIMESTAMP_FLAG} �λ��ѤϿ侩��
��ޤ��󡣤����Ϸ���°���ǤϤʤ��ե�����ɤη��򼨤�����Ǥ�������
�� @code{field->type} �� @code{FIELD_TYPE_BLOB}, @code{FIELD_TYPE_ENUM},
@code{FIELD_TYPE_TIMESTAMP} ���Ф��ƥƥ��Ȥ������򤪴��ᤷ�ޤ���

@noindent
������� @code{flags} �ͤ�ŵ��Ū�ʻ��Ѥ򼨤��Ƥ��ޤ�:

@example
if (field->flags & NOT_NULL_FLAG)
    printf("Field can't be null\n");
@end example

@code{flags} �ͤο������֤�Ĵ�٤뤿��ˡ����������ʥޥ�������ѤǤ�
�ޤ�:

@multitable @columnfractions .3 .5
@item @code{IS_NOT_NULL(flags)} @tab ���Υե�����ɤ� @code{NOT NULL} �Ȥ����������Ƥ���п�
@item @code{IS_PRI_KEY(flags)}  @tab ���Υե�����ɤ��ץ饤�ޥꥭ���ʤ�п�
@item @code{IS_BLOB(flags)}     @tab ���Υե�����ɤ� @code{BLOB} �ޤ��� @code{TEXT} �ʤ�п� (��侩; ����� @code{field->type} ��ƥ��Ȥ��Ʋ�����)
@end multitable

@item unsigned int decimals
���ͥե�����ɤξ����������
@end table

@node C API function overview, C API functions, C API datatypes, Clients
@section C API �ؿ�����

C API �ˤϼ��˰������줿�ؿ���¸�ߤ��ޤ��������δؿ��ϼ�����Ǥ���
��ܺ٤���������Ƥ��ޤ���
@xref{C API functions}��

@multitable @columnfractions .3 .7
@item @strong{mysql_affected_rows()} @tab
�Ǹ�� @code{UPDATE}, @code{DELETE}, @code{INSERT} ������ˤ�äƱƶ���
�줿�쥳���ɿ����֤��ޤ���

@item @strong{mysql_close()} @tab
��������³�򥯥��������ޤ���

@item @strong{mysql_connect()} @tab
@strong{MySQL} �����Ф���³���ޤ������δؿ��Ͽ侩����ޤ���; �����
@code{mysql_real_connect()} ����Ѥ��Ƥ���������

@item @strong{mysql_change_user()} @tab
��³��ΤΥ桼���ȥǡ����١������ѹ����ޤ���

@item @strong{mysql_create_db()} @tab
�ǡ����١������������ޤ������δؿ��Ͽ侩����ޤ���; ����� SQL ���ޥ�
�� @code{CREATE DATABASE} ����Ѥ��Ƥ���������

@item @strong{mysql_data_seek()} @tab
�������̥��å����Ǥ�դΥ쥳���ɤ˥��������ޤ���

@item @strong{mysql_debug()} @tab
Ϳ����줿ʸ����� @code{DBUG_PUSH} ��Ԥʤ��ޤ���

@item @strong{mysql_drop_db()} @tab
�ǡ����١������˴����ޤ������δؿ��Ͽ侩����ޤ���; ����� SQL ���ޥ�
�� @code{DROP DATABASE} ����Ѥ��Ƥ���������

@item @strong{mysql_dump_debug_info()} @tab
�����Фˡ��ǥХå����������˽񤭽Ф����ޤ���

@item @strong{mysql_eof()} @tab
��̥��åȤκǸ�Υ쥳���ɤ��ɤޤ줿���ɤ�����Ƚ�ꤷ�ޤ������δؿ��Ͽ侩����ޤ�
��; ����� @code{mysql_errno()} �ޤ��� @code{mysql_error()} ����Ѥ��Ʋ�
������

@item @strong{mysql_errno()} @tab
�Ǹ�� @strong{MySQL} �ؿ�����Υ��顼�ֹ���֤��ޤ���

@item @strong{mysql_error()} @tab
�Ǹ�� @strong{MySQL} �ؿ�����Υ��顼��å��������֤��ޤ���

@item @strong{mysql_real_escape_string()} @tab
Escapes special characters in a string for use in a SQL statement taking
into account the current charset of the connection.

@item @strong{mysql_escape_string()} @tab
SQL ���ơ��ȥ�����ǻ��Ѥ��뤿���ʸ��������ü�ʸ���򥨥������פ��ޤ���

@item @strong{mysql_fetch_field()} @tab
�ơ��֥�μ��Υե�����ɤη����֤��ޤ���

@item @strong{mysql_fetch_field_direct()} @tab
�ơ��֥�Ρ��ֹ�ǻ��ꤵ�줿�ե�����ɤη����֤��ޤ���

@item @strong{mysql_fetch_fields()} @tab
���ƤΥե�����ɹ�¤�Τ�������֤��ޤ���

@item @strong{mysql_fetch_lengths()} @tab
���ߤΥ쥳����������ƤΥե�����ɤ�Ĺ�����֤��ޤ���

@item @strong{mysql_fetch_row()} @tab
��̥��åȤ��鼡�Υ쥳���ɤ���Ф��ޤ���

@item @strong{mysql_field_seek()} @tab
���ꤵ�줿�ե�����ɾ�˥ե�����ɥ���������֤��ޤ���

@item @strong{mysql_field_count()} @tab
�Ǹ�Υ�����η�̤Υե�����ɤο����֤��ޤ���

@item @strong{mysql_field_tell()} @tab
�Ǹ�� @code{mysql_fetch_field()} �ǻ��Ѥ��줿�ե�����ɥ�������ΰ��֤���
���ޤ���

@item @strong{mysql_free_result()} @tab
��̥��åȤˤ�äƻ��Ѥ��줿�����������ޤ���

@item @strong{mysql_get_client_info()} @tab
���饤����ȥС�����������֤��ޤ���

@item @strong{mysql_get_host_info()} @tab
��³����������ʸ������֤��ޤ���

@item @strong{mysql_get_proto_info()} @tab
��³�˻��Ѥ����ץ��ȥ���С��������֤��ޤ���

@item @strong{mysql_get_server_info()} @tab
�����ФΥС�������ֹ���֤��ޤ���

@item @strong{mysql_info()} @tab
�Ǹ�˼¹Ԥ��줿������ˤĤ��Ƥξ�����֤��ޤ���

@item @strong{mysql_init()} @tab
@code{MYSQL} ��¤�Τ�����ޤ��Ͻ�������ޤ���

@item @strong{mysql_insert_id()} @tab
@code{AUTO_INCREMENT} �ե�����ɤ˺Ǹ���������줿 ID ���֤��ޤ���

@item @strong{mysql_kill()} @tab
���ꤵ�줿����åɤ򻦤��ޤ���

@item @strong{mysql_list_dbs()} @tab
�ʰ�����ɽ����Ŭ�礹��ǡ����١���̾���֤��ޤ���

@item @strong{mysql_list_fields()} @tab
�ʰ�����ɽ����Ŭ�礹��ե������̾���֤��ޤ���

@item @strong{mysql_list_processes()} @tab
���ߤΥ����Х���åɤΥꥹ�Ȥ��֤��ޤ���

@item @strong{mysql_list_tables()} @tab
�ʰ�����ɽ����Ŭ�礹��ơ��֥�̾���֤��ޤ���

@item @strong{mysql_num_fields()} @tab
��̥��å���Υե�����ɿ����֤��ޤ���

@item @strong{mysql_num_rows()} @tab
��̥��å���Υ쥳���ɿ����֤��ޤ���

@item @strong{mysql_options()} @tab
@code{mysql_connect()} �Τ������³���ץ��������ꤷ�ޤ���

@item @strong{mysql_ping()} @tab
�����Фؤ���³��ư��Ƥ��뤫�ɤ���������å����ޤ���
ɬ�פǤ���к���³���ޤ���

@item @strong{mysql_query()} @tab
NULL ��üʸ����Ȥ��Ƶ��Ҥ��줿 SQL �������¹Ԥ��ޤ���

@item @strong{mysql_real_connect()} @tab
@strong{MySQL} �����Ф���³���ޤ���

@item @strong{mysql_real_query()} @tab
������줿ʸ����Ȥ��Ƶ��Ҥ��줿 SQL �������¹Ԥ��ޤ���

@item @strong{mysql_reload()} @tab
���¥ơ��֥����ɤ߹��ߤ���褦�˥����Ф˻ؼ����ޤ���

@item @strong{mysql_row_seek()} @tab
��̥��å���Τ���쥳���ɤإ��������ޤ���@code{mysql_row_tell()} �����֤�����ͤ�
���Ѥ��ޤ���

@item @strong{mysql_row_tell()} @tab
�쥳���ɥ�������ΰ��֤��֤��ޤ���

@item @strong{mysql_select_db()} @tab
�ǡ����١��������򤷤ޤ���

@item @strong{mysql_shutdown()} @tab
�ǡ����١��������Ф򥷥�åȥ����󤷤ޤ���

@item @strong{mysql_start_slave()} @tab
Starts slave replication thread

@item @strong{mysql_stat()} @tab
ʸ����ǥ����о��֤��֤��ޤ���

@item @strong{mysql_store_result()} @tab
���饤����Ȥ˴����ʷ�̥��åȤ���Ф��ޤ���

@item @strong{mysql_stop_slave()} @tab
Stops slave replication thread

@item @strong{mysql_thread_id()} @tab
���ߤΥ���å� ID ���֤��ޤ���

@item @strong{mysql_thread_save()} @tab
Returns 1 if the clients are compiled as threadsafe.

@item @strong{mysql_use_result()} @tab
�ƥ쥳���ɤ�ưŪ��̥��åȤ��������ޤ���
@end multitable

�����Ф���³����ˤϡ���³�ϥ�ɥ���������뤿��� @code{mysql_init()} 
��ƤӤ��������줫�� @code{mysql_real_connect()} �򤽤Υϥ�ɥ�ǸƤӤ���
�ޤ� (�ۥ���̾���桼��̾���ѥ���ɤΤ褦��¾�ξ���˲ä���)��
Upon connection, @code{mysql_real_connect()} sets the
@code{reconnect} flag (part of the MYSQL structure) to a value of
@code{1}. This flag indicates, in the event that a query cannot be
performed because of a lost connection, to try reconnecting to the
server before giving up.
������³��
�ν�������λ�������ϡ���³��λ�����뤿��� @code{mysql_close()} ��ƤӤ�
���ޤ���

��³��ͭ���ʴ֤ϡ����饤����Ȥ� @code{mysql_query()} �ޤ��� 
@code{mysql_real_query()} ����Ѥ��� SQL ������򥵡��Ф������Ǥ��ޤ�����
�Σ��Ĥΰ㤤�ϡ�@code{mysql_query()} �� NULL��üʸ����Ȥ��ƥ����꤬���Ҥ�
��뤳�Ȥ���Ԥ���Τ��Ф���@code{mysql_real_query()} �Ͽ�����줿ʸ�����
���Ԥ��뤳�ȤǤ���ʸ���󤬥Х��ʥ�ǡ���(NUL�Х��Ȥ�ޤߤ��Ȥ�����)��ޤ�
���ϡ�@code{mysql_real_query()} ����Ѥ���ɬ�פ�����ޤ���

��@code{SELECT} ������(�㤨�С�@code{INSERT}, @code{UPDATE},
@code{DELETE})�Ǥϡ��ɤ줯�餤�Υ쥳���ɤ��ƶ�(�ѹ�)���줿����
@code{mysql_affected_rows()} ��ƤӽФ����ȤǸ��Ĥ��Ф����Ȥ��Ǥ��ޤ���

@code{SELECT} ������Ǥϡ����򤵤줿�쥳���ɤ��̥��åȤȤ��Ƽ��Ф��ޤ���
(����: �����Ĥ��Υ��ơ��ȥ��Ȥϡ��쥳���ɤ��֤��Ȥ������� 
@code{SELECT}�˻��Ƥ��ޤ�������� @code{SHOW}, @code{DESCRIBE},
@code{EXPLAIN} �Ǥ��������� @code{SELECT} ���ơ��ȥ��Ȥ�Ʊ����ˡ�ǰ���
���٤��Ǥ���)

���饤����Ȥ���̥��åȤ��������ˤϣ��Ĥ���ˡ������ޤ�������ܤϡ�
@code{mysql_store_result()} ��ƤӽФ����Ȥǡ���̥��å����Τ���٤ˤ��٤�
���Ф����ȤǤ������δؿ��ϥ����Ф��饯����ˤ�ä��֤���뤹�٤ƤΥ쥳��
�ɤ������������򥯥饤����Ȥ˳�Ǽ���ޤ�������ܤϡ�
@code{mysql_use_result()} ��ƤӽФ����Ȥǡ��쥳���ɤ��Ȥη�̥��åȼ���
�����������뤳�ȤǤ������δؿ��ϼ��Ф����������ޤ������ºݤˤϥ�����
���鲿�Υ쥳���ɤ����ޤ���

�ɤ���ξ��Ǥ⡢@code{mysql_fetch_row()} ��ƤӽФ��ƥ쥳���ɤ˥�������
���ޤ���@code{mysql_store_result()} �Ǥϡ�@code{mysql_fetch_row()} �ϴ���
�����Ф���������Ƥ���쥳���ɤ˥����������ޤ���
@code{mysql_use_result()} �Ǥϡ�@code{mysql_fetch_row()} �ϼºݤ˥����Ф�
��쥳���ɤ���Ф��ޤ����ƥ쥳���ɤΥǡ����ͤΥ������ˤĤ��Ƥξ���� 
@code{mysql_fetch_lengths()} ��ƤӽФ����Ȥ������ޤ���

��̥��åȤǤν��������ä���ϡ�@code{mysql_free_result()} ��ƤӽФ�����
�줬���Ѥ��Ƥ��������������Ʋ�������

���Σ��Ĥμ��Ф�����������Ū�ʤ�ΤǤ������饤����ȥץ������ϡ�ɬ�פ�
��äƤ�äȤ�Ŭ�ڤʥ��ץ����������򤹤٤��Ǥ�������Ū�ˡ����饤����Ȥϰ�
�̤� @code{mysql_store_result()} ����Ѥ��뷹���ˤ���ޤ���

@code{mysql_store_result()} �������ϡ����٤ƤΥ쥳���ɤ򥯥饤����Ȥ˼��
����뤿�ᡢϢ³���ƥ쥳���ɤ򥢥������Ǥ�������Ǥʤ�����̥��å���θ���
�Υ쥳���ɰ��֤��ѹ����뤿��ˡ�@code{mysql_data_seek()} �� 
@code{mysql_row_seek()} ����Ѥ��ơ���̥��åȤ���������˰�ư���뤳�Ȥ�
�Ǥ��ޤ����ޤ���@code{mysql_num_rows()} ��ƤӽФ����Ȥǡ��쥳���ɿ��򸫤�
���뤳�Ȥ�Ǥ��ޤ���������@code{mysql_store_result()} ��ɬ�ץ���ϡ��礭
�ʷ�̥��åȤǤϤȤƤ�⤯��out-of-memory ���֤����������ǽ�����⤯�ʤ��
����

@code{mysql_use_result()} �������ϡ����٤˰�ĤΥ쥳���ɤ������ݻ����뤿�ᡢ
���饤����Ȥ���̥��åȤ��׵᤹����꤬���ʤ����ȤǤ��ʤ����ơ������Υ���
�С��إåɤ⾯�ʤ��Τǡ�@code{mysql_use_result()} �Ϥ��®���ʤ�ޤ��ˡ���
�������ϡ������Фι�«���򤱤뤿�ᡢ�ƥ쥳���ɤ����᤯��������ɬ�פ����뤳
�ȡ���̥��å���ǥ쥳���ɤΥ����ॢ���������Ǥ��ʤ����ȡʥ쥳���ɤ����
�˥����������뤳�Ȥ����Ǥ��ޤ���ˡ������ơ����٤ƤΥ쥳���ɤ���Ф��ʤ�
�¤ꡢ��̥��å���ˤ����ĤΥ쥳���ɤ����뤫���Τ뤳�Ȥ��Ǥ��ʤ����ȤǤ���
����ˡ����ʤ���õ���Ƥ������򡢸���������Ǹ��Ĥ��뤳�Ȥ��Ǥ��ơ����꤬
��褷���Ȥ��Ƥ⡢���٤ƤΥ쥳���ɤ���Ф�@emph{�ʤ���Фʤ�ޤ���}��

API �ϥ��饤����Ȥ������꤬ @code{SELECT} �Ǥ��뤫�ɤ������Τ뤳�Ȥʤ��ˡ�
��ɬ�׻������쥳���ɤ���Ф��˥������Ŭ�ڤ˱����Ǥ���褦�ˤ��ޤ���
���줾��� @code{mysql_query()}�ʤޤ��� @code{mysql_real_query()}�ˤθ�ǡ�
@code{mysql_store_result()} ��ƤӽФ����Ȥǡ����줬��ǽ�Ǥ�����̥��åȤ�
�ƤӽФ�����������ȡ�������� @code{SELECT} �Ǥ��ꡢ�쥳���ɤ��ɤळ�Ȥ�
�Ǥ��ޤ�����̥��åȸƤӽФ������Ԥ������ϡ���̤��ºݤ˴��Ԥ��줿��Τ�
���뤫�ɤ�������ꤹ�뤿��ˡ�@code{mysql_field_count()} ��ƤӽФ��Ƥ���
������@code{mysql_field_count()} �� 0 ���֤����ϡ�������ϥǡ������֤���
����ʥ����꤬ @code{INSERT}, @code{UPDATE}, @code{DELETE} ���Ǥ��뤳�Ȥ�
�����ޤ��ˡ��Ĥޤ�쥳���ɤ��֤뤳�Ȥ���ԤǤ��ޤ���
@code{mysql_field_count()} �� 0 �Ǥʤ����ϡ�������ϥ쥳���ɤ��֤��٤���
�Τˡ��֤��ʤ��ä��Ȥ������ȤǤ�������ϥ����꤬ @code{SELECT} �Ǽ��Ԥ���
�Ȥ������Ȥ򼨤��ޤ��������ɤΤ褦�˹Ԥʤ����Ȥ��Ǥ��뤫����ϡ�
@code{mysql_field_count()} �������򻲾Ȥ��Ƥ���������

@code{mysql_store_result()} �� @code{mysql_use_result()} �Ϥɤ���⡢���
���åȤ���ե�����ɤˤĤ��Ƥξ���ʥե�����ɤο�������̾���䷿�ʤɡˤ�
�������뤳�Ȥ��Ǥ��ޤ���@code{mysql_fetch_field()} �򷫤��֤��ƤӽФ�����
�ǽ��֤ˡ��ޤ��ϡ�@code{mysql_fetch_field_direct()} ��ƤӽФ����Ȥǥ쥳��
����Υե�������ֹ�ǡ��쥳������Υե�����ɾ���˥����������뤳�Ȥ��Ǥ�
�ޤ������ߤΥե�����ɥ���������֤� @code{mysql_field_seek()} ��ƤӽФ�
���Ȥ��ѹ��Ǥ��ޤ����ե�����ɥ������������ϡ����θ�� 
@code{mysql_fetch_field()} �ƤӽФ��˱ƶ����ޤ���
@code{mysql_fetch_fields()} ��ƤӽФ����Ȥǡ����٤ˤ��٤ƤΥե�����ɤξ�
������뤳�Ȥ�Ǥ��ޤ���

���顼�θ��С����ˤĤ��Ƥϡ�@code{mysql_errno()} �� 
@code{mysql_error()} �ؿ�����ˡ�ˤ�äơ�@strong{MySQL} �ϥ��顼����ؤΥ�
���������󶡤��ޤ��������ϡ��Ǹ�˸ƤӽФ��줿�����ޤ��ϼ��Ԥ�����ؿ���
�Ĥ��ƤΥ��顼�����ɤȥ��顼��å��������֤������顼�����IJ���ȯ����������
���ꤹ�뤳�Ȥ��Ǥ��ޤ���

@node C API functions, Perl, C API function overview, Clients
@section C API �ؿ�����

@menu
* mysql_affected_rows::         @code{mysql_affected_rows()}
* mysql_close::                 @code{mysql_close()}
* mysql_connect::               @code{mysql_connect()}
* mysql_change_user::           @code{mysql_change_user()}
* mysql_create_db::             @code{mysql_create_db()}
* mysql_data_seek::             @code{mysql_data_seek()}
* mysql_debug::                 @code{mysql_debug()}
* mysql_drop_db::               @code{mysql_drop_db()}
* mysql_dump_debug_info::       @code{mysql_dump_debug_info()}
* mysql_eof::                   @code{mysql_eof()}
* mysql_errno::                 @code{mysql_errno()}
* mysql_error::                 @code{mysql_error()}
* mysql_escape_string::         @code{mysql_escape_string()}
* mysql_fetch_field::           @code{mysql_fetch_field()}
* mysql_fetch_fields::          @code{mysql_fetch_fields()}
* mysql_fetch_field_direct::    @code{mysql_fetch_field_direct()}
* mysql_fetch_lengths::         @code{mysql_fetch_lengths()}
* mysql_fetch_row::             @code{mysql_fetch_row()}
* mysql_field_count::           @code{mysql_field_count()}
* mysql_field_seek::            @code{mysql_field_seek()}
* mysql_field_tell::            @code{mysql_field_tell()}
* mysql_free_result::           @code{mysql_free_result()}
* mysql_get_client_info::       @code{mysql_get_client_info()}
* mysql_get_host_info::         @code{mysql_get_host_info()}
* mysql_get_proto_info::        @code{mysql_get_proto_info()}
* mysql_get_server_info::       @code{mysql_get_server_info()}
* mysql_info::                  @code{mysql_info()}
* mysql_init::                  @code{mysql_init()}
* mysql_insert_id::             @code{mysql_insert_id()}
* mysql_kill::                  @code{mysql_kill()}
* mysql_list_dbs::              @code{mysql_list_dbs()}
* mysql_list_fields::           @code{mysql_list_fields()}
* mysql_list_processes::        @code{mysql_list_processes()}
* mysql_list_tables::           @code{mysql_list_tables()}
* mysql_num_fields::            @code{mysql_num_fields()}
* mysql_num_rows::              @code{mysql_num_rows()}
* mysql_options::               @code{mysql_options()}
* mysql_ping::                  @code{mysql_ping()}
* mysql_query::                 @code{mysql_query()}
* mysql_real_connect::          @code{mysql_real_connect()}
* mysql_real_escape_string::    @code{mysql_real_escape_string()}
* mysql_real_query::            @code{mysql_real_query()}
* mysql_reload::                @code{mysql_reload()}
* mysql_row_seek::              @code{mysql_row_seek()}
* mysql_row_tell::              @code{mysql_row_tell()}
* mysql_select_db::             @code{mysql_select_db()}
* mysql_shutdown::              @code{mysql_shutdown()}
* mysql_stat::                  @code{mysql_stat()}
* mysql_store_result::          @code{mysql_store_result()}
* mysql_thread_id::             @code{mysql_thread_id()}
* mysql_use_result::            @code{mysql_use_result()}
* NULL mysql_store_result::     Why is it that after @code{mysql_query()} returns success, @code{mysql_store_result()} sometimes returns @code{NULL?}
* Query results::               What results can I get from a query?
* Getting unique ID::           How can I get the unique ID for the last inserted row?
* C API linking problems::      Problems linking with the C API
* Thread-safe clients::         How to make a thread-safe client
@end menu

�ʲ��������Ǥϡ�@code{NULL} �ΰ����ޤ�������ͤ� C �ץ�����ߥ󥰸����
�� @code{NULL} ���̣���ޤ���@strong{MySQL} @code{NULL} �ͤǤϤ���ޤ���
 
�ؿ����̾�ݥ��󥿤��������ͤ��֤��ޤ����������ؿ������˵��Ҥ������硢
�ݥ��󥿤��֤��ؿ��ϡ������򼨤�������� @code{NULL} �ͤ��֤������顼�򼨤���
��� @code{NULL} ���֤��ޤ����������֤��ؿ��ϡ������򼨤������ 0 ���֤���
���顼�򼨤��������0���֤��ޤ���``��0'' �ϴؿ�������¾�˽Ҥ٤Ƥ��ʤ���
�ꡢ���ΰ�̣�ˤʤ뤳�Ȥ����դ��Ƥ�������; �ؿ�������¾�˽Ҥ٤Ƥ����硢
�������Ф��� 0 �ʳ��θ�ͭ���ͤ�ƥ��Ȥ��ʤ��Ǥ�������:

@example
if (result)                   /* ������ */
    ... error ...

if (result < 0)               /* �ְ㤤 */
    ... error ...

if (result == -1)             /* �ְ㤤 */
    ... error ...
@end example

�ؿ������顼���֤��Ȥ����ؿ������� @strong{���顼} �᤬�������륨�顼��
�����������Ƥ��ޤ���@code{mysql_errno()} �θƤӽФ��ˤ�äƤɤ줬ȯ��
�������򸫤Ĥ��Ф����Ȥ��Ǥ��ޤ������顼��ɽ������ʸ����� 
@code{mysql_error()} �θƤӽФ��ˤ�ä������ޤ���

@findex @code{mysql_affected_rows()}
@node mysql_affected_rows, mysql_close, C API functions, C API functions
@subsection @code{mysql_affected_rows()}

@code{my_ulonglong mysql_affected_rows(MYSQL *mysql)}

@subsubheading ����

�Ǹ�� @code{UPDATE}, @code{DELETE}, @code{INSERT} ������ˤ�äƱƶ���
�줿(�ѹ����줿)�Կ����֤��ޤ���@code{UPDATE}, @code{DELETE}, @code{INSERT} ���ơ���
���ȤǤ� @code{mysql_query()} ľ��˸ƤӽФ��ޤ���@code{SELECT} ���ơ���
���ȤǤϡ������ @code{mysql_num_rows()} �˻���ư���򤷤ޤ���

@code{mysql_affected_rows()} �ϸ��ߥޥ����Ȥ��Ƽ�������Ƥ��ޤ���

@subsubheading �����

0 ����礭�������ϱƶ����줿�Կ��ޤ��ϼ��Ф��줿�Կ��򼨤��ޤ���������
�� @code{WHERE} ���Ŭ�礷���쥳���ɤ��ʤ����ޤ��ϥ����꤬�ޤ��¹Ԥ���
�Ƥ��ʤ����� 0 �Ǥ��������꤬���顼���֤�������@code{SELECT} �������
�Ĥ��� @code{mysql_store_result()} ���ƤФ������
@code{mysql_affected_rows()} ���ƤФ줿���� -1 �Ǥ���

@subsubheading ���顼

̵����

@subsubheading ��

@example
mysql_query(&mysql,"UPDATE products SET cost=cost*1.25 WHERE group=10");
printf("%d products updated",mysql_affected_rows(&mysql));
@end example

@findex @code{mysql_close()}
@node mysql_close, mysql_connect, mysql_affected_rows, C API functions
@subsection @code{mysql_close()}

@code{void mysql_close(MYSQL *mysql)}

@subsubheading ����
���˥����ץ󤵤줿��³�򥯥��������ޤ����ϥ�ɥ뤬 @code{mysql_init()} ��
���� @code{mysql_connect()} �Ǽ�ưŪ�˳�����Ƥ�줿��硢
@code{mysql_close()} �� @code{mysql} �Ǽ��������³�ϥ�ɥ�β�����Ԥʤ�
�ޤ���

@subsubheading �����

̵����

@subsubheading ���顼

@table @code
@item CR_COMMANDS_OUT_OF_SYNC
�����ʽ�˥��ޥ�ɤ��¹Ԥ��줿��

@item CR_SERVER_GONE_ERROR
@strong{MySQL} �����Ф����ʤ��ʤä���

@item CR_SERVER_LOST
�����Фؤ���³����������˼���줿��

@item CR_UNKNOWN_ERROR
̤�ΤΥ��顼��ȯ��������
@end table

@findex @code{mysql_connect()}
@node mysql_connect, mysql_change_user, mysql_close, C API functions
@subsection @code{mysql_connect()}

@code{MYSQL *mysql_connect(MYSQL *mysql, const char *host, const char *user, const char *passwd)}

@subsubheading ����

���δؿ��Ͽ侩����ޤ�������� @code{mysql_real_connect()} �λ��Ѥ�
�����ᤷ�ޤ���

@code{mysql_connect()} �� @code{host} ���ư��Ƥ��� @strong{MySQL} �ǡ�
���١������󥸥�ؤ���³�γ�Ω���ߤޤ���@code{mysql_get_client_info()} 
�����¾�Τ��٤Ƥ� API �ؿ���¹Ԥ�������@code{mysql_connect()} ��������λ
���Ƥ���ɬ�פ�����ޤ���

�ѥ�᡼���ΰ�̣�� @code{mysql_real_connect()} ���б�����ѥ�᡼����Ʊ���Ǥ�����
��³�ѥ�᡼���� @code{NULL} �ˤǤ��뤳�Ȥ��ۤʤ�ޤ������ξ�� C API ����
³��¤�Τ˼�ưŪ�˥���������ơ�@code{mysql_close()} �ƤӽФ����ˤ���
��������ޤ������Υ��ץ�������������������³�����Ԥ������˥��顼��å���
������Ф����Ȥ��Ǥ��ʤ����ȤǤ�����@code{mysql_errno()} �ޤ��� 
@code{mysql_error()} ���饨�顼���������ˤϡ������� @code{MYSQL} �ݥ���
�����󶡤���ɬ�פ�����ޤ�����

@subsubheading �����

@code{mysql_real_connect()} ��Ʊ��

@subsubheading ���顼

@code{mysql_real_connect()} ��Ʊ��

@findex @code{mysql_change_user()}
@node mysql_change_user, mysql_create_db, mysql_connect, C API functions
@subsection @code{mysql_change_user()}

@code{my_bool mysql_change_user(MYSQL *mysql, const char *user, const
char *password, const char *db)}

@subsubheading ����

�桼�����ѹ�����@code{mysql} �Ǽ����줿��³��ǡ�@code{db} �Ǽ����줿�ǡ�
���١������ǥե���ȡʸ��ߤΡ˥ǡ����١����ˤʤ�ޤ������θ�Υ�����Ǥϡ�
����Ū�ʥǡ����١����λ����ޤ�Ǥ��ʤ��ơ��֥뻲�ȤˤĤ��ơ����Υǡ����١�
�����ǥե���Ȥˤʤ�ޤ���

���δؿ��� @strong{MySQL} 3.23.3 ��Ƴ������ޤ�����

@code{mysql_change_user()} ����³���줿�桼����ǧ�ڤ���ʤ���硢�ޤ��ϥǡ�
���١�������Ѥ��븢�¤���äƤ��ʤ����˼��Ԥ��ޤ������ξ�硢�桼���ȥǡ�
���١������ѹ�����ޤ���

�ǥե���ȥǡ����١�������������ʤ���硢@code{db} �ѥ�᡼���� 
@code{NULL} ������Ǥ��ޤ���

@subsubheading �����

������ 0�����顼��ȯ������������0��

@subsubheading ���顼

@code{mysql_real_connect()} �����������Τ�Ʊ���Ǥ���

@table @code
@item CR_COMMANDS_OUT_OF_SYNC
�����ʽ�˥��ޥ�ɤ��¹Ԥ��줿��
@item CR_SERVER_GONE_ERROR
@strong{MySQL} �����Ф����ʤ��ʤä���
@item CR_SERVER_LOST
�����Фؤ���³����������˼���줿��
@item CR_UNKNOWN_ERROR
̤�ΤΥ��顼��ȯ��������
@item ER_UNKNOWN_COM_ERROR
@strong{MySQL} �����ФϤ��Υ��ޥ�ɤ�������Ƥ��ʤ��ʤ����餯�Ť������Сˡ�
@item ER_ACCESS_DENIED_ERROR
�桼���ޤ��ϥѥ���ɤ��ְ�äƤ��롣
@item ER_BAD_DB_ERROR
�ǡ����١�����¸�ߤ��ʤ���
@item ER_DBACCESS_DENIED_ERROR
�桼�����ǡ����١����ؤΥ�������������äƤ��ʤ���
@item ER_WRONG_DB_NAME
�ǡ����١���̾��Ĺ�᤮�롣
@end table

@subsubheading ��

@example
if (mysql_change_user(&mysql, "user", "password", "new_database"))
@{
   fprintf(stderr, "Failed to change user.  Error: %s\n",
           mysql_error(&mysql));
@}
@end example

@findex @code{mysql_create_db()}
@node mysql_create_db, mysql_data_seek, mysql_change_user, C API functions
@subsection @code{mysql_create_db()}

@code{int mysql_create_db(MYSQL *mysql, const char *db)}

@subsubheading ����
@code{db} �����ˤ�äƻ��ꤵ�줿�ǡ����١�����������ޤ���

���δؿ��Ͽ侩����ޤ�������� @code{mysql_query()} ��Ȥäơ�SQL
@code{CREATE DATABASE} ���ơ��ȥ��Ȥ�ȯ�Ԥ��뤳�Ȥ򤪴��ᤷ�ޤ���

@subsubheading �����

�ǡ����١����κ�����������������0�����顼��ȯ������������0��

@subsubheading ���顼
@table @code

@item CR_COMMANDS_OUT_OF_SYNC
�����ʽ�˥��ޥ�ɤ��¹Ԥ��줿��

@item CR_SERVER_GONE_ERROR
@strong{MySQL} �����Ф����ʤ��ʤä���

@item CR_SERVER_LOST
�����Фؤ���³����������˼���줿��

@item CR_UNKNOWN_ERROR
̤�ΤΥ��顼��ȯ��������
@end table

@subsubheading ��

@example
if(mysql_create_db(&mysql, "my_database"))
@{
   fprintf(stderr, "Failed to create new database.  Error: %s\n",
           mysql_error(&mysql));
@}
@end example

@findex @code{mysql_data_seek()}
@node mysql_data_seek, mysql_debug, mysql_create_db, C API functions
@subsection @code{mysql_data_seek()}

@code{void mysql_data_seek(MYSQL_RES *result, unsigned long long offset)}

@subsubheading ����
�������̥��å����Ǥ�դΥ쥳���ɤ˥��������ޤ�������ϡ���̥��åȹ�¤��
��������Τ��٤Ƥη�̤���äƤ��뤳�Ȥ��׵ᤷ�ޤ������Τ��ᡢ
@code{mysql_data_seek()} �� @code{mysql_store_result()} �ȶ��ˤ������Ѥ��졢
@code{mysql_use_result()} �ȶ��ˤϻ��ѤǤ��ޤ���

���ե��åȤ��ͤ� @code{0} ���� @code{mysql_num_rows(result)-1} �Ǥʤ��Ƥ�
�ʤ�ޤ���

@subsubheading �����

̵����

@subsubheading ���顼
̵����

@findex @code{mysql_debug()}
@node mysql_debug, mysql_drop_db, mysql_data_seek, C API functions
@subsection @code{mysql_debug()}

@code{void mysql_debug(char *debug)}

@subsubheading ����
Ϳ����줿ʸ����� @code{DBUG_PUSH} ��Ԥʤ��ޤ���@code{mysql_debug()} 
�� Fred Fish ���������� debug library ����Ѥ��ޤ������δؿ�����Ѥ��뤿��ˤϡ��ǥХ�
���򥵥ݡ��Ȥ���褦�ˡ����饤����ȥ饤�֥��򥳥�ѥ��뤹��ɬ�פ�����
�ޤ���
@xref{Debugging server}. @xref{Debugging client}.

@subsubheading �����

̵����

@subsubheading ���顼
̵����

@subsubheading ��

���˼������ƤӽФ��ϡ����饤����ȥ饤�֥�꤬�����饤����ȥޥ����� 
@file{/tmp/client.trace} �˥ȥ졼���ե�������������ޤ�:

@example
mysql_debug("d:t:O,/tmp/client.trace");
@end example

@findex @code{mysql_drop_db()}
@node mysql_drop_db, mysql_dump_debug_info, mysql_debug, C API functions
@subsection @code{mysql_drop_db()}

@code{int mysql_drop_db(MYSQL *mysql, const char *db)}

@subsubheading ����
@code{db} �����ˤ�äƻ��ꤵ�줿�ǡ����١������˴����ޤ���

���δؿ��Ͽ侩����ޤ�������� @code{mysql_query()} ��Ȥäơ�SQL
@code{DROP DATABASE} ���ơ��ȥ��Ȥ�ȯ�Ԥ��뤳�Ȥ򤪴��ᤷ�ޤ���

@subsubheading �����

�ǡ����١������˴���������������0�����顼��ȯ������������0��

@subsubheading ���顼

@table @code
@item CR_COMMANDS_OUT_OF_SYNC
�����ʽ�˥��ޥ�ɤ��¹Ԥ��줿��
@item CR_SERVER_GONE_ERROR
@strong{MySQL} �����Ф����ʤ��ʤä���
@item CR_SERVER_LOST
�����Фؤ���³����������˼���줿��
@item CR_UNKNOWN_ERROR
̤�ΤΥ��顼��ȯ��������
@end table

@subsubheading ��

@example
if(mysql_drop_db(&mysql, "my_database"))
  fprintf(stderr, "Failed to drop the database: Error: %s\n",
          mysql_error(&mysql));
@end example

@findex @code{mysql_dump_debug_info()}
@node mysql_dump_debug_info, mysql_eof, mysql_drop_db, C API functions
@subsection @code{mysql_dump_debug_info()}

@code{int mysql_dump_debug_info(MYSQL *mysql)}

@subsubheading ����

�����Ĥ��ΥǥХå����������˥���פ���褦�˥����Ф˻ؼ����ޤ�������ư
��򤹤뤿��ˤϡ���³���줿�桼���� @strong{process} ������äƤ��ʤ�
��Фʤ�ޤ���

@subsubheading �����

���ޥ�ɤ�������������0�����ޥ�ɤ����Ԥ���������0��

@subsubheading ���顼
@table @code
@item CR_COMMANDS_OUT_OF_SYNC
�����ʽ�˥��ޥ�ɤ��¹Ԥ��줿��
@item CR_SERVER_GONE_ERROR
@strong{MySQL} �����Ф����ʤ��ʤä���
@item CR_SERVER_LOST
�����Фؤ���³����������˼���줿��
@item CR_UNKNOWN_ERROR
̤�ΤΥ��顼��ȯ��������
@end table

@findex @code{mysql_eof()}
@node mysql_eof, mysql_errno, mysql_dump_debug_info, C API functions
@subsection @code{mysql_eof()}

@code{my_bool mysql_eof(MYSQL_RES *result)}

@subsubheading ����

���δؿ��Ͽ侩����ޤ���@code{mysql_errno()} �� @code{mysql_error()} ��
����˻��ѤǤ��ޤ���

@code{mysql_eof()} �Ϸ�̥��åȤκǸ�Υ쥳���ɤ��ɤޤ줿���ɤ�����Ĵ�٤�
����

@code{mysql_store_result()} �θƤӽФ����������ơ���̥��åȤ����ꤷ����硢
���饤����Ȥϰ�ĤΥ��ڥ졼�����Ǥ��٤ƤΥ��åȤ�������ޤ������ξ�硢
@code{mysql_fetch_row()} �����֤���� @code{NULL} �ϡ���˷�̥��åȤν�ü
��ã�������Ȥ��̣����@code{mysql_eof()} ��Ƥ�ɬ�פϤ���ޤ���

��������̥��åȼ��Ф��ν�����Τ���� @code{mysql_use_result()} �����
�����硢���åȤΥ쥳���ɤ� @code{mysql_fetch_row()} �򷫤��֤��Ƥ֤��Ȥ�
��ꡢ�ҤȤĤ��ĥ����Ф����������ޤ������ν��������³��ǥ��顼��ȯ����
���뤿�ᡢ@code{mysql_fetch_row()} ���������� @code{NULL} �ϡ��̾�ɬ����
���̥��åȤν�ü��ã�������Ȥ��̣���ޤ��󡣤��ξ�� 
@code{mysql_eof()} ����Ѥ��ơ����������ä����򸡽ФǤ��ޤ�����̥��åȤ�
��ü��ã�������� @code{mysql_eof()} ����0�ͤ��֤������顼��ȯ���������
�� 0 ���֤��ޤ���

���Ū�� @code{mysql_eof()} ��ɸ�� @strong{MySQL} ���顼�ؿ� 
@code{mysql_errno()} �� @code{mysql_error()} �������̤�ޤ��������Υ��顼
�ؿ���Ʊ��������󶡤���Τǡ������λ��Ѥ� @code{mysql_eof()} ���⹥��
��ޤ���@code{mysql_eof()} �ϸ��߿侩����ޤ��󡣡ʼºݡ�������¿���ξ�
����󶡤��ޤ������顼�ؿ��ϥ��顼��ȯ���������Υ��顼����ͳ�򼨤��ޤ�����
@code{mysql_eof()} �Ͽ����ͤ������֤��ޤ�����

@subsubheading �����

���顼��ȯ�����ʤ��ä�����0����̥��åȤν�ü��ã����������0��

@subsubheading ���顼
̵����

@subsubheading ��

������� @code{mysql_eof} �λ�����ˡ�򼨤��ޤ�:

@example
mysql_query(&mysql,"SELECT * FROM some_table");
result = mysql_use_result(&mysql);
while((row = mysql_fetch_row(result)))
@{
    // do something with data
@}
if(!mysql_eof(result))  // mysql_fetch_row() failed due to an error
@{
    fprintf(stderr, "Error: %s\n", mysql_error(&mysql));
@}
@end example

��������ɸ�� @strong{MySQL} ���顼�ؿ���Ʊ�����̤����뤳�Ȥ��Ǥ��ޤ�:

@example
mysql_query(&mysql,"SELECT * FROM some_table");
result = mysql_use_result(&mysql);
while((row = mysql_fetch_row(result)))
@{
    // do something with data
@}
if(mysql_errno(&mysql))  // mysql_fetch_row() failed due to an error
@{
    fprintf(stderr, "Error: %s\n", mysql_error(&mysql));
@}
@end example

@findex @code{mysql_errno()}
@node mysql_errno, mysql_error, mysql_eof, C API functions
@subsection @code{mysql_errno()}

@code{unsigned int mysql_errno(MYSQL *mysql)}

@subsubheading ����

@code{mysql} �ˤ�äƻ��ꤵ�줿��³��ǡ��Ǹ�˸ƤӽФ��줿 API �ؿ������ݤΥ��顼����
�ɤ��֤��ޤ��������0�ϥ��顼��ȯ�����ʤ��ä����Ȥ��̣���ޤ������饤��
��ȥ��顼��å������ֹ�� @file{errmsg.h} �˥ꥹ�Ȥ���Ƥ��ޤ���������
���顼��å������ֹ�� @file{mysqld_error.h} �˥ꥹ�Ȥ���Ƥ��ޤ���

@subsubheading �����: 

���顼�������͡����顼��ȯ�����Ƥ��ʤ�����0��

@subsubheading ���顼
̵����

@findex @code{mysql_error()}
@node mysql_error, mysql_escape_string, mysql_errno, C API functions
@subsection @code{mysql_error()}

@code{char *mysql_error(MYSQL *mysql)}

@subsubheading ����

@code{mysql} �ˤ�äƻ��ꤵ�줿��³��ǡ� @code{mysql_error()} ��
�Ǹ�˸ƤӽФ��줿 API �ؿ������ݤ򡢥��顼��å������Ȥ����֤��ޤ���
���顼ȯ�����ʤ��ä����϶�ʸ���� (@code{""}) ���֤���ޤ���
����ϼ��Σ��ĤΥƥ��Ȥ�Ʊ���Ǥ��뤳�Ȥ��̣���ޤ�:

@example
if(mysql_errno(&mysql))
@{
    // an error occurred
@}

if(mysql_error(&mysql)[0] != '\0')
@{
    // an error occurred
@}
@end example

���饤����ȥ��顼��å������θ���� @strong{MySQL} ����
������ȥ饤�֥��κƥ���ѥ�����ѹ��Ǥ��ޤ������ߤϤ����Ĥ��θ���ǽ񤫤줿
���饤����ȥ��顼��å�����������Ǥ��ޤ���
@xref{Languages}.

@subsubheading �����

���顼��ɽ�魯ʸ����
���顼��ȯ�����Ƥ��ʤ����϶�ʸ����

@subsubheading ���顼
̵����

@findex @code{mysql_escape_string()}
@node mysql_escape_string, mysql_fetch_field, mysql_error, C API functions
@subsection @code{mysql_escape_string()}

You should use @code{mysql_real_escape_string()} instead!
 
This is identical to @code{mysql_real_escape_string()} except that it takes
the connection as the first argument. @code{mysql_real_escape_string()}
will escape the string according to the current character set while @code{mysql_escape_string()}
does not respect the current charset setting.

@findex @code{mysql_fetch_field()}
@node mysql_fetch_field, mysql_fetch_fields, mysql_escape_string, C API functions
@subsection @code{mysql_fetch_field()}

@code{MYSQL_FIELD *mysql_fetch_field(MYSQL_RES *result)}

@subsubheading ����

��̥��åȤΰ�ĤΥե�����ɤ������ @code{MYSQL_FIELD} ��¤�ΤȤ����֤���
������̥��å�������ƤΥե�����ɤˤĤ��ƾ������Ф��ˤϡ����δؿ���
���֤��Ƥ�Ǥ���������@code{mysql_fetch_field()} �ϥե�����ɤ��ĤäƤ���
���� @code{NULL} ���֤��ޤ���

@code{mysql_fetch_field()} �ϡ������� @code{SELECT} �������¹Ԥ��뤿�Ӥˡ�
�ǽ�Υե�����ɤˤĤ��Ƥξ�����֤��褦�˥ꥻ�åȤ���ޤ���
@code{mysql_fetch_field()} ���֤����ե�����ɤ� 
@code{mysql_field_seek()} �θƤӽФ��ˤ�ƶ��򤦤��ޤ���

�ơ��֥�� @code{SELECT} ���뤿��� @code{mysql_query()} ��Ƥӡ���������
�� @code{mysql_store_result()} ��Ƥ�Ǥ��ʤ���硢
@code{mysql_fetch_field()} �� @code{BLOB} �ե�����ɤ�Ĺ�����䤤��碌�˻�
�Ѥ���ȡ�@strong{MySQL} �ϥǥե���Ȥ� blob Ĺ (8K bytes) ���֤��ޤ���
(8K �������ˤʤ�Τϡ�@strong{MySQL} �� @code{BLOB} �κ���Ĺ���Τ�ʤ�����
�Ǥ�������Ϥ��Ĥ�����ե�����ǽ�ˤʤ�٤��Ǥ���) ���ٷ�̥��åȤ���Ф�
�С�@code{field->max_length} �ϻ��ꤷ����������ǤΤ��Υե�����ɤκ�����
��Ĺ����ޤߤޤ���

@subsubheading �����

���ߤΥե�����ɤ� @code{MYSQL_FIELD} ��¤�Ρ��ե�����ɤ��ĤäƤ��ʤ����� 
@code{NULL}��

@subsubheading ���顼
̵����

@subsubheading ��

@example
MYSQL_FIELD *field;

while((field = mysql_fetch_field(result)))
@{
    printf("field name %s\n", field->name);
@}
@end example

@findex @code{mysql_fetch_fields()}
@node mysql_fetch_fields, mysql_fetch_field_direct, mysql_fetch_field, C API functions
@subsection @code{mysql_fetch_fields()}

@code{MYSQL_FIELD *mysql_fetch_fields(MYSQL_RES *result)}

@subsubheading ����

��̥��åȤΤ��٤Ƥ� @code{MYSQL_FIELD} ��¤�Τ�������֤��ޤ����ƹ�¤�Τ�
��̥��åȤΰ�ĤΥե�����ɤΥե������������󶡤��ޤ���

@subsubheading �����

��̥��åȤ����Ƥι��ܤ� @code{MYSQL_FIELD} ��¤�Τ�����

@subsubheading ���顼
̵����

@subsubheading ��

@example
unsigned int num_fields;
unsigned int i;
MYSQL_FIELD *fields;

num_fields = mysql_num_fields(result);
fields = mysql_fetch_fields(result);
for(i = 0; i < num_fields; i++)
@{
   printf("Field %u is %s\n", i, fields[i].name);
@}
@end example

@findex @code{mysql_fetch_field_direct()}
@node mysql_fetch_field_direct, mysql_fetch_lengths, mysql_fetch_fields, C API functions
@subsection @code{mysql_fetch_field_direct()}

@code{MYSQL_FIELD *mysql_fetch_field_direct(MYSQL_RES *result, unsigned int fieldnr)}

@subsubheading ����

��̥��å���Υե�����ɤ򼨤��ե�������ֹ� @code{fieldnr} ��Ϳ����졢��
�Υե�����ɤΥե����������� @code{MYSQL_FIELD} ��¤�ΤȤ����֤��ޤ�����
�δؿ���Ǥ�դΥե�����ɤˤĤ��Ƥ��������Ф����Ȥ˻��ѤǤ��ޤ���
@code{fieldnr} ���ͤ� 0 ���� @code{mysql_num_fields(result)-1} ���ϰϤˤ�
�٤��Ǥ���

@subsubheading �����

���ꤵ�줿�ե�����ɤ� @code{MYSQL_FIELD} ��¤�Ρ�

@subsubheading ���顼
̵����

@subsubheading ��

@example
unsigned int num_fields;
unsigned int i;
MYSQL_FIELD *field;

num_fields = mysql_num_fields(result);
for(i = 0; i < num_fields; i++)
@{
    field = mysql_fetch_field_direct(result, i);
    printf("Field %u is %s\n", i, field->name);
@}
@end example

@findex @code{mysql_fetch_lengths()}
@node mysql_fetch_lengths, mysql_fetch_row, mysql_fetch_field_direct, C API functions
@subsection @code{mysql_fetch_lengths()}

@code{unsigned long *mysql_fetch_lengths(MYSQL_RES *result)}

@subsubheading ����

��̥��å���θ��ߤΥ쥳���ɤΥե�����ɤ�Ĺ�����֤��ޤ����ե�����ɤ��ͤ򥳥ԡ������硢
����Ĺ������Ϻ�Ŭ���ˤ�ͭ�ѤǤ���@code{strlen()} �θƤӽФ������Ǥ���
����Ǥ���
����ˡ���̥��åȤ��Х��ʥ�ǡ�������ľ��ϡ��ǡ����Υ����������ꤹ�뤿��ˤ��δؿ���@emph{�Ȥ�ʤ���Фʤ�ޤ���}��
�ʤ��ʤ� @code{strlen()} �� NULL ʸ����ޤ�ե�����ɤˤĤ��Ƥη�̤��������֤��ʤ�����Ǥ���

���ե�����ɤ�Ĺ���� @code{NULL} �ͤ�ޤ�ե�����ɤ�Ĺ���� 0 �Ǥ������Σ�
�ĤΥ���������̤�����ˡ�ˤĤ��Ƥϡ�@code{mysql_fetch_row()} �������򻲾�
���Ʋ�������

@subsubheading �����

�ƥե�����ɤΥ����� (��ü NUL ʸ���ϴޤߤޤ���)���󶡤��� unsigned long 
����������
���顼��ȯ���������� @code{NULL}��

@subsubheading ���顼
@code{mysql_fetch_lengths()} �Ϸ�̥��åȤθ��ߤΥ쥳���ɤˤĤ��Ƥ���ͭ��
�Ǥ���@code{mysql_fetch_row()} ��ƤӽФ������ޤ��Ϸ�̤����ƤΥ쥳���ɤ�
���Ф�����ˤ����Ƥ����硢@code{NULL} ���֤���ޤ���

@subsubheading ��

@example
MYSQL_ROW row;
unsigned long *lengths;
unsigned int num_fields;
unsigned int i;

row = mysql_fetch_row(result);
if (row)
@{
    num_fields = mysql_num_fields(result);
    lengths = mysql_fetch_lengths(result);
    for(i = 0; i < num_fields; i++)
    @{
         printf("Column %u is %lu bytes in length.\n", i, lengths[i]);
    @}
@}
@end example

@findex @code{mysql_fetch_row()}
@node mysql_fetch_row, mysql_field_count, mysql_fetch_lengths, C API functions
@subsection @code{mysql_fetch_row()}

@code{MYSQL_ROW mysql_fetch_row(MYSQL_RES *result)}

@subsubheading ����

��̥��åȤμ��Υ쥳���ɤ���Ф��ޤ���@code{mysql_store_result()} �θ�˻��Ѥ���ȡ�
����ʾ���Ф��쥳���ɤ��ʤ����ϡ�@code{NULL} ���֤��ޤ���
@code{mysql_use_result()} �θ�˻��Ѥ���ʤ顢
����ʾ���Ф��쥳���ɤ��ʤ����䥨�顼��ȯ���������� @code{NULL} ���֤��ޤ���

�쥳��������ͤο��� @code{mysql_num_fields(result)} �ˤ�ä�Ϳ�����ޤ���
@code{row} �� @code{mysql_fetch_row()} �θƤӽФ����������ͤ��ݻ������
�硢�ͤؤΥݥ��󥿤� @code{row[0]} ���� 
@code{row[mysql_num_fields(result)-1} �Ȥ��ƥ�����������ޤ����쥳������� 
@code{NULL} �ͤ�@code{NULL} �ݥ��󥿤ˤ�äƼ�����ޤ���

�쥳���ɤΥե�������ͤ�Ĺ���ϡ�@code{mysql_fetch_lengths()} �θƤӽФ���
�����Ǥ��ޤ������ե�����ɤ� @code{NULL} ��ޤ�ե�����ɤϤɤ����Ĺ�� 
0 ������ޤ�; �ե�������ͤΥݥ��󥿤�����å����뤳�Ȥǡ���������̤Ǥ�
�ޤ����ݥ��󥿤� @code{NULL} �ξ�硢�ե�����ɤ� @code{NULL} �Ǥ�; ������
�ʤ���Хե�����ɤ϶��Ǥ���

@subsubheading �����

���Υ쥳���ɤ� @code{MYSQL_ROW} ��¤�Ρ����顼��ȯ�����������⤦���Ф���
�����ɤ��ʤ����� @code{NULL}��

@subsubheading ���顼

@table @code
@item CR_SERVER_LOST
�����Фؤ���³����������˼���줿��
@item CR_UNKNOWN_ERROR
̤�ΤΥ��顼��ȯ��������
@end table

@subsubheading ��

@example
MYSQL_ROW row;
unsigned int num_fields;
unsigned int i;

num_fields = mysql_num_fields(result);
while ((row = mysql_fetch_row(result)))
@{
   unsigned long *lengths;
   lengths = mysql_fetch_lengths(result);
   for(i = 0; i < num_fields; i++)
   @{
       printf("[%.*s] ", (int) lengths[i], row[i] ? row[i] : "NULL");
   @}
   printf("\n");
@}
@end example

@findex @code{mysql_field_count()}
@node mysql_field_count, mysql_field_seek, mysql_fetch_row, C API functions
@subsection @code{mysql_field_count()}

@code{unsigned int mysql_field_count(MYSQL *mysql)}

3.22.24 ������� @code{MySQL} �С���������Ѥ��Ƥ����硢
@code{unsigned int mysql_num_fields(MYSQL *mysql)} ������˻��Ѥ��٤���
����

@subsubheading ����

��³��κǸ�Υ�����Υե�����ɿ����֤��ޤ���

���δؿ����̾� @code{mysql_store_result()} �� @code{NULL} ���֤������ʤ���
�Ƥ��Τ褦�˷�̥��åȥݥ��󥿤���äƤ��ʤ����ˤ˻��Ѥ���ޤ������ξ�硢
@code{mysql_store_result()} �����Ǥʤ���̤��󶡤��٤����ɤ�����Ĵ�٤뤿��
�ˡ�@code{mysql_field_count()} ��ƤӽФ����Ȥ��Ǥ��ޤ�������ϡ������꤬ 
@code{SELECT}�ʤޤ��� @code{SELECT}�˻����˥��ơ��ȥ��ȤǤ��뤫���Τ뤳
��̵���ˡ����饤����ȥץ������ˡ�Ŭ�ڤʹ�ư��Ȥ餻�뤳�Ȥ��Ǥ��ޤ�����
�˼��������ϡ������ɤΤ褦�˹Ԥʤ����Ȥ��Ǥ��뤫���������Ƥ��ޤ���

@xref{NULL mysql_store_result, , @code{NULL mysql_store_result()}}.

@subsubheading �����

��̥��å���Υե�������ֹ��ɽ�� unsigned integer��

@subsubheading ���顼
̵����

@subsubheading ��

@example
MYSQL_RES *result;
unsigned int num_fields;
unsigned int num_rows;

if (mysql_query(&mysql,query_string))
@{
    // error
@}
else // query succeeded, process any data returned by it
@{
    result = mysql_store_result(&mysql);
    if (result)  // there are rows
    @{
        num_fields = mysql_num_fields(result);
        // retrieve rows, then call mysql_free_result(result)
    @}
    else  // mysql_store_result() returned nothing; should it have?
    @{
        if(mysql_field_count(&mysql) == 0)
        @{
            // query does not return data
            // (it was not a SELECT)
            num_rows = mysql_affected_rows(&mysql);
        @}
        else // mysql_store_result() should have returned data
        @{
            fprintf(stderr, "Error: %s\n", mysql_error(&mysql));
        @}
    @}
@}
@end example

�̤���ˡ�ϡ�@code{mysql_field_count(&mysql)} �ƤӽФ��� 
@code{mysql_errno(&mysql)} ���֤������뤳�ȤǤ������ξ�硢���ơ��ȥ���
�� @code{SELECT} ���ɤ����� @code{mysql_field_count()} ���ͤ����¬�����
�ǤϤʤ���ľ�� @code{mysql_store_result()} ����Υ��顼������å����ޤ���

@findex @code{mysql_field_seek()}
@node mysql_field_seek, mysql_field_tell, mysql_field_count, C API functions
@subsection @code{mysql_field_seek()}

@code{MYSQL_FIELD_OFFSET mysql_field_seek(MYSQL_RES *result, MYSQL_FIELD_OFFSET offset)}

@subsubheading ����

Ϳ����줿���ե��åȤ˥ե�����ɥ�����������ꤷ�ޤ������� 
@code{mysql_fetch_field()} �θƤӽФ��Ϥ��Υ��ե��åȤ��б������ե�����ɤ��
��Ф��ޤ���

�쥳���ɤκǽ�˥���������ˤϡ�0 �� @code{offset} �ͤ��Ϥ��Ƥ���������

@subsubheading �����

�ե�����ɥ�������������͡�

@subsubheading ���顼
̵����

@findex @code{mysql_field_tell()}
@node mysql_field_tell, mysql_free_result, mysql_field_seek, C API functions
@subsection @code{mysql_field_tell()}

@code{MYSQL_FIELD_OFFSET mysql_field_tell(MYSQL_RES *result)}

@subsubheading ����

�Ǹ�� @code{mysql_fetch_field()} �˻��Ѥ����ե�����ɥ�������ΰ��֤���
���ޤ��������ͤ� @code{mysql_field_seek()} �ؤΰ����Ȥ��ƻ��ѤǤ��ޤ���

@subsubheading �����

�ե�����ɥ�������θ��ߤΥ��ե��åȡ�

@subsubheading ���顼
̵����

@findex @code{mysql_free_result()}
@node mysql_free_result, mysql_get_client_info, mysql_field_tell, C API functions
@subsection @code{mysql_free_result()}

@code{void mysql_free_result(MYSQL_RES *result)}

@subsubheading ����

@code{mysql_store_result()}, @code{mysql_use_result()},
@code{mysql_list_dbs()} ���ˤ�äƷ�̥��åȤ˳�����Ƥ�줿��������
���ޤ�����̥��åȤDz�����Ԥʤä�����@code{mysql_free_result()} ��Ƥ�
�Ф��Ƥ��줬���Ѥ���������������ɬ�פ�����ޤ���

@subsubheading �����

̵����

@subsubheading ���顼
̵����

@findex @code{mysql_get_client_info()}
@node mysql_get_client_info, mysql_get_host_info, mysql_free_result, C API functions
@subsection @code{mysql_get_client_info()}

@code{char *mysql_get_client_info(void)}

@subsubheading ����

���饤����ȥ饤�֥��С�������ɽ�魯ʸ������֤��ޤ���

@subsubheading �����

@strong{MySQL} ���饤����ȥ饤�֥��С�������ɽ�魯ʸ����

@subsubheading ���顼
̵����

@findex @code{mysql_get_host_info()}
@node mysql_get_host_info, mysql_get_proto_info, mysql_get_client_info, C API functions
@subsection @code{mysql_get_host_info()}

@code{char *mysql_get_host_info(MYSQL *mysql)}

@subsubheading ����

���������³�����פ�ɽ�魯ʸ������֤��ޤ��������ФΥۥ���̾��ޤߤޤ���

@subsubheading �����

�����Хۥ���̾����³�����פ�ɽ�魯ʸ����

@subsubheading ���顼
̵����

@findex @code{mysql_get_proto_info()}
@node mysql_get_proto_info, mysql_get_server_info, mysql_get_host_info, C API functions
@subsection @code{mysql_get_proto_info()}

@code{unsigned int mysql_get_proto_info(MYSQL *mysql)}

@subsubheading ����

���ߤ���³�˻��Ѥ���Ƥ���ץ��ȥ���С��������֤��ޤ���

@subsubheading Return values

���ߤ���³�˻��Ѥ���Ƥ���ץ��ȥ���С�������ɽ�魯���̵�������͡�

@subsubheading ���顼
̵����

@findex @code{mysql_get_server_info()}
@node mysql_get_server_info, mysql_info, mysql_get_proto_info, C API functions
@subsection @code{mysql_get_server_info()}

@code{char *mysql_get_server_info(MYSQL *mysql)}

@subsubheading ����

�����ФΥС�������ֹ��ɽ�魯ʸ������֤��ޤ���

@subsubheading �����

�����ФΥС�������ֹ��ɽ�魯ʸ����

@subsubheading ���顼
̵����

@findex @code{mysql_info()}
@node mysql_info, mysql_init, mysql_get_server_info, C API functions
@subsection @code{mysql_info()}

@code{char * mysql_info(MYSQL *mysql)}

@subsubheading ����

�Ǥ�Ƕ�˼¹Ԥ��줿������ˤĤ��Ƥξ����ʸ������֤��ޤ�������
�ʲ��˵󤲤빽ʸ�˸¤�ޤ���
¾�ι�ʸ�Ǥ�@code{mysql_info()} �� @code{NULL} ���֤��ޤ���
ʸ����η���
�ϥ�����η��ˤ�ä��͡��Ǥ��������������ޤ� (���ͤ���Ǥ�; ʸ����ϥ���
���Ŭ�����ͤ�ޤߤޤ�):

@table @code
@item INSERT INTO ... SELECT ...
String format: @code{Records: 100 Duplicates: 0 Warnings: 0}
@item INSERT INTO ... VALUES (...),(...),(...)...
String format: @code{Records: 3  Duplicates: 0  Warnings: 0}
@item LOAD DATA INFILE ...
String format: @code{Records: 1 Deleted: 0 Skipped: 0 Warnings: 0}
@item ALTER TABLE
String format: @code{Records: 3 Duplicates: 0 Warnings: 0}
@item UPDATE
String format: @code{Rows matched: 40 Changed: 40 Warnings: 0}
@end table

����: ʣ�����ͥꥹ�Ȥ����ơ��ȥ�����˵��Ҥ��줿���ˤ�����
@code{mysql_info()} �ϡ�@code{INSERT ... VALUES} ���ơ��ȥ��Ȥ���
@code{NULL}�ͤ��֤��ޤ���

@subsubheading �����

�Ǥ�Ƕ�˼¹Ԥ��줿������ˤĤ��Ƥ��ɲþ����ɽ�魯ʸ���󡣥������ͭ��
�ʾ��󤬤ʤ����� @code{NULL} �ݥ��󥿡�

@subsubheading ���顼
̵����

@findex @code{mysql_init()}
@node mysql_init, mysql_insert_id, mysql_info, C API functions
@subsection @code{mysql_init()}

@code{MYSQL * mysql_init(MYSQL *mysql)}

@subsubheading ����

@code{mysql_real_connect()} ��Ŭ���� @code{MYSQL} ���֥������Ȥγ������
�ޤ��Ͻ������Ԥʤ��ޤ��������� @code{NULL} �ݥ��󥿤ξ�硢�ؿ��Ͽ���
�����֥������Ȥ������Ƥƽ�������֤��ޤ��������Ǥʤ���Х��֥������Ȥ�
��������졢���֥������ȤΥ��ɥ쥹���֤���ޤ������������֥������Ȥ����
���Ƥ�줿��硢@code{mysql_close()} �Ϥ��Υ��֥������Ȥ�������ޤ���

@subsubheading �����

��������줿 @code{MYSQL*} �ϥ�ɥ롢�ޤ��Ͽ��������֥������Ȥ�������
��Τ˽�ʬ�ʥ��꤬�ʤ��ä����� @code{NULL} �ݥ��󥿡�

@subsubheading ���顼
������­�ξ��� @code{NULL} ���֤���ޤ���

@findex @code{mysql_insert_id()}
@node mysql_insert_id, mysql_kill, mysql_init, C API functions
@subsection @code{mysql_insert_id()}

@code{my_ulonglong mysql_insert_id(MYSQL *mysql)}

@subsubheading ����

���Υ�����ˤ�ä� @code{AUTO_INCREMENT} �ե�����ɤ��������줿 ID ���֤��ޤ���
@code{AUTO_INCREMENT} �ե�����ɤ�ޤ�ơ��֥�� @code{INSERT} �������
�¹Ԥ�����ǡ����δؿ�����Ѥ��Ƥ���������

����: ���Υ����꤬ @code{AUTO_INCREMENT} �ͤ��������ʤ��ä���硢
@code{mysql_insert_id()} �� @code{0} ���֤��ޤ�����Τ�����ͤ���¸����ɬ
�פ������硢�ͤ��������륯�����ľ��� @code{mysql_insert_id()} ��Ƥӽ�
�����Ȥ˵���Ĥ��Ƥ���������

�ޤ���SQL @code{LAST_INSERT_ID()} ��˺Ǹ���������줿 
@code{AUTO_INCREMENT} �ͤ�ޤߡ�������֤ǥꥻ�åȤ���ʤ����Ȥ����դ��Ʋ�
���������δؿ����ͤϥ���������ݼ餵��뤫��Ǥ���

@subsubheading �����

���Υ�����ˤ�äƹ������줿 @code{AUTO_INCREMENT} �ե�����ɤ��͡���³��
�����Υ����꤬�ʤ���硢�����꤬ @code{AUTO_INCREMENT} �ͤ򹹿����ʤ��ä�
���ˤ� 0 ���֤�ޤ���

@subsubheading ���顼
̵����

@findex @code{mysql_kill()}
@node mysql_kill, mysql_list_dbs, mysql_insert_id, C API functions
@subsection @code{mysql_kill()}

@code{int mysql_kill(MYSQL *mysql, unsigned long pid)}

@subsubheading ����

@code{pid} �ǻ��ꤵ�줿����åɤ򻦤��褦�˥����Ф���ߤޤ���

@subsubheading �����

������0�����Ի���0��

@subsubheading ���顼

@table @code
@item CR_COMMANDS_OUT_OF_SYNC
�����ʽ�˥��ޥ�ɤ��¹Ԥ��줿��
@item CR_SERVER_GONE_ERROR
@strong{MySQL} �����Ф����ʤ��ʤä���
@item CR_SERVER_LOST
�����Фؤ���³����������˼���줿��
@item CR_UNKNOWN_ERROR
̤�ΤΥ��顼��ȯ��������
@end table

@findex @code{mysql_list_dbs()}
@node mysql_list_dbs, mysql_list_fields, mysql_kill, C API functions
@subsection @code{mysql_list_dbs()}

@code{MYSQL_RES *mysql_list_dbs(MYSQL *mysql, const char *wild)}

@subsubheading ����

�����о�Ρ�@code{wild} �����ǻ��ꤵ�줿�ʰ�����ɽ����Ŭ�礹�롢�ǡ����١�
��̾����ʤ��̥��åȤ��֤��ޤ���@code{wild} �ϥ磻��ɥ�����ʸ�� 
@samp{%} �ޤ��� @samp{_} ��ޤळ�Ȥ��Ǥ��ޤ����ޤ������ƤΥǡ����١���
��Ŭ�礹��褦�� @code{NULL} �ݥ��󥿤ˤǤ��ޤ���@code{mysql_list_dbs()} 
�θƤӽФ��ϥ����� @code{SHOW databases [LIKE wild]} ��¹Ԥ���Τ�Ʊ��
�Ǥ���

@code{mysql_free_result()} �Ƿ�̥��åȤ��������ɬ�פ�����ޤ���

@subsubheading �����

������ @code{MYSQL_RES} ��̥��åȡ����Ԥ������� @code{NULL}��

@subsubheading ���顼

@table @code
@item CR_COMMANDS_OUT_OF_SYNC
�����ʽ�˥��ޥ�ɤ��¹Ԥ��줿��
@item CR_OUT_OF_MEMORY
������­��
@item CR_SERVER_GONE_ERROR
@strong{MySQL} �����Ф����ʤ��ʤä���
@item CR_SERVER_LOST
�����Фؤ���³����������˼���줿��
@item CR_UNKNOWN_ERROR
̤�ΤΥ��顼��ȯ��������
@end table

@findex @code{mysql_list_fields()}
@node mysql_list_fields, mysql_list_processes, mysql_list_dbs, C API functions
@subsection @code{mysql_list_fields()}

@code{MYSQL_RES *mysql_list_fields(MYSQL *mysql, const char *table, const char *wild)}

@subsubheading ����

Ϳ����줿�ơ��֥���Ρ�@code{wild} �����ǻ��ꤵ�줿�ʰ�����ɽ����Ŭ�礹��
�ե������̾����ʤ��̥��åȤ��֤��ޤ���@code{wild} �ϥ磻��ɥ���
��ʸ�� @samp{%} �ޤ��� @samp{_} ��ޤळ�Ȥ��Ǥ��ޤ����ޤ������ƤΥե���
��ɤ�Ŭ�礹��褦�� @code{NULL} �ݥ��󥿤ˤǤ��ޤ���
@code{mysql_list_fields()} �ϥ����� @code{SHOW COLUMNS FROM table [LIKE
wild]} ��¹Ԥ���Τ�Ʊ�ͤǤ���

����: @code{mysql_list_fields()} ������� @code{SHOW COLUMNS FROM
tbl_name} �λ��Ѥ򴫤�ޤ���

@code{mysql_free_result()} �Ƿ�̥��åȤ��������ɬ�פ�����ޤ���

@subsubheading �����

������ @code{MYSQL_RES} ��̥��åȡ����顼��ȯ���������� @code{NULL}��

@subsubheading ���顼

@table @code
@item CR_COMMANDS_OUT_OF_SYNC
�����ʽ�˥��ޥ�ɤ��¹Ԥ��줿��
@item CR_SERVER_GONE_ERROR
@strong{MySQL} �����Ф����ʤ��ʤä���
@item CR_SERVER_LOST
�����Фؤ���³����������˼���줿��
@item CR_UNKNOWN_ERROR
̤�ΤΥ��顼��ȯ��������
@end table

@findex @code{mysql_list_processes()}
@node mysql_list_processes, mysql_list_tables, mysql_list_fields, C API functions
@subsection @code{mysql_list_processes()}

@code{MYSQL_RES *mysql_list_processes(MYSQL *mysql)}

@subsubheading ����

���ߤΥ����Х���åɤ򼨤���̥��åȤ��֤��ޤ�������� @code{mysqladmin
processlist} �� @code{SHOW PROCESSLIST} �������
��𤵤���Τ�Ʊ������ξ���Ǥ���

@code{mysql_free_result()} �Ƿ�̥��åȤ��������ɬ�פ�����ޤ���

@subsubheading �����

������ @code{MYSQL_RES} ��̥��åȡ����Ԥ������� @code{NULL}��

@subsubheading ���顼

@table @code
@item CR_COMMANDS_OUT_OF_SYNC
�����ʽ�˥��ޥ�ɤ��¹Ԥ��줿��
@item CR_SERVER_GONE_ERROR
@strong{MySQL} �����Ф����ʤ��ʤä���
@item CR_SERVER_LOST
�����Фؤ���³����������˼���줿��
@item CR_UNKNOWN_ERROR
̤�ΤΥ��顼��ȯ��������
@end table

@findex @code{mysql_list_tables()}
@node mysql_list_tables, mysql_num_fields, mysql_list_processes, C API functions
@subsection @code{mysql_list_tables()}

@code{MYSQL_RES *mysql_list_tables(MYSQL *mysql, const char *wild)}

@subsubheading ����

@code{wild} �����ǻ��ꤵ�줿�ʰ�����ɽ����Ŭ�礹�롢���ߤΥǡ����١���
��Υơ��֥�̾����ʤ��̥��åȤ��֤��ޤ���@code{wild} �ϥ磻��ɥ�����
ʸ�� @samp{%} �ޤ��� @samp{_} ��ޤळ�Ȥ��Ǥ��ޤ����ޤ������ƤΥơ��֥�
��Ŭ�礹��褦�� @code{NULL} �ݥ��󥿤ˤǤ��ޤ���
@code{mysql_list_tables()} �ϥ����� @code{SHOW tables [LIKE wild]} ���
�Ԥ���Τ�Ʊ�ͤǤ���

@code{mysql_free_result()} �Ƿ�̥��åȤ��������ɬ�פ�����ޤ���

@subsubheading �����

������ @code{MYSQL_RES} ��̥��åȡ����Ԥ������� @code{NULL}��

@subsubheading ���顼

@table @code
@item CR_COMMANDS_OUT_OF_SYNC
�����ʽ�˥��ޥ�ɤ��¹Ԥ��줿��
@item CR_SERVER_GONE_ERROR
@strong{MySQL} �����Ф����ʤ��ʤä���
@item CR_SERVER_LOST
�����Фؤ���³����������˼���줿��
@item CR_UNKNOWN_ERROR
̤�ΤΥ��顼��ȯ��������
@end table

@findex @code{mysql_num_fields()}
@findex @code{mysql_field_count()}
@node mysql_num_fields, mysql_num_rows, mysql_list_tables, C API functions
@subsection @code{mysql_num_fields()}

@code{unsigned int mysql_num_fields(MYSQL_RES *result)}

�ޤ���

@code{unsigned int mysql_num_fields(MYSQL *mysql)}

�����ܤη����� @strong{MySQL} 3.23 �ʾ�Ǥ�ư��ޤ���@code{MYSQL*} ��
�����̤����ϡ������ @code{unsigned int mysql_field_count(MYSQL*mysql)}
����Ѥ��ʤ��ƤϤ����ޤ���

@subsubheading ����

��̥��å���Υե�����ɿ����֤��ޤ���

����: ��̥��åȤؤΥݥ��󥿤ޤ�����³�ϥ�ɥ�Τ����줫����ե�����ɤο�
�����뤳�Ȥ��Ǥ��ޤ���@code{mysql_store_result()} �ޤ��� 
@code{mysql_use_result()} �� @code{NULL} ���֤����ʤĤޤ��̥��åȥݥ���
����̵���˾�硢��³�ϥ�ɥ����Ѥ��ޤ������ξ�硢
@code{mysql_field_count()} ��ƤӽФ��ơ�@code{mysql_store_result()} ����
�Ǥʤ���̤��󶡤��٤����ɤ��������Ǥ��ޤ�������ˤ�ꡢ���饤����ȥץ�
�����ϥ����꤬ @code{SELECT}�ʤޤ��� @code{SELECT} �˻����˥��ơ��ȥ��
�Ȥ��ä����ɤ������Τ뤳�Ȥʤ��ˡ�Ŭ�ڤʹ�ư���뤳�Ȥ��Ǥ��ޤ����ʲ��˼�
����Ϥ����ɤΤ褦�˹Ԥʤ������������Ƥ��ޤ���

@xref{NULL mysql_store_result, , @code{NULL mysql_store_result()}}.

@subsubheading �����

��̥��å���Υե�����ɿ���ɽ�魯���̵��������

@subsubheading ���顼
̵����

@subsubheading ��

@example
MYSQL_RES *result;
unsigned int num_fields;
unsigned int num_rows;

if (mysql_query(&mysql,query_string))
@{
    // error
@}
else // query succeeded, process any data returned by it
@{
    result = mysql_store_result(&mysql);
    if (result)  // there are rows
    @{
        num_fields = mysql_num_fields(result);
        // retrieve rows, then call mysql_free_result(result)
    @}
    else  // mysql_store_result() returned nothing; should it have?
    @{
        if (mysql_errno(&mysql))
	@{
           fprintf(stderr, "Error: %s\n", mysql_error(&mysql));
	@}
        else if (mysql_field_count(&mysql) == 0)
        @{
            // query does not return data
            // (it was not a SELECT)
            num_rows = mysql_affected_rows(&mysql);
        @}
    @}
@}
@end example

�ʷ�̥��åȤ��֤�٤�������Ǥ��뤳�Ȥ��ΤäƤ�����Ρ���ˡ�ϡ�
@code{mysql_errno(&mysql)} ������� @code{mysql_field_count(&mysql)} �� 
0 ���ɤ����Υ����å����֤������뤳�ȤǤ�������ϲ������������ˤ���������
�ޤ���

@findex @code{mysql_num_rows()}
@node mysql_num_rows, mysql_options, mysql_num_fields, C API functions
@subsection @code{mysql_num_rows()}

@code{my_ulonglong mysql_num_rows(MYSQL_RES *result)}

@subsubheading ����

��̥��å���Υ쥳���ɿ����֤��ޤ���

@code{mysql_num_rows()} �λ��Ѥϡ���̥��åȤ��֤��Τ� 
@code{mysql_store_result()} �� @code{mysql_use_result()} �Τɤ������Ѥ�
�뤫�˰�¸���ޤ���@code{mysql_store_result()} ����Ѥ����硢
@code{mysql_num_rows()} �Ϥ����˸Ƥ֤��Ȥ��Ǥ��ޤ���
@code{mysql_use_result()} ����Ѥ����硢��̥��åȤ����ƤΥ쥳���ɤ����
�Ф����ޤǡ�@code{mysql_num_rows()} ���������ͤ��֤��ޤ���

@subsubheading �����

��̥��åȤΥ쥳���ɿ���

@subsubheading ���顼
̵����

@findex @code{mysql_options()}
@node mysql_options, mysql_ping, mysql_num_rows, C API functions
@subsection @code{mysql_options()}

@code{int mysql_options(MYSQL *mysql, enum mysql_option option, const char *arg)}

@subsubheading ����

���̤���³���ץ��������ꤷ����³�ο��񤤤˱ƶ���Ϳ���뤿��˻��ѤǤ��ޤ���
���δؿ���ʣ���Υ��ץ��������ꤹ�뤿���ʣ����Ƥ֤��Ȥ��Ǥ��ޤ���

@code{mysql_options()} �� @code{mysql_init()} �θ�ǡ�
@code{mysql_connect()} �� @code{mysql_real_connect()} �����˸ƤФ�ʤ����
�ʤ�ޤ���

@code{option} ���������ꤷ�������ץ����Ǥ�; @code{arg} �����ϥ��ץ����
���Ф����ͤǤ������ץ���������ξ�硢@code{arg} �������ͤؤΥݥ��󥿤�
����

ͭ���ʥ��ץ������:

@multitable @columnfractions .25 .25 .5
@item @strong{���ץ����} @tab @strong{������} @tab @strong{��ǽ}
@item @code{MYSQL_OPT_CONNECT_TIMEOUT} @tab @code{unsigned int *} @tab ��³�����ॢ���ȡ��áˡ�
@item @code{MYSQL_OPT_COMPRESS} @tab ���Ѥ��ʤ� @tab ���̥��饤����ȡ������Хץ��ȥ������Ѥ��롣
@item @code{MYSQL_OPT_NAMED_PIPE} @tab ���Ѥ��ʤ� @tab NT ��� @strong{MySQL} �����Фؤ���³��̾���եѥ��פ���Ѥ��롣
@item @code{MYSQL_INIT_COMMAND} @tab @code{char *} @tab @strong{MySQL} �����Фؤ���³���˼¹Ԥ��륳�ޥ�ɡ�����³���˼�ưŪ�˺Ƽ¹Ԥ���롣
@item @code{MYSQL_READ_DEFAULT_FILE} @tab @code{char *} @tab @file{my.cnf} ������˻��ꤵ�줿���ץ����ե����뤫�饪�ץ������ɤ߹��ࡣ
@item @code{MYSQL_READ_DEFAULT_GROUP} @tab @code{char *} @tab @file{my.cnf} �ޤ��� @code{MYSQL_READ_DEFAULT_FILE} �ǻ��ꤵ�줿�ե����뤫����ꤵ�줿���롼�פΥ��ץ������ɤ߹��ࡣ
@end multitable

����: @code{MYSQL_READ_DEFAULT_FILE} �� @code{MYSQL_READ_DEFAULT_GROUP} ��
���Ѥ����硢@code{client} ���롼�פ�����ɤޤ�ޤ���

���ץ����ե�������˻��ꤵ��륰�롼�פϼ��Υ��ץ�����ޤळ�Ȥ��Ǥ���
��:

@multitable @columnfractions .3 .7
@item @code{compress} @tab ���̥��饤����ȡ������Хץ��ȥ������Ѥ��롣
@item @code{database} @tab ��³̿����ǥǡ����١��������ꤵ��ʤ���硢���Υǡ����١�������³���롣
@item @code{debug} @tab �ǥХå����ץ����
@item @code{host} @tab �ǥե���ȥۥ���̾
@item @code{init-command} @tab @strong{MySQL} �����Фؤ���³���˼¹Ԥ��륳�ޥ�ɡ�����³���˼�ưŪ�˺Ƽ¹Ԥ���롣
@item @code{password} @tab �ǥե���ȥѥ����
@item @code{pipe} @tab NT ��� @strong{MySQL} �����Фؤ���³��̾���եѥ��פ���Ѥ��롣
@item @code{port} @tab �ǥե���ȥݡ����ֹ�
@item @code{return-found-rows} @tab @code{UPDATE} ���ѻ���@code{mysql_info()} ���������줿�Ԥ�����˸��Ĥ��ä��Ԥ��֤��褦�ˤ��롣
@item @code{socket} @tab �ǥե���ȥ����å��ֹ�
@item @code{timeout} @tab ��³�����ॢ���ȡ��áˡ�
@item @code{user} @tab �ǥե���ȥ桼��
@end multitable

���ץ����ե�����ˤĤ��ƤΤ���ʤ����ϡ�@ref{Option files} �򻲾Ȥ���
��������

@subsubheading �����

�����ξ���0��̤�ΤΥ��ץ�������Ѥ���������0��

@subsubheading ��

@example
MYSQL mysql;

mysql_init(&mysql);
mysql_options(&mysql,MYSQL_OPT_COMPRESS,0);
mysql_options(&mysql,MYSQL_READ_DEFAULT_GROUP,"odbc");
if (!mysql_real_connect(&mysql,"host","user","passwd","database",0,NULL,0))
@{
    fprintf(stderr, "Failed to connect to database: Error: %s\n",
          mysql_error(&mysql));
@}
@end example

�嵭�ϡ����̥��饤����ȡ������Хץ��ȥ������Ѥ���@code{my.cnf} �ե�����
��� @code{odbc} ��������󤫤��ɲå��ץ������ɤ�褦�ˡ����饤����Ȥ�
�׵ᤷ�ޤ���

@findex @code{mysql_ping()}
@node mysql_ping, mysql_query, mysql_options, C API functions
@subsection @code{mysql_ping()}

@code{int mysql_ping(MYSQL *mysql)}

@subsubheading ����

�����Фؤ���³��ư��Ƥ��뤫�ɤ���������å����ޤ��������󤷤Ƥ�����
�ϡ���ưŪ�˺���³���ߤޤ���

���δؿ��ϡ�Ĺ�����Ť��ˤ��Ƥ��륯�饤����Ȥ��������Ф���³�򥯥�������
�����ɤ���������å��ʤȺ���³�ˤ��뤿��˻��ѤǤ��ޤ���

@subsubheading �����

�����Ф������Ƥ�����0��¾���ͤϥ��顼�򼨤��ޤ���

@subsubheading ���顼

@table @code
@item CR_COMMANDS_OUT_OF_SYNC
�����ʽ�˥��ޥ�ɤ��¹Ԥ��줿��
@item CR_SERVER_GONE_ERROR
@strong{MySQL} �����Ф����ʤ��ʤä���
@item CR_UNKNOWN_ERROR
̤�ΤΥ��顼��ȯ��������
@end table

@findex @code{mysql_query()}
@node mysql_query, mysql_real_connect, mysql_ping, C API functions
@subsection @code{mysql_query()}

@code{int mysql_query(MYSQL *mysql, const char *query)}

@subsubheading ����
NULL ��üʸ���� @code{query} �Ǽ������ SQL �������¹Ԥ��ޤ���������Ϥ�
�ȤĤ� SQL ���ơ��ȥ��ȤǤʤ���Фʤ�ޤ��󡣽�ü�Υ��ߥ�����
(@samp{;})�� @code{\g} �򥹥ơ��ȥ��Ȥ��ɲä��٤��ǤϤ���ޤ���

@code{mysql_query()} �ϥХ��ʥ�ǡ�����ޤ९����ˤϻ��ѤǤ��ޤ���ʥ�
���ʥ�ǡ����� @samp{\0} ʸ����ޤळ�Ȥ�����ޤ�������ϥ�����ʸ�����
�Ǹ�Ȥ��Ʋ�ᤵ��ޤ��ˡ����ξ�硢@code{mysql_real_query()} �������
���Ѥ��Ƥ���������

If you want to know if the query should return a result set or not, you can
use @code{mysql_field_count()} to check for this.
@xref{mysql_field_count, @code{mysql_field_count}}.

@subsubheading �����

�����꤬������������0�������꤬���Ԥ���������0��

@subsubheading ���顼

@table @code
@item CR_COMMANDS_OUT_OF_SYNC
�����ʽ�˥��ޥ�ɤ��¹Ԥ��줿��
@item CR_SERVER_GONE_ERROR
@strong{MySQL} �����Ф����ʤ��ʤä���
@item CR_SERVER_LOST
�����Фؤ���³����������˼���줿��
@item CR_UNKNOWN_ERROR
̤�ΤΥ��顼��ȯ��������
@end table

@findex @code{mysql_real_connect()}
@node mysql_real_connect, mysql_real_escape_string, mysql_query, C API functions
@subsection @code{mysql_real_connect()}

@code{MYSQL *mysql_real_connect(MYSQL *mysql, const char *host,
                          const char *user, const char *passwd, const char *db,
                          unsigned int port, const char *unix_socket,
                          unsigned int client_flag)}

@subsubheading ����

@code{host} ���ư��Ƥ��� @strong{MySQL} �ǡ����١������󥸥�ؤ���³
�γ�Ω���ߤޤ���
@code{mysql_get_client_info()} �ʳ���¾�� API �ؿ���¹Ԥ������ˡ�
@code{mysql_real_connect()} ���������Ƥ���ɬ�פ�����ޤ���

@code{mysql_real_connect()} ��ƤӽФ����ˡ�@code{MYSQL} ��¤�Τ������
���Ͻ�������뤿��� @code{mysql_init()} ��Ƥ�ɬ�פ����뤳�Ȥ����դ���
����������

@itemize @bullet
@item
�ǽ�Υѥ�᡼���ϴ�¸�� @code{MYSQL} ��¤�ΤΥ��ɥ쥹�Ǥ���
@code{mysql_real_connect()} ��Ƥ����ˡ�@code{MYSQL} ��¤�Τν�����Τ���
�� @code{mysql_init()} ��Ƥ�ɬ�פ�����ޤ�����Ҥ���򻲾Ȥ��Ƥ���������

@item
@code{host} ���ͤϥۥ���̾�� IP ���ɥ쥹�Τɤ���Ǥ��ǽ�Ǥ���
@code{host} �� @code{NULL} �ޤ���ʸ���� @code{"localhost"} �ξ��ϥ���
����ۥ��Ȥؤ���³�Ȥߤʤ���ޤ���OS �������åȤ򥵥ݡ��Ȥ�����(Unix)
�ޤ���̾���Ĥ��ѥ��פ򥵥ݡ��Ȥ�����(Win32)�������Фؤ� TCP/IP ��³��
����˻��Ѥ���ޤ���

@item
@code{user} �ѥ�᡼���ϥ桼���� @strong{MySQL} �������� ID �����äƤ��ޤ���
@code{user} �� @code{NULL} �ξ�硢���ߤΥ桼���Ȥߤʤ���ޤ���Windows
ODBC ���Ǥϡ����ߤΥ桼��������Ū�˻��ꤵ��ʤ���Фʤ�ޤ���Unix ����
�ϸ��ߤΥ�������̾��Ŭ�Ѥ���ޤ���
Windows ODBC �Ǥ�, �����ȤΥ桼����̾��Ϳ���ʤ���Фʤ�ޤ���
@xref{ODBC administrator}.

@item
@code{passwd} �ѥ�᡼���� @code{user} �Υѥ���ɤ����äƤ��ޤ���
�⤷ @code{passwd} �� @code{NULL} �ξ�硢����Υѥ���ɥե�����ɤ���� 
@code{user} �ơ��֥���Υ쥳���ɤ�����Ŭ������å�����ޤ������Τ褦����
ˡ�ǡ��ѥ���ɤ����Ҥ��줿���ɤ����ˤ�äƥ桼�����ۤʤ븢�¤�����褦
�ˡ��ǡ����١��������Ԥ� @strong{MySQL} �ø������ƥ�����ꤹ�뤳�Ȥ��Ǥ�
�ޤ���

����: @code{mysql_connect()} ��ƤӽФ����� @code{passwd} ��Ź沽���ʤ�
�Ǥ����������ѥ���ɤΰŹ沽�ϥ��饤����� API �Ǽ�ưŪ�˽�������ޤ���

@item
@code{db} �� @code{NULL} �Ǥʤ���硢��³�Ϥ����ͤ�ǥե���ȥǡ����١�
���˥��åȤ��ޤ���

@item
@code{port} �� 0 �Ǥʤ���硢�ͤ� TCP/IP ��³�Υݡ����ֹ�Ȥ��ƻ��Ѥ���
�ޤ���@code{host} �ѥ�᡼������³�Υ����פ���ꤹ�뤳�Ȥ����դ��Ƥ�����
����

@item
@code{unix_socket} �� @code{NULL} �Ǥʤ���硢ʸ����ϻ��Ѥ���륽���å�
�ޤ���̾���Ĥ��ѥ��פ򵭽Ҥ��ޤ���@code{host} �ѥ�᡼������³�Υ����פ�
���ꤹ�뤳�Ȥ����դ��Ƥ���������

@item
client_flag ���ͤ��̾� 0 �Ǥ������ȤƤ��ü�ʾ����Τ��ἡ�Υե饰���Ȥ�
��碌������Ǥ��ޤ�:

@multitable @columnfractions .25 .7
@item @strong{�ե饰̾}        @tab @strong{�ե饰�ΰ�̣}
@item @code{CLIENT_FOUND_ROWS} @tab �ƶ����줿�Կ��ǤϤʤ����Ĥ��ä��Կ����֤��ޤ�
@item @code{CLIENT_NO_SCHEMA}  @tab @code{db_name.tbl_name.col_name} ������ޤ��󡣤���� ODBC �Τ���Ǥ�; ���ι�ʸ����Ѥ�����硢�ѡ��������顼���������ޤ�������Ϥ����Ĥ��� ODBC �ץ������ΥХ��Υȥ�åפ���Ω���ޤ���
@item @code{CLIENT_COMPRESS}   @tab ���̥ץ��ȥ������Ѥ��ޤ�
@item @code{CLIENT_ODBC}       @tab ���饤����Ȥ� ODBC ���饤����ȡ������ @code{mysqld} �򤵤�� ODBC-�ե��ɥ���ѹ����ޤ���
@end multitable
@end itemize

@code{mysql_real_connect()} �κǽ�ΰ����� @code{NULL} �ݥ��󥿤򵭽Ҥ�
�뤳�Ȥ�Ǥ��ޤ�������� C API ����³��¤�ΤΥ���������ơ�
@code{mysql_close()} �ƤӽФ����˼�ưŪ�˲�������ޤ���������ˡ��������
���ϡ���³�����Ԥ������� @code{mysql_real_connect()} ����Υ��顼���
����������Ф����Ȥ��Ǥ��ʤ����ȤǤ���

�ǽ�ΰ����� @code{NULL} �ݥ��󥿤Ǥʤ����ϡ�¸�ߤ��� @code{MYSQL} ��
¤�ΤΥ��ɥ쥹�Ǥ���٤��Ǥ���

@subsubheading �����

��³�������������� @code{MYSQL*} ��³�ϥ�ɥ�Ǥ�����³�����Ԥ������
�� C @code{NULL} �ݥ��󥿤Ǥ���
��³����������ȡ��ǽ�Υѥ�᡼���� @code{NULL} �Ǥʤ���硢����ͤϤ��Υѥ�
�᡼�����ͤ�Ʊ���Ǥ���

@subsubheading ���顼

@table @code
@item CR_CONN_HOST_ERROR
@strong{MySQL} �����Фؤ���³�˼��Ԥ�����

@item CR_CONNECTION_ERROR
�������� @strong{MySQL} �����Фؤ���³�˼��Ԥ�����

@item CR_IPSOCK_ERROR
IP �����åȤ������˼��Ԥ�����

@item CR_OUT_OF_MEMORY
������­��

@item CR_SOCKET_CREATE_ERROR
Unix �����åȤ������˼��Ԥ�����

@item CR_UNKNOWN_HOST
�ۥ���̾�� IP  ���ɥ쥹�򸫤Ĥ���Τ˼��Ԥ�����

@item CR_VERSION_ERROR
�ۤʤ�ץ��ȥ���С���������Ѥ��륯�饤����ȥ饤�֥��ǥ����Фؤ���
³���ߤ���̤Υץ��ȥ���ߥ��ޥå�������ϡ��ȤƤ�Ť����饤����ȥ饤
�֥�����Ѥ��ơ�@code{--old-protocol} ���ץ�����դ��dz��Ϥ��Ƥ��ʤ���
���������Ф���³�������ȯ�����ޤ���

@item CR_NAMEDPIPEOPEN_ERROR;
Win32 ���̾���Ĥ��ѥ��פ������˼��Ԥ�����

@item CR_NAMEDPIPEWAIT_ERROR;
Win32 ���̾���Ĥ��ѥ��פ� wait �˼��Ԥ�����

@item CR_NAMEDPIPESETSTATE_ERROR;
Win32 ��Υѥ��ץϥ�ɥ�γ����˼��Ԥ�����
@end table

@subsubheading ��

@example 
MYSQL mysql;

mysql_init(&mysql);
mysql_options(&mysql,MYSQL_READ_DEFAULT_GROUP,"your_prog_name");
if (!mysql_real_connect(&mysql,"host","user","passwd","database",0,NULL,0))
@{
    fprintf(stderr, "Failed to connect to database: Error: %s\n",
          mysql_error(&mysql));
@}
@end example

By using @code{mysql_options()} the @strong{MySQL} library will read the
@code{[client]} and @code{your_prog_name} sections in the @code{my.cnf}
file which will ensure that your program will work, even if someone has
set up @strong{MySQL} in some non-standard way.

Note that upon connection, @code{mysql_real_connect()} sets the @code{reconnect}
flag (part of the MYSQL structure) to a value of @code{1}. This flag indicates,
in the event that a query cannot be performed because of a lost connection, to
try reconnecting to the server before giving up.


@findex @code{mysql_real_escape_string()}
@node mysql_real_escape_string, mysql_real_query, mysql_real_connect, C API functions
@subsection @code{mysql_real_escape_string()}

@code{unsigned int mysql_real_escape_string(MYSQL *mysql, char *to, const char *from, unsigned int length)}

@subsubheading ����

@code{from} ��ʸ�����SQL ���ơ��ȥ��ȤȤ��ƥ����Ф����뤳�Ȥ��Ǥ���
�褦�ˡ����ߤΥ���饯�������åȤ��θ���ʤ����Ѵ����ޤ���
��̤� @code{to} �����ꡢ��ü null ʸ�����ɲä��ޤ���
�Ѵ������ʸ����� @samp{NUL} (ASCII 0), @samp{\n}, @samp{\r}, @samp{\},
@samp{'}, @samp{"}, Control-Z �Ǥ���(@pxref{Literals}).

@code{from} �Ǽ������ʸ����
��@code{length} �Х���Ĺ�Ǥʤ���Фʤ�ޤ���
@code{to} �Хåե��ˤϾ��ʤ��Ȥ� @code{length*2+1} �Х���Ĺ�������Ƥ�
ɬ�פ�����ޤ����ʺǰ��ξ�硢���줾���ʸ�������Х��Ȥ��Ѵ�����뤳�Ȥ���
�ꡢ����˽�ü null �Х��ȤΤ���ξ�꤬ɬ�פǤ�����
@code{mysql_escape_string()} ����������Ȥ���@code{to} 
�����Ƥ� @code{NUL} ��üʸ����ˤʤ�ޤ���
����ͤ��Ѵ����줿ʸ�����Ĺ���Ǥ�����ü null ʸ���ϴޤߤޤ���

@subsubheading ��

@example
char query[1000],*end;

end = strmov(query,"INSERT INTO test_table values(");
*end++ = '\'';
end += mysql_real_escape_string(&mysql, end,"What's this",11);
*end++ = '\'';
*end++ = ',';
*end++ = '\'';
end += mysql_real_escape_string(&mysql, end,"binary data: \0\r\n",16);
*end++ = '\'';
*end++ = ')';

if (mysql_real_query(&mysql,query,(unsigned int) (end - query)))
@{
   fprintf(stderr, "Failed to insert row, Error: %s\n",
           mysql_error(&mysql));
@}
@end example

�嵭�� @code{strmov()} �ؿ��� @code{mysqlclient} �饤�֥��˴ޤޤ�Ƥ�
�ơ�@code{strcpy()} �Τ褦��Ư���ޤ������ǽ�ΰ����ν���� null �ؤΥݥ�
�󥿤��֤��ޤ���

@subsubheading �����

@code{to} ���֤��줿�ͤ�Ĺ������ü null ʸ���ϴޤߤޤ���

@subsubheading ���顼
̵����


@findex @code{mysql_real_query()}
@node mysql_real_query, mysql_reload, mysql_real_escape_string, C API functions
@subsection @code{mysql_real_query()}

@code{int mysql_real_query(MYSQL *mysql, const char *query, unsigned int length)}

@subsubheading ����

@code{query} �Ǽ������ SQL �������¹Ԥ��ޤ�������� @code{length} ��
����Ĺ�Ǥ���������ϤҤȤĤ� SQL ���ơ��ȥ��ȤǤʤ���Фʤ�ޤ��󡣽�ü
�Υ��ߥ�����(@samp{;})�� @code{\g} �򥹥ơ��ȥ��Ȥ��ɲä��٤��ǤϤ����
����

�Х��ʥ�ǡ�����ޤ९����� @code{mysql_real_query()} ���
��@emph{���ʤ���Фʤ�ޤ���}���Х��ʥ�ǡ����� @samp{\0} ʸ����ޤळ��
�����뤫��Ǥ���
�ޤ���@code{mysql_real_query()} �� @code{mysql_query()} ����®���Ǥ���
������� @code{strlen()} ��ƤФʤ�����Ǥ���

If you want to know if the query should return a result set or not, you can
use @code{mysql_field_count()} to check for this.
@xref{mysql_field_count, @code{mysql_field_count}}.

@subsubheading �����

�����꤬������������0�������꤬���Ԥ���������0��

@subsubheading ���顼

@table @code
@item CR_COMMANDS_OUT_OF_SYNC
�����ʽ�˥��ޥ�ɤ��¹Ԥ��줿��
@item CR_SERVER_GONE_ERROR
@strong{MySQL} �����Ф����ʤ��ʤä���
@item CR_SERVER_LOST
�����Фؤ���³����������˼���줿��
@item CR_UNKNOWN_ERROR
̤�ΤΥ��顼��ȯ��������
@end table

@findex @code{mysql_reload()}
@node mysql_reload, mysql_row_seek, mysql_real_query, C API functions
@subsection @code{mysql_reload()}

@code{int mysql_reload(MYSQL *mysql)}

@subsubheading ����

@strong{MySQL} �����Фˡ������������ơ��֥����ɤ߹��ߤ���褦�˰��ꤷ
�ޤ�����³���줿�桼���� @strong{reload} ���¤����ɬ�פ�����ޤ���

���δؿ��Ͽ侩����ޤ�������ˡ�SQL @code{FLUSH PRIVILEGES} ���ơ��ȥ�
��Ȥ�ȯ�Ԥ��� @code{mysql_query()} �λ��Ѥ��侩����ޤ���

@subsubheading �����

������0�����Ի���0��

@subsubheading ���顼

@table @code
@item CR_COMMANDS_OUT_OF_SYNC
�����ʽ�˥��ޥ�ɤ��¹Ԥ��줿��
@item CR_SERVER_GONE_ERROR
@strong{MySQL} �����Ф����ʤ��ʤä���
@item CR_SERVER_LOST
�����Фؤ���³����������˼���줿��
@item CR_UNKNOWN_ERROR
̤�ΤΥ��顼��ȯ��������
@end table

@findex @code{mysql_row_seek()}
@node mysql_row_seek, mysql_row_tell, mysql_reload, C API functions
@subsection @code{mysql_row_seek()}

@code{MYSQL_ROW_OFFSET mysql_row_seek(MYSQL_RES *result, MYSQL_ROW_OFFSET offset)}

@subsubheading ����
�쥳���ɥ�������򥯥����̥��å�������Х쥳���ɤ����ꤷ�ޤ�������ϡ���
�̥��åȹ�¤�Τ�������Τ��٤Ƥη�̤���äƤ��뤳�Ȥ��׵ᤷ�ޤ������Τ��ᡢ
@code{mysql_row_seek()} �� @code{mysql_store_result()} �ȶ��ˤ������ѤǤ���
@code{mysql_use_result()} �ȶ��ˤϻ��ѤǤ��ޤ���

���ե��åȤ� @code{mysql_row_tell()} �ޤ��� @code{mysql_row_seek()} �ƤӤ�
�����������ͤǤ���٤��Ǥ��������ͤ�ñ��ʥ쥳�����ֹ�ǤϤ���ޤ���;��
�������ֹ����Ѥ��Ʒ�̥��å���Υ쥳���ɤ˥��������������ϡ�
@code{mysql_data_seek()} ������˻��Ѥ��Ƥ���������

@subsubheading �����

�쥳���ɥ�������������͡������ͤϤ��θ�� @code{mysql_row_seek()} �ƤӤ�
�����Ϥ����Ȥ��Ǥ��ޤ���

@subsubheading ���顼
̵����

@findex @code{mysql_row_tell()}
@node mysql_row_tell, mysql_select_db, mysql_row_seek, C API functions
@subsection @code{mysql_row_tell()}

@code{MYSQL_ROW_OFFSET mysql_row_tell(MYSQL_RES *result)}

@subsubheading ����

�Ǹ�� @code{mysql_fetch_row()} �ˤĤ��ƥ쥳���ɥ�������θ��ߤΰ��֤��֤��ޤ���
�����ͤ� @code{mysql_row_seek()} �ؤΰ����Ȥ��ƻ��ѤǤ��ޤ���

@code{mysql_row_tell()} �� @code{mysql_store_result()} �θ�ˤ������Ѥ���
���ǡ�@code{mysql_use_result()} �θ�ˤϻ��Ѥ��٤��ǤϤ���ޤ���

@subsubheading �����

�ԥ�������θ��ߤΥ��ե��åȡ�

@subsubheading ���顼
̵����

@findex @code{mysql_select_db()}
@node mysql_select_db, mysql_shutdown, mysql_row_tell, C API functions
@subsection @code{mysql_select_db()}

@code{int mysql_select_db(MYSQL *mysql, const char *db)}

@subsubheading ����

@code{mysql} �Ǽ�����븽�ߤ���³�ˡ��ǥե����(���ߤ�)�ǡ����١����Ȥ�
�� @code{db} �Ǽ������ǡ����١�������Ѥ���褦�˻ؼ����ޤ����ʹߤΥ�
����Ǥϡ�����Ū�˥ǡ����١�������ꤷ�ʤ��ơ��֥뻲�ȤˤĤ��ơ����Υǡ�
���١������ǥե���Ȥˤʤ�ޤ���

��³���줿�桼�����ǡ����١�������Ѥ��븢�¤���äƤ���Ⱦ�������ʤ���
�С�@code{mysql_select_db()} �ϼ��Ԥ��ޤ���

@subsubheading �����

������0�����Ի���0��

@subsubheading ���顼

@table @code
@item CR_COMMANDS_OUT_OF_SYNC
�����ʽ�˥��ޥ�ɤ��¹Ԥ��줿��
@item CR_SERVER_GONE_ERROR
@strong{MySQL} �����Ф����ʤ��ʤä���
@item CR_SERVER_LOST
�����Фؤ���³����������˼���줿��
@item CR_UNKNOWN_ERROR
̤�ΤΥ��顼��ȯ��������
@end table

@findex @code{mysql_shutdown()}
@node mysql_shutdown, mysql_stat, mysql_select_db, C API functions
@subsection @code{mysql_shutdown()}

@code{int mysql_shutdown(MYSQL *mysql)}

@subsubheading ����

�ǡ����١��������Ф˥���åȥ����󤹤�褦���׵ᤷ�ޤ�����³���줿�桼��
�� @strong{shutdown} ���¤���äƤ���ɬ�פ�����ޤ���

@subsubheading �����

������0�����Ի���0��

@subsubheading ���顼

@table @code
@item CR_COMMANDS_OUT_OF_SYNC
�����ʽ�˥��ޥ�ɤ��¹Ԥ��줿��
@item CR_SERVER_GONE_ERROR
@strong{MySQL} �����Ф����ʤ��ʤä���
@item CR_SERVER_LOST
�����Фؤ���³����������˼���줿��
@item CR_UNKNOWN_ERROR
̤�ΤΥ��顼��ȯ��������
@end table

@findex @code{mysql_stat()}
@node mysql_stat, mysql_store_result, mysql_shutdown, C API functions
@subsection @code{mysql_stat()}

@code{char *mysql_stat(MYSQL *mysql)}

@subsubheading ����

@code{mysqladmin status} ���󶡤����Τ�Ʊ�ͤξ����ʸ����Ȥ����֤���
����������äǤ� uptime �ȡ��¹���Υ���åɿ����䤤��碌�������ɤ߹���
���������ץ�ơ��֥����ޤߤޤ���

@subsubheading �����

�����о��֤�ɽ�魯ʸ���󡣥��顼��ȯ��������� @code{NULL}��

@subsubheading ���顼

@table @code
@item CR_COMMANDS_OUT_OF_SYNC
�����ʽ�˥��ޥ�ɤ��¹Ԥ��줿��
@item CR_SERVER_GONE_ERROR
@strong{MySQL} �����Ф����ʤ��ʤä���
@item CR_SERVER_LOST
�����Фؤ���³����������˼���줿��
@item CR_UNKNOWN_ERROR
̤�ΤΥ��顼��ȯ��������
@end table

@findex @code{mysql_store_result()}
@node mysql_store_result, mysql_thread_id, mysql_stat, C API functions
@subsection @code{mysql_store_result()}

@code{MYSQL_RES *mysql_store_result(MYSQL *mysql)}

@subsubheading ����

�ǡ�������Ф�������(@code{SELECT}, @code{SHOW}, @code{DESCRIBE},
@code{EXPLAIN})������������ˡ�@code{mysql_store_result()} �ޤ��� 
@code{mysql_use_result()} ��ƤӽФ�ɬ�פ�����ޤ���

If you want to know if the query should return a result set or not, you can
use @code{mysql_field_count()} to check for this.
@xref{mysql_field_count, @code{mysql_field_count}}.

@code{mysql_store_result()} �ϥ�����Τ��٤Ƥη�̤򥯥饤����Ȥ��ɤ߹��ߡ�
@code{MYSQL_RES} ��¤�Τ������ơ����ι�¤�Τ˷�̤����֤��ޤ���

@code{mysql_store_results()} returns a null pointer if the query didn't return
a result sets (If the query was for example an @code{INSERT} statement).

@code{mysql_store_results()} returns also null pointer if reading of the
result set failed. You can check if you got an error by checking if
@code{mysql_error()} doesn't return a null pointer, if
@code{mysql_errno()} returns <> 0 or if @code{mysql_field_count()}
returns <> 0.

�֤����쥳���ɤ�̵����硢���η�̥��åȤ��֤���ޤ��� (���η�̥��åȤ� 
@code{NULL} ����ͤȤϰۤʤ�ޤ���)

���� @code{mysql_store_result()} ��ƤӽФ��� null �ݥ��󥿡��Ǥʤ�
��̤���������Ǥ����顢��̥��å���ˤ����ĤΥ�
�����ɤ����뤫�򸫤Ĥ��뤿��ˡ�@code{mysql_num_rows()} ��ƤӽФ����Ȥ���
���ޤ���

��̥��åȤ���쥳���ɤ���Ф������ @code{mysql_fetch_row()} ��ƤӽФ�
���Ȥ��Ǥ��ޤ����ޤ�����̥��å���θ��ߤΥ쥳���ɰ��֤����꡿�������뤿��
�� @code{mysql_row_seek()} �� @code{mysql_row_tell()} ��ƤӽФ����Ȥ��Ǥ�
�ޤ���

���ٷ�̥��åȤǹԤʤ��ȡ�@code{mysql_free_result()} ��ƤӽФ�ɬ�פ���
��ޤ���

@xref{NULL mysql_store_result, , @code{NULL mysql_store_result()}}.

@subsubheading �����

��̤� @code{MYSQL_RES} ��̹�¤�Ρ����顼�������� @code{NULL}��

@subsubheading ���顼

@table @code
@item CR_COMMANDS_OUT_OF_SYNC
�����ʽ�˥��ޥ�ɤ��¹Ԥ��줿��
@item CR_OUT_OF_MEMORY
������­��
@item CR_SERVER_GONE_ERROR
@strong{MySQL} �����Ф����ʤ��ʤä���
@item CR_SERVER_LOST
�����Фؤ���³����������˼���줿��
@item CR_UNKNOWN_ERROR
̤�ΤΥ��顼��ȯ��������
@end table

@findex @code{mysql_thread_id()}
@node mysql_thread_id, mysql_use_result, mysql_store_result, C API functions
@subsection @code{mysql_thread_id()}

@code{unsigned long mysql_thread_id(MYSQL *mysql)}

@subsubheading ����

���ߤ���³�Υ���å� ID ���֤��ޤ��������ͤϡ�����åɤ򻦤������
@code{mysql_kill()} �ؤΰ����Ȥ��ƻ��ѤǤ��ޤ���

��³�������ơ�@code{mysql_ping()} �Ǻ���³������硢����å� ID ���ѹ���
��ޤ�������ϥ���å� ID ���ǻȤ�����˼������Ƴ�Ǽ���٤��ǤϤʤ����Ȥ�
��̣���ޤ���ɬ�פʻ��ˤ����������٤��Ǥ���

@subsubheading �����

���ߤ���³�Υ���å� ID��

@subsubheading ���顼
̵����

@findex @code{mysql_use_result()}
@node mysql_use_result, NULL mysql_store_result, mysql_thread_id, C API functions
@subsection @code{mysql_use_result()}

@code{MYSQL_RES *mysql_use_result(MYSQL *mysql)}

@subsubheading ����

�ǡ�������Ф�������(@code{SELECT}, @code{SHOW}, @code{DESCRIBE},
@code{EXPLAIN})������������ˡ� @code{mysql_store_result()} �ޤ��� 
@code{mysql_use_result()} ��ƤӽФ�ɬ�פ�����ޤ���

@code{mysql_use_result()} �Ϸ�̥��åȸ����򳫻Ϥ��ޤ���,
@code{mysql_store_result()} �Τ褦�ˡ��ºݤ˥��饤����Ȥ˷�̥��åȤ��ɤ�
���ޤ���. ����ˡ��ƥ쥳���ɤ� @code{mysql_fetch_row()} �ƤӤ������Ԥ�
���뤳�Ȥˤ�ꡢ�ġ��˼��Ф���ޤ���
@code{mysql_use_result()} �ϥ�����η�̤򡢰���ơ��֥���������Хåե�
�˳�Ǽ���뤳��̵���������Ф���ľ���ɤ߹��ߤޤ�������� 
@code{mysql_store_result()} ���⤤���餫®�������ʤ��������Ѥ��ޤ���
���ξ�硢���饤����Ȥϸ��ߤιԤ���³�Хåե�
( @code{max_allowed_packet} bytes �ޤ����ä��� ) �Υ�������������Ƥޤ���

���������饤�����¦�dzƹԤ�
�Ĥ���¿���ν�����Ԥʤ����䡢�桼���� @code{^S} (�������������) ����
�ϤǤ���褦�ʲ��̤˽��Ϥ�������ϡ�@code{mysql_use_result()} ����Ѥ�
�٤��ǤϤ���ޤ��󡣤���ϥ����Ф�Ϣ�Ȥ��Ƥ��ꡢ¾�Υ���åɤ�
�ǡ��������Ф����ơ��֥�򹹿����������⤷�ޤ���

@code{mysql_use_result()} ���ѻ���@code{NULL} �ͤ���Ф��ޤ� 
@code{mysql_fetch_row()} ��¹Ԥ���ɬ�פ�����ޤ����������ʤ��ȡ����Υ�
��������Υ����꤫���̤���Ф��ޤ��������˺���ȡ�C API �ϥ��顼 
@code{Commands out of sync; You can't run this command now} ��Ϳ���ޤ���

@code{mysql_use_result()} �����֤�����̤Ǥϡ�
@code{mysql_data_seek()}, @code{mysql_row_seek()},
@code{mysql_row_tell()}, @code{mysql_num_rows()},
@code{mysql_affected_rows()} ����ѤǤ��ޤ���
�ޤ���@code{mysql_use_result()} ����λ����ޤ�¾�Υ������ȯ�Ԥ�Ǥ��ޤ�
��(���ƤιԤ�ե��å�������ˡ��ե��å����줿�Կ����Τ뤿��� 
@code{mysql_num_rows} ��ƤӽФ����Ȥ��Ǥ��ޤ���)

���ٷ�̥��åȤǹԤʤ��ȡ�@code{mysql_free_result()} ��ƤӽФ�ɬ�פ���
��ޤ���

@subsubheading �����

��̤� @code{MYSQL_RES} ��̹�¤�Ρ����顼�������� @code{NULL}��

@subsubheading ���顼

@table @code
@item CR_COMMANDS_OUT_OF_SYNC
�����ʽ�˥��ޥ�ɤ��¹Ԥ��줿��
@item CR_OUT_OF_MEMORY
������­��
@item CR_SERVER_GONE_ERROR
@strong{MySQL} �����Ф����ʤ��ʤä���
@item CR_SERVER_LOST
�����Фؤ���³����������˼���줿��
@item CR_UNKNOWN_ERROR
̤�ΤΥ��顼��ȯ��������
@end table

@node NULL mysql_store_result, Query results, mysql_use_result, C API functions
@subsection @code{mysql_query()} ���������֤����塢@code{mysql_store_result()} �� @code{NULL} ���֤���������Τϲ��Ρ�

@code{mysql_query()} �θƤӽФ�������������� 
@code{mysql_store_result()} �� @code{NULL} ���֤����Ȥ�����ޤ������줬
�����ä��Ȥ������ξ��Τɤ줫��ȯ�����̣���ޤ�:

@itemize @bullet
@item
@code{malloc()} �����Ԥ��� (�㤨�С���̥��åȤ��礭�᤮�����)��

@item
�ǡ������ɤ�ʤ��ä� (��³�Υ��顼)��

@item
�����꤬�ǡ������֤��ʤ��ä� (@code{INSERT}, @code{UPDATE}, @code{DELETE})��
@end itemize

���ơ��ȥ��Ȥ����Ǥʤ���̤��󶡤��뤫�ɤ����� 
@code{mysql_field_count()} �θƤӽФ��ˤ�äƤ��ĤǤ�����å��Ǥ��ޤ���
@code{mysql_field_count()} �� 0 ���֤���硢��̤϶��ǺǸ�Υ�������ͤ�
�֤��ʤ����ơ��ȥ��ȤǤ� (�㤨�С�@code{INSERT} �� @code{DELETE})��
@code{mysql_field_count()} ���� 0 �ͤ��֤���硢���ơ��ȥ��Ȥ϶��Ǥʤ�
��̤��󶡤��ޤ���
���@code{mysql_field_count()} �ؿ��������򻲾Ȥ��Ƥ���������

@code{mysql_error()} �ޤ��� @code{mysql_errno()} ��ƤӽФ����Ȥˤ�ä�
���顼�Υƥ��Ȥ�Ǥ��ޤ���

@node Query results, Getting unique ID, NULL mysql_store_result, C API functions
@subsection �����꤫���������̤ϲ�����

������ˤ�ä��֤�����̥��åȤ˲ä��ơ����ξ�������뤳�Ȥ��Ǥ��ޤ�:

@itemize @bullet
@item
@code{mysql_affected_rows()} �ϡ�@code{INSERT}, @code{UPDATE} �ޤ��� 
@code{DELETE} ��Ԥʤä����κǸ�Υ�����ǡ��ƶ����줿�Կ����֤��ޤ���
@code{WHERE} �᤬�ʤ� @code{DELETE} �����Ѥ���ơ��ơ��֥뤬�ڤ�ͤ���
�������㳰�Ǥ�������ϤȤƤ�®���Ǥ��� ���ξ�硢
@code{mysql_affected_rows()} �ϱƶ����줿�Կ��� 0 ���֤��ޤ���

@item
@code{mysql_num_rows()} �Ϸ�̥��åȤΥ쥳���ɿ����֤��ޤ���
@code{mysql_store_result()} �Ǥϡ�@code{mysql_num_rows()} �� 
@code{mysql_store_result()} ����������������˸ƤӽФ����Ȥ��Ǥ��ޤ���
@code{mysql_use_result()} �Ǥϡ�@code{mysql_num_rows()} �� 
@code{mysql_fetch_row()} �Ǥ��٤ƤΥ쥳���ɤ���Ф�����ˤ����ƤֽФ���
�Ȥ��Ǥ��ޤ���

@item
@code{mysql_insert_id()} �ϡ�@code{AUTO_INCREMENT} ����ǥå�������ĥơ�
�֥�˹Ԥ����������Ǹ�Υ�����ˤ�ä��������줿 ID ���֤��ޤ���
@xref{mysql_insert_id, , @code{mysql_insert_id()}}.

@item
�����Ĥ��Υ����� (@code{LOAD DATA INFILE...}, @code{INSERT INTO ... 
SELECT ...}, @code{UPDATE}) ���ɲþ�����֤��ޤ�����̤� 
@code{mysql_info()} ���֤���ޤ���
�֤�ʸ����η����ˤĤ��Ƥϡ�@code{mysql_info()} �������򻲾Ȥ��Ƥ���������
@code{mysql_info()} ���ɲþ��󤬤ʤ���
��� @code{NULL} �ݥ��󥿤��֤��ޤ���
@end itemize

@node Getting unique ID, C API linking problems, Query results, C API functions
@subsection �Ǹ���������줿�ԤΥ�ˡ��� ID ��ɤΤ褦�������뤫��

@code{AUTO_INCREMENT} °������Ĺ��ܤ�ޤ�ơ��֥�˥쥳���ɤ����������
�硢@code{mysql_insert_id()} �ؿ���Ϳ����줿 ID �����뤳�Ȥ��Ǥ��ޤ���

@code{mysql_query()} ���Ϥ�������ʸ�������@code{LAST_INSERT_ID()} �ؿ�
����Ѥ��뤳�ȤǤ⡢ID ����Ф����Ȥ��Ǥ��ޤ���

���Υ����ɤ�¹Ԥ��뤳�Ȥǡ�@code{AUTO_INCREMENT} ����ǥå��������Ѥ���
�����ɤ��������å��Ǥ��ޤ�������ϡ������꤬ @code{AUTO_INCREMENT} ����
�ǥå�����ȼ�� @code{INSERT} ���ä����ɤ���������å��Ǥ��ޤ�:

@example
if (mysql_error(&mysql)[0] == 0 &&
    mysql_num_fields(result) == 0 &&
    mysql_insert_id(&mysql) != 0)
@{
    used_id = mysql_insert_id(&mysql);
@}
@end example

�������줿�Ǹ�� ID ����³��˥�������ǰݻ�����Ƥ��ޤ���¾�Υ��饤�����
�ˤ�ä��ѹ��Ϥ���ޤ���¾�� @code{AUTO_INCREMENT} ���ܤ���ޥ��å��� 
(���ʤ����@code{NULL} �Ǥʤ� @code{0} �Ǥʤ���) �ǹ���������Ǥ⡢������ѹ�
����ޤ���

�ޤ���¾�Υơ��֥�ˤ��� ID ���������褦�Ȥ����硢���ǹԤʤ����Ȥ��Ǥ��ޤ�:

@example
INSERT INTO foo (auto,text)
    VALUES(NULL,'text');              # generate ID by inserting NULL
INSERT INTO foo2 (id,text)
    VALUES(LAST_INSERT_ID(),'text');  # use ID in second table
@end example

@node C API linking problems, Thread-safe clients, Getting unique ID, C API functions
@subsection C API �ǤΥ�󥯤�����

C API �ǥ�󥯤�����������Ĥ��Υ����ƥ��Ǥϼ��Υ��顼�ˤʤ�ޤ�:

@example
gcc -g -o client test.o -L/usr/local/lib/mysql -lmysqlclient -lsocket -lnsl

Undefined        first referenced
 symbol          in file
floor            /usr/local/lib/mysql/libmysqlclient.a(password.o)
ld: fatal: Symbol referencing errors. No output written to client
@end example

����ϡ����ʤ��Υ����ƥ��Ǥϡ�����ѥ���/��󥯹ԤκǸ�ˡ�math �饤��
��� (@code{-lm}) ��ޤ��ɬ�פ����뤳�Ȥ��̣���ޤ���

@node Thread-safe clients,  , C API linking problems, C API functions
@subsection ����åɰ������饤����Ȥ�����ˡ

���饤����Ȥ� `�ۤȤ��' ����åɰ����Ǥ��������礭������� 
@file{net.c} (�����åȤ����ɤ߹��ߤ򤹤륵�֥롼�����ޤ�ե�����) ����
����߰����Ǥʤ����ȤǤ�������ϡ������Ф����Ĺ���ɤ߹��ߤ����ǤǤ����
���ˡ����ȤΥ��顼�����������������Ȥ�����θ�ǹԤʤ��ޤ�����
If you
install an interrupt handlers for the @code{SIGPIPE} interrupt,
the socket handling should be thread safe. 

ɸ�९�饤����ȥ饤�֥��ϥ���åɥ��ץ����ǥ���ѥ��뤵��Ƥ��ޤ���

����åɰ������饤�����(MySQL�����С��Ȥ��̿����ˡ�
¾�Υ���åɤ����饤����ȤΥ���åɤ� interrupt �򤫤����ꡢ
�����ॢ���Ȥ򥻥åȤ����ꤹ��)
�����뤿��ˤϡ�@code{-lmysys}, @code{-lstring},
@code{-ldbug} �饤�֥��ȥ����Ф����Ѥ��� @code{net_serv.o} ����Ѥ���
����

If you don't need interrupts or timeouts you can just compile the client
library @code{(mysqlclient)} to be thread safe and use this.  In this
case you don't have to worry about the @code{net_serv.o} object file or
the other @strong{MySQL} libraries.

����åɥ��饤����Ȥ���Ѥ������@file{thr_alarm.c} �롼������礤�˻�
�ѤǤ��ޤ���@code{mysys} �饤�֥�꤫��Υ롼�������Ѥ����硢�Ф���
�����ʤ���Фʤ�ʤ����Ȥ� @code{my_init()} ��ǽ�˸Ƥ֤��Ȥ����Ǥ���

@code{mysql_real_connect()} ��������Ƥδؿ��ϸ��ߥ���åɰ����Ǥ��������
�ɰ������饤����ȥ饤�֥��򥳥�ѥ��뤷������򥹥�åɰ����ʥޥʡ��ǻ�
�Ѥ��뤿�����ˡ�򡢼������դ��������ޤ���(���� 
@code{mysql_real_connect()} �ˤĤ��Ƥ����դϡ��ºݤˤ� 
@code{mysql_connect()} �ˤ�ͭ���Ǥ��������� @code{mysql_connect()} �Ͽ侩
����ޤ���Τǡ��Ȥˤ��� @code{mysql_real_connect()} ����Ѥ��٤��Ǥ���)

@code{mysql_real_connect()} �򥹥�åɰ����ˤ��뤿��ˤϡ����饤����Ȥ򼡤�
���ޥ�ɤǺƥ���ѥ��뤹��ɬ�פ�����ޤ�:

@example
shell> ./configure --enable-thread-safe-client
@end example

This will ensure that the client library will use the header files required
for thread safe programs and also that @code{mysql_real_connect()} will use
a thread safe version of the @code{gethostbyname()} call.

ɸ�९�饤����ȤΥ�󥯻���̤�������ܥ�Τ��ᤤ���Ĥ��Υ��顼���Ф��
���礦������ϥǥե���ȤǤ� pthread �饤�֥�꤬�ޤޤ�Ƥ��ʤ�����Ǥ���

@c ��̤� @file{libmysqld.a} �饤�֥��ϸ��ߥ���åɰ����Ǥ���

@c 2�ĤΥ���åɤ�Ʊ����³�ϥ�ɥ� (@code{mysql_connect()} ���֤������) 
@c ��Ʊ���˻��ѤǤ��ޤ���2�ĤΥ���åɤ���@code{mysql_store_result()} ��
@c �������줿�ۤʤ� @code{MYSQL_RES} �ݥ��󥿤���ѤǤ���Ȥ��Ƥ�Ǥ���

��̤� @file{libmysqlclient.a} �饤�֥��ϥ���åɰ����Ǥ�������ΰ�̣��
�뤳�Ȥϡ�Ʊ����³�ϥ�ɥ�(@code{mysql_real_connect()} ���֤����)�ˡ�Ʊ��
�ˣ��ĤΥ���åɤ��饯�����Ԥʤ�ʤ��¤ꡢ���饤����ȥ����ɤϥ���åɰ�
���Ȥ������ȤǤ�; ���饤����ȡ������Хץ��ȥ���ϡ�Ϳ����줿��³���Ʊ��
�˰�Ĥ��׵����������ޤ���ʣ���Υ���åɤ���Ʊ����³����Ѥ��������ϡ�
@code{mysql_query()} �� @code{mysql_store_result()} ���Ȥ߹�碌�Τޤ��� 
mutex lock ��Ԥʤ�ɬ�פ�����ޤ������� @code{mysql_store_result()} ���Ѱ�
���Ǥ���ȡ����å��ϲ����Ǥ���¾�Υ���åɤ�Ʊ����³�˥������Ԥʤ����Ȥ�
�Ǥ��ޤ���(¾�θ��դǸ����ȡ����������å��ץ��ȥ������Ѥ���¤ꡢ�̤Υ�
��åɤϡ�@code{mysql_store_result()} ������������̤� @code{MYSQL_RES} ��
���󥿤���ѤǤ��ޤ���) POSIX ����åɤǥץ�������Ԥʤ���硢
@code{pthread_mutex_lock()} �� @code{pthread_mutex_unlock()} ��mutex
lock �γ�Ω�Ȳ����˻��ѤǤ��ޤ���

@code{mysql_store_result()} �Ǥʤ� @code{mysql_use_result()} ����Ѥ����
�硢@code{mysql_use_result()} �β��� @code{mysql_fetch_row()} �ƤӽФ���
���å���ɬ�פǤ���������������åɲ����饤����Ȥ������˰����ɤ��Τϡ�
@code{mysql_use_result()} ����Ѥ��ʤ����ȤǤ���

@node Perl, Eiffel, C API functions, Clients
@section @strong{MySQL} Perl API

�����Ǥ� Perl @code{DBI} ���󥿡��ե������ˤĤ��ƽҤ٤롣
�����Υ��󥿡��ե������� @code{mysqlperl} �Ǥ��ä���
@code{DBI}/@code{DBD} �� Perl ���󥿡��ե������Ȥ��Ƹ��߿侩����Ƥ���Τǡ�
@code{mysqlperl} �˴ؤ��ƤϤ����ǤϽҤ٤ʤ���

@menu
* DBI with DBD::                @code{DBI} with @code{DBD::mysql}
* Perl DBI Class::              The @code{DBI} interface
* DBI-info::                    More @code{DBI}/@code{DBD} information
@end menu

@node DBI with DBD, Perl DBI Class, Perl, Perl
@subsection @code{DBI} with @code{DBD::mysql}

@code{DBI} ��¿���Υǡ������١����Ȥΰ���Ū�ʥ��󥿡��ե������Ǥ��롣
����ϡ�¿���Υǡ������١�����ư��륹����ץȤ��ѹ��ʤ��˽񤱤뤳�Ȥ��̣���롣
���Τ���ˤϡ����줾��Υǡ����١����ѤΥǡ����١����ɥ饤�� (DBD) ��ɬ�פǤ��롣
@strong{MySQL} �Ǥϡ����Υɥ饤�Ф� @code{DBD::mysql} �Ǥ��롣

Perl5 DBI �˴ؤ���ܺ٤ϡ�@code{DBI}�����å֥ڡ����򻲾ȤΤ��ȡ�
@example
@uref{http://www.symbolstone.org/technology/perl/DBI/index.html}
@end example
Object Oriented Programming (OOP) �˴ؤ���ܺ٤ϡ�Perl OOP �ڡ����򻲾ȤΤ��ȡ�
@example
@uref{http://language.perl.com/info/documentation.html}
@end example

Installation instructions for @strong{MySQL} Perl support are given in
@ref{Perl support}.

@cindex @code{DBI} Perl module
@node Perl DBI Class, DBI-info, DBI with DBD, Perl
@subsubsection The @code{DBI} interface

@noindent
@strong{Portable DBI methods}

@multitable @columnfractions .3 .7
@item @code{connect} @tab �ǡ����١��������Ф���³����
@item @code{disconnect} @tab �ǡ����١��������ФȤ���³���ڤ�
@item @code{prepare} @tab SQLʸ�����ꤹ��
@item @code{execute} @tab ���ꤵ�줿SQLʸ��¹Ԥ���
@item @code{do}      @tab SQLʸ�����ꤷ���¹Ԥ���
@item @code{quote}   @tab �������뤿��Υ�������ʸ�����ޤ��� @code{BLOB} ��
@item @code{fetchrow_array} @tab �ե�����ɤ�����Ȥ��Ƽ��Υ쥳���ɤ���Ф�
@item @code{fetchrow_arrayref} @tab �ե�����ɤ����󻲾ȤȤ��Ƽ��Υ쥳���ɤ���Ф�
@item @code{fetchrow_hashref} @tab �ϥå���ơ��֥�ؤλ��ȤȤ��Ƽ��Υ쥳���ɤ���Ф�
@item @code{fetchall_arrayref} @tab ���������Ȥ������ǡ�������Ф�
@item @code{finish}  @tab ̿���λ�����꥽�������饷���ƥ���ڤ�Υ��
@item @code{rows}    @tab �ƶ��Τ��ä��쥳���ɤο����֤�
@item @code{data_sources} @tab ��������ۥ��Ⱦ�����ѤǤ���ǡ����١�����������֤�
@item @code{ChopBlanks} @tab @code{fetchrow_*} �᥽�åɤ��������������ɤ������������
@item @code{NUM_OF_PARAMS} @tab ���ꤵ�줿̿��ʸ��� placeholder �ο�
@item @code{NULLABLE} @tab �ɤΥե�����ɤ� @code{NULL} �ͤ����뤫��
@item @code{trace}    @tab Perform tracing for debugging
@end multitable

@noindent
@strong{MySQL ��ͭ�᥽�å�}

@multitable @columnfractions .3 .7
@item @code{insertid} @tab �Ǹ�� @code{AUTO_INCREMENT} ��
@item @code{is_blob} @tab �ɤΥե�����ɤ� @code{BLOB} ����
@item @code{is_key} @tab �ɤΥե�����ɤ���������
@item @code{is_num} @tab �ɤΥե�����ɤ����ͷ�����
@item @code{is_pri_key} @tab �ɤΥե�����ɤ��ץ饤�ޥꥭ������
@item @code{is_not_null} @tab �ɤΥե�����ɤ� @code{NULL} �ͤ�����@code{NULLABLE} ���ȡ�
@item @code{length} @tab ���Ѳ�ǽ�ʥե�����ɥ������κ�����
@item @code{max_length} @tab �ºݤ�¸�ߤ��Ƥ���ե�����ɥ������κ�����
@item @code{NAME} @tab �ե������̾
@item @code{NUM_OF_FIELDS} @tab �֤��줿�ե�����ɤο�
@item @code{table} @tab �֤��줿���åȤΥơ��֥�̾
@item @code{type} @tab ���ƤΥե�����ɤη�
@item @code{_CreateDB} @tab �ǡ����١������������
@item @code{_DropDB} @tab �ǡ����١����������롣 @strong{���������Υ᥽�åɤϴ����Ǥ��������}
@end multitable

�ʲ�����ˡ����ܺ٤� Perl �᥽�åɤβ��⤬���롣
Variables used for method return values have these meanings:

@table @code
@item $dbh
Database handle

@item $sth
Statement handle

@item $rc
Return code (often a status)

@item $rv
Return value (often a row count)
@end table

@noindent
@strong{���� DBI �᥽�å�}

@table @code

Generally the 'do' statement is MUCH faster (and is preferable)
than prepare/execute for statements that doesn't contain parameters.

@findex DBI->connect()
@findex connect() DBI method
@item connect($data_source, $username, $password)
�ǡ����������ȤΥǡ����١�����³�򤹤뤿��� @code{connect} ��Ȥ���
@code{$data_source} �ͤ� @code{DBI:driver_name:} �ǤϤ���뤳�ȡ�
@code{DBD::mysql} �ɥ饤�С����Ѥ��� @code{connect} �λ����㡧
@example
$dbh = DBI->connect("DBI:mysql:$database", $user, $password);
$dbh = DBI->connect("DBI:mysql:$database:$hostname",
                    $user, $password);
$dbh = DBI->connect("DBI:mysql:$database:$hostname:$port",
                    $user, $password);
@end example
�桼����̾�ޤ��ϥѥ���ɤ�̤����ξ�硢 @code{DBI} �ϴĶ��ѿ��Ǥ���
 @code{DBI_USER} �� @code{DBI_PASS} �򤽤줾��Ȥ���
�ۥ���̾����ꤷ�ʤ����ϡ�@code{'localhost'} ���ǥե���ȤȤʤ롣
�ݡ����ֹ����ꤷ�ʤ����ϡ�@strong{MySQL} �ݡ��ȡ�@value{default_port}��
���ǥե���ȤȤʤ롣

As of @code{Msql-Mysql-modules} version 1.2009,
the @code{$data_source} value allows certain modifiers:

@table @code
@item mysql_read_default_file=file_name
Read @file{filename} as an option file.  For information on option files,
see @ref{Option files}.

@item mysql_read_default_group=group_name
The default group when reading an option file is normally the
@code{[client]} group.  By specifying the @code{mysql_read_default_group}
option, the default group becomes the @code{[group_name]} group.

@item mysql_compression=1
Use compressed communication between the client and server (@strong{MySQL}
3.22.3 or later).

@item mysql_socket=/path/to/socket
Specify the pathname of the Unix socket that is used to connect
to the server (@strong{MySQL} 3.21.15 or later).
@end table

Multiple modifiers may be given; each must be preceded by a semicolon.

For example, if you want to avoid hardcoding the user name and password into
a @code{DBI} script, you can take them from the user's @file{~/.my.cnf}
option file instead by writing your @code{connect} call like this:

@example
$dbh = DBI->connect("DBI:mysql:$database"
                . ";mysql_read_default_file=$ENV@{HOME@}/.my.cnf",
                $user, $password);
@end example

This call will read options defined for the @code{[client]} group in the
option file.  If you wanted to do the same thing, but use options specified
for the @code{[perl]} group as well, you could use this:

@example
$dbh = DBI->connect("DBI:mysql:$database"
                . ";mysql_read_default_file=$ENV@{HOME@}/.my.cnf"
                . ";mysql_read_default_group=perl",
                $user, $password);
@end example

@findex DBI->disconnect
@findex disconnect DBI method
@item disconnect
@code{disconnect} �᥽�åɤϡ��ǡ����١����ȤΥǡ����١����ϥ�ɥ�����Ǥ��롣
�ץ�������λ����ľ���˸ƤӽФ����Τ�ŵ��Ū�Ǥ��롣
�㡧
@example
$rc = $dbh->disconnect;
@end example

@findex DBI->prepare()
@findex prepare() DBI method
@item prepare($statement)
�ǡ����١������󥸥�Ǽ¹Ԥ��뤿���SQLʸ�����ꤷ��@code{execute} �᥽�åɤ�
���ѽ���륹�ơ��ȥ��ȥϥ�ɥ� @code{($sth)} ���֤���
Typically you handle @code{SELECT} statements (and @code{SELECT}-like statements
such as @code{SHOW}, @code{DESCRIBE} and @code{EXPLAIN}) by means of
@code{prepare} and @code{execute}.
�㡧
@example
$sth = $dbh->prepare($statement)
    or die "Can't prepare $statement: $dbh->errstr\n";
@end example

@findex DBI->execute
@findex execute DBI method
@item execute
@code{execute} �᥽�åɤϡ����ꤵ�줿SQLʸ��¹Ԥ��롣�� @code{SELECT} ʸ�ΤȤ��ϡ�
�ƶ��Τ��ä��쥳���ɤο����֤��� �⤷�ʤ���Ѳ���ʤ��ä��ʤ顢 @code{execute} �� @code{"0E0"}
(����� Perl �Ǥ� ���� �����Ǥ����� �� �Ǥ⤢��) ���֤���
@code{SELECT} ʸ�ΤȤ��ϡ�SQL�׵�򳫻Ϥ���ΤߤǤ��롣
�ǡ��������� @code{fetch_*} �᥽�åɤ���ΰ�Ĥ򵭽Ҥ���ɬ�פ����롣
�㡧
@example
$rv = $sth->execute
          or die "can't execute the query: $sth->errstr;
@end example

@findex DBI->do()
@findex do() DBI method
@item do($statement)
@code{do} �᥽�åɤ�SQLʸ�����ꡦ�¹Ԥ����ƶ��Τ��ä��쥳���ɤο����֤���
���Υ᥽�åɤϡ����� select��ʸ�����ʤ�������١ʥɥ饤�С��θ³��Τ���ˤ�����Ǥ��ʤ�ʸ��
���٤μ¹ԡ�inserts, deletes �ʤɡˤǺѤ�ʸ�ΤȤ��˰���Ū���Ѥ����롣
�㡧
@example
$rv = $dbh->do($statement)
        or die "Can't execute $statement: $dbh- >errstr\n";
@end example

@findex DBI->quote()
@findex quote() DBI method
@cindex Quoting strings
@cindex Strings, quoting
@item quote($string)
@code{quote} �᥽�åɤϡ�ʸ������˥���������ʸ��������Ȥ����Ѥ���졢
��������ʸ����ʸ�γ�¦���ղä��롣
�㡧
@example
$sql = $dbh->quote($string)
@end example

@findex DBI->fetchrow_array
@findex fetchrow_array DBI method
@item fetchrow_array
���Υ᥽�åɤϥǡ����μ��Υ쥳���ɤ���Ф����ե�����ɤ��ͤ�����Ȥ����֤���
�㡧
@example
while(@@row = $sth->fetchrow_array) @{
        print qw($row[0]\t$row[1]\t$row[2]\n);
@}
@end example

@findex DBI->fetchrow_arrayref
@findex fetchrow_arrayref DBI method
@item fetchrow_arrayref
���Υ᥽�åɤϥǡ����μ��Υ쥳���ɤ���Ф����ե�����ɤ��ͤ�����ؤλ��ȤȤ����֤���
�㡧
@example
while($row_ref = $sth->fetchrow_arrayref) @{
        print qw($row_ref->[0]\t$row_ref->[1]\t$row_ref->[2]\n);
@}
@end example

@findex DBI->fetchrow_hashref
@findex fetchrow_hashref DBI method
@item fetchrow_hashref
���Υ᥽�åɤϥǡ����Υ쥳���ɤ���Ф���̾�����ͤΥڥ��Υե�����ɤ�ޤ��
�ϥå���ơ��֥�ؤλ��Ȥ��֤������Υ᥽�åɤϡ���Ǽ��������󻲾�
��������@code{fetchrow_arrayref}�ˤ��⤫�ʤ��ΨŪ�ǤϤʤ����㡧
@example
while($hash_ref = $sth->fetchrow_hashref) @{
        print qw($hash_ref->@{firstname@}\t$hash_ref->@{lastname@}\t\
                $hash_ref- > title@}\n);
@}
@end example

@findex DBI->fetchall_arrayref
@findex fetchall_arrayref DBI method
@item fetchall_arrayref
���Υ᥽�åɤϡ�SQLʸ����֤��줿�ǡ����ʥ쥳���ɡˤ����Ƥ����뤿��˻Ȥ���
���Υ᥽�åɤϡ��ƥ쥳���ɤؤλ��Ȥ����������ؤλ��Ȥ��֤���
����ҤΥ롼�פ�Ȥäƥǡ��������ѡ�ɽ�����롣�㡧
@example
my $table = $sth->fetchall_arrayref
                or die "$sth->errstr\n";
my($i, $j);
for $i ( 0 .. $#@{$table@} ) @{
        for $j ( 0 .. $#@{$table->[$i]@} ) @{
                print "$table->[$i][$j]\t";
        @}
        print "\n";
@}
@end example

@findex DBI->finish
@findex finish DBI method
@item finish
���Υ��ơ��ȥ��ȥϥ�ɥ뤫�餽��ʾ�ǡ�������Ф��ʤ����Ȥ򼨤������ơ��ȥ��ȥϥ�ɥ�䡢�Ĥ���Ǥ��������ƥ�꥽������������뤿��ˤ��Υ᥽�åɤ�ƤӽФ����㡧
@example
$rc = $sth->finish;
@end example

@findex DBI->rows
@findex rows DBI method
@item rows
�Ǹ��̿��ˤ�ꡢ�ʥǡ����ι�����������ʤɤǡ˱ƶ��Τ��ä��쥳���ɤο����֤���
���Υ᥽�åɤ� @code{do} ���뤤�� �� @code{SELECT} @code{execute} ʸ��
�¹Ԥ�����ˡ������Ƥ��Ȥ��롣�㡧
Example:
@example
$rv = $sth->rows;
@end example

@findex DBI->@{NULLABLE@}
@findex NULLABLE DBI method
@item NULLABLE
����γ����Ǥ��Ф����֡����ͤ�����ؤλ��Ȥ��֤���
TRUE �Ǥ���Ф��Υե�����ɤ� @code{NULL} �ͤ��ޤޤ�Ƥ��뤳�Ȥ򼨤����㡧
Example:
@example
$null_possible = $sth->@{NULLABLE@};
@end example

@findex DBI->@{NUM_OF_FIELDS@}
@findex NUM_OF_FIELDS DBI method
@item NUM_OF_FIELDS
����°���ϡ�@code{SELECT} ʸ�� @code{SHOW FIELDS} ʸ�ˤ�ä��֤��줿
�ե�����ɤο��򼨤��Ƥ��롣̿��ʸ����̤��֤������ɤ���������å�����Τˡ�
�����Ȥ����Ȥ�����롧���ͤϡ�@code{INSERT}, @code{DELETE} �ޤ���
 @code{UPDATE} �Τ褦���� @code{SELECT} ʸ�򼨤��Ƥ��롣�㡧
Example:
@example
$nr_of_fields = $sth->@{NUM_OF_FIELDS@};
@end example

@findex DBI->data_sources()
@findex data_sources() DBI method
@item data_sources($driver_name)
���Υ᥽�åɤϡ�@code{'localhost'} �ۥ��Ⱦ�� @strong{MySQL} �����Ф�
���Ѳ�ǽ�ʥǡ����١�����̾����ޤ��������֤����㡧
@example
@@dbs = DBI->data_sources("mysql");
@end example

@findex DBI->@{ChopBlanks@}
@findex ChopBlanks DBI method
@item ChopBlanks
����°���ϡ� @code{fetchrow_*} �᥽�åɤ��֤��ͤ�������ζ����
����뤫�ɤ�������ꤹ�롣�㡧
@example
$sth->@{'ChopBlanks'@} =1;
@end example

@findex DBI->trace
@findex trace DBI method
@item trace($trace_level)
@itemx trace($trace_level, $trace_filename)
The @code{trace} method enables or disables tracing.  When invoked as a
@code{DBI} class method, it affects tracing for all handles.  When invoked as
a database or statement handle method, it affects tracing for the given
handle (and any future children of the handle).  Setting @code{$trace_level}
to 2 provides detailed trace information.  Setting @code{$trace_level} to 0
disables tracing.  Trace output goes to the standard error output by
default.  If @code{$trace_filename} is specified, the file is opened in
append mode and output for @emph{all} traced handles is written to that
file.  Example:
@example
DBI->trace(2);                # trace everything
DBI->trace(2,"/tmp/dbi.out"); # trace everything to /tmp/dbi.out
$dth->trace(2);               # trace this database handle
$sth->trace(2);               # trace this statement handle
@end example

@tindex DBI_TRACE environment variable
@tindex Environment variable, DBI_TRACE
You can also enable @code{DBI} tracing by setting the @code{DBI_TRACE}
environment variable.  Setting it to a numeric value is equivalent to calling
@code{DBI->(value)}.  Setting it to a pathname is equivalent to calling
@code{DBI->(2,value)}.

@end table

@noindent
@strong{MySQL ��ͭ�᥽�å�}

The methods shown below are @strong{MySQL}-specific and not part of the
@code{DBI} standard.  Several of them are now deprecated:
@code{is_blob}, @code{is_key}, @code{is_num}, @code{is_pri_key},
@code{is_not_null}, @code{length}, @code{max_length}, and @code{table}.
Where @code{DBI}-standard alternatives exist, they are noted below.

@table @code
@findex DBI->@{insertid@}
@findex insertid DBI method
@cindex AUTO_INCREMENT, using with DBI
@item insertid
@strong{MySQL} ����ħ�Ǥ��� @code{AUTO_INCREMENT} ��Ȥ��Ȥ���
��������ư����夬���ͤ������˵�������롣�㡧
Example:
@example
$new_id = $sth->@{insertid@};
@end example

As an alternative, you can use @code{$dbh->@{'mysql_insertid'@}}.

@findex DBI->@{is_blob@}
@findex is_blob DBI method
@item is_blob
����γ����Ǥ��Ф����֡����ͤ�����ؤλ��Ȥ��֤���TRUE �Ǥ����
���Υե�����ɤ� @code{BLOB} �ͤǤ��뤳�Ȥ򼨤����㡧
@example
$keys = $sth->@{is_blob@};
@end example

@findex DBI->@{is_key@}
@findex is_key DBI method
@item is_key
����γ����Ǥ��Ф����֡����ͤ�����ؤλ��Ȥ��֤���TRUE �Ǥ����
���Υե�����ɤ������Ǥ��뤳�Ȥ򼨤���
�㡧
@example
$keys = $sth->@{is_key@};
@end example

@findex DBI->@{is_num@}
@findex is_num DBI method
@item is_num
����γ����Ǥ��Ф����֡����ͤ�����ؤλ��Ȥ��֤���TRUE �Ǥ����
���Υե�����ɤ����ͷ��Ǥ��뤳�Ȥ򼨤���
�㡧
@example
$nums = $sth->@{is_num@};
@end example

@findex DBI->@{is_pri_key@}
@findex is_pri_key DBI method
@item is_pri_key
����γ����Ǥ��Ф����֡����ͤ�����ؤλ��Ȥ��֤���TRUE �Ǥ����
���Υե�����ɤ��ץ饤�ޥ꡼�����Ǥ��뤳�Ȥ򼨤���
�㡧
@example
$pri_keys = $sth->@{is_pri_key@};
@end example

@findex DBI->@{is_not_null@}
@findex is_not_null DBI method
@item is_not_null
����γ����Ǥ��Ф����֡����ͤ�����ؤλ��Ȥ��֤���FALSE �Ǥ����
���Υե�����ɤ� @code{NULL} �ͤ�ޤळ�Ȥ򼨤���
�㡧
@example
$not_nulls = $sth->@{is_not_null@};
@end example

@code{is_not_null} is deprecated;
���Ҥ� @code{NULLABLE} °������Ѥ���ۤ���˾�ޤ��������줬 DBI ��ɸ��Ǥ��롣

@findex DBI->@{length@}
@findex length DBI method
@findex DBI->@{max_length@}
@findex max_length DBI method
@item length
@itemx max_length
���줾��Υ᥽�åɤϡ��ե�����ɥ�����������ؤλ��Ȥ��֤���@code{length} ����ϡ�
�ʥơ��֥뵭�Ҥ�������줿�˳ƥե�����ɤ����Ѳ�ǽ�����ͤ򼨤���
@code{max_length} ����ϡ��ơ��֥���˼ºݤ�¸�ߤ��Ƥ�������ͤ򼨤����㡧

@example
$lengths = $sth->@{length@};
$max_lengths = $sth->@{max_length@};
@end example

@findex DBI->@{NAME@}
@findex NAME DBI method
@item NAME
�ե������̾������ؤλ��Ȥ��֤���
�㡧
@example
$names = $sth->@{NAME@};
@end example

@findex DBI->@{table@}
@findex table DBI method
@item table
�ơ��֥�̾������ؤλ��Ȥ��֤���
�㡧
@example
$tables = $sth->@{table@};
@end example

@findex DBI->@{type@}
@findex type DBI method
@item type
�ե�����ɤη�������ؤλ��Ȥ��֤���
�㡧
@example
$types = $sth->@{type@};
@end example

@end table

@node DBI-info,  , Perl DBI Class, Perl
@subsection @code{DBI}/@code{DBD} �˴ؤ��뤽��ʾ�ξ���

@code{DBI} �˴ؤ��뤽��ʾ�ξ���� @code{perldoc} ���ޥ�ɤ������롣

@example
perldoc DBI
perldoc DBI::FAQ
perldoc DBD::mysql
@end example

¾�Υե����ޥåȤ��Ѵ�����ġ��롢@code{pod2man}, @code{pod2html} �ʤɤ�
�Ȥ����Ȥ�����롣

�����Ƥ������@code{DBI} �κǿ������ @code{DBI} �����å֥ڡ����Ǹ��뤳�Ȥ�����롧
@example
@uref{http://www.symbolstone.org/technology/perl/DBI/index.html}
@end example

@node Eiffel, Java, Perl, Clients
@section @strong{MySQL} Eiffel wrapper

The @strong{MySQL} @uref{http://www.mysql.com/Contrib/,Contrib directory}
contains an Eiffel wrapper written by Michael Ravits

You can also find this at:
@url{http://www.netpedia.net/hosting/newplayer/}

@node Java, PHP, Eiffel, Clients
@section @strong{MySQL} Java connectivity (JDBC)

There are 2 supported JDBC drivers for @strong{MySQL} (the twz and mm driver).
You can find a copy of these at @uref{http://www.mysql.com/Contrib}.
For documentation consult any JDBC documentation and the
drivers own documentation for @strong{MySQL} specific features.

@node PHP, Cplusplus, Java, Clients
@section @strong{MySQL} PHP API

PHP is a server-side, HTML embedded scripting language that may be used to
create dynamic web pages.  It contains support for accessing several
databases, including @strong{MySQL}.  PHP may be run as a separate program,
or compiled as a module for use with the Apache web server.

The distribution and documentation are available at the
@uref{http://www.php.net/, PHP website}.

@menu
* PHP problems::                
@end menu

@node PHP problems,  , PHP, PHP
@subsection Common problems with MySQL and PHP

@itemize bullet
@item Error: "Maximum Execution Time Exeeded"
This is a PHP limit;  Go into the @file{php3.ini} file and set the maximum
execution time up from 30 seconds to something higher, as needed.
It is also not a bad idea to double the ram allowed per script to 16 instead of
8 MB.
@item Error: "Fatal error: Call to unsupported or undefined function mysql_connect() in .."
This means that your PHP version isn't compiled with @strong{MySQL} support.
You can either compile a dynamic @strong{MySQL} module and load it into PHP or
recompile PHP with built-in @code{MySQL} support.  This is described in
detail in the PHP manual.
@end itemize

@node Cplusplus, Python, PHP, Clients
@section @strong{MySQL} C++ APIs

Two API's is available in the @strong{MySQL}
@uref{http://www.mysql.com/Contrib/,Contrib directory}.

@node Python, Tcl, Cplusplus, Clients
@section @strong{MySQL} Python APIs

The @strong{MySQL} @uref{http://www.mysql.com/Contrib/,Contrib directory}
contains a Python
interface written by Joseph Skinner.

You can also use the Python interface to iODBC to access a
@strong{MySQL} server.
@uref{http://starship.skyport.net/~lemburg/,mxODBC}

@node Tcl, Ruby, Python, Clients
@section @strong{MySQL} Tcl APIs

@uref{http://www.binevolve.com/~tdarugar/tcl-sql/, Tcl at binevolve}.
The
@uref{http://www.mysql.com/Contrib,Contrib directory} contains a Tcl
interface that is based on msqltcl 1.50.

@cindex Ruby
@node Ruby, , Tcl, Clients
@section @strong{MySQL} Ruby API

�ʲ��Υ����Ȥˡ�Ruby �� MySQL ���󥿡��ե�����������ޤ���

@uref{http://www.tmtm.org/, www.tmtm.org �Ȥߤ��ޤ��Ҥ���� Web �ڡ���}

@node Comparisons, MySQL internals, Clients, Top
@chapter How @strong{MySQL} compares to other databases

@menu
* Compare mSQL::                @strong{MySQL} �� @code{mSQL} �Ȥ����
* Compare PostgreSQL::          @strong{MySQL} �� @code{PostgreSQL} �Ȥ����
@end menu

@node Compare mSQL, Compare PostgreSQL, Comparisons, Comparisons
@section @strong{MySQL} �� @code{mSQL} �Ȥ����

������ϡ�@strong{MySQL} ��ȯ�Ԥˤ�äƽ񤫤�Ƥ��ޤ��Τǡ����ΤĤ���
�ɤ�Dz��������������桹���ΤäƤ�����¾�δְ㤤�Ϥ���ޤ���

For a list of all supported limits, functions and types, see the
@uref{http://www.mysql.com/crash-me-choose.htmy, @code{crash-me} web page}.

@table @strong
@item Performance

����®����ӤΤ���ϡ����ä��� @strong{MySQL} �٥���ޡ����������Ȥ򸫤Ʋ�����
@xref{Benchmarks}.

Because there is no thread creation overhead, a small parser, few features and
simple security, @code{mSQL} should be quicker at:

@itemize @bullet
@item
Tests that perform repeated connects and disconnects, running a very simple
query during each connection.
@item
@code{INSERT} operations into very simple tables with few columns and keys.
@item
@code{CREATE TABLE} and @code{DROP TABLE}.
@item
@code{SELECT} on something that isn't an index. (A table scan is very
easy.)
@end itemize

�����Υ��ڥ졼�����ϤȤƤ�ñ��ʤΤǡ����ϤΥ����С��إåɤ��⤯�ʤ�
���ˤ������ɤ�����Τ��񤷤��Ǥ�����³����Ω���줿��� @strong{MySQL} 
�ϤȤƤ��ɤ���ǽ�ˤʤ�ޤ���

¾�Τ�ΤǤ� @strong{MySQL} �� @code{mSQL} ��¿����¾�� SQL �������Ȥ�
��®���Ǥ�:

@itemize @bullet
@item
Complex @code{SELECT} operations.
@item
�礭�ʷ�̤μ��Ф� (@strong{MySQL} �Ϥ���ɤ�, ���®�������Ƥ�����
�ʥץ��ȥ��������ޤ�)
@item
����Ĺʸ�������ĥơ��֥롣@strong{MySQL} �Ϥ���˸�ΨŪ�ʽ���������� @code{VARCHAR}
��˥���ǥå�������Ĥ��Ȥ��Ǥ��ޤ���
@item
¿���Υե�����ɤ���ĥơ��֥�ν�����
@item
�礭�ʥ쥳����Ĺ�Υơ��֥�ν�����
@item
@code{SELECT} with many expressions.
@item
@code{SELECT} on large tables.
@item
Ʊ����¿������³��������ޤ���@strong{MySQL} �ϴ����ʥޥ������åɤǤ���
����³�Ϥ��켫�ȤΥ���åɤ�����ޤ�������ϡ�����餬¾���Ԥ�ɬ�פ��ʤ�
���Ȥ��̣���ޤ�(Ʊ���ơ��֥���ѹ����륯���꤬�¹Ԥ����������)��
@code{mSQL} �Ǥϡ����Ƥ�¾����³�ϡ��ǽ�Τ�� - �����꤬Ĺ����û������
�ؤ�餺 - ���¹Ԥ��졢�����ޤ��Ԥ�ɬ�פ�����ޤ������θ弡����³��Ϳ
����졢¾�����ƤϺƤ��Ԥ��ޤ���
@item
Joins.
@code{mSQL} can become pathologically slow if you change the order of tables
in a @code{SELECT}. In the benchmark suite, a time more than 15000 times
slower than @strong{MySQL} was seen.  This is due to @code{mSQL}'s lack of a
join optimizer to order tables in the optimal order. However, if you put the
tables in exactly the right order in @code{mSQL}2 and the @code{WHERE} is
simple and uses index columns, the join will be relatively fast!
@xref{Benchmarks}.
@item
@code{ORDER BY} and @code{GROUP BY}.
@item
@code{DISTINCT}.
@item
@code{TEXT} �ޤ��� @code{BLOB} �ե�����ɤλ��ѡ�
@end itemize

@item SQL Features

@itemize @bullet
@item @code{GROUP BY} and @code{HAVING}.
@code{mSQL} does not support @code{GROUP BY} at all.
@strong{MySQL} �� @code{HAVING} ��ȼ�������� @code{GROUP BY} �䡢���δ�
�� @code{count()}, @code{avg()}, @code{min()}, @code{max()},
@code{sum()} ������ @code{std()} �򥵥ݡ��Ȥ��ޤ���@code{min()} �� 
@code{max()} ��ʸ����ΰ�������ޤ���@code{count(*)} �ϡ��������⤬��
������ξ��ˤȤƤ�®���֤����褦�˺�Ŭ������ޤ���@code{mSQL} �� 
@code{GROUP BY} ���������ݡ��Ȥ��ޤ���

@item @code{INSERT} and @code{UPDATE} with calculations.
@strong{MySQL} can do calculations in an @code{INSERT} or @code{UPDATE}.
For example:
@example
mysql> UPDATE SET x=x*10+y WHERE x<20;
@end example

@item Aliasing.
@strong{MySQL} �ϥե�����ɤΥ����ꥢ��̾������ޤ���

@item Qualifying column names.
In @strong{MySQL}, if a column name is unique among the tables used in a
query, you do not have to use the full qualifier.

@item @code{SELECT} with functions.
@strong{MySQL} has many functions (too many to list here; see @ref{Functions}).

@end itemize

@item �ΰ�ǽ��
����ϡ��ơ��֥��ɤΤ褦�˾������Ǥ��뤫�Ǥ���

@strong{MySQL} �ϤȤƤ���̩�ʷ�������ޤ����ȤƤ⾮�����ΰ����Ѥ���ơ��֥������Ǥ�
�뤿��Ǥ���@strong{MySQL} �ǡ�������ͭ�Ѥ���ϡ�3�Х���Ĺ�� @code{MEDIUMINT} 
�Ǥ���10,000,000 �쥳���ɤ���ľ�硢1�쥳���ɤ�����1�Х��Ȥ�����Ǥ��
�Ƥ���פǤ���

@code{mSQL2} ��4�Ĥη�(char,text,int,real)�����ʤ��Τǡ������ʥơ��֥��
����Τ��񤷤��Ǥ���

@item ������
�����Ҵ�Ū��Ƚ�Ǥ���Τ��񤷤��Ǥ���@strong{MySQL} �ΰ������ˤĤ��Ƥ�
@ref{Stability} �򻲾Ȥ��Ƥ���������

�桹�ˤ� @code{mSQL} �������ηи�������ޤ��󡣤��Τ��ᡢ�桹�Ϥ���ˤ�
���Ƥϲ�������ޤ���

@item ����
�⤦��Ĥν��פ�����Ϥ������饤���󥹤Ǥ���@strong{MySQL} �� 
@code{mSQL} �������ʥ饤���󥹤���äƤ��ޤ��������� @code{mSQL} ��
�����¤��Ǥ������ʤ��Ȥ⡢���ʤ������Ѥ����򤷤��������Ƥˡ��饤����
���ޤ��� email ���ݡ��Ȥؤλ�ʧ�����θ���뤳�Ȥ�Ф��Ƥ��Ʋ�������
@strong{MySQL} ��ޤ᤿���ʤ�����硢������󤳤Υ饤���󥹤γ������׵�
����ޤ���


@item Perl interfaces
@strong{MySQL} �ϴ���Ū�� @code{mSQL} ��Ʊ�� perl ���󥿥ե������ȡ������Ĥ�����
�õ�ǽ������ޤ���

@item JDBC (Java)
@strong{MySQL} currently has 4 JDBC drivers:
@itemize @bullet
@item
The gwe driver: A Java interface by GWE technologies (not supported anymore).
@item
The jms driver: An improved gwe driver by Xiaokun Kelvin ZHU
@email{X.Zhu@@brad.ac.uk}.
@item
The twz driver: A type 4 JDBC driver by Terrence W. Zellers
@email{zellert@@voicenet.com}.  This is commercial but is free for private
and educational use.
@item
The mm driver: A type 4 JDBC driver by Mark Matthews
@email{mmatthew@@ecn.purdue.edu}.  This is released under the GPL.
@end itemize

The recommended drivers are the twz or mm driver. Both are reported to work
excellently.

We know that @code{mSQL} has a JDBC driver, but we have too little experience
with it to compare.

@item ��ȯ��®��
@strong{MySQL} �ϤȤƤ⾮������ȯ���������äƤ��ޤ������桹�� C �� C++ �Υ����ǥ�
�󥰤�ȤƤ�®���Ԥʤ��ޤ�������åɡ��ؿ��� @code{GROUP BY} �ʤɤϤޤ� 
@code{mSQL} �ˤϼ�������Ƥ��ޤ���Τǡ�it has a lot of chatching up to
do.  ���ξ�Ǥ����Ĥ��θ��̤������뤿��ˡ���ǯ�� @code{mSQL} @file{HISTORY} �ե�
����򸫤ơ�@strong{MySQL} Reference Manual News �����ӤǤ��ޤ�(@pxref{News})��®����ȯ���줿¿���Τ��
�������ʤ�����ˤʤ�ޤ���

@item �桼�ƥ���ƥ��ץ������
@code{mSQL} �� @strong{MySQL} ��¿���ζ�̣���������ɥѡ��ƥ��ġ�������
�Ƥ��ޤ�����̤ؤΰܹ� (@code{mSQL} -> @strong{MySQL}) �ϤȤƤ��ñ�Ǥ���
@strong{MySQL} �ϡ��ۤȤ�����Ƥζ�̣���� @code{mSQL} ���ץꥱ��������
���äƤ��ޤ���

@strong{MySQL} �ˤϡ���ñ�� @code{msql2mysql} �ץ�����ब�Ѱդ���Ƥ��ޤ���
����ϡ�@code{mSQL} �� @strong{MySQL} �� C API �ؿ��Υ��ڥ�ΰ㤤��������ץ������Ǥ���
For example, it changes instances of @code{msqlConnect()} to
@code{mysql_connect()}. 
@code{mSQL} ���� MySQL �ؤ��Ѵ����̾��ʬ���Ѥ�������Ǥ���
@end table

@menu
* Using mSQL tools::            How to convert @code{mSQL} tools for @strong{MySQL}
* Protocol differences::        How @code{mSQL} and @strong{MySQL} client/server communications protocols differ
* Syntax differences::          How @code{mSQL} 2.0 SQL syntax differs from @strong{MySQL}
@end menu

@node Using mSQL tools, Protocol differences, Compare mSQL, Compare mSQL
@subsection How to convert @code{mSQL} tools for MySQL

According to our experience, it would just take a few hours to convert tools
such as @code{msql-tcl} and @code{msqljava} that use the
@code{mSQL} C API so that they work with the @strong{MySQL} C API.

The conversion procedure is:

@enumerate
@item
�����륹����ץ� @code{msql2mysql} �򥽡����˼¹Ԥ��ޤ����Х��ʥ�ץ������ 
@code{replace} ��ɬ�פǤ�������� @strong{MySQL} �����ۤ���ޤ���
@item
Compile.
@item
���ƤΥ���ѥ��饨�顼�������ޤ�.
@end enumerate

@strong{MySQL} �� @code{mSQL} �֤� C API �ΰ㤤:
@itemize @bullet
@item
@strong{MySQL} �� @code{MYSQL} ��¤�Τ���³���Ȥ��ƻ��Ѥ��ޤ� (@code{mSQL} �� 
@code{int} ����Ѥ��ޤ�)��
@item
@code{mysql_connect()} �� @code{MYSQL} ��¤�ΤؤΥݥ��󥿤�ѥ�᡼���Ȥ��ƻ��Ѥ��ޤ�����
��򥰥����Х����������ꡢ���γ����� @code{malloc()} ����Ѥ���Τϴ�ñ�Ǥ���
@code{mysql_connect()} also takes two parameters for specifying the user and
password.  You may set these to @code{NULL, NULL} for default use.
@item
@code{mysql_error()} �� @code{MYSQL} ��¤�Τ�ѥ�᡼���Ȥ��ƻ��Ѥ��ޤ����Ť������ɤ��
�Ԥ����硢���ʤ��θŤ�  @code{msql_error()} �����ɤإѥ�᡼�����ɲä��Ƥ���������
@item
@strong{MySQL} returns an error number and a text error message for all
errors. @code{mSQL} returns only a text error message.
@item
Some incompatibilities exist as a result of @strong{MySQL} supporting
multiple connections to the server from the same process.
@end itemize

@node Protocol differences, Syntax differences, Using mSQL tools, Compare mSQL
@subsection How @code{mSQL} and MySQL client/server communications protocols differ

There are enough differences that it is impossible (or at least not easy)
to support both.

The most significant ways in which the @strong{MySQL} protocol differs
from the @code{mSQL} protocol are listed below:

@itemize @bullet
@item
��å������Хåե���¿���η�̹Ԥ�ޤ�ޤ���
@item
����ޤ��ϲ��������ߤΥХåե������礭����硢�����Фȥ��饤����ȤΥ�
��ե�����ǽ���¤ޤǡ���å������Хåե���ưŪ�����礵��ޤ���
@item
���ƤΥѥ��åȤϡ��ѥ��åȤν�ʣ�丫�����򸫤Ĥ��Ф�����ˡ��ֹ�Ť���
��Ƥ��ޤ���
@item
���Ƥι��ܤ� ASCII ������졢���ܤιԤ�Ĺ���ϥѥå����줿�Х��ʥꥳ���ǥ���
��(1,2 �ޤ��� 3 �Х���)�������ޤ���
@item
@strong{MySQL} �ϥХåե�����ʤ���̤��ɤ߹��߲�ǽ�Ǥ�(���饤�������˴����ʥ���
�Ȥ��Ǽ����ɬ�פ�����ޤ���)��
@item
��Ĥν񤭹���/�ɤ߹��ߤ� 30 �ðʾ夫����ȡ������Ф���³�򥯥���������
����
@item
��³�� 8 ���ֲ��ⵯ���ʤ��ȡ������Ф���³�򥯥��������ޤ���
@end itemize

@node Syntax differences,  , Protocol differences, Compare mSQL
@subsection @strong{MySQL} & @code{mSQL} 2.0 �֤� SQL ��ʸ�ΰ㤤�ϡ�

@noindent
@strong{Column types}

@table @code
@item @strong{MySQL}
¾�˲ä����ι��ܥ��ץ���󷿤�����ޤ� (among others; see
@pxref{CREATE TABLE, , @code{CREATE TABLE}}):
@itemize @bullet
@item
@code{ENUM} type for one of a set of strings.
@item
@code{SET} type for many of a set of strings.
@item
@code{BIGINT} type for 64-bit integers.
@end itemize
@item
@strong{MySQL} also supports
the following additional type attributes:
@itemize @bullet
@item
�������ܤؤ� @code{UNSIGNED} ���ץ����
@item
�������ܤؤ� @code{ZEROFILL} ���ץ����
@item
@code{PRIMARY KEY} ��ޤ����Ƥ��������ܤؤ� @code{AUTO_INCREMENT} ���ץ����
@xref{mysql_insert_id, , @code{mysql_insert_id()}}.
@item
���Ƥι��ܤؤ� @code{DEFAULT} ��
@end itemize
@item mSQL2
@code{mSQL} column types correspond to the @strong{MySQL} types shown below:
@multitable @columnfractions .15 .85
@item @code{mSQL} @strong{type} @tab @strong{Corresponding @strong{MySQL} type}
@item @code{CHAR(len)} @tab @code{CHAR(len)}
@item @code{TEXT(len)} @tab @code{TEXT(len)}. @code{len} is the maximal length.
And @code{LIKE} works.
@item @code{INT} @tab @code{INT}. With many more options!
@item @code{REAL} @tab @code{REAL}. Or @code{FLOAT}. Both 4- and 8-byte versions are available.
@item @code{UINT} @tab @code{INT UNSIGNED}
@item @code{DATE} @tab @code{DATE}. Uses ANSI SQL format rather than @code{mSQL}'s own format.
@item @code{TIME} @tab @code{TIME}
@item @code{MONEY} @tab @code{DECIMAL(12,2)}. A fixed-point value with two decimals.
@end multitable
@end table

@noindent
@strong{Index creation}

@table @code
@item @strong{MySQL}
Indexes may be specified at table creation time with the @code{CREATE TABLE}
statement.
@item mSQL
Indexes must be created after the table has been created, with separate
@code{CREATE INDEX} statements.
@end table

@noindent
@strong{To insert a unique identifier into a table}

@table @code
@item @strong{MySQL}
Use @code{AUTO_INCREMENT} as a column type
specifier.
@xref{mysql_insert_id, , @code{mysql_insert_id()}}.
@item mSQL
Create a @code{SEQUENCE} on a table and select the @code{_seq} column.
@end table

@noindent
@strong{To obtain a unique identifier for a row}

@table @code
@item @strong{MySQL}
Add a @code{PRIMARY KEY} or @code{UNIQUE} key to the table and use this.
New in 3.23.11: If the @code{PRIMARY} or @code{UNIQUE} key consists of only one
column and this is of type integer, one can also refer to it as
@code{_rowid}.
@item mSQL
Use the @code{_rowid} column. Observe that @code{_rowid} may change over time
depending on many factors.
@end table

@noindent
@strong{To get the time a column was last modified}

@table @code
@item @strong{MySQL}
Add a @code{TIMESTAMP} column to the table. This column is automatically set
to the current date and time for @code{INSERT} or @code{UPDATE} statements if
you don't give the column a value or if you give it a @code{NULL} value.

@item mSQL
Use the @code{_timestamp} column.
@end table

@noindent
@strong{@code{NULL} value comparisons}

@table @code
@item @strong{MySQL}
@strong{MySQL} follows
ANSI SQL and a comparison with @code{NULL} is always @code{NULL}.
@item mSQL
In @code{mSQL}, @code{NULL = NULL} is TRUE.  You
must change @code{=NULL} to @code{IS NULL} and @code{<>NULL} to
@code{IS NOT NULL} when porting old code from @code{mSQL} to @strong{MySQL}.
@end table

@noindent
@strong{String comparisons}

@table @code
@item @strong{MySQL}
Normally, string comparisons are performed in case-independent fashion with
the sort order determined by the current character set (ISO-8859-1 Latin1 by
default).  If you don't like this, declare your columns with the
@code{BINARY} attribute, which causes comparisons to be done according to the
ASCII order used on the @strong{MySQL} server host.
@item mSQL
All string comparisons are performed in case-sensitive fashion with
sorting in ASCII order.
@end table

@noindent
@strong{Case-insensitive searching}

@table @code
@item @strong{MySQL}
@code{LIKE} is a case-insensitive or case-sensitive operator, depending on
the columns involved. If possible, @strong{MySQL} uses indexes if the
@code{LIKE} argument doesn't start with a wildcard character.
@item mSQL
Use @code{CLIKE}.
@end table

@noindent
@strong{Handling of trailing spaces}

@table @code
@item @strong{MySQL}
Strips all spaces at the end of @code{CHAR} and @code{VARCHAR}
columns. Use a @code{TEXT} column if this behavior is not desired.
@item mSQL
Retains trailing space.
@end table

@noindent
@strong{@code{WHERE} clauses}

@table @code
@item @strong{MySQL}
@strong{MySQL} correctly prioritizes everything (@code{AND} is evaluated
before @code{OR}). To get @code{mSQL} behavior in @strong{MySQL}, use
parentheses (as shown below).
@item mSQL
Evaluates everything from left to right. This means that some logical
calculations with more than three arguments cannot be expressed in any
way. It also means you must change some queries when you upgrade to
@strong{MySQL}. You do this easily by adding parentheses.  Suppose you
have the following @code{mSQL} query:
@example
mysql> SELECT * FROM table WHERE a=1 AND b=2 OR a=3 AND b=4;
@end example
To make @strong{MySQL} evaluate this the way that @code{mSQL} would,
you must add parentheses:
@example
mysql> SELECT * FROM table WHERE (a=1 AND (b=2 OR (a=3 AND (b=4))));
@end example
@end table

@noindent
@strong{Access control}

@table @code
@item @strong{MySQL}
Has tables to store grant (permission) options per user, host and
database. @xref{Privileges}.
@item mSQL
Has a file @file{mSQL.acl} in which you can grant read/write privileges for
users.
@item
@end table

@node Compare PostgreSQL,  , Compare mSQL, Comparisons
@section How @strong{MySQL} compares to PostgreSQL

We would first like to note that @code{PostgreSQL} and @strong{MySQL}
are both widely used products but their design goals are completely
different.  This means that for some applications @strong{MySQL} is more
suitable and for others @code{PostgreSQL} is more suitable.  When
choosing which database to use you should first check if the databases
feature set is good enough to satisfy your application.  If you need
speed then @strong{MySQL} is probably your best choice, if you need some
of the extra features that @code{PostgreSQL} can offer you should use
@code{PostgreSQL}.

@code{PostgreSQL} �Ϥ���˿ʤ����ǽ�򤤤��Ĥ����äƤ��ޤ����桼����������ȥ�
�����롼�롢�ȥ�󥶥������Τ褦�ʡ�
(currently it's
has about same symantic as @code{MySQL}'s transactions in that the
transaction is not 100 % atomic)
������ ANSI SQL �� ODBC ��ɸ�෿��
��ǽ��¿�����礱�Ƥ��ޤ������ݡ���/̤���ݡ��Ȥη�/�ؿ��δ����ʰ�����
@uref{http://www.mysql.com/crash-me-choose.htmy, @code{crash-me} web page} �򸫤Ƥ���������

�̾@code{PostgreSQL} �� @strong{MySQL} ���ȤƤ��٤��Ǥ���
@xref{Benchmarks}.  This is due largely to they have only
transaction safe tables and that their transactions system is not as
sophisticated as Berkeley DB's.  In @strong{MySQL} you can decide per
table if you want the table to be fast or take the speed penalty of
making it transaction safe.

The most important things that @code{PostgreSQL} supports that @strong{MySQL}
don't yet support:

@table @code
@item Sub select
@item Foregin keys
@item Stored procedures
@item An extendable type system.
@item A way to extend the SQL to handle new key types (like R-trees)
@end table

@strong{MySQL} on the other hand supports a many ANSI SQL constructs
that @code{PostgreSQL} doesn't support;  Most of these can be found at the
@uref{http://www.mysql.com/crash-me-choose.htmy, @code{crash-me} web page}.

If you really need the rich type system @code{PostgreSQL} offers and you
can afford the speed penalty of having to do everything transaction
safe, you should take a look at @code{PostgreSQL}.
@node MySQL internals, Environment variables, Comparisons, Top
@chapter MySQL internals

This chapter describes a lot of things that you need to know when
working on the @strong{MySQL} code.

@menu
* MySQL threads::               
@end menu

@node MySQL threads,  , MySQL internals, MySQL internals
@section MySQL threads

@strong{MySQL} �����С��ϰʲ��Υ���åɤ�������ޤ���

@itemize @bullet
@item
TCP/IP ��³�ϥ�ɥ�ϡ����Ƥ���³�׵�򰷤�������ˡ�
ǧ�ڤ�Ԥ�����Υ���å�SQL�������������륹��åɤ��������ޤ�
@item
NT�Ǥϡ��͡���ɡ��ѥ��ס��ϥ�ɥ顼������åɤ�����ޤ���
����ϥ͡���ɡ��ѥ��פ���³�׵���Ф���TCP/IP��³����åɤ�Ʊ�ͤ�ư���ޤ���
@item
�����ʥ륹��åɤϡ����ƤΥ����ʥ�򰷤��ޤ���
This thread also normally handles
alarms and calls @code{process_alarm()} to force timeouts on connections
that have been idle too long.
@item
If compiled with @code{-DUSE_ALARM_THREAD}, a dedicated thread that
handles alarms is created. This is only used on some systems where
there are some problems with @code{sigwait()} or if one wants to use the
@code{thr_alarm()} code in ones application without a dedicated signal
handling thread.
@item
�⤷ @code{--flush-time} ���ץ�������Ѥ����ʤ顢
���ƤΥơ��֥�������֤ǥե�å��夹�뤿������Υ���åɤ���ޤ���
@item
Every connection has its own thread.
@item
Every different table on which one uses @code{INSERT DELAYED} gets its
own thread.
@item
If you use @code{--master-host} , slave replication thread will be started to read and apply
updates from the master.
@end itemize

@code{mysqladmin processlist} only shows the connection and @code{INSERT
DELAYED} threads.


@page
@node Environment variables, Users, MySQL internals, Top
@appendix  Environment variables

Here follows a list of all environment variables that are used directly or
indirectly by @strong{MySQL}. Most of these can also be found at other
places in this manual.

Note that any options on the command line will take precedence over
values specified in configuration files and environment variables, and
values in configuration files take precedence over values in environment
variables.

In many cases its preferable to use a configure file instead of environment
variables to modify the behaviour of @strong{MySQL}. @xref{Option files}.

@tindex CCX environment variable
@tindex Environment variable, CCX
@tindex CC environment variable
@tindex Environment variable, CC
@tindex CFLAGS environment variable
@tindex Environment variable, CFLAGS
@tindex CXXFLAGS environment variable
@tindex Environment variable, CXXFLAGS
@tindex DBI_USER environment variable
@tindex Environment variable, DBI_USER
@tindex DBI_TRACE environment variable
@tindex Environment variable, DBI_TRACE
@tindex HOME environment variable
@tindex Environment variable, HOME
@tindex LD_RUN_PATH environment variable
@tindex Environment variable, LD_RUN_PATH
@tindex MYSQL_DEBUG environment variable
@tindex Environment variable, MYSQL_DEBUG
@tindex MYSQL_HISTFILE environment variable
@tindex Environment variable, MYSQL_HISTFILE
@tindex MYSQL_HOST environment variable
@tindex Environment variable, MYSQL_HOST
@tindex MYSQL_PWD environment variable
@tindex Environment variable, MYSQL_PWD
@tindex MYSQL_TCP_PORT environment variable
@tindex Environment variable, MYSQL_TCP_PORT
@tindex MYSQL_UNIX_PORT environment variable
@tindex Environment variable, MYSQL_UNIX_PORT
@tindex PATH environment variable
@tindex Environment variable, PATH
@tindex TMPDIR environment variable
@tindex Environment variable, TMPDIR
@tindex TZ environment variable
@tindex Environment variable, TZ
@tindex UMASK_DIR environment variable
@tindex Environment variable, UMASK_DIR
@tindex UMASK environment variable
@tindex Environment variable, UMASK
@tindex USER environment variable
@tindex Environment variable, USER

@multitable @columnfractions .2 .8
@item @code{CCX}  @tab Set this to your C++ compiler when running configure.
@item @code{CC}  @tab Set this to your C compiler when running configure.
@item @code{CFLAGS} @tab Flags for your C compiler when running configure.
@item @code{CXXFLAGS} @tab Flags for your C++ compiler when running configure.
@item @code{DBI_USER} @tab The default user name for Perl DBI.
@item @code{DBI_TRACE} @tab Used when tracing Perl DBI.
@item @code{HOME} @tab The default path for the @code{mysql} history file is @file{$HOME/.mysql_history}.
@item @code{LD_RUN_PATH} @tab Used to specify where your @code{libmysqlclient.so} is.
@item @code{MYSQL_DEBUG} @tab Debug-trace options when debugging
@item @code{MYSQL_HISTFILE} @tab The path to the @code{mysql} history file.
@item @code{MYSQL_HOST} @tab Default host name used by the @code{mysql} command line prompt.
@item @code{MYSQL_PWD} @tab The default password when connecting to mysqld. Note that use of this is insecure!
@item @code{MYSQL_TCP_PORT} @tab The default TCP/IP port.
@item @code{MYSQL_UNIX_PORT} @tab The default socket; used for connections to @code{localhost}.
@item @code{PATH} @tab Used by the shell to finds the @strong{MySQL} programs.
@item @code{TMPDIR} @tab The directory where temporary tables/files are created.
@item @code{TZ} @tab This should be set to your local timezone. @xref{Timezone problems}.
@item @code{UMASK_DIR} @tab The user-directory creation mask when creating directories. Note that this is anded with @code{UMSK} !
@item @code{UMASK} @tab The user-file creation mask when creating files.
@item @code{USER} @tab The default user on Windows to use when connection to @code{mysqld}.
@end multitable

@page
@node Users, Contrib, Environment variables, Top
@appendix Some MySQL users

@appendixsec General news sites

@itemize @bullet

@item @uref{http://www.yahoo.com/, Yahoo!}
 
@item @uref{http://slashdot.org/, Slashdot: A pro-Linux/tech news and comment/discussion site}

@item @uref{http://www.linux.com/, All about Linux}

@item @uref{http://www.linuxtoday.com/, Linuxtoday}

@item @uref{http://www.32bitsonline.com/, 32Bits Online: because there's
more than one way to compute}

@item @uref{http://www.freshmeat.net/, Freshmeat: News about new versions of computer related stuff}

@end itemize

@appendixsec Some Web search engines

@itemize @bullet

@item @uref{http://www.aaa.com.au, AAA Matilda Web Search}

@item @uref{http://www.whatsnu.com/, What's New}

@item @uref{http://www.aladin.de/, Aladin}

@item @uref{http://www.columbus-finder.de/, Columbus Finder}

@item @uref{http://www.spider.de/, Spider}

@item @uref{http://www.blitzsuche.de/, Blitzsuche}

@item @uref{http://www.indoseek.co.id, Indoseek Indonesia}

@item @uref{http://www.yaboo.dk/, Yaboo - Yet Another BOOkmarker}

@item @uref{http://www.yahoosuck.com, Yahoosuck}

@item @uref{http://www.ozsearch.com.au, OzSearch Internet Guide}

@item @uref{http://www.splatsearch.com/, Splat! Search}

@end itemize

@appendixsec Some Information search engines concentrated on some area

@itemize @bullet

@item @uref{http://www.tucows.com/, TuCows Network; Free Software archive}

@item @uref{http://www.jobvertise.com,Jobvertise: Post and search for jobs}

@item @uref{http://www.musicdatabase.com, The Music Database}

@item @uref{http://www.soccersearch.com, Fotball (Soccer) search page}

@item @uref{http://www.headrush.net/takedown, TAKEDOWN - wrestling}

@item @uref{http://www.lyrics.net, The International Lyrics Network}

@item @uref{http://TheMatrix.com/~matrix/band_search.phtml, Musicians looking for other musicians (Free Service)}

@item @uref{http://www.addall.com/AddBooks/Stores.html,AddALL books searching and price comparison}

@item @uref{http://www.herbaria.harvard.edu/Data/Gray/gray.html,Harvard's Gray Herbarium Index of Plant Names}

@item @uref{http://www.game-developer.com/,The Game Development Search Engine}

@item @uref{http://www.i-run.com/html/cookbook.html,My-Recipe.com; Cookbook at i-run.com}

@item @uref{www.theinnkeeper.com, The Innkeeper Vacation Guides}

@item @uref{http://www.macgamedatabase.com/, The Mac Game Database uses PHP and MySQL}
@c From: Marc Antony Vose <suzerain@suzerain.com>

@item @uref{http://www.csse.monash.edu.au/publications/, Research
Publications at Monash University in Australia}

@item @uref{http://www.ipielle.emr.it/bts/index.html,
Occupational Health & Safety website databse (a project for the ECC)}
@c c.presutti@ipielle.emr.it

@item @uref{http://data.mch.mcgill.ca/, Bioinformatics databases at the
Montreal Children's Hospital using MySQL}
@c saeed@www.debelle.mcgill.ca
@end itemize

@appendixsec Online magazines

@itemize @bullet
@item @uref{http://www.spoiler.com, Spoiler Webzine}.
An online magazine featuring music, literature, arts, and design content.
@item @uref{http://www.linux-magazin.de/newsflash/, Daily news about Linux in German language}
@item @uref{http://www.betazine.com,Betazine - The Ultimate Online Beta Tester's Magazine}
@item @uref{http://www.currents.net/ccinfo/aboutcc.html,Computer Currents Magazine}
@end itemize

@appendixsec Web sites that use MySQL as a backed

@itemize @bullet

@item @uref{http://lindev.jmc.tju.edu/qwor, Qt Widget and Object Repository}

@item @uref{http://www.samba-choro.com.br, Brazilian samba site (in Portuguese)}

@item @uref{http://pgss.iss.uw.edu.pl/en_index.ISS, Polish General Social Survey}

@item @uref{http://www.expo2000.com, Expo2000} World-wide distribution of
tickets for this event is implemented using @strong{MySQL} and tcl/tk. More than
5000 travel-agencies all over the world have access to it.

@item @uref{http://www.freevote.com/, FreeVote.com is a free voting
service with millions of users.}

@item @uref{http://f1.tauzero.se, Forza Motorsport}
@end itemize

@appendixsec Some Domain/Internet/Web and related services

@itemize @bullet

@item @uref{http://www.wix.com/mysql-hosting, Registry of Web providers that
support @strong{MySQL}}

@item @uref{http://www.yi.org/, Dynamic DNS Services}

@item @uref{http://www.dynodns.net/, Dynamic domain name service}

@item @uref{http://www.ods.org/, Open DNS Project; free dynamic DNS service}

@c @item @uref{http://dynodns.net, Free dynamic DNS implementation}
@c EMAIL: A Moore <amoore@mooresystems.com>

@item @uref{http://www.fdns.net/, Free 3rd level domains}

@item @uref{http://worldcommunity.com/, Online Database}

@item @uref{http://www.bigbiz.com, BigBiz Internet Services}

@item @uref{http://virt.circle.net, The Virt Gazette}

@item @uref{http://www.california.com, Global InfoNet Inc}

@item @uref{http://www.webhosters.com, WebHosters - A Guide to WWW Providers}

@item @uref{http://online.dn.ru, Internet information server}

@item @uref{http://www.stopbit.com, A technology news site}

@item @uref{http://www.worldnetla.net, WorldNet Communications - An Internet Services Provider}

@item @uref{http://www.netizen.com.au/, Netizen: Australian-based web consultancy}

@item @uref{http://www.trainingpages.co.uk, Search site for training courses in the UK}

@item @uref{http://chat.nitco.com, Gannon Chat (GPL). Written in Perl and Javascript}

@item @uref{http://www.addurls.com/,A general links directory}

@item @uref{http://www.bookmarktracker.com, A web-based bookmark management service}

@item @uref{http://www.cdrom.com,Walnut Creek CDROM}

@item @uref{http://www.wwwthreads.org/, WWWThreads; Interactive discussion Forums}

@item @uref{http://pvmon.portici.enea.it/Meteo, In Italian; Storage data from meteo station}

@item @uref{http://www.buysell.net/, Online "Person To Person" Auction}

@item @uref{http://tips.pair.com,Tips on web development}

@item @uref{http://www.mailfriends.com, Mailfriends.com is a FREE service for
everybody who wants to find friends over the internet.}

@item @uref{http://www.uninova.com/cgi-bin/wctelnets?list, Web Page Telnet BBS List}

@item @uref{http://www.uninova.com/cnc.html,UniNova Digital Postcards}

@c @item @uref{http://cabinboy.powersurfr.com, An Internet RFC search engine}

@item @uref{http://www.dslreports.com, DSL providers search with reviews}
Made with @strong{MySQL} and Modperl, all pages are generated dynamically out of
the @strong{MySQL} database
@end itemize

@appendixsec Web sites that use @code{PHP} and MySQL

@itemize @bullet
@c @item @uref{http://www.wh200th.com,  White House 200th Anniversary site}

@item @uref{http://war.jgaa.com:8080/support/index.php3, Jgaa's Internet - Official Support Site}

@item @uref{http://io.incluso.com, Ionline - online publication:} @strong{MySQL},
PHP, Java, Web programming, DB development

@item @uref{http://www.baboo.com, BaBoo(Browse and bookmark). Free web-based bookmark manager and Calendar}

@item @uref{http://www.courses.pjc.cc.fl.us/Schedule/index.php, Course
Schedule System at Pensacola Junior College}

@item @uref{http://www.fccj.org, Florida Community College at Jacksonville}

@item @uref{http://www.32bit.com/, 32bit.com; An extensive shareware / freeware archive}

@item @uref{http://www.jokes2000.com/, Jokes 2000}
@c Added 990604; EMAIL: ah@dybdahl.dk 


@item @uref{http://www.burken.nu/ , Burken.NU} Burken is a webhotel that
provides scripts, among other things, for remote users, like counters,
guestbooks etc.
@c Added 990608; EMAIL: spacedmp@SpaceDump.Burken.NU (Anders Olausson)

@item @uref{http://tips.pair.com, tips.pair.com} Contains tips on html,
javascript, 2d/3d graphics and PHP3/MySQL. All pages are generated from
a database.
@c Added 990614; EMAIL: downey@image.dk (Rune Madsen)

@end itemize

@appendixsec Some MySQL consultants

@itemize @bullet

@item @uref{http://www.ayni.com, Ayni AG}

@item @uref{http://worldcommunity.com/, Online Database}

@item @uref{http://www2.dataguard.no/,DataGuard (Uses @strong{MySQL} and PHP)}

@item @uref{http://wwits.net/programs/mysql.phtml, WWITS (Uses @strong{MySQL} and PHP)}

@item @uref{http://www.worldcommunity.com/, WCN - The World Community Network}

@item @uref{http://www.chipcastle.com, Chip Castle Dot Com Inc}
@c Added 990603 EMAIL: chip@chipcastle.com (Chip Castle)


@item @uref{http://www.cyber.com.au/, Cybersource Pty. Ltd}

@item @uref{http://www.spring.de, Spring infotainment gmbh & co. kg}
@c added 990905 "Oliver Pischke" <opischke@spring.de>

@item @uref{http://www.wamdesign.com/, Develops websites using MySQL}
@c Added 990905; max@wamdesign.com

@item @uref{http://www.berkeleyconsultants.com, Berkeley Consultants Group}

@end itemize

@appendixsec Programming

@itemize @bullet
@item @uref{http://www.perl.org/cpan-testers, The Perl CPAN Testers results page}
@end itemize


@appendixsec Uncategorized pages

@itemize @bullet

@item @uref{http://www.feature-showcase.com/htmls/demo_mysql.sql,
AZC.COM's Feature Showcase}

@item @uref{http://www.teach.org.uk/subjects/trainingcourse/g.html, Course Search}

@item @uref{http://www.northerbys.com, Northerbys Online Auctions}

@item @uref{http://www.schiphol.nl/flights/home.htm, Amsterdam Airport Schiphol}

@item @uref{http://TheMatrix.com/seventhsin/query.phtml, CD database}

@item @uref{http://TheMatrix.com/~flmm/GEAR.html, Used Audio Gear Database}

@item @uref{http://www.kiss.de/musik-mueller, Musical note-sheets}

@item @uref{http://www.bagism.com, Bagism - A John Lennon fan page}

@item @uref{http://www.selftaught.com/, US Folk art broker}

@item @uref{http://organizer.net/, Mail reading on the web}

@item @uref{http://www.mypage.org/, Free home pages on www.somecoolname.mypage.org}

@item @uref{http://www.schulweb.de/, Der Server f@"ur Schulen im Web (In German)}

@item @uref{http://www.ald.net/, Auldhaefen Online Services}

@item @uref{http://www.cary.net/, CaryNET Information Center}

@item @uref{http://www.dataden.com/, Dataden Computer Systems}

@item @uref{http://andree.grm.se/, Andr@'emuseet (In Swedish)}

@item @uref{http://www.him.net/, HOMESITE Internet Marketing}

@item @uref{http://www.jade-v.com/techinfo.html, Jade-V Network Services }

@item @uref{http://ww2010.atmos.uiuc.edu/(Gl)/abt/aknw/tech.rxml,
Weather World 2010 Technical Credits} @*

@item @uref{http://gimp.foebud.org/registry/doc/, About The Gimp plugin registry}

@item @uref{http://www.fast-inc.com/Products/Archiver/database.html, Java tool
Archiver technical detail (Slightly optimistic about @strong{MySQL}
ANSI-92 compliance)}

@item @uref{http://www.gamesdomain.com/cheats/usrcheat.phtml, Games Domain Cheats Database}

@item @uref{http://www.kcilink.com/poweredby/, The "Powered By" Page (Kcilink)}

@item @uref{http://www.netcasting.net/index.whtml, Netcasting}

@item @uref{http://homepages.tig.com.au/~mjj/nbltips, NBL (Australian National Basketball League) tipping}

@item @uref{http://www.cgishop.com/, CGI shop}

@item @uref{http://www.whirlycott.com/, Whirlycott: Website Design}

@item @uref{http://www.mtp.dk, Museum Tusculanum Press}

@item @uref{http://csdgi.historie.ku.dk/biblio, Centro Siciliano di Documentazione}

@item @uref{http://caribou.dyn.ml.org:8000, Quake statistics database}

@item @uref{http://www.astroforum.ch, Astroforum: Astrologie and related things (in German)}

@item @uref{http://www.opendebate.com, OpenDebate - Interactive Polls & Open Discussion}

@item @uref{http://vermeer.organik.uni-erlangen.de/dissertationen/, Online chemical dissertation server}

@item @uref{http://www.freschinfo.com, FreSch! The Free Scholarship Search Service}

@item @uref{http://www.nada.kth.se/~staffanu/pinball, Stockholm Pinball Locator}

@item @uref{http://www.hek.com, HEK A construction company}

@item @uref{http://www.nbi.nl, Elsevier Bussines Information}

@item @uref{http://vaccination.medicallink.se/, Medical Links (Using ColdFusion and @strong{MySQL})}

@item @uref{http://www.joblink-usa.com, Search for jobs & people at JobLink-USA}

@item @uref{http://www.skydive.net/competfs, Competition Formation Skydiving}

@item @uref{http://www.galaxy-net.net/Galaxy-NET Telecommunications, E-commerce and internal accounting}

@item @uref{http://www.borsen.dk/, Denmark's leading business daily newspaper Borsen}

@item @uref{http://tmmm.simplenet.com/indb/, The Internet NES Database}

@item @uref{http://www.russia.cz, Travel agency in Prague in 3 languages}

@item @uref{http://www.linkstation.de, Linkstation}

@item @uref{http://www.peoplestaff.com, Searchable online database at Peoplestaff}

@item @uref{http://www.dreamhorse.com, A searchable database system for horse classified ads}

@item @uref{http://pootpoot.com/,The Poot site}

@item @uref{http://grateful.net/hw_html/,"Playin' in the LAN"; a network monitoring suite}

@c Update from  Christopher Milton <cmilton@bwn.net> 1999-12-21
@item @uref{http://www.usapa.army.mil,U.S. Army Publishing Agency}

@item @uref{http://www.nekretnine.co.yu/,Realestate handling in Yugoslavia}

@item @uref{http://demo.cpsoft.com/pims/devFAQ.html, PIMS; a Patient Information Management System}

@item @uref{http://cpsoft.com,Pilkington Software Inc}

@item @uref{http://www.no-quarter.org/,A Vietnam Veteran's Memorial (The Wall) database.}

@item @uref{http://www.gamers-union.com/,Gamer's Union specializes inauctions of used & out of print gaming material}

@item @uref{http://www.montereyhigh.com/office/dbul.php3, A daily bulletin at Monterey High school}

@item @uref{http://www.myEastside.com,Community-owned site serving Lake
Washington's Eastside residents and businesses}

@item @uref{http://bowling-france.net/,French bowling site}.
@end itemize

Send any additions to this list to @email{webmaster@@mysql.com}.

@page
@node Contrib, Credits, Users, Top
@appendix Contributed programs

Many users of @strong{MySQL} have contributed @emph{very} useful support
tools and addons.

@ifclear web
A list of what is available at @uref{http://www.mysql.com/Contrib}
(or any mirror) is shown below.
If you want to build @strong{MySQL} support for the Perl @code{DBI}/@code{DBD}
interface, you should fetch the @code{Data-Dumper}, @code{DBI}, and
@code{Msql-Mysql-modules} files and install them.
@xref{Perl support}.
@end ifclear


@uref{http://www.mysql.com/Contrib/00-README, 00-README}
This listing.
 
@appendixsec API's

@itemize @bullet
@item Perl modules
@itemize @bullet
@item @uref{http://www.mysql.com/Contrib/Data-Dumper-2.101.tar.gz, Data-Dumper-2.101.tar.gz}
Perl @code{Data-Dumper} module.  Useful with @code{DBI}/@code{DBD} support for
older perl installations.

@item @uref{http://www.mysql.com/Contrib/DBI-1.13.tar.gz, DBI-1.13.tar.gz}
Perl @code{DBI} module.

@item @uref{http://www.mysql.com/Contrib/KAMXbase1.0.tar.gz,KAMXbase1.0.tar.gz}
Convert between @file{.dbf} files and @strong{MySQL} tables.  Perl
module written by Pratap Pereira @email{pereira@@ee.eng.ohio-state.edu},
extened by Kevin A. McGrail @email{kmcgrail@@digital1.peregrinehw.com}.
This converter can handle MEMO fields.

@item @uref{http://www.mysql.com/Contrib/Msql-Mysql-modules-1.2209.tar.gz, Msql-Mysql-modules-1.2209.tar.gz}
Perl @code{DBD} module to access mSQL and @strong{MySQL} databases..

@item @uref{http://www.mysql.com/Contrib/Data-ShowTable-3.3.tar.gz,  Data-ShowTable-3.3.tar.gz}
Perl @code{Data-ShowTable} module.  Useful with @code{DBI}/@code{DBD} support.
@end itemize

@item JDBC
@itemize @bullet
@item @uref{http://www.mysql.com/Contrib/mm.mysql.jdbc-1.2c.tar.gz, mm.mysql.jdbc-1.2c.tar.gz}
The mm JDBC driver for @strong{MySQL}. This is a production release
and is actively developed. By Mark Matthews
(@email{mmatthew@@ecn.purdue.edu}).

@item @uref{http://www.mysql.com/Contrib/mm.mysql.jdbc-2.0pre5.tar.gz, mm.mysql.jdbc-2.0pre5.tar.gz}
The mm JDBC driver for @strong{MySQL}. This is a pre-release beta version
and is actively developed. By Mark Matthews
(@email{mmatthew@@ecn.purdue.edu}).
The two drivers above have an LGPL
license. Please check @uref{http://www.worldserver.com/mm.mysql/} for
the latest drivers (and other JDBC information) because these drivers may be ou
updated as frequently.

@item @uref{http://www.mysql.com/Contrib/twz1jdbcForMysql-1.0.4-GA.tar.gz, twz1jdbcForMysql-1.0.4-GA.tar.gz}
The twz driver: A type 4 JDBC driver by Terrence W. Zellers
@email{zellert@@voicenet.com}.  This is commercial but is free for
private and educational use.
@c no answer from server 990830
@c You can always find the latest driver at @uref{http://www.voicenet.com/~zellert/tjFM/}.
@item
@item @uref{http://www.mysql.com/Contrib/pmdamysql.tgz,pmdamysql.tgz}
A @strong{MySQL} PMDA. Provides @strong{MySQL} server status and configuration
variables.
@end itemize

@item C++
@itemize @bullet

@item @uref{http://www.mysql.com/Contrib/mysql-c++-0.02.tar.gz, mysql-c++-0.02.tar.gz}
@strong{MySQL} C++ wrapper library. By Roland Haenel,
@email{rh@@ginster.net}.

@item @uref{http://www.mysql.com/Contrib/MyDAO.tar.gz, MyDAO}
@strong{MySQL} C++ API. By Satish @email{spitfire@@pn3.vsnl.net.in}. Inspired
by Roland Haenel's C++ API and Ed Carp's MyC library.

@item @uref{http://www.mysql.com/download_mysql++.html, mysql++}
@strong{MySQL} C++ API (More than just a wrapper library). Originally by
@email{kevina@@clark.net}. Nowadays maintained by Sinisa at TCX.

@item @uref{http://nelsonjr.homepage.com/NJrAPI,NJrAPI}
A C++ database independent library that supports @strong{MySQL}.
@end itemize

@item Delphi
@itemize @bullet
@item @uref{http://www.mysql.com/Contrib/delphi-interface.gz, delphi-interface.gz}
Delphi interface to @code{libmysql.dll}, by Blestan Tabakov,
@email{root@@tdg.bis.bg}.

@item @uref{http://www.mysql.com/Contrib/DelphiMySQL2.zip, DelphiMySQL2.zip}
Delphi interface to @code{libmysql.dll}, by @email{bsilva@@umesd.k12.or.us}

@item @uref{http://www.mysql.com/Contrib/Udmysel.pas, Udmysql.pas}
A wrapper for libmysql.dll for usage in Delphi. By Reiner Sombrowsky.

@item @uref{http://www.fichtner.net/delphi/mysql.delphi.phtml, A Delphi interface to @strong{MySQL}.}
With source code. By Matthias Fichtner.

@item @uref{http://www.productivity.org/projects/mysql/, @strong{TmySQL}
A library to use @strong{MySQL} with Delphi}

@item @uref{http://www.geocities.com/CapeCanaveral/2064/mysql.html, Delphi TDataset-component}
@end itemize

@item @uref{http://www.mysql.com/Contrib/mysql-ruby-2.2.0.tar.gz, mysql-ruby-2.2.0.tar.gz}
@strong{MySQL} Ruby module. By TOMITA Masahiro @email{tommy@@tmtm.org}
@uref{http://www.netlab.co.jp/ruby/,Ruby} is an Object-Oriented Interpreter Language.
 
@item @uref{http://www.mysql.com/Contrib/JdmMysqlDriver-0.1.0.tar.gz,JdmMysqlDriver-0.1.0.tar.gz}
A VisualWorks 3.0 Smalltalk driver for @strong{MySQL}. By
@email{joshmiller@@earthlink.net}

@item @uref{http://www.mysql.com/Contrib/Db.py, Db.py}
Python module with caching. By @email{gandalf@@rosmail.com}.

@item @uref{http://www.mysql.com/Contrib/MySQLmodule-1.4.tar.gz, MySQLmodule-1.4.tar.gz}
Python interface for @strong{MySQL}. By Joseph Skinner @email{joe@@earthlight.co.nz};  Modified by Joerg Senekowitsch @email{senekow@@ibm.net}

@item @uref{http://www.mysql.com/Contrib/mysql_mex_1_1.tar.gz, mysql_mex_1_1.tar.gz}
An interface program for the Matlab program by MathWorks.  The interface
is done by Kimmo Uutela and John Fisher (not by Mathworks).
Check @uref{http://boojum.hut.fi/~kuutela/mysqlmex.html,mysqlmex.html}
for more information.
 
@item @uref{http://www.mysql.com/Contrib/mysqltcl-1.53.tar.gz, mysqltcl-1.53.tar.gz}
Tcl interface for @strong{MySQL}. Based on @file{msqltcl-1.50.tar.gz}.
Updated by Tobias Ritzau, @email{tobri@@ida.liu.se}.

@item @uref{http://www.mysql.com/Contrib/MyC-0.1.tar.gz, MyC-0.1.tar.gz}
A Visual Basic-like API, by Ed Carp.
 
@item @uref{http://www.mysql.com/Contrib/sqlscreens-1.0.1.tar.gz, sqlscreens-1.0.1.tar.gz}
Tcl/TK code to generate database screens. By Jean-Francois Dockes.

@item @uref{http://www.mysql.com/Contrib/Vdb-dflts-2.1.tar.gz, Vdb-dflts-2.1.tar.gz}
This is a new version of a set of library utilities intended
to provide a generic interface to SQL database engines such that your
application becomes a 3-tiered application.  The advantage is that you
can easily switch between and move to other database engines by
implementing one file for the new backend without needing to make any
changes to your applications. By @email{damian@@cablenet.net}.

@item @uref{http://www.mysql.com/Contrib/DbFramework-1.10.tar.gz, DbFramework-1.10.tar.gz}
DbFramework is a collection of classes for manipulating @strong{MySQL}
databases.  The classes are loosely based on the CDIF Data Model
Subject Area. By Paul Sharpe @email{paul@@miraclefish.com}.

@item @uref{http://www.mysql.com/Contrib/pike-mysql-1.4.tar.gz, pike-mysql-1.4.tar.gz}
@strong{MySQL} module for pike. For use with the Roxen web server.

@item @uref{http://www.mysql.com/Contrib/squile.tar.gz, squile.tar.gz}
Module for @code{guile} that allows @code{guile} to interact with SQL
databases. By Hal Roberts.

@item @uref{http://www.mysql.com/Contrib/stk-mysql.tar.gz, stk-mysql.tar.gz}
Interface for Stk. Stk is the Tk widgets with Scheme underneath instead of Tcl.
By Terry Jones

@item @uref{http://www.mysql.com/Contrib/eiffel-wrapper-1.0.tar.gz,eiffel-wrapper-1.0.tar.gz}.
Eiffel wrapper by Michael Ravits.
@end itemize

@appendixsec  Clients

@itemize @bullet
@item Graphical clients
@itemize @bullet
@item @uref{http://www.mysql.com/download_clients.html, mysqlgui homepage}
The @strong{MySQL} GUI client homepage. By Sinisa at TCX.
@item @uref{http://www.mysql.com/Contrib/kmysqladmin-0.4.1.tar.gz, kmysqladmin-0.4.1.tar.gz}
@item @uref{http://www.mysql.com/Contrib/kmysqladmin-0.4.1-1.src.rpm, kmysqladmin-0.4.1-1.src.rpm}
@item @uref{http://www.mysql.com/Contrib/kmysqladmin-0.4.1-1.i386.rpm, kmysqladmin-0.4.1-1.i386.rpm}
An administration tool for the @strong{MySQL} server using QT / KDE.  Tested
only on Linux.

@item @uref{http://www.mysql.com/Contrib/mysql-admin-using-java+swing.tar.gz, Java client
using Swing} By Fredy Fischer, @email{se-afs@@dial.eunet.ch}. Ypu can
always find the latest version
@uref{http://www.trash.net/~ffischer/admin/index.html, here}.

@item @uref{http://www.mysql.com/Contrib/mysqlwinadmn.zip, mysqlwinadmn.zip}
Win32 GUI (binary only) to administrate a database, by David B. Mansel,
@email{david@@zhadum.org}.

@item @uref{http://www.mysql.com/Contrib/netadmin.zip, netadmin.zip} A
administrator tool for @strong{MySQL} on Windows 95/98 and Windows NT
4.0. Only tested with @strong{MySQL} 3.23.5 - 3.23.7. Written using the
Tmysql components.

You can write queries and show tables, indexes, table syntax and
administrate user,host and database and so on. The is still beta and
have still some bugs. you can test the program with all features. Please
send bugs and hints to Marco Suess @email{ms@@it-netservice.de}. Original
URL @url{http://www.it-netservice.de/pages/software/index.html}.

@item @uref{http://www.mysql.com/Contrib/xmysqladmin-1.0.tar.gz, xmysqladmin-1.0.tar.gz}
A front end to the @strong{MySQL} database engine.  It allows reloads,
status check, process control, myisamchk, grant/revoke privileges,
creating databases, dropping databases, create, alter, browse and drop
tables.  Originally by Gilbert Therrien, @email{gilbert@@ican.net} but
now in public domain and supported by TcX.

@item @uref{http://www.mysql.com/Contrib/xmysql-1.9.tar.gz, xmysql-1.9.tar.gz}
@item @uref{http://web.wt.net/~dblhack, xmysql home page}
A front end to the @strong{MySQL} database engine. It allows for simple
queries and table maintenance, as well as batch queries. By Rick
Mehalick, @email{dblhack@@wt.net}.
Requires @uref{http://bragg.phys.uwm.edu/xforms,xforms 0.88} to work.
@item @uref{http://www.tamos.net/sw/dbMetrix,dbMetrix}
An open source client for exploring databases and executing SQL. Supports
@strong{MySQL}, Oracle, PostgreSQL and mSQL.
@item @uref{http://www.multimania.com/bbrox/GtkSQL,GtkSQL}
A query tool for @strong{MySQL} and PostgreSQL.
@item @uref{http://dbman.linux.cz/,dbMan}
A query tool written in Perl. Uses DBI and Tk.
@item @uref{http://www.mysql.com/Downloads/Win32/ArtronicWINAdmin.exe,Atronic's
@strong{MySQL} client for Win32}
@item @uref{http://www.mysql.com/Contrib/mascon1.exe, mascon1.exe}
You can get the newest one from
@uref{http://www.SciBit.com,http://www.SciBit.com}.
@item @uref{http://www.virtualbeer.net/dbui/,DBUI}
DBUI is a Gtk graphical database editor.
@end itemize

@item Web clients
@itemize @bullet
@item @uref{http://www.mysql.com/Contrib/mysqladmin-atif-1.0.tar.gz, mysqladmin-atif-1.0.tar.gz}
WWW @strong{MySQL} administrator for the @code{user,} @code{db} and
@code{host} tables.  By Tim Sailer, modified by Atif Ghaffar
@email{aghaffar@@artemedia.ch}.

@item @uref{http://www.mysql.com/Contrib/mysql-webadmin-1.0a8-rz.tar.gz, mysql-webadmin-1.0a8-rz.tar.gz}
A tool written in PHP-FI to administrate @strong{MySQL} databases
remotely over the web within a Web-Browser. By Peter Kuppelwieser,
@email{peter.kuppelwieser@@kantea.it}. Updated by Wim Bonis, bonis@@kiss.de.
Not maintained anymore!

@item @uref{http://www.mysql.com/Contrib/mysqladm.tar.gz, mysqladm.tar.gz}
@strong{MySQL} Web Database Administration written in Perl.  By Tim
Sailer.

@item @uref{http://www.mysql.com/Contrib/mysqladm-2.tar.gz, mysqladm-2.tar.gz}
Updated version of @file{mysqladm.tar.gz}, by High Tide.

@item @uref{http://www.mysql.com/Contrib/billowmysql.zip, billowmysql.zip}
Updated version of @file{mysqladm.tar.gz}, by Ying Gao.

@item @uref{http://www.mysql.com/Contrib/myadmin-0.4.tar.gz, myadmin-0.4.tar.gz}
@item @uref{http://myadmin.cheapnet.net/, MyAdmin home page}
A web based mysql administrator by Mike Machado.

@item @uref{http://www.mysql.com/Contrib/phpMyAdmin_2.0.1.tar.gz,phpMyAdmin_2.0.1.tar.gz}
A set of PHP3-scripts to adminstrate @strong{MySQL} over the WWW.

@item @uref{http://www.htmlwizard.net/phpMyAdmin/, phpMyAdmin home page}
A PHP3 tool in the spirit of mysql-webadmin, by Tobias Ratschiller, tobias@@dnet.it

@item @uref{http://www.mysql.com/Contrib/useradm.tar.gz, useradm.tar.gz}
@strong{MySQL} administrator in PHP. By Ofni Thomas
@email{othomas@@vaidsystems.com}.
@end itemize
@item @uref{http://www.mysql.com/Contrib/mysql-editor.tar.gz,mysql-editor.tar.gz}
This cgi scripts in Perl enables you to edit content of Mysql
database. By Tomas Zeman.
@end itemize


@appendixsec Web tools

@itemize @bullet

@item @uref{http://www.mysql.com/Contrib/mod_mysql_include_1.0.tar.gz, mod_mysql_include_1.0.tar.gz}
Apache module to include HTML from MySQL queries into your pages, and run update queries.
Originally written to implement a simple fast low-overhead banner-rotation system.
By Sasha Pachev.

@item @uref{http://www.odbsoft.com/cook/sources.htm}
This package has various functions for generating html code from a SQL
table structure and for generating SQL statements (Select, Insert,
Update, Delete) from an html form. You can build a complete forms
interface to a SQL database (query, add, update, delete) without any
programming!  By Marc Beneteau, @email{marc@@odbsoft.com}.

@item @uref{http://www.mysql.com/Contrib/sqlhtml.tar.gz, sqlhtml.tar.gz}
SQL/HTML is an HTML database manager for @strong{MySQL} using @code{DBI} 1.06.

@item @uref{http://www.mysql.com/Contrib/udmsearch-2.2.1b.tar.gz, UdmSearch 2.2.1b (stable version)}
@item @uref{http://www.mysql.com/Contrib/udmsearch-3.0.5.tar.gz, UdmSearch 3.0.5 (development version)}
@item @uref{http://mysearch.udm.net, UdmSearch home page}
A @strong{MySQL}- and PHP- based search engine over HTTP. By
Alexander I. Barkov @email{bar@@izhcom.ru}.

@item @uref{http://www.mysql.com/Contrib/wmtcl.doc, wmtcl.doc}
@item @uref{http://www.mysql.com/Contrib/wmtcl.lex, wmtcl.lex}
With this you can write HTML files with inclusions of TCL code. By
@email{vvs@@scil.npi.msu.su}.

@item @uref{http://www.mysql.com/Contrib/www-sql-0.5.7.lsm, www-sql-0.5.7.lsm}
@item @uref{http://www.mysql.com/Contrib/www-sql-0.5.7.tar.gz, www-sql-0.5.7.tar.gz}
A CGI program that parses an HTML file containing special tags, parses
them and inserts data from a @strong{MySQL} database.

@item @uref{http://www.mysql.com/Contrib/genquery.zip, genquery.zip}
Perl SQL database interface package for html.

@item @uref{http://www.mysql.com/Contrib/cgi++-0.8.tar.gz, cgi++-0.8.tar.gz}
A macro-processor to simply writing CGI/Database programs in C++ by Sasha Pachev.

@item  @uref{http://www.mysql.com/Contrib/webboard-1.0.zip, WebBoard 1.0}
EU-Industries Internet-Message-Board. 

@item @uref{http://www.mysql.com/Contrib/DBIx-TextIndex-0.02.tar.gz, DBIx-TextIndex-0.02.tar.gz}
Full-text searching with Perl on @code{BLOB}/@code{TEXT} columns by Daniel Koch.
@end itemize

@appendixsec Performance Benchmarking tools

@itemize @bullet
@item @uref{http://www.mysql.com/Contrib/mysql-bench-0.6.tar.gz, mysql-super-smack and friends}
User-customizable multi-threaded tool set to benchmark @strong{MySQL}. By Sasha Pachev.
@end itemize

@appendixsec Authentication tools

@itemize @bullet
@item @uref{http://www.mysql.com/Contrib/ascend-radius-mysql-0.7.1.patch.gz,
ascend-radius-mysql-0.7.1.patch.gz}
This is authentication and logging patch using @strong{MySQL} for
Ascend-Radius. By @email{takeshi@@SoftAgency.co.jp}.

@item @uref{http://www.mysql.com/Contrib/icradius-0.10.tar.gz, icradius 0.10}
@uref{http://www.mysql.com/Contrib/icradius.README, icradius readme file}

@item @uref{http://www.mysql.com/Contrib/checkpassword-0.81-mysql-0.6.5.patch.gz,
checkpassword-0.81-mysql-0.6.5.patch.gz}
@strong{MySQL} authentication patch for QMAIL and checkpassword. These are
useful for management user(mail,pop account) by @strong{MySQL}.
By @email{takeshi@@SoftAgency.co.jp}

@item @uref{http://www.mysql.com/Contrib/jradius-diff.gz, jradius-diff.gz}
@strong{MySQL} support for Livingston's Radius 2.01. Authentication and
Accounting. By Jose de Leon, @email{jdl@@thevision.net}

@item @uref{http://www.mysql.com/Contrib/mod_auth_mysql-2.20.tar.gz, mod_auth_mysql-2.20.tar.gz}
Apache authentication module for @strong{MySQL}. By Zeev Suraski,
@email{bourbon@@netvision.net.il}.

@strong{Please} register this module at:
@url{http://bourbon.netvision.net.il/mysql/mod_auth_mysql/register.html}. The
registering information is only used for statistical purposes and will
encourage further development of this module!

@item @uref{http://www.mysql.com/Contrib/mod_log_mysql-1.05.tar.gz, mod_log_mysql-1.05.tar.gz}
@strong{MySQL} logging module for Apache. By Zeev Suraski,
@email{bourbon@@netvision.net.il}.

@item @uref{http://www.mysql.com/Contrib/mypasswd-2.0.tar.gz, mypasswd-2.0.tar.gz}
Extra for @code{mod_auth_mysql}. This is a little tool that allows you
to add/change user records storing group and/or password entries in
@strong{MySQL} tables. By Harry Brueckner, @email{brueckner@@respublica.de}.

@item @uref{http://www.mysql.com/Contrib/mysql-passwd.README, mysql-passwd.README}
@item @uref{http://www.mysql.com/Contrib/mysql-passwd-1.2.tar.gz, mysql-passwd-1.2.tar.gz}
Extra for @code{mod_auth_mysql}. This is a two-part system for use with
@code{mod_auth_mysql}.

@item @uref{http://www.mysql.com/Contrib/pam_mysql.tar.gz, pam_mysql.tar.gz}
This module authenticates users via @code{pam}, using @strong{MySQL}.

@item @uref{http://www.mysql.com/Contrib/nsapi_auth_mysql.tar, nsapi_auth_mysql.tar}
Netscape Web Server API (NSAPI) functions to authenticate (BASIC) users
against @strong{MySQL} tables. By Yuan John Jiang.

@item @uref{http://www.mysql.com/Contrib/qmail-1.03-mysql-0.6.5.patch.gz,
qmail-1.03-mysql-0.6.5.patch.gz}
Patch for qmail to authenticate users from a @strong{MySQL} table.

@item @uref{http://www.mysql.com/Contrib/pwcheck_mysql-0.1.tar.gz,pwcheck_mysql-0.1.tar.gz}
An authentication module for the Cyrus IMAP server. By Aaron Newsome.
@end itemize

@appendixsec Converters

@itemize @bullet
@item @uref{http://www.mysql.com/Contrib/dbf2mysql-1.13.tgz, dbf2mysql-1.13.tgz}
Convert between @file{.dbf} files and @strong{MySQL} tables. By Maarten
Boekhold, @email{boekhold@@cindy.et.tudelft.nl}, and Michael Widenius.
This converter can't handle MEMO fields.

@item @uref{http://www.mysql.com/Contrib/dbf2mysql.zip, dbf2mysql.zip}
Convert between FoxPro @file{.dbf} files and @strong{MySQL} tables on Win32.
By Alexander Eltsyn, @email{ae@@nica.ru} or @email{ae@@usa.net}.

@item @uref{http://www.mysql.com/Contrib/dump2h-1.20.gz, dump2h-1.20.gz}
Convert from @code{mysqldump} output to a C header file. By Harry Brueckner,
@email{brueckner@@mail.respublica.de}.

@item @uref{http://www.mysql.com/Contrib/exportsql.txt, exportsql.txt}
A script that is similar to @code{access_to_mysql.txt}, except that this
one is fully configurable, has better type conversion (including
detection of @code{TIMESTAMP} fields), provides warnings and suggestions
while converting, quotes @strong{all} special characters in text and
binary data, and so on.  It will also convert to @code{mSQL} v1 and v2,
and is free of charge for anyone. See
@uref{http://www.cynergi.net/prod/exportsql/} for latest version. By
Pedro Freire, @email{support@@cynergi.net}.  Note: Doesn't work with
Access2!
@item @uref{http://www.mysql.com/Contrib/access_to_mysql.txt, access_to_mysql.txt}
Paste this function into an Access module of a database which has the
tables you want to export. See also @code{exportsql}. By Brian Andrews.
Note: Doesn't work with Access2!

@item @uref{http://www.mysql.com/Contrib/importsql.txt, importsql.txt}
A script that does the exact reverse of @code{exportsql.txt}.  That is,
it imports data from @strong{MySQL} into an Access database via
ODBC. This is very handy when combined with exportsql, because it lets you
use Access for all DB design and administration, and synchronize with
your actual @strong{MySQL} server either way. Free of charge. See
@uref{http://www.netdive.com/freebies/importsql/} for any updates.
Created by Laurent Bossavit of NetDIVE.
@strong{Note:} Doesn't work with Access2!

@item @uref{http://www.mysql.com/Contrib/msql2mysqlWrapper-1.0.tgz, /msql2mysqlWrapper 1.0}
A C wrapper from @code{mSQL} to @strong{MySQL}. By @email{alfred@@sb.net}

@item @uref{http://www.mysql.com/Contrib/sqlconv.pl, sqlconv.pl}
A simple script that can be used to copy fields from one @strong{MySQL} table to
another in bulk. Basically, you can run @code{mysqldump} and pipe it to
the @code{sqlconv.pl} script and the script will parse through the
@code{mysqldump} output and will rearrange the fields so they can be
inserted into a new table. An example is when you want to create a new
table for a different site you are working on, but the table is just a
bit different (ie - fields in different order, etc.).
By Steve Shreeve.
@end itemize

@appendixsec Using MySQL with other products

@itemize @bullet
@item @uref{http://www.mysql.com/Contrib/emacs-sql-mode.tar.gz, emacs-sql-mode.tar.gz}
Raw port of a SQL mode for XEmacs. Supports completion. Original by
Peter D. Pezaris @email{pez@@atlantic2.sbi.com} and partial
@strong{MySQL} port by David Axmark.

@item @uref{http://www.mysql.com/Downloads/Win32/MyAccess97_Ver_1_01.zip, MyAccess97 1.01}
MyAccess is an AddIn for Access 97 and handles a lot of maintanance work
for @strong{MySQL} databases.

@item @uref{http://www.mysql.com/Downloads/Win32/MyAccess2000_Ver_1_01.zip, MyAccess2000 1.01}
MyAccess is an AddIn for Access 2000 and handles a lot of maintanance work
for @strong{MySQL} databases.

@uref{http://www.mysql.com/Downloads/Win32/MyAccess-1.01.readme,
MyAccess-readme}.  By Hubertus Hiden.

@item @uref{http://www.mysql.com/Contrib/radius-0.3.tar.gz, radius-0.3.tar.gz}
Patches for @code{radiusd} to make it support @strong{MySQL}. By Wim Bonis,
@email{bonis@@kiss.de}.
@end itemize

@appendixsec Useful tools

@itemize @bullet
@item @uref{http://www.mysql.com/Contrib/mysql_watchdog.pl, mysql_watchdog.pl}
Monitor the @strong{MySQL} daemon for possible lockups. By Yermo Lamers,
@email{yml@@yml.com}.

@item @uref{http://www.mysql.com/Contrib/mysqltop.tar.gz, mysqltop.tar.gz}
Sends a query in a fixed time interval to the server and shows the
resulting table. By Thomas Wana.
@item @uref{http://www.mysql.com/Contrib/mysql_structure_dumper.tar.gz,mysql_structure_dumper.tar.gz}
Prints out the structure of the all tables in a database. By Thomas Wana.

@item @uref{http://www.mysql.com/Contrib/mysql_structure_dumper.tgz, structure_dumper.tgz}
Prints the structure of every table in a database. By Thomas Wana.

@item @uref{http://www.mysql.com/Contrib/mysqlsync, mysqlsync-1.0-alpha.tar.gz}.
A perl script to keep remote copies of a @strong{MySQL} database in sync with a
central master copy. By Mark Jeftovic.  @email{markjr@@easydns.com}
@item @uref{http://www.mysql.com/Contrib/MySQLTutor-0.2.tar.gz, MySQLTutor}.
MySQLTutor. A tutor of @strong{MySQL} for beginners

@item @uref{http://www.mysql.com/Contrib/MySQLDB.zip, MySQLDB.zip}
A COM library for @strong{MySQL} by Alok Singh.
@item @uref{http://www.mysql.com/Contrib/MySQLDB-readme.html, MySQLDB-readme.html}

@item @uref{http://www.mysql.com/Contrib/mysql_replicate.pl, mysql_replicate.pl}
Perl program that handles replication.  By @email{elble@@icculus.nsg.nwu.edu}

@item @uref{http://www.mysql.com/Contrib/DBIx-TextIndex-0.02.tar.gz, DBIx-TextIndex-0.02.tar.gz}
Perl program that uses reverse indexing to handle text searching.
By Daniel Koch.
@end itemize

@appendixsec RPMs for common tools (Most are for RedHat 6.1)

@itemize @bullet
@item @uref{http://www.mysql.com/Contrib/perl-Data-ShowTable-3.3-2.i386.rpm,perl-Data-ShowTable-3.3-2.i386.rpm}
@item @uref{http://www.mysql.com/Contrib/perl-Msql-Mysql-modules-1.2210-2.i386.rpm,perl-Msql-Mysql-modules-1.2210-2.i386.rpm}
@item @uref{http://www.mysql.com/Contrib/php-pg-3.0.13-1.i386.rpm,php-pg-3.0.13-1.i386.rpm}
@item @uref{http://www.mysql.com/Contrib/php-pg-manual-3.0.13-1.i386.rpm,php-pg-manual-3.0.13-1.i386.rpm}
@item @uref{http://www.mysql.com/Contrib/php-pg-mysql-3.0.13-1.i386.rpm,php-pg-mysql-3.0.13-1.i386.rpm}
@item @uref{http://www.mysql.com/Contrib/phpMyAdmin-2.0.5-1.noarch.rpm,phpMyAdmin-2.0.5-1.noarch.rpm}
@end itemize

@appendixsec Useful functions
@itemize @bullet
@item @uref{http://www.mysql.com/Contrib/mysnprintf.c,mysnprintf.c}
sprintf() function for SQL queries that can escape blobs. By Chunhua Liu.
@end itemize

@appendixsec Uncategorized

@itemize @bullet

@item @uref{http://www.mysql.com/Contrib/findres.pl, findres.pl}
Find reserved words in tables. By Nem W Schlecht.

@item @uref{http://www.mysql.com/Contrib/handicap.tar.gz, handicap.tar.gz}
Performance handicapping system for yachts. Uses PHP. By
@email{rhill@@stobyn.ml.org}.

@item @uref{http://www.mysql.com/Contrib/hylalog-1.0.tar.gz, hylalog-1.0.tar.gz}
Store @code{hylafax} outgoing faxes in a @strong{MySQL} database. By Sinisa
Milivojevic, @email{sinisa@@mysql.com}.

@item @uref{http://www.mysql.com/Contrib/mrtg-mysql-1.0.tar.gz, mrtg-mysql-1.0.tar.gz}
@strong{MySQL} status plotting with MRTG, by Luuk de Boer, @email{luuk@@wxs.nl}.

@item @uref{http://www.mysql.com/Contrib/wuftpd-2.4.2.18-mysql_support.2.tar.gz, wuftpd-2.4.2.18-mysql_support.2.tar.gz}
Patches to add logging to @strong{MySQL} for WU-ftpd. By Zeev Suraski,
@email{bourbon@@netvision.net.il}.

@item @uref{http://www.mysql.com/Contrib/wu-ftpd-2.6.0-mysql.4.tar.gz,wu-ftpd-2.6.0-mysql_support.4.tar.gz}
Patches to add logging to @strong{MySQL} for WU-ftpd 2.6.0. By, 
@email{takeshi@@SoftAgency.co.jp}, based on Zeev Suraski wuftpd patches.

@item @uref{http://www.mysql.com/Contrib/Old-Versions, Old-Versions}
Previous versions of things found here that you probably won't be
interested in.
@end itemize


@page
@node Credits, News, Contrib, Top
@appendix Contributors to MySQL

Contributors to the @strong{MySQL} distribution are listed below, in
somewhat random order:

@table @asis
@item Michael (Monty) Widenius
Has written the following parts of @strong{MySQL}:
@itemize @bullet
@item
All the main code in @code{mysqld}.
@item
New functions for the string library.
@item
Most of the @code{mysys} library.
@item
The @code{ISAM} and @code{MyISAM} libraries (B-tree index file
handlers with index compression and different record formats).
@item
The @code{heap} library. A memory table system with our superior full dynamic
hashing. In use since 1981 and published around 1984.
@item
The @code{replace} program (look into it, it's COOL!).
@item
@strong{MyODBC}, the ODBC driver for Windows95.
@item
Fixing bugs in MIT-pthreads to get it to work for @strong{MySQL}. And
also Unireg, a curses-based application tool with many utilities.
@item
Porting of @code{mSQL} tools like @code{msqlperl}, @code{DBD}/@code{DBI} and
@code{DB2mysql}.
@item
Most parts of crash-me and the @strong{MySQL} benchmarks.
@end itemize
@item David Axmark
@itemize @bullet
@item
Coordinator and main writer for the @strong{Reference Manual}, including
enhancements to @code{texi2html}. Also automatic website updating from
this manual.
@item
Autoconf, Automake and @code{libtool} support.
@item
The licensing stuff.
@item
Parts of all the text files.  (Nowadays only the @file{README} is
left. The rest ended up in the manual.)
@item
Our Mail master.
@item
Lots of testing of new features.
@item
Our in-house ``free'' software lawyer.
@item
Mailing list maintainer (who never has the time to do it right...)
@item
Our original portability code (more than 10 years old now). Nowadays
only some parts of @code{mysys} are left.
@item
Someone for Monty to call in the middle of the night when he just got
that new feature to work. :-)
@end itemize
@item Paul DuBois
Help with making the Reference Manual correct and understandable. That
includes rewriting Monty's and David's attempts at English into English
as other people know it.
@item Gianmassimo Vigazzola @email{qwerg@@mbox.vol.it} or @email{qwerg@@tin.it}
The initial port to Win32/NT.
@item Kim Aldale
Helped to rewrite Monty's and David's early attempts at English into
English.
@item Allan Larsson (The BOSS at TcX)
For all the time he has allowed Monty to spend on this ``maybe useful''
tool (@strong{MySQL}). Dedicated user (and bug finder) of Unireg & @strong{MySQL}.
@item Per Eric Olsson
For more or less constructive criticism and real testing of the dynamic
record format.
@item Irena Pancirov @email{irena@@mail.yacc.it}
Win32 port with Borland compiler. @code{mysqlshutdown.exe} and
@code{mysqlwatch.exe}
@item David J. Hughes
For the effort to make a shareware SQL database. We at TcX started with
@code{mSQL}, but found that it couldn't satisfy our purposes so instead we
wrote a SQL interface to our application builder Unireg.  @code{mysqladmin}
and @code{mysql} are programs that were largely influenced by their
@code{mSQL} counterparts. We have put a lot of effort into making the
@strong{MySQL} syntax a superset of @code{mSQL}. Many of the APIs ideas are
borrowed from @code{mSQL} to make it easy to port free @code{mSQL} programs
to @strong{MySQL}. @strong{MySQL} doesn't contain any code from @code{mSQL}.
Two files in the distribution (@file{client/insert_test.c} and
@file{client/select_test.c}) are based on the corresponding (non-copyrighted)
files in the @code{mSQL} distribution, but are modified as examples showing
the changes necessary to convert code from @code{mSQL} to @strong{MySQL}.
(@code{mSQL} is copyrighted David J. Hughes.)
@item Fred Fish
For his excellent C debugging and trace library. Monty has made a number
of smaller improvements to the library (speed and additional options).
@item Richard A. O'Keefe
For his public domain string library.
@item Henry Spencer
For his regex library, used in @code{WHERE column REGEXP regexp}.
@item Free Software Foundation
From whom we got an excellent compiler (@code{gcc}), the @code{libc} library
(from which we have borrowed @file{strto.c} to get some code working in Linux)
and the @code{readline} library (for the @code{mysql} client).
@item Free Software Foundation & The XEmacs development team
For a really great editor/environment used by almost everybody at TcX/detron.
@item Patrick Lynch
For helping us acquire @code{www.mysql.com}.
@item Fred Lindberg
For setting up qmail to handle @strong{MySQL} mailing list and for the
incredible help we got in managing the @strong{MySQL} mailing lists.
@item Igor Romanenko @email{igor@@frog.kiev.ua}
@code{mysqldump} (previously @code{msqldump}, but ported and enhanced by
Monty).
@item Tim Bunce, Alligator Descartes
For the @code{DBD} (Perl) interface.
@item Andreas Koenig @email{a.koenig@@mind.de}
For the Perl interface to @strong{MySQL}.
@item Eugene Chan @email{eugene@@acenet.com.sg}
For porting PHP to @strong{MySQL}.
@item Michael J. Miller Jr. @email{mke@@terrapin.turbolift.com}
For the first @strong{MySQL} manual. And a lot of spelling/language
fixes for the FAQ (that turned into the @strong{MySQL} manual a long
time ago).
@item Giovanni Maruzzelli @email{maruzz@@matrice.it}
For porting iODBC (Unix ODBC).
@item Chris Provenzano
Portable user level pthreads. From the copyright: This product includes
software developed by Chris Provenzano, the University of California,
Berkeley, and contributors.  We are currently using version 1_60_beta6
patched by Monty (see @file{mit-pthreads/Changes-mysql}).
@item Xavier Leroy @email{Xavier.Leroy@@inria.fr}
The author of LinuxThreads (used by @strong{MySQL} on Linux).
@item Zarko Mocnik @email{zarko.mocnik@@dem.si}
Sorting for Slovenian language and the @file{cset.tar.gz} module that makes
it easier to add other character sets.
@item "TAMITO" @email{tommy@@valley.ne.jp}
The @code{_MB} character set macros and the ujis and sjis character sets.
@item Yves Carlier @email{Yves.Carlier@@rug.ac.be}
@code{mysqlaccess}, a program to show the access rights for a user.
@item Rhys Jones @email{rhys@@wales.com} (And GWE Technologies Limited)
For the JDBC, a module to extract data from @strong{MySQL} with a Java
client.
@item Dr Xiaokun Kelvin ZHU @email{X.Zhu@@brad.ac.uk}
Further development of the JDBC driver and other @strong{MySQL}-related
Java tools.
@item James Cooper @email{pixel@@organic.com}
For setting up a searchable mailing list archive at his site.
@item Rick Mehalick @email{Rick_Mehalick@@i-o.com}
For @code{xmysql}, a graphical X client for @strong{MySQL}.
@item Doug Sisk @email{sisk@@wix.com}
For providing RPM packages of @strong{MySQL} for RedHat Linux.
@item Diemand Alexander V. @email{axeld@@vial.ethz.ch}
For providing RPM packages of @strong{MySQL} for RedHat Linux-Alpha.
@item Antoni Pamies Olive @email{toni@@readysoft.es}
For providing RPM versions of a lot of @strong{MySQL} clients for Intel
and SPARC.
@item Jay Bloodworth @email{jay@@pathways.sde.state.sc.us}
For providing RPM versions for @strong{MySQL} 3.21 versions.
@item Jochen Wiedmann @email{wiedmann@@neckar-alb.de}
For maintaining the Perl @code{DBD::mysql} module.
@item Therrien Gilbert @email{gilbert@@ican.net}, Jean-Marc Pouyot @email{jmp@@scalaire.fr}
French error messages.
@item Petr snajdr, @email{snajdr@@pvt.net}
Czech error messages.
@item Jaroslaw Lewandowski @email{jotel@@itnet.com.pl}
Polish error messages.
@item Miguel Angel Fernandez Roiz
Spanish error messages.
@item Roy-Magne Mo @email{rmo@@www.hivolda.no}
Norwegian error messages and testing of 3.21.#.
@item Timur I. Bakeyev @email{root@@timur.tatarstan.ru}
Russian error messages.
@item @email{brenno@@dewinter.com} && Filippo Grassilli @email{phil@@hyppo.com}
Italian error messages.
@item Dirk Munzinger @email{dirk@@trinity.saar.de}
German error messages.
@item Billik Stefan @email{billik@@sun.uniag.sk}
Slovak error messages.
@item Stefan Saroiu @email{tzoompy@@cs.washington.edu}
Romanian error messages.
@item Peter Feher
Hungarian error messages
@item David Sacerdote @email{davids@@secnet.com}
Ideas for secure checking of DNS hostnames.
@item Wei-Jou Chen @email{jou@@nematic.ieo.nctu.edu.tw}
Some support for Chinese(BIG5) characters.
@item  Wei He @email{hewei@@mail.ied.ac.cn}
A lot of functionality for the Chinese(GBK) character set.
@item Zeev Suraski @email{bourbon@@netvision.net.il}
@code{FROM_UNIXTIME()} time formatting, @code{ENCRYPT()} functions, and
@code{bison} advisor.
Active mailing list member.
@item Luuk de Boer @email{luuk@@wxs.nl}
Ported (and extended) the benchmark suite to @code{DBI}/@code{DBD}. Have
been of great help with @code{crash-me} and running benchmarks. Some new
date functions. The mysql_setpermissions script.
@item Jay Flaherty @email{fty@@utk.edu}
Big parts of the Perl @code{DBI}/@code{DBD} section in the manual.
@item Paul Southworth @email{pauls@@etext.org}, Ray Loyzaga @email{yar@@cs.su.oz.au}
Proof-reading of the Reference Manual.
@item Alexis Mikhailov @email{root@@medinf.chuvashia.su}
User definable functions (UDFs); @code{CREATE FUNCTION} and
@code{DROP FUNCTION}.
@item Andreas F. Bobak @email{bobak@@relog.ch}
The @code{AGGREGATE} extension to UDF functions.
@item Ross Wakelin @email{R.Wakelin@@march.co.uk}
Help to set up InstallShield for @strong{MySQL}-Win32.
@item Jethro Wright III @email{jetman@@li.net}
The @file{libmysql.dll} library.
@item James Pereria @email{jpereira@@iafrica.com}
Mysqlmanager, a Win32 GUI tool for administrating @strong{MySQL}.
@item Curt Sampson @email{cjs@@portal.ca}
Porting of MIT-pthreads to NetBSD/Alpha and NetBSD 1.3/i386.
@item Sinisa Milivojevic @email{sinisa@@mysql.com}
Compression (with @code{zlib}) to the client/server protocol.
Perfect hashing for the lexical analyzer phase.
@item Antony T. Curtis @email{antony.curtis@@olcs.net}
Porting of @strong{MySQL} to OS/2.
@item Martin Ramsch @email{m.ramsch@@computer.org}
Examples in the @strong{MySQL} Tutorial.
@item Tim Bunce
Author of @code{mysqlhotcopy}.
@item Steve Harvey
For making @code{mysqlaccess} more secure.
@item Jeremy Cole @email{jeremy@@spaceapes.com}
Proofreading and editing this fine manual.
@end table

Other contributors, bugfinders and testers: James H. Thompson, Maurizio
Menghini, Wojciech Tryc, Luca Berra, Zarko Mocnik, Wim Bonis, Elmar
Haneke, @email{jehamby@@lightside}, @email{psmith@@BayNetworks.COM},
@email{duane@@connect.com.au}, Ted Deppner @email{ted@@psyber.com},
Mike Simons, Jaakko Hyv@"atti.

And lots of bug report/patches from the folks on the mailing list.

And a big tribute to those that help us answer questions on the
@code{mysql@@lists.mysql.com} mailing list:

@table @asis
@item Daniel Koch @email{dkoch@@amcity.com}
Irix setup.
@item Luuk de Boer @email{luuk@@wxs.nl}
Benchmark questions.
@item Tim Sailer @email{tps@@users.buoy.com}
@code{DBD-mysql} questions.
@item Boyd Lynn Gerber @email{gerberb@@zenez.com}
SCO related questions.
@item Richard Mehalick @email{RM186061@@shellus.com}
@code{xmysql}-related questions and basic installation questions.
@item Zeev Suraski @email{bourbon@@netvision.net.il}
Apache module configuration questions (log & auth), PHP-related
questions, SQL syntax related questions and other general questions.
@item Francesc Guasch @email{frankie@@citel.upc.es}
General questions.
@item Jonathan J Smith @email{jsmith@@wtp.net}
Questions pertaining to OS-specifics with Linux, SQL syntax, and other
things that might be needing some work.
@item David Sklar @email{sklar@@student.net}
Using @strong{MySQL} from PHP and Perl.
@item Alistair MacDonald @email{A.MacDonald@@uel.ac.uk}
Not yet specified, but is flexible and can handle Linux and maybe HP-UX.
Will try to get user to use @code{mysqlbug}.
@item John Lyon @email{jlyon@@imag.net}
Questions about installing @strong{MySQL} on Linux systems, using either
@file{.rpm} files, or compiling from source.
@item Lorvid Ltd. @email{lorvid@@WOLFENET.com}
Simple billing/license/support/copyright issues.
@item Patrick Sherrill @email{patrick@@coconet.com}
ODBC and VisualC++ interface questions.
@item Randy Harmon @email{rjharmon@@uptimecomputers.com}
@code{DBD}, Linux, some SQL syntax questions.
@end table

@node News, Bugs, Credits, Top
@appendix @strong{MySQL} change history

�������ѹ��� @strong{MySQL} �˻ܤ���Ʊ���ˡ��ޥ˥奢����ѹ����뤳�Ȥ����դ��Ƥ���������
�⤷�ޥ˥奢��ˤ�����Ƥ���Τ�
@uref{http://www.mysql.com/download.html,@strong{MySQL} download page} ��
�������С������� MySQL �����Ĥ���ʤ���硢���ΥС������Ϥޤ���꡼������Ƥ��ޤ���

@menu
* News-3.23.x::                 Changes in release 3.23.x (Released as alpha)
* News-3.22.x::                 Changes in release 3.22.x (Recommended version)
* News-3.21.x::                 Changes in release 3.21.x
* News-3.20.x::                 Changes in release 3.20.x
* News-3.19.x::                 Changes in release 3.19.x
@end menu

@node News-3.23.x, News-3.22.x, News, News
@appendixsec Changes in release 3.23.x  (Released as alpha)

��꡼��3.23������ӥ�꡼��3.22��3.21�Ȥΰ㤤�ϡ�
3.23��������ISAM�饤�֥��( MyISAM )��ޤ�Ȥ������ȤǤ���
����ϸŤ�ISAM��ꡢSQL�ˤȤäƤ����塼�˥󥰤���Ƥ��ޤ���

3.23��꡼���ϳ�ȯ��ǡ���ǽ��®���ڡ������դ��ä�����Ǥ��礦��
���������ꡢ�桹�ϡ����Υ�꡼���򡢤��Υ�꡼���Τߤˤ��뵡ǽ
(��ե�����Υ��ݡ��ȡ�����ӡ��ޥ������¸�Υơ��֥�)��
ɬ�פȤ��Ƥ���桼�������Ф��ƤΤߡ��������ޤ���
( MySQL 3.23�����Ƥο�������ǽ�ϡ������ƥ��Ȥ���ޤ���
�����������Υ�꡼����¿���ο��������ɤ�ޤ�Τǡ����٤Ƥ�ƥ��Ȥ��뤳�Ȥ��񤷤��Ǥ�)��

We are not adding any more new features that are likely to break any
old code in @strong{MySQL} 3.23 so this version should stabilise pretty soon
and will soon be declared beta, gamma and release.

@menu
* News-3.23.18::                Changes in release 3.23.18
* News-3.23.17::                Changes in release 3.23.17
* News-3.23.16::                Changes in release 3.23.16
* News-3.23.15::                Changes in release 3.23.15
* News-3.23.14::                Changes in release 3.23.14
* News-3.23.13::                Changes in release 3.23.13
* News-3.23.12::                Changes in release 3.23.12
* News-3.23.11::                Changes in release 3.23.11
* News-3.23.10::                Changes in release 3.23.10
* News-3.23.9::                 Changes in release 3.23.9
* News-3.23.8::                 Changes in release 3.23.8
* News-3.23.7::                 Changes in release 3.23.7
* News-3.23.6::                 Changes in release 3.23.6
* News-3.23.5::                 Changes in release 3.23.5
* News-3.23.4::                 Changes in release 3.23.4
* News-3.23.3::                 Changes in release 3.23.3
* News-3.23.2::                 Changes in release 3.23.2 
* News-3.23.1::                 Changes in release 3.23.1             
* News-3.23.0::                 Changes in release 3.23.0
@end menu

@node News-3.23.18, News-3.23.17, News-3.23.x, News-3.23.x
@appendixsubsec Changes in release 3.23.18
@itemize @bullet
@item
Fixed a problem from 3.23.17 when choosing character set on the client side.
@item
Added @code{FLUSH TABLES WITH READ LOCK} to make a global lock suitable to
make a copy of @strong{MySQL} data files.
@item
@code{CREATE TABLE  ... SELECT ... PROCEDURE} now works.
@item
Internal temporary tables will now uses compressed index when using
@code{GROUP BY} on @code{VARCHAR/CHAR} columns.
@item
Fixed a problem when locking the same table with both a @code{READ} and a
@code{WRITE} lock.
@item
Fixed problem with myisamchk and @code{RAID} tables.
@end itemize

@node News-3.23.17, News-3.23.16, News-3.23.18, News-3.23.x
@appendixsubsec Changes in release 3.23.17
@itemize @bullet
@item
Fixed a bug in @code{find_in_set()} when the first argument was @code{NULL}.
@item
Added table locks to Berkeley DB.
@item
Fixed a bug with @code{LEFT JOIN} and @code{ORDER BY} where the first
table had only one matching row.
@item
Added 4 sample @code{my.cfg} example files in the @file{support-files}
directory.
@item
Fixed @code{duplicated key} problem when doing big @code{GROUP BY}'s.
(This bug was probably introduced in 3.23.15).
@item
Changed syntax for @code{INNER JOIN} to match ANSI SQL.
@item
Added @code{NATURAL JOIN} syntax.
@item
A lot of fixes in the @code{BDB} interface.
@item
Added handling of @code{--no-defaults} and @code{--defaults-file} to
@code{safe_mysqld.sh} and @code{mysql_install_db.sh}.
@item
Fixed bug in reading compressed tables with many threads.
@item
Fixed that @code{USE INDEX} works with @code{PRIMARY} keys.
@item
Added @code{BEGIN} statement to start a transaction in @code{AUTOCOMMIT} mode.
@item
Added symbolic links support for Win32.
@item
Changed protocol to let client know if the server is in AUTOCOMMIT mode
and if there is a pending transaction.  If there is a pending transaction
the client library will give an error before reconnecting to the server to
let the client know that the server did a rollback.
The protocol is still backward compatible with old clients
@item
@code{KILL} now works on a thread that is locked on a 'write' to a dead client.
@item
Fixed memory leak in the  replication slave thread
@item
Added new option @code{log-slave-updates} to allow daisy-chaining the slaves
@item
Fixed compile error on FreeBSD and other systems where @code{pthread_t}
is not the same as @code{int}
@item
Fixed master shutdown aborting the slave thread
@item
Fixed a race condition in @code{INSERT DELAYED} code when doing 
@code{ALTER TABLE}.
@item
Added deadlock detection sanity checks to @code{INSERT DELAYED}
@end itemize

@node News-3.23.16, News-3.23.15, News-3.23.17, News-3.23.x
@appendixsubsec Changes in release 3.23.16
@itemize @bullet
@item
Added option @code{TYPE=QUICK} to @code{CHECK} and @code{REPAIR}.
@item
Fixed bug in @code{REPAIR TABLE} when the table was in use by other threads.
@item
Added a thread cache to make it possible to debug @strong{MySQL} with
@code{gdb} when one does a lot of reconnects. This will also improve
systems where you can't use persistent connections.
@item
Lots of fixes in the Berekely DB interface.
@item
@code{UPDATE IGNORE} will not abort if an update results in a
@code{DUPLICATE_KEY} error.
@item
Put @code{CREATE TEMPORARY TABLE} commands in the update log.
@item
Fixed bug in handling of masked IP numbers in the privilege tables.
@item
Fixed bug with @code{delayed_key_writes} tables and @code{CHECK TABLE}.
@item
Added @code{replicate-do-db} and @code{replicate-ignore-db} options to
restrict which databases get replicated
@item 
Added @code{SQL_LOG_BIN} option
@end itemize

@node News-3.23.15, News-3.23.14, News-3.23.16, News-3.23.x
@appendixsubsec Changes in release 3.23.15
@itemize @bullet
@item
To start @code{mysqld} as @code{root} one must now use the @code{--user=root} option.
@item
Added interface to Berkeley DB. (This is not yet functional;  Play with it at
your own risk!)
@item
Replication between master and slaves.
@item
Fixed bug that other threads could steal a lock when a thread had
a lock on a table and did a @code{FLUSH TABLES} command.
@item
Added the @code{slow_launch_time} variable and the @code{Slow_launch_threads}
status variable to @code{mysqld}.  These can be examined with
@code{mysqladmin variables} and @code{mysqladmin extended-status}.
@item
Added functions @code{INET_NTOA()} and @code{INET_ATON()}.
@item
The default type of @code{IF()} now depends on the second and
third arguments and not only on the second argument.
@item
Fixed case when @code{myisamchk} could go into a loop when trying to
repair a crashed table.
@item
Don't write @code{INSERT DELAYED} to update log if @code{SQL_LOG_UPDATE=0}.
@item
Fixed problem with @code{REPLACE} on @code{HEAP} tables.
@item
Added possible character sets and time zone to @code{SHOW VARIABLES}.
@item
Fixed bug in locking code that could result it locking problems with
concurrent inserts under high load.
@item
Fixed a problem with @code{DELETE} of many rows on a table with
compressed keys where @strong{MySQL} scanned the index to find the rows.
@item
Fixed problem with @code{CHECK} on table with deleted keyblocks.
@item
Fixed a bug in reconnect (at the client side) where it didn't free memory
properly in some contexts.
@item
Fixed problems in update log when using @code{LAST_INSERT_ID()} to update
a table with an auto_increment key.   
@item
Added function @code{NULLIF()}.
@item
Fixed bug when using @code{LOAD DATA INFILE} on a table with
@code{BLOB/TEXT} columns.
@item
Optimised MyISAM to be faster when inserting keys in sorted order.
@item
@code{EXPLAIN SELECT..} now also prints out whether @strong{MySQL} needs to
create a temporary table or use file sorting when resolving the @code{SELECT}.
@item
Added optimization to skip @code{ORDER BY} parts where the part is a
constant expression in the @code{WHERE} part.  Indexes can now be used
even if the @code{ORDER BY} doesn't match the index exactly, as long as
all the not used index parts and all the extra @code{ORDER BY}
columns are constants in the @code{WHERE} clause.  @xref{MySQL indexes}.
@item
@code{UPDATE} and @code{DELETE} on a whole unique key in the @code{WHERE} part,
is now faster than before.
@item
Changed @code{RAID_CHUNKSIZE} to be in 1024 byte increments.
@item
Fixed coredump in LOAD_FILE(NULL) - you have to be as stupid as Sasha to try this :-)
@end itemize

@node News-3.23.14, News-3.23.13, News-3.23.15, News-3.23.x
@appendixsubsec Changes in release 3.23.14
@itemize @bullet
@item
Fixed a bug in @code{CONCAT()} where one of the arguments was a function
that returned a modified argument.
@item
@code{myisamchk} ����̿Ū�ʥХ����������� ���ΥХ��ϥ���ǥå����ե��������
�إå����򡢥ơ��֥������å����Ƥ�������ʤΤˤ⤫����餺���������Ƥ�����
This confused the
@code{mysqld} daemon if it updated the same table at the same time. Now
the status in the index file is only updated if one uses
@code{--update-state}.  With older @code{myisamchk} versions you shoul
use @code{--read-only} when only checking tables, if there is the
slightest chance that the @code{mysqld} server is working on the table at the
same time!
@item
Fixed that @code{DROP TABLE} is logged in the update log.
@item
Fixed problem when searching on @code{DECIMAL()} key field
where the column data contained leading zeros.
@item
auto_increment ���ǽ�Υ����Ǥʤ����� @code{myisamchk} �ΥХ�������
@item
Allow @code{DATETIME} in ISO8601 format: 2000-03-12T12:00:00
@item
ưŪ����饯�����åȡ�  ���Ĥ� @code{mysqld} �Х��ʥ�ǡ�¿���ΰ㤦
����饯�����åȤ򰷤���褦�ˤʤä���
(@code{mysqld} �������Ȼ��˻���Ǥ��ޤ�).
@item
@code{REPAIR TABLE} ���ޥ�ɤ��ɲá�
@item
@code{mysql_thread_safe()} C API �ؿ����ɲá�
@item
@code{UMASK_DIR} �Ķ��ѿ����ɲá�
@item
@code{CONNECTION_ID()} �ؿ����ɲ�
@item
When using @code{=} on @code{BLOB} or @code{VARCHAR BINARY} keys, where
only a part of the column was indexed, the whole column of the result
row wasn't compared.
@item
sjis ����饯�������åȤ� @code{ORDER BY} ���������
@item
When running in ANSI mode, don't allow columns to be used that aren't in
the @code{GROUP BY} part.
@end itemize

@node News-3.23.13, News-3.23.12, News-3.23.14, News-3.23.x
@appendixsubsec Changes in release 3.23.13
@itemize @bullet
@item
Fixed problem when doing locks on the same table more than 2 times in
the same @code{LOCK TABLE} command; This fixed the problem one got when running
the test-ATIS test with @code{--fast}.
@item
@code{SQL_BUFFER_RESULT} ���ץ����� @code{SELECT} ���ɲ�
@item
Removed end space from double/float numbers in results from temporary
tables.
@code{CHECK TABLE} ���ޥ�ɤ��ɲá�
@item
Added changes for MyISAM in 3.23.12 that didn't get into the source
distribution because of CVS problems.
@item
Fixed bug so that mysqladmin shutdown will wait for the local server to close
down.
@item
Fixed a possible endless loop when calculating timestamp.
@item
Added print_defaults to the .rpm files. Removed mysqlbug from the client
rpm file.
@end itemize

@node News-3.23.12, News-3.23.11, News-3.23.13, News-3.23.x
@appendixsubsec Changes in release 3.23.12
@itemize @bullet
@item
Fixed bug in @code{MyISAM} involving @code{REPLACE ... SELECT} which could
give a corrupted table.
@item
Fixed bug in @code{myisamchk} where it wrongly reset the auto_increment value.
@item
Linux Alpha �Ѥ�¿���Υѥå����ɲ�. @strong{MySQL} now appears to be relatively
stable on Alpha.
@item
��ʣ�����쥳���ɤ�®�����Ĥ��뤿��Υϥå��岽���줿��������Ѥ��뤿��ˡ�
@code{HEAP} ����ơ��֥��� @code{DISTINCT} ���ѹ�������
This mostly concerns queries of
type @code{SELECT DISTINCT ... GROUP BY ..}.  This fixes a problem where
not all duplicates were removed in queries of the above type.
�������ɲä��������ɤϡ��ȤƤ�®����
@item
MacOS X �� @code{MySQL} �򥳥�ѥ���Ǥ���褦�ˤʤ�ѥå����ɲ�
@item
���ץ���� @code{IF NOT EXISTS} �� @code{CREATE DATABASE} ���ɲ�.
@item
¿���Υǡ����١�����Ʊ���˥���פǤ���褦�ˡ�
@code{--all-databases} �� @code{--databases} ���ץ����� @code{mysqldump} ���ɲá�
@item
@code{MyISAM} ���ơ��֥���ΰ��̤��� @code{DECIMAL()} ����ǥå����ΥХ�����������
@item
0 �� timestamp ����¸�����Ȥ��ΥХ�����������
@item
�����������³�� @code{mysqladmin shutdown} ��¹Ԥ������ˡ�@code{mysqladmin} ��
��λ���� pidfile ��̵���ʤ�ޤ��ԤĤ褦�ˤʤä���
@item
�����Ĥ��� @code{COUNT(DISTINCT ...)} ������ǥ������Ǥ����Τ���������
@item
Fixed that @code{myisamchk} works properly with RAID:ed tables.
@item
Fixed problem with @code{LEFT JOIN} and @code{key_field IS NULL}.
@item
Fixed bug in @code{net_clear()} which could give the error @code{Aborted
connection} in the @strong{MySQL} clients.
@item
Added options @code{USE INDEX (key_list)} and @code{IGNORE INDEX (key_list)} as
join parameters in @code{SELECT}.
@item
@code{DELETE} and @code{RENAME} should now work on @code{RAID} tables.
@end itemize

@node News-3.23.11, News-3.23.10, News-3.23.12, News-3.23.x
@appendixsubsec Changes in release 3.23.11
@itemize @bullet
@item
@code{ALTER TABLEL tbl_name ADD (field_list)} ʸ����Ĥ�����
@item
Fixed problem with optimizer that could sometimes use wrong keys.
@item
@code{GRANT/REVOKE ALL PRIVILEGES} �� @code{GRANT OPTION} �˱ƶ����ʤ��ä��Τ�����
@item
Removed extra @code{)} from the output of @code{SHOW GRANTS}
@item
Fixed problem when storing numbers in timestamps.
@item
Fix problem with timezones that have half hour offsets.
@item
@code{CREATE} ʸ�Ǥ� @code{UNIQUE INDEX} �λ��Ѥ���ġ�
@item
@code{mysqlhotcopy} - ��������� @strong{MySQL} �ǡ����١�����Хå����åפ���
�ġ��롣 By Tim Bunce.
@item
������ @code{mysqlaccess}. Thanks to Steve Harvey for this.
@item
@code{--i-am-a-dummy} �� @code{--safe-updates} ���ץ����� @code{mysql} ���ɲá�
@item
@code{select_limit} �� @code{max_join_size} �ѿ��� @code{mysql} ���ɲá�
@item
SQL ���ѿ����ɲá� @code{SQL_MAX_JOIN_SIZE} �� @code{SQL_SAFE_UPDATES}.
@item
Added @code{READ LOCAL} lock that doesn't lock the table for concurrent
inserts. (This is used by @code{mysqldump}).
@item
Changed that @code{LOCK TABLES .. READ} doesn't anymore allow concurrent
inserts.
@item
���ץ���� @code{--skip-delay-key-write} �� @code{mysqld} ���ɲá�
@item
Fixed security problem in the protocol regarding password checking.
@item
@code{_rowid} can now be used as an alias for an integer type unique indexed
column.
@item
Added back blocking of @code{SIGPIPE} when compiling with @code{--thread-safe-clients}
to make things safe for old clients.
@end itemize

@node News-3.23.10, News-3.23.9, News-3.23.11, News-3.23.x
@appendixsubsec Changes in release 3.23.10
@itemize @bullet
@item
Fixed bug in 3.23.9 where memory wasn't properly freed when doing
@code{LOCK TABLES}.
@end itemize

@node News-3.23.9, News-3.23.8, News-3.23.10, News-3.23.x
@appendixsubsec Changes in release 3.23.9
@itemize @bullet
@item
Fixed problem that affected queries that did arithmetic on group functions.
@item
Fixed problem with timestamps and @code{INSERT DELAYED}.
@item
Fixed that @code{date_column BETWEEN const_date AND const_date} works.
@item
Fixed problem when only changing a 0 to @code{NULL} in a table with
@code{BLOB/TEXT} columns.      
@item
Fixed bug in range optimizer when using many key parts and or on the middle
key parts:  @code{WHERE K1=1 and K3=2 and (K2=2 and K4=4 or K2=3 and K4=5)}
@item
@code{source} ���ޥ�ɤ� @code{mysql} ���ɲá� ����� @code{mysql} ���饤�������
�ǡ��Хå��ե�������ɤळ�Ȥ��Ǥ��롣 Original patch by Matthew Vanecek.
@item
@code{WITH GRANT OPTION} ���ץ�������̿Ū�ʥХ�����
@item
Don't give an unnecessary @code{GRANT} error when using tables from many
databases in the same query.
@item
Added VIO wrapper (needed for SSL support ; By Andrei Errapart and
Tnu Samuel).
@item
Fixed optimizer problem on @code{SELECT} when using many overlapping indexes.
@strong{MySQL} should now be able to choose keys even better when there
is many keys to choose from.
@item
Changed optimizer to prefer a range key instead of a ref key when the
range key can uses more columns than the ref key (which only can use
columns with =).  For example, the following type of queries should now
be faster: @code{SELECT * from key_part_1=const and key_part_2 > const2}
@item
Fixed bug that a change of all @code{VARCHAR} columns to @code{CHAR} columns
didn't change row type from dynamic to fixed.
@item
Disabled floating point exceptions for FreeBSD to fix core dump when
doing @code{SELECT floor(pow(2,63))}.
@item
@code{mysqld} �ε�ư���ץ���� @code{--delay-key-write} ��
@code{--delay-key-write-for-all-tables} ���ѹ�
@item
Added @code{read-next-on-key} to @code{HEAP} tables.  This should fix all
problems with @code{HEAP} tables when using not @code{UNIQUE} keys.
@item
�ѿ��Υǥե���Ȥ�ɽ�����륪�ץ����򥯥饤����Ȥ��ɲ�
@item
@code{mysqld} �� @code{--log-slow-queries} ���ɲá� ����ϻ��֤Τ����ä�
���ƤΥ�������̤Υ����ե�����˵�Ͽ���롣�ɤΤ��餤���֤������ä������������
@item
@code{WHERE key_column=RAND(...)} ��Ԥä��Ȥ��������Ǥ��Х�����
@item
Fixed optimization bug in @code{SELECT .. LEFT JOIN ... key_column IS NULL},
when @code{key_column} could contain @code{NULL} values.
@item
Fixed problem with 8-bit characters as separators in @code{LOAD DATA INFILE}.
@end itemize

@node News-3.23.8, News-3.23.7, News-3.23.9, News-3.23.x
@appendixsubsec Changes in release 3.23.8
@itemize @bullet
@item
8G ����礭�ʥ���ǥå����ե�����򰷤ä��������������
@item
NetBSD �Ѥκǿ��� mit-pthread �Υѥå����ɲá�
@item
�����ॾ���� < GMT - 11 �ξ������������
@item
@code{NISAM} ��Υѥå����줿�����κ�����ΥХ�������
@item
�����Ĥ� @code{ORDER BY ... DESC} �������¹Ԥ����ݤ� @code{ISAM} �����������
@item
Fixed bug when doing a join on a text key which didn't covert the whole key.
@item
���ץ���� @code{--delay-key-write} �� delayed key writing ��ͭ���ˤ��Ƥ��ʤ��ä��Τ�����
@item
Fixed update of @code{TEXT} column which only involved case changes.
@item
Fixed that @code{INSERT DELAYED} doesn't update timestamps that are given.
@item
@code{YEARWEEK()} �ؿ����ɲäȡ�@code{x}, @code{X}, @code{v},
@code{V} ���ץ����� @code{DATE_FORMAT()} �ؤ��ɲá�
@item
Fixed problem with @code{MAX(indexed_column)} and HEAP tables.
@item
Fixed problem with @code{BLOB NULL} keys and @code{LIKE} "prefix%".
@item
Fixed problem with @code{MyISAM} and fixed length rows < 5 bytes.
@item
Fixed problem that could cause @strong{MySQL} to touch freed memory when
doing very complicated @code{GROUP BY} queries.
@item
Fixed core dump if you got a crashed table where an @code{ENUM} field value
was too big.
@end itemize

@node News-3.23.7, News-3.23.6, News-3.23.8, News-3.23.x
@appendixsubsec Changes in release 3.23.7
@itemize @bullet
@item
Linux�Ķ����ˤ����ơ�@code{pthread_mutex_timedwait} ��������򤱤�褦�ˤ�����
���δؿ��� @code{INSERT DELAYED} �ǻ��Ѥ���Ƥ����� @xref{Linux}.
@item
Fixed that one will get at 'disk full' error message if one gets disk full
when doing sorting (instead of waiting until we got more disk space).
@item
@code{MyISAM} �ǡ������� 250 ʸ����Ķ�������ΥХ�������
@item
@code{MyISAM} �ˤ����ơ�¾�Υ���åɤ��ɤ�Ǥ���ơ��֥���Ф���
¾�Υ���åɤ� @code{INSERT} ��Ʊ���˹Ԥ����Ȥ��Ǥ���褦�ˤʤä���
@item
Added variable @code{max_write_lock_count} to @code{mysqld} to force a
@code{READ} lock after a certain number of @code{WRITE} locks.
@item
Inverted flag @code{delayed_key_write} on @code{show variables}.
@item
@code{concurrency} �ѿ��� @code{thread_concurrency} �˲�̾��
@item
�ʲ��δؿ����ޥ���Х��ȡ������դˤʤä���
@code{LOCATE(substr,str)}, @code{POSITION(substr IN str)},
@code{LOCATE(substr,str,pos)}, @code{INSTR(str,substr)},
@code{LEFT(str,len)}, @code{RIGHT(str,len)},
@code{SUBSTRING(str,pos,len)}, @code{SUBSTRING(str FROM pos FOR len)},
@code{MID(str,pos,len)}, @code{SUBSTRING(str,pos)}, @code{SUBSTRING(str
FROM pos)}, @code{SUBSTRING_INDEX(str,delim,count)}, @code{RTRIM(str)},
@code{TRIM([[BOTH | TRAILING] [remstr] FROM] str)},
@code{REPLACE(str,from_str,to_str)}, @code{REVERSE(str)},
@code{INSERT(str,pos,len,newstr)}, @code{LCASE(str)}, @code{LOWER(str)},
@code{UCASE(str)} and @code{UPPER(str)};  Patch by Wei He.
@item
Fix core dump when releasing a lock from a non-existant table.
@item
Remove locks on tables before starting to remove duplicates.
@item
@code{FULL} ���ץ����� @code{SHOW PROCESSLIST} ���ɲá�
@item
@code{--verbose} ���ץ����� @code{mysqladmin} ���ɲá�
@item
HEAP �� MyISAM �ؤμ�ư�Ѵ����ΥХ�������
@item
HEAP �ơ��֥���Ф��ơ�insert + delete + insert + scan table ��Ԥä��ݤ�
��������
@item
Alpha �ץ�åȥե������ǤΡ�@code{REPLACE()} �� @code{LOAD DATA INFILE}
�ΥХ�������
@item
@code{mysqld} �ѿ��� @code{interactive_timeout} ���ɲ�.
@item
@code{mysql_data_seek()} ����� @code{ulong} ���� @code{ulonglong} ��
�ѹ�.
@end itemize

@node News-3.23.6, News-3.23.5, News-3.23.7, News-3.23.x
@appendixsubsec Changes in release 3.23.6

@itemize @bullet
@item
@code{mysqld} �� @code{-O lower_case_table_names=@{0|1@}} ���ץ������ɲá�
����ϥơ��֥�̾����Ū�˾�ʸ���ˤ��ޤ���
@item 
@code{SELECT ... INTO DUMPFILE} �ɲá�
@item
mysqld �� @code{--ansi} ���ץ������ɲá� ����Ϥ����Ĥ��δؿ���
@code{ANSI SQL} �ߴ��ˤ��ޤ���
@item
Temporary tables now starts with @code{#sql}.
@item
Added quoting of identifiers with @code{`} (@code{"} in @code{--ansi} mode).
@item
Changed to use snprintf() when printing floats to avoid some buffer
overflows on FreeBSD.
@item
FreeBSD ��ǡ�@code{floor()} �򥪡��С��ե��������դˤ�����
@item
@code{--quote-names} ���ץ����� @code{mysqldump} ���ɲ�
@item
Fixed bug that one could make a part of a @code{PRIMARY KEY NOT NULL}.
@item
Fixed @code{encrypt()} to be thread safe and not reuse buffer.
@item
MyODBC �� @code{mysql_odbc_escape_string()} �ؿ�����big5 �򥵥ݡ��Ȥ�����
@item
Rewrote the table handler to use classes.  This introduces a lot of new code,
but will make table handling faster and better.
@item
�桼��������ѿ��Υѥå�(Sasha�ˤ��)���ɲá�
@item
Changed that @code{FLOAT} and @code{DOUBLE} (without any length modifiers) are
not anymore fixed decimal point numbers.
@item
@code{FLOAT(X)} �ΰ�̣���ѹ�: X <=24 �ʤ�С������ @code{FLOAT} ��Ʊ���ǡ�
24 < X <= 53 �Ǥ���ʤ�� @code{DOUBLE} ��Ʊ���ˤʤ�ޤ���
@item
@code{DECIMAL(X)} �� @code{DECIMAL(X,0)} �Υ����ꥢ���ˤʤ�ޤ�����
�ޤ� @code{DECIMAL} �� @code{DECIMAL(10,0)} �Υ����ꥢ���ˤʤ�ޤ�����
The same goes for @code{NUMERIC}.
@item
@code{ROW_FORMAT=@{default | dynamic | static | compressed@}} ���ץ�����
@code{CREATE_TABLE} ���ɲ�.
@item
@code{DELETE FROM table_name} ������ơ��֥��ư���ʤ��ä���
@item
@code{CHAR_LENGTH()} �ؿ���ޥ���Х��ȥ����դ��ѹ�
@item
@code{ORD(string)} �ؿ����ɲ�.
@end itemize

@node News-3.23.5, News-3.23.4, News-3.23.6, News-3.23.x
@appendixsubsec Changes in release 3.23.5

@itemize @bullet
@item
�������ǡ����ϥ�ɥ����Τ����Ĥ��� Y2K ���������
@item
@code{SELECT DISTINCT ... ORDER BY RAND()} �����������
@item
Sergei A. Golubchik �ˤ�� MyISAM �Υ�٥�ǤΥƥ����ȥ������Υѥå����ɲ�
@item
����̵����full JOIN ����Ѥ����ݤΥ���å��奪���С��ե��������������
@item
�����Ĥ��� configure �����������
@item
Some small changes to make parsing faster.
@item
ALTER TABLE + adding a column after the last field didn't work. 
@item
2�ĤΥ������auto_increment�ե�����ɤ���Ѥ����Ȥ������������
@item
@code{MyISAM} �� auto_increment �򥵥֥ѡ��ȤȤ��ƻ��ѤǤ���褦�ˤʤä���
@code{ CREATE TABLE foo (a int not null auto_increment, b char(5), primary key (b,a)) }
@item
Fixed bug in @code{MyISAM} with packed char keys that could be @code{NULL}.
@item
�ե������̾�� @code{CREATE TABLE table_name SELECT ... } ���ˤȤ�����硢ư���ʤ��ä���
@item
Allow use of @code{NATIONAL} and @code{NCHAR} when defining character columns.
 This is the same as not using @code{BINARY}.
@item
@code{NULL} �Υե�����ɤ� @code{PRIMARY KEY} ( @code{UNIQUE} ����) �ˤ�
�����ʤ��ʤä���
@item
Clear @code{LAST_INSERT_ID} if one uses this in ODBC:
@code{WHERE auto_increment_column IS NULL}.  This seems to fix some problems
@item
@code{WHERE auto_increment_column IS NULL} ����Ѥ��ƺǸ�˥쥳���ɤ��������줿��ˡ�
@code{SET SQL_AUTO_IS_NULL=0|1} �ϥ������Υϥ�ɥ�󥰤� on/off �ˤʤä���
@item
Added new @code{mysqld} variable concurrency for Solaris. 
@item
@code{--relative} ���ץ����� @code{mysqladmin} ���ɲá�
����� @code{extended-status} ���ѹ��Υ�˥����򤹤��硢��������ˤʤä���
@item
���Υơ��֥���Ф��� @code{COUNT(DISTINCT..)} ����Ѥ����ݤΥХ�������
@item
����Υ���饯�������å� @code{GBK} ���ɲá�
@item
@code{LOAD DATA INFILE} �� @code{BLOB} �ե�����ɤ˻��Ѥ����ݤ����������
@item
�����黻�� @code{~} (negation) ���ɲá�
@item
@code{UDF} �ؿ��Ǥ����������
@end itemize

@node News-3.23.4, News-3.23.3, News-3.23.5, News-3.23.x
@appendixsubsec Changes in release 3.23.4

@itemize @bullet
@item
@code{DATETIME} ���� @code{TIME} �ե�����ɤ���������Ȥ���'day' ��
��¸���褦�Ȼ�ߤʤ��ʤä���
@item
low endian �Υޥ���� float/double ����¸�����������
(����� @code{SUM()} �˱ƶ�����.)
@item
TCP/IP ��³�� connect timeout ���ɲá�
@item
����ǥå�����ǡ� @code{NULL} �ͤ���Ĥ��⤷��ʤ���Τ� @code{LIKE} "%" �����ݤ����������
@item
@code{REVOKE ALL PRIVILEGES} �����Ƥθ��¤���ä��Ƥ��ʤ��ä��Τ�����
@item
���ꥸ�ʥ�Υơ��֥�̾��Ʊ��̾���ǰ���ơ��֥�����褦�ˤ�����
@item
�ǡ����١����ؤθ��¤򤢤�桼������Ϳ�����ݡ�
���Υ桼������¾�Υ桼�����˸��¤�Ϳ���뤳�Ȥ�����ʤ��ä���
@item
�����ޥ�ɡ� @code{SHOW GRANTS FOR user} (by Sinisa).
@item
�� @code{date_add} syntax:  @code{date/datetime + INTERVAL # interval_type}.
By Joshua Chamas.
@item
@code{LOAD DATA REPLACE} �θ��¤Υ����å�������
@item
Solaris 2.7 ��ǤΡ����줿 include �ե������ư������
@item
big file system �򸡽Ф���ݤΤ����Ĥ��� configure �����������
@item
@code{REGEXP} �ϥ��������¸�ˤʤä����⤷�Х��ʥ�ʸ���Ǥʤ����ϡ�
@end itemize

@node News-3.23.3, News-3.23.2, News-3.23.4, News-3.23.x
@appendixsubsec Changes in release 3.23.3 
 
@itemize @bullet 
@item
NetBSD ��Ǥ� MIT-pthreads �ѥå����ɲá�
@item
MyISAM ��� range bug ������
@item 
@code{ORDER BY} �Υǥե���Ȥ��Ƥ� @code{ASC} �ˤʤä���
@item 
@code{LIMIT} �� @code{UPDATE} ���ɲá�
@item 
�����饤����ȴؿ��� @code{mysql_change_user()}.
@item 
@code{SHOW VARIABLES} �˥���饯�������åȤ��ɲá�
@item 
@code{--[whitespace]} �����Ȥ򥵥ݡ��Ȥ�����
@item 
Allow @code{INSERT into tbl_name VALUES ()}, that is, you may now specify
an empty value list to insert a row in which each column is set to its
default value.
@item 
Changed @code{SUBSTRING(text FROM pos)} to conform to ANSI SQL. (Before this 
construct returned the rightmost 'pos' characters). 
@item 
�����Ĥ��Υ����ƥ��� @code{GROUP BY} ��Ȥ�ʤä� @code{SUM(..)} �� 0 ���֤��褦�ˤʤä���
@item 
@code{SHOW TABLE STATUS} �ν��Ϥ��ѹ���
@item 
@code{DELAY_KEY_WRITE} ���ץ����� @code{CREATE TABLE} ���ɲá�
@item 
@code{AUTO_INCREMENT} �򤤤��ʤ륭������ʬ�˻��ѤǤ���褦�ˤ�����
@item 
@code{YEAR(NOW())} , @code{YEAR(CURDATE())} �����������
@item 
Added @code{CASE} construct. 
@item 
������ @code{COALESCE()}. 
@end itemize 
 
@node News-3.23.2, News-3.23.1, News-3.23.3, News-3.23.x 
@appendixsubsec Changes in release 3.23.2 
 
@itemize @bullet 
@item 
Fixed range optimizer bug: @code{SELECT * FROM table_name WHERE 
key_part1 >= const AND (key_part2 = const OR key_part2 = const)}.  The 
bug was that some rows could be duplicated in the result. 
@item 
Running @code{myisamchk} without @code{-a} updated the index 
distribution wrong. 
@item 
@code{SET SQL_LOW_PRIORITY_UPDATES=1} gave parse error before. 
@item 
@code{WHERE} ��˻��Ѥ���Ƥ��륤��ǥå����ե�����ɤ򹹿��Ǥ���褦�ˤʤä���
@code{UPDATE tbl_name SET KEY=KEY+1 WHERE KEY > 100} 
@item 
Date handling should now be a bit faster. 
@item 
Added handling of fuzzy dates (dates where day or month is 0): 
(Like: 1999-01-00) 
@item 
Fixed optimization of @code{SELECT ... WHERE key_part1=const1 AND 
key_part_2=const2 AND key_part1=const4 AND key_part2=const4} ; Indextype 
should be @code{range} instead of @code{ref}. 
@item 
Linux Alpha ��� @code{egcs} 1.1.2 optimizer �ΥХ�(@code{BLOB} ���ѻ�)������
@item 
Fixed problem with @code{LOCK TABLES} combined with @code{DELETE FROM table}. 
@item 
MyISAM �ơ��֥�� @code{NULL} �ͤ� @code{BLOB/TEXT} �ե�����ɤ˥���������褦�ˤʤä���
@item 
�ʲ���JOIN�����®���ʤä���
@code{SELECT ... FROM t1 LEFT JOIN t2 ON ... WHERE t2.not_null_column IS NULL}. 
@item 
@code{ORDER BY} and @code{GROUP BY} can be done on functions. 
@item 
Changed handling of 'const_item' to allow handling of @code{ORDER BY RAND()}. 
@item 
@code{WHERE key_column = function} �ǥ���ǥå��������Ѥ����褦�ˤʤä���
@item 
�㤨�ե�����ɤ�����Ʊ���˥ѥå�����Ƥ��ʤ��Ƥ⡢
@code{WHERE key_column = column_name} �ǥ���ǥå��������Ѥ����褦�ˤʤä���
@item 
@code{WHERE column_name IS NULL} �ǥ���ǥå��������Ѥ����褦�ˤʤä���
@item 
Changed heap tables to be stored in low_byte_first order (to make it easy 
to convert to MyISAM tables) 
@item 
Automatic change of HEAP temporary tables to MyISAM tables in case of 
'table is full' errors.        
@item 
@code{--init-file=file_name} ���ץ����� @code{mysqld} ���ɲá�
@item 
@code{COUNT(DISTINCT value,[value,...])} 
@item 
@code{CREATE TEMPORARY TABLE} now creates a temporary table, in its own 
namespace, that is automatically deleted if connection is dropped. 
@item 
��ͽ��� (@code{CASE} ���׵�):  @code{CASE, THEN, WHEN, ELSE and END}. 
@item 
���ؿ� @code{EXPORT_SET()} , @code{MD5()}. 
@item 
GB2312 ���쥭��饯�������åȤ򥵥ݡ��ȡ�
@end itemize 
 
@node News-3.23.1, News-3.23.0, News-3.23.2, News-3.23.x 
@appendixsubsec Changes in release 3.23.1 
 
@itemize @bullet 
@item 
�����Ĥ��Υ���ѥ����������������
@end itemize 
 
@node News-3.23.0,  , News-3.23.1, News-3.23.x 
@appendixsubsec Changes in release 3.23.0

@itemize @bullet
@item
¿���ο�������ħ���������������ơ��֥롦�ϥ�ɥ顼���饤�֥��( @code{MyISAM} )��
@xref{MyISAM}.
@item
���꡼��� @code{HEAP} �ơ��֥������Ǥ���褦�ˤʤ�ޤ�����
�����õ�����ȤƤ�®���Ǥ���
@item
�����̥ե�����򥵥ݡ��Ȥ��Ƥ���OS��ǡ���ե����� (63 bit) �Υ��ݡ��ȡ�
@item
�������ؿ� @code{LOAD_FILE(filename)} �� ����ϥե��������Ȥ�ʸ�����ͤȤ����ɤߤޤ���
@item
�������黻�� @code{<=>} �� ����ϡ� @code{=} �Τ褦�˿����񤤤ޤ�����
�⤷ξ�դΰ����� @code{NULL} �ʤ顢�����֤��ޤ���
����ϥơ��֥�֤��ѹ�����Ӥ���Ω���ޤ���
@item
ODBC 3.0 @code{EXTRACT(interval FROM datetime)} �ؿ����ɲá�
@item
@code{FLOAT(X)} �ե�����ɤϡ���¸�����ͤ�ݤ�ޤ���
����ϸ������줿�Ȥ��� �ʳ�ɽ�� (1.0 E+10) �ˤʤ뤫�⤷��ޤ���
@item
@code{REPLACE} ��������®���ʤä���
@item
@code{LIKE} ʸ����Ӥ� @code{=} �Τ�˿����񤦤褦���ѹ���
����� @code{'e' LIKE '@'e'} �����ˤʤ�Ȥ������ȤǤ���
@item
@code{SHOW TABLE STATUS} �ϥơ��֥�ˤĤ��Ƥξ����¿���Ф��褦�ˤʤ�ޤ�����
@item
@code{LIKE} �� @code{SHOW STATUS} ���ޥ�ɤ��ɲá�
@item
@code{SHOW COLUMNS} �� Privileges ���ܤ��ɲá�
@item
@code{SHOW INDEX} �� @code{packed} �� @code{comment} ���ܤ��ɲá�
@item
�ơ��֥�ؤΥ����Ȥ��ɲá� ( @code{CREATE TABLE ... COMMENT "xxx"}).
@item
@code{UNIQUE} �򼡤Τ褦���ɲá� 
@code{CREATE TABLE table_name (col int not null UNIQUE)}
@item
�� create ��ʸ�� @code{CREATE TABLE table_name SELECT ....}
@item
�� create ��ʸ�� @code{CREATE TABLE IF NOT EXISTS ...}
@item
@code{CHAR(0)} �ե�����ɤκ�������Ĥ�����
@item
@code{DATE_FORMAT()} �ϡ��ե����ޥå�ʸ�������� @samp{%} ��ɬ�פˤʤä���
@item
@code{DELAYED} ��ͽ���ˤʤä��� (sorry about that :( ).
@item
�ץ������㡼������ɲá� @code{analyse}, file: @file{sql_analyse.c}.
����ϥ�����Υǡ����ˤĤ����������ޤ��� �ʲ����ͤˤ��ƤߤƤ���������
@example
SELECT ... FROM ... WHERE ... PROCEDURE ANALYSE([max elements,[max memory]])
@end example
���� �ץ������㡼�ϡ��ơ��֥�Υǡ���������å����������ˡ��ȤƤ���Ω���ޤ���
@item
@code{BINARY} cast to force a string to be compared case sensitively.
@item
@code{--skip-show-database} ���ץ����� @code{mysqld} ���ɲá�
@item
@code{BLOB}/@code{TEXT} �ե�����ɤˤ����ơ� @code{UPDATE} ���줿
�쥳���ɤ�����å��Ǥ���褦�ˤʤ�ޤ�����
@item
@code{INNER JOIN} ���ɲá�  @strong{����}: @code{INNER} ��ͽ���ˤʤ�ޤ�����
@item
@strong{MySQL} �ơ��֥�Υۥ��Ȥ˥ͥåȥޥ����򥵥ݡ��Ȥ�����
@code{IP/NETMASK} �Ȥ��ơ��ͥåȥޥ��������Ǥ��ޤ���
@item
If you compare a @code{NOT NULL DATE/DATETIME} column with @code{IS
NULL}, this is changed to a compare against @code{0} to satisfy some ODBC
applications.  (By @email{shreeve@@uci.edu}).
@item
@code{NULL IN (...)} �� @code{0} �ǤϤʤ� @code{NULL} ���֤��ޤ��� �����
 @code{null_column NOT IN (...)} �� @code{NULL} �ͤ˥ޥå����ʤ��Τ�μ¤ˤ��ޤ���
@item
@code{TIME} �ե��������ˡ���ư���������ͤ������Τ�����
@item
Changed parsing of @code{TIME} strings to be more strict.  Now the
fractional second part is detected (and currently skipped). The
following formats are supported:
@table @code
@item [[DAYS] [H]H:]MM:]SS[.fraction]
@item [[[[[H]H]H]H]MM]SS[.fraction]
@end table
@item
Detect (and ignore) second fraction part from @code{DATETIME}.
@item
@code{LOW_PRIORITY} °���� @code{LOAD DATA INFILE} ���ɲá�
@item
�ǥե���ȤΥ���ǥå���̾�򡢥ե�����ɤ�̾����Ʊ���������ˤ�����
@item
�ǥե���Ȥ���³���� 100 ���ѹ���
@item
@code{LOAD DATA INFILE} ���ˡ�����礭�ʥХåե�����Ѥ���褦�ˤ�����
@item
@code{DECIMAL(x,y)} �� ANSI SQL �˽��ä�ư���褦�ˤʤä���
@item
Added aggregate UDF functions. Thanks to Andreas F. Bobak
@email{bobak@@relog.ch} for this!
@item
@code{LAST_INSERT_ID()} is now updated for @code{INSERT INTO ... SELECT}.
@item
Some small changes to the join table optimizer to make some joins faster.
@item
@code{SELECT DISTINCT} ������®���ʤä��� 
����� @code{MyISAM} �ο����� @code{UNIQUE} ����Ѥ��ޤ���
@strong{MySQL} 3.22 �Ȱ�İ㤦���ϡ� @code{DISTINCT} �ν��Ϥ�
�����Ȥ���ʤ��Ȥ������Ǥ���
@item
���Ƥ� C ���饤����� API ������ͭ�饤�֥������˺������뤿�ᡢ
�ޥ�������ؿ��ˤʤ�ޤ����� ���Τ��ᡢ @code{mysql_num_fields()} ��
@code{MYSQL} �ȤȤ��ƥ�����Ǥ�������������� @code{mysql_field_count()} ��
���Ѥ��ʤ��ƤϤʤ�ޤ���
@item
@code{LIBWRAP} ���ɲ�;  Patch by Henning P . Schmiedehausen.
@item
Don't allow @code{AUTO_INCREMENT} for other than numerical columns.
@item
@code{AUTO_INCREMENT} �λ��Ѥϡ��ե�����ɤ�ưŪ��
@code{NOT NULL} �ˤ��ޤ���
@item
Show @code{NULL} as the default value for AUTO_INCREMENT columns.
@item
@code{SQL_BIG_RESULT} ���ɲ�;  @code{SQL_SMALL_RESULT} ���ǥե���Ȥˤʤ�ޤ�����
@item
Added a shared library RPM. This enchancement was contributed by David
Fox (dsfox@@cogsci.ucsd.edu).
@item
@code{--enable-large-files/--disable-large-files} ������� @code{configure} ��
�ɲá� See @file{configure.in} for some systems where this is
automatically turned off because of broken implementations.
@item
@code{readline} 4.0 �˥��åץ��졼��
@item
������ @code{CREATE TABLE} ���ץ���� @code{PACK_KEYS} �� @code{CHECKSUM}.
@item
@code{mysqld} ���ץ����� @code{--default-table-type} ���ɲá�
@end itemize

@node News-3.22.x, News-3.21.x, News-3.23.x, News
@appendixsec Changes in release 3.22.x

3.22 �Ϥ���᤯���������ʥ����ɤ�������������ο�������ǽ��������ޤ�Ƥ��ޤ���
�������ѹ��� 3.21 �˹Ԥ�ʤ��Τϡ�3.21 �ΰ����٤��ݤĤ���ˤϤȤƤ�¿�����ѹ���ɬ�פȤ���뤫��Ǥ���
�������ѹ��ϥ᥸�㡼�С��������ѹ��ǤϤʤ��Τǡ���ñ�˾㳲��ʤ� 3.22 �˥��åץ��졼�ɤ��Ǥ��ޤ���
@xref{Upgrading-from-3.21}.

3.22 �Ͽ����� @code{DBD-mysql} (1.20xx) �ɥ饤�С��Τߤ򿷤�����³�ץ��ȥ�����Ф��ƻ��Ѥ��ޤ���

@menu
* News-3.22.35::                Changes in release 3.22.35
* News-3.22.34::                Changes in release 3.22.34
* News-3.22.33::                Changes in release 3.22.33
* News-3.22.32::                Changes in release 3.22.32
* News-3.22.31::                Changes in release 3.22.31
* News-3.22.30::                Changes in release 3.22.30
* News-3.22.29::                Changes in release 3.22.29
* News-3.22.28::                Changes in release 3.22.28
* News-3.22.27::                Changes in release 3.22.27
* News-3.22.26::                Changes in release 3.22.26
* News-3.22.25::                Changes in release 3.22.25
* News-3.22.24::                Changes in release 3.22.24
* News-3.22.23::                Changes in release 3.22.23
* News-3.22.22::                Changes in release 3.22.22
* News-3.22.21::                Changes in release 3.22.21
* News-3.22.20::                Changes in release 3.22.20
* News-3.22.19::                Changes in release 3.22.19
* News-3.22.18::                Changes in release 3.22.18
* News-3.22.17::                Changes in release 3.22.17
* News-3.22.16::                Changes in release 3.22.16
* News-3.22.15::                Changes in release 3.22.15
* News-3.22.14::                Changes in release 3.22.14
* News-3.22.13::                Changes in release 3.22.13
* News-3.22.12::                Changes in release 3.22.12
* News-3.22.11::                Changes in release 3.22.11
* News-3.22.10::                Changes in release 3.22.10
* News-3.22.9::                 Changes in release 3.22.9
* News-3.22.8::                 Changes in release 3.22.8
* News-3.22.7::                 Changes in release 3.22.7
* News-3.22.6::                 Changes in release 3.22.6
* News-3.22.5::                 Changes in release 3.22.5
* News-3.22.4::                 Changes in release 3.22.4
* News-3.22.3::                 Changes in release 3.22.3
* News-3.22.2::                 Changes in release 3.22.2
* News-3.22.1::                 Changes in release 3.22.1
* News-3.22.0::                 Changes in release 3.22.0
@end menu

@node News-3.22.35, News-3.22.34, News-3.22.x, News-3.22.x
@appendixsubsec Changes in release 3.22.35
@itemize @bullet
@item
Fixed problem with @code{STD()}.
@item
Merged changes from the newest @code{ISAM} library from 3.23.
@item
Fixed problem with @code{INSERT DELAYED}.
@item
Fixed a bug core dump when using a @code{LEFT JOIN}/@code{STRAIGHT_JOIN}
on a table with only one row.
@end itemize

@node News-3.22.34, News-3.22.33, News-3.22.35, News-3.22.x
@appendixsubsec Changes in release 3.22.34
@itemize @bullet
@item
Fixed problem with @code{GROUP BY} on @code{TINYBLOB} columns;  This
caused bugzilla to not show rows in some queries.
@item
Had to do total recompile of the Windows binary version as VC++ didn't
compile all relevant files for 3.22.33 :(
@end itemize

@node News-3.22.33, News-3.22.32, News-3.22.34, News-3.22.x
@appendixsubsec Changes in release 3.22.33
@itemize @bullet
@item
Fixed problems in windows when locking tables with @code{LOCK TABLE}
@item
Quicker kill of @code{SELECT DISTINCT} queries.
@end itemize

@node News-3.22.32, News-3.22.31, News-3.22.33, News-3.22.x
@appendixsubsec Changes in release 3.22.32
@itemize @bullet
@item
���ͤ� timestamps ����¸����ݤ��������������
@item
Fix problem with timezones that have half hour offsets.
@item
@code{mysqlhotcopy} - ��������� @strong{MySQL} �ǡ����١����򥳥ԡ�����
�ġ���. By Tim Bunce.
@item
@code{mysqlaccess} ���������ʤä�. Thanks to Steve Harvey for this.
@item
Fixed security problem in the protocol regarding password checking.
@item
Fixed problem that affected queries that did arithmetic on @code{GROUP} functions.
@item
Fixed a bug in the @code{ISAM} code when deleting rows on tables with
packed indexes.
@end itemize

@node News-3.22.31, News-3.22.30, News-3.22.32, News-3.22.x
@appendixsubsec Changes in release 3.22.31

@itemize @bullet
@item
Win32 �ǤΤ����Ĥ��ξ����ʥХ�����
@end itemize


@node News-3.22.30, News-3.22.29, News-3.22.31, News-3.22.x
@appendixsubsec Changes in release 3.22.30

@itemize @bullet
@item
Fixed optimizer problem on @code{SELECT} when using many overlapping indexes.
@item
Disabled floating point exceptions for FreeBSD to fix core dump when
doing @code{SELECT floor(pow(2,63))}.
@item
Added print of default arguments options to all clients.
@item
@code{WITH GRANT OPTION} ���ץ�������̿Ū�ʥХ�����.
@item
Fixed non-critical Y2K problem when writing short date to log files.
@end itemize

@node News-3.22.29, News-3.22.28, News-3.22.30, News-3.22.x
@appendixsubsec Changes in release 3.22.29

@itemize @bullet
@item
Upgraded the configure and include files to match the latest 3.23 version.
This should increase portability and make it easier to build shared libraries.
@item
NetBSD �Ѥκǿ��� mit-pthread �Υѥå����ɲá�
@item
�����ॾ���� < GMT - 11 �ξ������������
@item
@code{NISAM} ��Υѥå����줿�����κ�����ΥХ�������
@item
Fixed problem that could cause @strong{MySQL} to touch freed memory when
doing very complicated @code{GROUP BY} queries.
@item
Fixed core dump if you got a crashed table where an @code{ENUM} field value
was too big.
@item
Added @code{mysqlshutdown.exe} and @code{mysqlwatch.exe} to the Windows
distribution.
@item
�������Ф��� @code{ORDER BY} ��Ԥä��Ȥ����������
@item
Fixed that @code{INSERT DELAYED} doesn't update timestamps that are given.

@end itemize

@node News-3.22.28, News-3.22.27, News-3.22.29, News-3.22.x
@appendixsubsec Changes in release 3.22.28

@itemize @bullet
@item
Fixed problem with @code{LEFT JOIN} and @code{COUNT()} on a column which
was declared @code{NULL} + and it had a @code{DEFAULT} value.
@item
@code{CONCAT()} �򤢤� @code{WHERE} ��ǻ��Ѥ����ݤ˥���������פ����������������
@item
Fixed problem with @code{AVG()} and @code{STD()} with @code{NULL} values.
@end itemize

@node News-3.22.27, News-3.22.26, News-3.22.28, News-3.22.x
@appendixsubsec Changes in release 3.22.27

@itemize @bullet
@item
@file{my_ctype.h} ��Ρ�¾�Υ���饯�������åȤΥץ��ȥ����פ�����
@item
configure ��Ρ���ե����륷���ƥ�򸡽Ф�����ʬ�����������
@item
�礭��BLOB�ե�����ɤ򥽡��Ȥ����Ȥ��ΥХ�������
@item
@code{ROUND()} will now work on Win32.
@end itemize

@node News-3.22.26, News-3.22.25, News-3.22.27, News-3.22.x
@appendixsubsec Changes in release 3.22.26

@itemize @bullet
@item
���� @code{BLOB/TEXT} �ե�����ɤ� @code{REVERSE()} �����ݤ˥�������פ����Τ�����
@item
@code{/*! */} �С�������ֹ� ���ĥ����
@item
Changed @code{SUBSTRING(text FROM pos)} to conform to ANSI SQL. (Before this
construct returned the rightmost 'pos' characters).
@item
Fixed problem with @code{LOCK TABLES} combined with @code{DELETE FROM table}
@item
@code{INSERT ... SELECT} �� @code{SQL_BIG_TABLES} ����Ѥ��Ƥ��ʤ��ä��Τ�����
@item
@code{SET SQL_LOW_PRIORITY_UPDATES=#} ��ư���Ƥʤ��ä���
@item
���Ĥ� @code{GRANT ... IDENTIFIED BY} ���ѹ����Ƥ�ľ�˥ѥ���ɤ�
ȿ�Ǥ���ʤ��ä��Τ�����
@item
�ʲ��κ�Ŭ���ΥХ������� 
@code{SELECT * FROM table_name WHERE key_part1 >= const AND (key_part2 = const OR key_part2 = const)}
@item
Fixed bug in compression key handling in ISAM.
@end itemize

@node News-3.22.25, News-3.22.24, News-3.22.26, News-3.22.x
@appendixsubsec Changes in release 3.22.25

@itemize @bullet
@item
���󥹥ȡ�����ξ��������������
@end itemize

@node News-3.22.24, News-3.22.23, News-3.22.25, News-3.22.x
@appendixsubsec Changes in release 3.22.24

@itemize @bullet
@item
@code{DATA} ��ͽ���Ǥʤ��ʤä���
@item
���ä����쥳���ɤ����ʤ��ơ��֥�κ�Ŭ���ΥХ�������
@item
@code{LOCK TABLES table_name READ; FLUSH TABLES;} ����Ѥ����ݤΥХ�������
@item
HP-UX �Υѥå���Ŭ�ѡ�
@item
@code{isamchk} �� Win32 ���ư���褦�ˤʤä���
@item
Changed @file{configure} to not use big file handling on Linux as this
crashes some RedHat 6.0 systems
@end itemize

@node News-3.22.23, News-3.22.22, News-3.22.24, News-3.22.x
@appendixsubsec Changes in release 3.22.23

@itemize @bullet
@item
Autoconf 2.13, Automake 1.4, @code{libtool} 1.3.2 ����Ѥ���褦�˥��åץ��졼�ɡ�
@item
Better support for SCO in @code{configure}.
@item
Added option @code{--defaults-file=###} to option file handling to force use
of only one specific option file.
@item
@code{MySQL} 3.23 �Υ�����ɤ�̵�뤹��褦��
@code{CREATE} ��ʸ���ĥ������
@item
@code{LOCK TABLES} �ǥ��å�����Ƥ���ơ��֥�� @code{INSERT DELAYED} ��
���Ѥ����ݤΡ��ǥåɥ��å������������
@item
¾�Υ���åɤ˥��å�����Ƥ���ơ��֥�� @code{DROP TABLE} ����Ѥ����ݤ�
���������
@item
@code{GRANT/REVOKE} ���ޥ�ɤ� update log ���ɲá�
@item
���������顼���ܤ򸡽Ф���褦�� @code{isamchk} ������
@item
@code{NATURAL LEFT JOIN} �ΥХ�������
@end itemize

@node News-3.22.22, News-3.22.21, News-3.22.23, News-3.22.x
@appendixsubsec Changes in release 3.22.22

@itemize @bullet
@item
@code{mysql_init()} �θ��ľ�� @code{mysql_close()} ���ɤ���Ȥ������������
(C API)
@item
Better client error message when you can't open socket.
@item
������delayed_insert ����åɤ������Ǥ��ʤ��ä��Ȥ���
 @code{delayed_insert_thread} ����ɽ��������
@item
 @code{CONCAT()} �ΰ�����¿���������ΥХ�������
@item
DEC 3.2 �� SCO �Υѥå����ɲá�
@item
NT �Υ����ӥ��Ȥ��� @strong{MySQL} �򥤥󥹥ȡ��뤷���ݤ�
�ѥ������������
@item
@strong{MySQL}-Win32 �� VC++ 6.0 �ǥ���ѥ��뤵���褦�ˤʤä���
(VC++ 5.0 ������)
@item
@strong{MySQL}-Win32 �ο��������󥹥ȡ��顼
@end itemize

@node News-3.22.21, News-3.22.20, News-3.22.22, News-3.22.x
@appendixsubsec Changes in release 3.22.21

@itemize @bullet
@item
�ơ��֥뤬¾�Υ���åɤ˥��å����줿�Ȥ��Ρ�@code{DELETE FROM TABLE} ��
���������
@item
Fixed bug in @code{LEFT JOIN} involving empty tables.
@item
@code{mysql.db} �ե�����ɤ� @code{char(32)} ���� @code{char(60)} ���ѹ���
@item
@code{MODIFY} �� @code{DELAYED} ��ͽ���Ǥʤ��ʤä���
@item
 @code{TIME} �ե�����ɤ����ˤ�������褦�Ȥ����Ȥ��ΥХ�������
@item
@code{GRANT} ���ޥ�ɤǿ����� @strong{MySQL} �桼��������Ͽ�������
@code{Host '..' is not allowed to connect to this MySQL server} �Ȥʤ����������
@item
Linux ��� @code{TCP_NODELAY} ����Ѥ���褦���ѹ��� (����� TCP/IP ��³��®�����ޤ�)
@end itemize

@node News-3.22.20, News-3.22.19, News-3.22.21, News-3.22.x
@appendixsubsec Changes in release 3.22.20

@itemize @bullet
@item
Fixed @code{STD()} for big tables when result should be 0.
@item
�����Ĥ���OS ��update log �����Ԥ�����Ƥ��ʤ��ä��Τ�����
@item
@code{INSERT DELAYED} had some garbage at end in the update log.
@end itemize

@node News-3.22.19, News-3.22.18, News-3.22.20, News-3.22.x
@appendixsubsec Changes in release 3.22.19

@itemize @bullet
@item
@code{mysql_install_db} �ΥХ������� (from 3.22.17).
@item
�ǥե���ȤΥ�������å���� 8M ���ѹ���
@item
@code{BLOB} �ե�����ɤǰ���ơ��֥뤬ɬ�פȤ���륯��������������
@end itemize

@node News-3.22.18, News-3.22.17, News-3.22.19, News-3.22.x
@appendixsubsec Changes in release 3.22.18

@itemize @bullet
@item
Linux��ǡ�3.22.17����̿Ū������ν����� @code{shutdown} �塢���Ƥ�
����åɤ��μ¤˻�ʤʤ��ä���
@item
@code{-O flush-time=#} ���ץ����� @code{mysqld} ���ɲá� This is mostly
useful on Win32 and tells how often @strong{MySQL} should close all
unused tables and flush all updated tables to disk.
@item
@code{VARCHAR} �ե�����ɤ�  @code{CHAR} ����Ӥ����ݤ˥��������Ū��
���Ѥ��Ƥ��ʤ��ä��Τ�����
@end itemize

@node News-3.22.17, News-3.22.16, News-3.22.18, News-3.22.x
@appendixsubsec Changes in release 3.22.17

@itemize @bullet
@item
@code{--log-update} ����Ѥ����Ȥ��ȥǥե���ȤΥǡ����١�������ꤷ�ʤ���
��³�����Ȥ��Υ�������פ���������
@item
�����Ĥ��� @code{configure} �Ȱܿ������������������
@item
Using @code{LEFT JOIN} on tables that had circular dependencies caused
@code{mysqld} to hang forever.
@end itemize

@node News-3.22.16, News-3.22.15, News-3.22.17, News-3.22.x
@appendixsubsec Changes in release 3.22.16

@itemize @bullet
@item
@code{mysqladmin processlist} could kill the server if a new user logged in.
@item
@code{DELETE FROM table_name WHERE key_column=column_name} ��
�ޥå�����Ԥ�1�Ԥ⸫�Ĥ���ʤ��Τ���
@item
@code{DATE_ADD(column,...)} ��ư���ʤ��Τ���
@item
@code{INSERT DELAYED} could deadlock with status 'upgrading lock'
@item
2ʸ���ʾ�Υ���Ȥ����ѤǤ���褦�ˡ�@code{ENCRYPT()} ���ĥ��
@item
@code{longlong2str} �ϰ�����꤫�ʤ�®���ʤä���@code{Intel x86} �Ѥ�
���Υ����ɤϺ�Ŭ�����줿������֥�ǽ�ľ����
@item
@code{ALTER TABLE} �� @code{MODIFY} ������ɤ��ɲ�
@end itemize

@node News-3.22.15, News-3.22.14, News-3.22.16, News-3.22.x
@appendixsubsec Changes in release 3.22.15

@itemize @bullet
@item
@code{GRANT} �� @code{IDENTIFIED BY} �ȶ��˻��Ѥ����ݡ����¾��󤬥ե�å��夵���ޤ�
ͭ���ˤʤ�ʤ�
@item
Name change of some variables in @code{SHOW STATUS}.
@item
Fixed problem with @code{ORDER BY} with 'only index' optimization when there
were multiple key definitions for a used column.
@item
@code{DATE} and @code{DATETIME} columns are now up to 5 times faster than
before.
@item
@code{INSERT DELAYED} can be used to let the client do other things while the
server inserts rows into a table.
@item
�⤷2�Ĥΰ㤦�ǡ����١����Υơ��֥����Ѥ�����硢
@code{LEFT JOIN USING (col1,col2)} ��ư��ʤ��ä�
@item
@code{LOAD DATA LOCAL INFILE} ���ե����뤬�ʤ��������ͳ�� UNIX �Ǥ�ư��ʤ��ä�
@item
�ȤƤ�û����(<4�Х���)�����ʤ� @code{VARCHAR}/@code{BLOB} �Ǥ�����ν�����
error 127 �����ιԤ�õ����˵������ǽ�������ä�
@item
Updating @code{BLOB/TEXT} through formulas didn't work for short (< 256 char)
strings.
@item
�������ۥ��Ⱦ�� @code{GRANT} ��¹Ԥ�����硢���Υۥ��Ȥ���κǽ�Υ��ͥ�������
@code{mysqld} ����̲�ǽ�������ä�
@item
�����ꥢ��̾��Ʊ������̾�� @code{ORDER BY} �ǻ��Ѥ�����ΥХ�����
name as an alias.
@item
Added @code{BENCHMARK(loop_count,expression)} function to time expressions.
@end itemize

@node News-3.22.14, News-3.22.13, News-3.22.15, News-3.22.x
@appendixsubsec Changes in release 3.22.14

@itemize @bullet
@item
�����륹����ץȤ���ε�ư�Τ���ˡ�@code{mysqld} �ΰ������ʤ�������Ĥ�����
@item
Setting a @code{TIMESTAMP} column to @code{NULL} didn't record the timestamp
value in the update log.
@item
Fixed lock handler bug when one did
@code{INSERT INTO TABLE ... SELECT ... GROUP BY}.
@item
Added a patch for @code{localtime_r()} on Win32 so that it will not crash
anymore if your date is > 2039, but instead will return a time of all zero.
@item
Names for
user-defined functions are no longer case sensitive.
@item
Added escape of @code{^Z} (ASCII 26) to @code{\Z} as @code{^Z} doesn't
work with pipes on Win32.
@item
����� @strong{MySQL} ��꡼���Τ���ˡ�@code{mysql_fix_privileges} �ϡ�
UDF �Υ��ݡ��ȤΤ���ˡ����������ܤ� @code{mysql.func} ���ɲä��롣
( type enum ('function','aggregate') NOT NULL ���ɲä��줿 )
@end itemize

@node News-3.22.13, News-3.22.12, News-3.22.14, News-3.22.x
@appendixsubsec Changes in release 3.22.13

@itemize @bullet
@item
Saving @code{NOW()}, @code{CURDATE()} or @code{CURTIME()} directly in a
column didn't work.
@item
@code{WHERE} �᤬̵����硢@code{SELECT COUNT(*) ... LEFT JOIN ...} ��ư���ʤ��ä�
@item
UnixWare 7.0.x �� @strong{MySQL} �򥳥�ե����Ǥ���褦�� @file{config.guess} �򹹿�
UnixWare 7.0.x.
@item
Changed the implementation of @code{pthread_cond()} on the Win32 version.
@code{get_lock()} now correctly times out on Win32!
@end itemize

@node News-3.22.12, News-3.22.11, News-3.22.13, News-3.22.x
@appendixsubsec Changes in release 3.22.12

@itemize @bullet
@item
@code{WHERE} ��� @code{DATE_ADD()} �� @code{DATE_SUB()} ����Ѥ����ݤ��������
@item
@code{GRANT ... TO user IDENTIFIED BY 'password'} ��ʸ�ǥѥ���ɤ򥻥åȤǤ���褦�ˤ���
@item
¿���Υơ��֥�� @code{SELECT} ���� @code{GRANT} ���ǧ����ݤΥХ�����
@item
RPM ���ۤǤ� @code{mysql_fix_privilege_tables} �ե�������ɲá�
����ϥ��饤����ȥѥå������˴ޤ�����ᡢ�ǥե���ȤǤϵ�ư����ʤ���
@item
@code{SQL_SMALL_RESULT} ���ץ����� @code{SELECT} ���ɲá�
����϶���Ū��®������ơ��֥����Ѥ��롣
��̤��������Ȥ狼�äƤ�����˻��Ѥ����ͭ����
@item
��������Ĥ��ʤ��Ƥ�¿������ѤǤ���褦�ˤ���
@item
@code{DATE_ADD}/@code{DATE_SUB()} �η�̡���ʬ�������������ʤ���硢
�������κ������ˤ���褦�ˤ�����
@item
@code{GRANT} �������򥱡������¸����Ӥ��Ƥ����Τ���
@item
���빽ʸ���Ȥ߹�碌�� @code{ALTER TABLE} �� core ��Ϥ��Х���
 @file{sql_list.h} �ˤ��ä��ΤǤ������
@item
The hostname in @code{user@@hostname} can now include @samp{.} and @samp{-}
without quotes in the context of the @code{GRANT}, @code{REVOKE} and
@code{SET PASSWORD FOR ...} statements.
@item
�礭�ʰ���ե������ɬ�פȤ���ơ��֥�ؤ� @code{isamchk} ����
@end itemize

@node News-3.22.11, News-3.22.10, News-3.22.12, News-3.22.x
@appendixsubsec Changes in release 3.22.11

@itemize @bullet
@item
@strong{����}: 3.22.11�˥��åץ��졼�ɤ����硢ɬ�� @code{mysql_fix_privilege_tables} ������ץȤ�¹Ԥ��ʤ��ƤϤʤ�ޤ���
����Ͽ����� @code{GRANT} �����ƥ�Τ���˼¹Ԥ��ޤ���
�⤷�����Ԥ�ʤ���С�@code{ALTER TABLE} �� @code{CREATE INDEX}, @code{DROP INDEX} ��
�¹Ԥ��褦�Ȥ���� @code{Access denied} �ˤʤ�ޤ���
@item
�ơ��֥롢����ऴ�Ȥ˥桼�����Υ����������Ф��Ƶ��Ĥ���ݤ�����Ǥ��ޤ�
@item
@code{USER()} �� @code{user@@host} ���֤��褦���ѹ�
@item
¾�Υ桼������ @code{PASSWORD} �򥻥åȤ��빽ʸ���ѹ�
@item
�����ޥ�ɡ�@code{FLUSH STATUS} �ϤۤȤ�ɤΥ��ơ������ѿ��򥼥��˥��åȤ��ޤ�
@item
�����ơ������ѿ��� @code{aborted_threads}, @code{aborted_connects}.
@item
�����ץ���� @code{connection_timeout}
@item
�����ȤΥ��ݡ��� (by Pruet Boonma
@email{pruet@@ds90.intanon.nectec.or.th}).
@item
�����Х���������ܸ�Υ��顼��å�����
@item
Configuration and portability fixes.
@item
Added option @code{SET SQL_WARNINGS=1} to get a warning count also for simple
inserts.
@item
FreeBSD ��ǥ���åȥ����󤹤뤿��ˡ�@code{SIGQUIT} �Τ����� @code{SIGTERM} ����Ѥ��ޤ�
@item
@code{mysql} �� ���ץ���� @code{\G} (print vertically) �ɲ�
@item
@code{SELECT HIGH_PRIORITY} ... killed @code{mysqld}.
@item
@code{IS NULL} on a @code{AUTO_INCREMENT} column in a @code{LEFT JOIN} didn't
work as expected.
@item
New function @code{MAKE_SET()}.
@end itemize

@node News-3.22.10, News-3.22.9, News-3.22.11, News-3.22.x
@appendixsubsec Changes in release 3.22.10

@itemize @bullet
@item
mysql_install_db �� @strong{MySQL} �����С���ư���ʤ��ʤ�ޤ���!
mysql_install_db ��Ԥä���ˡ�@code{safe_mysqld} �� mysqld �򳫻Ϥ�����ɬ�פ�����ޤ���
������ @strong{MySQL} �� RPM �ѥå������ϥ����С��򤿤�������褦�ˤ��Ƥ��ޤ���
@item
@code{--bootstrap} �� @code{mysqld} ���ɲá�@code{mysql_install_db} �Ϥ������Ѥ��ޤ���
���ΰ����� RPM �ѥå�������  @strong{MySQL} �Υ��󥹥ȡ�����ά�����ޤ���
@item
@code{+, - (sign and minus), *, /, %, ABS() and MOD()} �Υ����ɤ�����
@code{BIGINT}�ǻ��Ѥ������δ���������򤷤ޤ���(64 bit safe).
@item
@code{ALTER TABLE} �� mysqld �򥯥�å��夵����Х�������
@item
��ʣ����������̤�������硢@strong{MySQL}�Ͼ�ˤ��λݤ���𤹤�褦�ˤʤ�ޤ�����
(�����ΥС������Ǥϡ�@code{INSERT} �λ��ˤ�����å��������Фޤ���Ǥ���)
@item
New syntax: @code{INSERT INTO table_name SET column=value,column=value,...}
@item
@file{.err} �����ե�����Υ�����Ͽ�ˡ�time stamp ��Ĥ���褦�ˤ��ޤ�����
@item
@code{MYSQL_INIT_COMMAND} ���ץ����� @code{mysql_options()} ���ɲá�
(��³�׵᤹����˻��ѤǤ���)
@item
@code{MYSQL_READ_DEFAULT_FILE} �� @code{MYSQL_READ_DEFAULT_GROUP} ��
 @code{mysql_options()}���ɲá�
@strong{MySQL} ���ץ����ե����뤫��ʲ��Υѥ�᡼�������ɤ߼�롧
@code{port},
@code{socket}, @code{compress}, @code{password}, @code{pipe}, @code{timeout},
@code{user}, @code{init-command}, @code{host} and @code{database}
 (����)���ץ����ե�����Υǥե���Ȥ� /etc/my.cnf , install_directory/share/mysql/my.cnf
@item
UDF ��ʸ�� @code{maybe_null} ���ɲ�
@item
Added option @code{IGNORE} to @code{INSERT} statemants with many rows.
@item
koi8 ����饯�����򥽡��Ȥ���������������
koi8����Ѥ��Ƥ���桼�����ϡ�@code{CHAR} �� @code{VARCHAR} ������
����ǥå����ˤ��Ƥ���ơ��֥���Ф��ơ�@strong{ɬ��} @code{isamchk -rq} ��¹Ԥ��뤳�ȡ�
@item
����������ץ� @code{mysql_setpermission} (Luuk de Boer ��)
����ϻ��ꤵ�줿�ǡ����١������Ф��ƥ�����������Ĥ���桼������
��ñ����Ͽ���Ƥ���ޤ���
@item
Allow use of hexadecimal strings (0x...) when specifying a constant string
(like in the column separators with @code{LOAD DATA INFILE}).
@item
OS/2 �˰ܿ� (thanks to Antony T. Curtis @email{antony.curtis@@olcs.net}).
@item
@code{SHOW STATUS} �Ǥ��ѿ������䤷�ޤ������ޤ���@code{SHOW VARIABLES} ��
�褦�ʽ��ϥե����ޥåȤ��ѹ����ޤ�����
@item
@code{extended-status} ���ޥ�ɤ� @code{mysqladmin} ���ɲá�
����Ͽ��������ƥ������ѿ���ɽ�����ޤ�
@end itemize

@node News-3.22.9, News-3.22.8, News-3.22.10, News-3.22.x
@appendixsubsec Changes in release 3.22.9

@itemize @bullet
@item
@code{SET SQL_LOG_UPDATE=0} caused a lockup of the server.
@item
New SQL command:  @code{FLUSH [ TABLES | HOSTS | LOGS | PRIVILEGES ] [, ...]}
@item
New SQL command:  @code{KILL} @code{thread_id} .
@item
AIX, DEC OSF1 4.x �� @strong{MySQL} ���ñ�˥���ѥ���Ǥ���褦��
include �ե�������ѹ���
@item
@code{ALTER TABLE} ����Ѥ��� @code{INT} ���饵�����ξ����� @code{CHAR()} ��
�ѹ�������ˤ����Ƥ����Զ�������
@item
@code{SELECT HIGH_PRIORITY} �ɲá�
@code{SELECT} �ˤ����ơ����Ȥ�¾�� @code{SELECT} ���ԤäƤ��륹��åɤ����ä��Ȥ��Ƥ⡢
@code{WRITE LOCK} ���뤳�Ȥ��Ǥ��ޤ���
@item
Moved wild_compare to string class to be able to use @code{LIKE} on
@code{BLOB}/@code{TEXT} columns with \0.
@item
Added @code{ESCAPE} option to @code{LIKE}
@item
@code{mysqladmin debug} �ˤ����ơ����¿���ν��Ϥ�������褦�ˤ�����
@item
Win32 �ˤ����ơ�@code{--flush} ���ץ�����Ĥ��� @code{mysqld} ��ư�Ǥ���褦�ˤʤ�ޤ�����
����ϥ��åץǡ��Ȥ�����ä���Ǥ��٤ƤΥơ��֥��ǥ������˥ե�å��夷�ޤ���
���Υ��ץ����ˤ�� NT/Win98 ��Ǥ�����������ư�������Ȥ��Ǥ��ޤ�����
@strong{�ȤƤ�} �٤��ʤ�ޤ���
@end itemize

@node News-3.22.8, News-3.22.7, News-3.22.9, News-3.22.x
@appendixsubsec Changes in release 3.22.8

@itemize @bullet
@item
Czech character sets should now work much better.  You must also install
@uref{ftp://www.mysql.com/pub/mysql/Downloads/Patches/czech-3.22.8-patch}.
This patch should also be installed if you are using a character set with
uses @code{my_strcoll()}!  The patch should always be safe to install (for any system),
but as this patch changes ISAM internals it's not yet in the default
distribution.
@item
@code{DATE_ADD()} and @code{DATE_SUB()} didn't work with group functions.
@item
@code{mysql} will now also try to reconnect on @code{USE DATABASE} commands.
@item
Fix problem with @code{ORDER BY} and @code{LEFT JOIN} and @code{const} tables.
@item
Fixed problem with @code{ORDER BY} if the first @code{ORDER BY} column
was a key and the rest of the @code{ORDER BY} columns wasn't part of the key.
@item
Fixed a big problem with @code{OPTIMIZE TABLE}.
@item
@strong{MySQL} clients on NT will now by default first try to connect with
named pipes and after this with TCP/IP.
@item
Fixed a problem with @code{DROP TABLE} and @code{mysqladmin shutdown} on Win32
(a fatal bug from 3.22.6).
@item
Fixed problems with @code{TIME columns} and negative strings.
@item
Added an extra thread signal loop on shutdown to avoid some error messages
from the client.
@item
@strong{MySQL} now uses the next available number as extension for the update
log file.
@item
Added patches for UNIXWARE 7.
@end itemize

@node News-3.22.7, News-3.22.6, News-3.22.8, News-3.22.x
@appendixsubsec Changes in release 3.22.7

@itemize @bullet
@item
Added @code{LIMIT} clause for the @code{DELETE} statement.
@item
You can now use the @code{/*! ... */} syntax to hide @strong{MySQL}-specific
keywords when you write portable code.  @strong{MySQL} will parse the code
inside the comments as if the surrounding @code{/*!} and @code{*/} comment
characters didn't exist.
@item
@code{OPTIMIZE TABLE tbl_name} can now be used to reclaim disk space
after many deletes.  Currently, this uses @code{ALTER TABLE} to re-generate
the table, but in the future it will use an integrated @code{isamchk}
for more speed.
@item
Upgraded @code{libtool} to get the configure more portable.
@item
Fixed slow @code{UPDATE} and @code{DELETE} operations when using
@code{DATETIME} or @code{DATE} keys.
@item
Changed optimizer to make it better at deciding when to do a full join
and when using keys.
@item
You can now use @code{mysqladmin proc} to display information about your own
threads. Only users with the @strong{Process_priv} privilege can get
information about all threads.
@item
Added handling of formats @code{YYMMDD}, @code{YYYYMMDD},
@code{YYMMDDHHMMSS} for numbers when using @code{DATETIME} and
@code{TIMESTAMP} types. (Formerly these formats only worked with strings.)
@item
Added connect option @code{CLIENT_IGNORE_SPACE} to allow use of spaces
after function names and before @samp{(} (Powerbuilder requires this).
This will make all function names reserved words.
@item
Added the @code{--log-long-format} option to @code{mysqld} to enable timestamps
and INSERT_ID's in the update log.
@item
Added @code{--where} option to @code{mysqldump} (patch by Jim Faucette).
@item
The lexical analyzer now uses ``perfect hashing'' for faster parsing of SQL
statements.
@end itemize

@node News-3.22.6, News-3.22.5, News-3.22.7, News-3.22.x
@appendixsubsec Changes in release 3.22.6

@itemize @bullet
@item
Faster @code{mysqldump}.
@item
For the @code{LOAD DATA INFILE} statement, you can now use the new @code{LOCAL}
keyword to read the file from the client.  @code{mysqlimport} will
automatically use @code{LOCAL} when importing with the TCP/IP protocol.
@item
Fixed small optimize problem when updating keys.
@item
Changed makefiles to support shared libraries.
@item
@strong{MySQL}-NT can now use named pipes, which means that you can now use
@strong{MySQL}-NT without having to install TCP/IP.
@end itemize

@node News-3.22.5, News-3.22.4, News-3.22.6, News-3.22.x
@appendixsubsec Changes in release 3.22.5

@itemize @bullet
@item
All table lock handing is changed to avoid some very subtle
deadlocks when using @code{DROP TABLE}, @code{ALTER TABLE}, @code{DELETE FROM
TABLE} and @code{mysqladmin flush-tables} under heavy usage.
Changed locking code to get better handling of locks of different types.
@item
Updated @code{DBI} to 1.00 and @code{DBD} to 1.2.0.
@item
Added a check that the error message file contains error messages suitable for
the current version of @code{mysqld}. (To avoid errors if you accidentally
try to use an old error message file.)
@item
All count structures in the client (@code{affected_rows()},
@code{insert_id()},...) are now of type @code{BIGINT} to allow 64-bit values
to be used.
This required a minor change in the @strong{MySQL} protocol which should affect
only old clients when using tables with @code{AUTO_INCREMENT} values > 24M.
@item
The return type of @code{mysql_fetch_lengths()} has changed from @code{uint *}
to @code{ulong *}. This may give a warning for old clients but should work
on most machines.
@item
Change @code{mysys} and @code{dbug} libraries to allocate all thread variables
in one struct.  This makes it easier to make a threaded @file{libmysql.dll}
library.
@item
Use the result from @code{gethostname()} (instead of @code{uname()}) when
constructing @file{.pid} file names.
@item
New better compressed server/client protocol.
@item
@code{COUNT()}, @code{STD()} and @code{AVG()} are extended to handle more than
4G rows.
@item
You can now store values in the range @code{-838:59:59} <= x <=
@code{838:59:59} in a @code{TIME} column.
@item
@strong{WARNING: INCOMPATIBLE CHANGE!!}
If you set a @code{TIME} column to too short a value, @strong{MySQL} now
assumes the value is given as: @code{[[[D ]HH:]MM:]SS} instead of
@code{HH[:MM[:SS]]}.
@item
@code{TIME_TO_SEC()} and @code{SEC_TO_TIME()} can now handle negative times
and hours up to 32767.
@item
Added new option
@code{SET OPTION SQL_LOG_UPDATE=@{0|1@}} to allow users with
the @strong{process} privilege to bypass the update log.
(Modified patch from Sergey A Mukhin @email{violet@@rosnet.net}.)
@item
Fixed fatal bug in @code{LPAD()}.
@item
Initialize line buffer in @file{mysql.cc} to make @code{BLOB} reading from
pipes safer.
@item
Added @code{-O max_connect_errors=#} option to @code{mysqld}.
Connect errors are now reset for each correct connection.
@item
Increased the default value of @code{max_allowed_packet} to @code{1M} in
@code{mysqld}.
@item
Added @code{--low-priority-updates} option to @code{mysqld}, to give
table-modifying operations (@code{INSERT}, @code{REPLACE}, @code{UPDATE},
@code{DELETE}) lower priority than retrievals.  You can now use
@code{@{INSERT | REPLACE | UPDATE | DELETE@} LOW_PRIORITY ...} You can
also use @code{SET OPTION SQL_LOW_PRIORITY_UPDATES=@{0|1@}} to change
the priority for one thread.  One side effect is that @code{LOW_PRIORITY}
is now a reserved word. :(
@item
Add support for @code{INSERT INTO table ... VALUES(...),(...),(...)},
to allow inserting multiple rows with a single statement.
@item
@code{INSERT INTO tbl_name} is now also cached when used with @code{LOCK TABLES}.
(Previously only @code{INSERT ... SELECT} and @code{LOAD DATA INFILE} were
cached.)
@item
Allow @code{GROUP BY} functions with @code{HAVING}:
@example
mysql> SELECT col FROM table GROUP BY col HAVING COUNT(*)>0;
@end example
@item
@code{mysqld} will now ignore trailing @samp{;} characters in queries. This
is to make it easier to migrate from some other SQL servers that require the
trailing @samp{;}.
@item
Fix for corrupted fixed-format output generated by @code{SELECT INTO OUTFILE}.
@item
@strong{WARNING: INCOMPATIBLE CHANGE!!}
Added Oracle @code{GREATEST()} and @code{LEAST()} functions.  You must now use
these instead of the @code{MAX()} and @code{MIN()} functions to get the
largest/smallest value from a list of values. These can now handle @code{REAL},
@code{BIGINT} and string (@code{CHAR} or @code{VARCHAR}) values.
@item
@strong{WARNING: INCOMPATIBLE CHANGE!!}
@code{DAYOFWEEK()} had offset 0 for Sunday. Changed the offset to 1.
@item
Give an error for queries that mix @code{GROUP BY} columns and fields when
there is no @code{GROUP BY} specification.
@item
Added @code{--vertical} option to @code{mysql}, for printing results in
vertical mode.
@item
Index-only optimization; some queries are now resolved using
only indexes.  Until @strong{MySQL} 4.0, this works only for numeric columns.
@xref{MySQL indexes, , @strong{MySQL} indexes}.
@item
Lots of new benchmarks.
@item
A new C API chapter and lots of other improvements in the manual.
@end itemize

@node News-3.22.4, News-3.22.3, News-3.22.5, News-3.22.x
@appendixsubsec Changes in release 3.22.4

@itemize @bullet
@item
Added @code{--tmpdir} option to @code{mysqld}, for specifying the location
of the temporary file directory.
@item
@strong{MySQL} now automatically changes a query from an ODBC client:
@example
SELECT ... FROM table WHERE auto_increment_column IS NULL
@end example
to:
@example
SELECT ... FROM table WHERE auto_increment_column == LAST_INSERT_ID()
@end example
This allows some ODBC programs (Delphi, Access) to retrieve the newly
inserted row to fetch the @code{AUTO_INCREMENT} id.
@item
@code{DROP TABLE} now waits for all users to free a table before deleting it.
@item
Fixed small memory leak in the new connect protocol.
@item
New functions @code{BIN()}, @code{OCT()}, @code{HEX()} and @code{CONV()} for
converting between different number bases.
@item
Added function @code{SUBSTRING()} with 2 arguments.
@item
If you created a table with a record length smaller than 5, you couldn't
delete rows from the table.
@item
Added optimization to remove const reference tables from @code{ORDER BY} and
@code{GROUP BY}.
@item
@code{mysqld} now automatically disables system locking on Linux and Win32,
and for systems that use MIT-pthreads.  You can force the use of locking
with the @code{--enable-locking} option.
@item
Added @code{--console} option to @code{mysqld}, to force a console window
(for error messages) when using Win32.
@item
Fixed table locks for Win32.
@item
Allow @samp{$} in identifiers.
@item
Changed name of user-specific configuration file from @file{my.cnf} to
@file{.my.cnf} (Unix only).
@item
Added @code{DATE_ADD()} and @code{DATE_SUB()} functions.
@end itemize

@node News-3.22.3, News-3.22.2, News-3.22.4, News-3.22.x
@appendixsubsec Changes in release 3.22.3

@itemize @bullet
@item
Fixed a lock problem (bug in @strong{MySQL} 3.22.1) when closing temporary tables.
@item
Added missing @code{mysql_ping()} to the client library.
@item
Added @code{--compress} option to all @strong{MySQL} clients.
@item
Changed @code{byte} to @code{char} in @file{mysql.h} and @file{mysql_com.h}.
@end itemize

@node News-3.22.2, News-3.22.1, News-3.22.3, News-3.22.x
@appendixsubsec Changes in release 3.22.2

@itemize @bullet
@item
Searching on multiple constant keys that matched more than 30% of the rows
didn't always use the best possible key.
@item
New functions @code{<<}, @code{>>}, @code{RPAD()} and @code{LPAD()}.
@item
You can now save default options (like passwords) in a configuration file
(@file{my.cnf}).
@item
Lots of small changes to get @code{ORDER BY} to work when no records are found
when using fields that are not in @code{GROUP BY} (@strong{MySQL} extension).
@item
Added @code{--chroot} option to @code{mysqld}, to start @code{mysqld} in
a chroot environment (by Nikki Chumakov @email{nikkic@@cityline.ru}).
@item
Trailing spaces are now ignored when comparing case-sensitive strings;
this should fix some problems with ODBC and flag 512!
@item
Fixed a core-dump bug in the range optimizer.
@item
Added @code{--one-thread} option to @code{mysqld}, for debugging with
LinuxThreads (or @code{glibc}).  (This replaces the @code{-T32} flag)
@item
Added @code{DROP TABLE IF EXISTS} to prevent an error from occurring if the
table doesn't exist.
@item
@code{IF} and @code{EXISTS} are now reserved words (they would have to
be sooner or later).
@item
Added lots of new options to @code{mysqldump}.
@item
Server error messages are now in @file{mysqld_error.h}.
@item
The server/client protocol now supports compression.
@item
All bug fixes from @strong{MySQL} 3.21.32.
@end itemize

@node News-3.22.1, News-3.22.0, News-3.22.2, News-3.22.x
@appendixsubsec Changes in release 3.22.1

@itemize @bullet
@item
Added new C API function @code{mysql_ping()}.
@item
Added new API functions @code{mysql_init()} and @code{mysql_options()}.
You now MUST call @code{mysql_init()} before you call
@code{mysql_real_connect()}.
You don't have to call @code{mysql_init()} if you only use
@code{mysql_connect()}.
@item
Added @code{mysql_options(...,MYSQL_OPT_CONNECT_TIMEOUT,...)} so you can set a
timeout for connecting to a server.
@item
Added @code{--timeout} option to @code{mysqladmin}, as a test of
@code{mysql_options()}.
@item
Added @code{AFTER column} and @code{FIRST} options to
@code{ALTER TABLE ... ADD columns}.
This makes it possible to add a new column at some specific location
within a row in an existing table.
@item
@code{WEEK()} now takes an optional argument to allow handling of weeks when
the week starts on Monday (some European countries).  By default,
@code{WEEK()} assumes the week starts on Sunday.
@item
@code{TIME} columns weren't stored properly (bug in @strong{MySQL} 3.22.0).
@item
@code{UPDATE} now returns information about how many rows were
matched and updated, and how many ``warnings'' occurred when doing the update.
@item
Fixed incorrect result from @code{FORMAT(-100,2)}.
@item
@code{ENUM} and @code{SET} columns were compared in binary (case-sensitive)
fashion; changed to be case insensitive.
@end itemize

@node News-3.22.0,  , News-3.22.1, News-3.22.x
@appendixsubsec Changes in release 3.22.0

@itemize @bullet
@item
New (backward compatible) connect protocol that allows you to
specify the database to use when connecting, to get much faster
connections to a specific database.

The @code{mysql_real_connect()} call is changed to:

@example
mysql_real_connect(MYSQL *mysql, const char *host, const char *user,
                   const char *passwd, const char *db, uint port,
                   const char *unix_socket, uint client_flag)
@end example
@item
Each connection is handled by its own thread, rather than by the
master @code{accept()} thread.  This fixes permanently the telnet bug
that was a topic on the mail list some time ago.
@item
All TCP/IP connections are now checked with backward resolution of
the hostname to get better security. @code{mysqld} now has a local hostname
resolver cache so connections should actually be faster than before,
even with this feature.
@item
A site automatically will be blocked from future connections if someone
repeatedly connects with an ``improper header'' (like when one uses telnet).
@item
You can now refer to tables in different databases with references of the form
@code{tbl_name@@db_name} or @code{db_name.tbl_name}.  This makes it possible to
give a user read access to some tables and write access to others simply by
keeping them in different databases!
@item
Added @code{--user} option to @code{mysqld}, to allow it to run
as another Unix user (if it is started as the Unix @code{root} user).
@item
Added caching of users and access rights (for faster access rights checking)
@item
Normal users (not anonymous ones) can change their password with
@code{mysqladmin password 'new_password'}.  This uses encrypted passwords
that are not logged in the normal @strong{MySQL} log!
@item
All important string functions are now coded in assembler for x86 Linux
machines.  This gives a speedup of 10% in many cases.
@item
For tables that have many columns, the column names are now hashed for
much faster column name lookup (this will speed up some benchmark
tests a lot!)
@item
Some benchmarks are changed to get better individual timing.
(Some loops were so short that a specific test took < 2 seconds. The
loops have been changed to take about 20 seconds to make it easier
to compare different databases. A test that took 1-2 seconds before
now takes 11-24 seconds, which is much better)
@item
Re-arranged @code{SELECT} code to handle some very specific queries
involving group functions (like @code{COUNT(*)}) without a @code{GROUP BY} but
with @code{HAVING}. The following now works:
@example
mysql> SELECT count(*) as C FROM table HAVING C > 1;
@end example
@item
Changed the protocol for field functions to be faster and avoid some
calls to @code{malloc()}.
@item
Added @code{-T32} option to @code{mysqld}, for running all queries under the
main thread.  This makes it possible to debug @code{mysqld} under Linux with
@code{gdb}!
@item
Added optimization of @code{not_null_column IS NULL} (needed for some Access
queries).
@item
Allow @code{STRAIGHT_JOIN} to be used between two tables to force the optimizer
to join them in a specific order.
@item
String functions now return @code{VARCHAR} rather than @code{CHAR} and
the column type is now @code{VARCHAR} for fields saved as @code{VARCHAR}.
This should make the @strong{MyODBC} driver better, but may break some old
@strong{MySQL} clients that don't handle @code{FIELD_TYPE_VARCHAR} the same
way as @code{FIELD_TYPE_CHAR}.
@item
@code{CREATE INDEX} and @code{DROP INDEX} are now implemented through
@code{ALTER TABLE}.
@code{CREATE TABLE} is still the recommended (fast) way to create indexes.
@item
Added @code{--set-variable} option @code{wait_timeout} to @code{mysqld}.
@item
Added time column to @code{mysqladmin processlist} to show how long a query
has taken or how long a thread has slept.
@item
Added lots of new variables to @code{show variables} and some new to
@code{show status}.
@item
Added new type @code{YEAR}. @code{YEAR} is stored in 1 byte with allowable
values of 0, and 1901 to 2155.
@item
Added new @code{DATE} type that is stored in 3 bytes rather than 4 bytes.
All new tables are created with the new date type if you don't use the
@code{--old-protocol} option to @code{mysqld}.
@item
Fixed bug in record caches; for some queries, you could get
@code{Error from table handler: #} on some operating systems.
@item
Added @code{--enable-assembler} option to @code{configure}, for x86 machines
(tested on Linux + @code{gcc}).  This will enable assembler functions for the
most important string functions for more speed!
@end itemize

@node News-3.21.x, News-3.20.x, News-3.22.x, News
@appendixsec Changes in release 3.21.x

@menu
* News-3.21.33::                Changes in release 3.21.33
* News-3.21.32::                Changes in release 3.21.32
* News-3.21.31::                Changes in release 3.21.31
* News-3.21.30::                Changes in release 3.21.30
* News-3.21.29::                Changes in release 3.21.29
* News-3.21.28::                Changes in release 3.21.28
* News-3.21.27::                Changes in release 3.21.27
* News-3.21.26::                Changes in release 3.21.26
* News-3.21.25::                Changes in release 3.21.25
* News-3.21.24::                Changes in release 3.21.24
* News-3.21.23::                Changes in release 3.21.23
* News-3.21.22::                Changes in release 3.21.22
* News-3.21.21a::               Changes in release 3.21.21a
* News-3.21.21::                Changes in release 3.21.21
* News-3.21.20::                Changes in release 3.21.20
* News-3.21.19::                Changes in release 3.21.19
* News-3.21.18::                Changes in release 3.21.18
* News-3.21.17::                Changes in release 3.21.17
* News-3.21.16::                Changes in release 3.21.16
* News-3.21.15::                Changes in release 3.21.15
* News-3.21.14b::               Changes in release 3.21.14b
* News-3.21.14a::               Changes in release 3.21.14a
* News-3.21.13::                Changes in release 3.21.13
* News-3.21.12::                Changes in release 3.21.12
* News-3.21.11::                Changes in release 3.21.11
* News-3.21.10::                Changes in release 3.21.10
* News-3.21.9::                 Changes in release 3.21.9
* News-3.21.8::                 Changes in release 3.21.8
* News-3.21.7::                 Changes in release 3.21.7
* News-3.21.6::                 Changes in release 3.21.6
* News-3.21.5::                 Changes in release 3.21.5
* News-3.21.4::                 Changes in release 3.21.4
* News-3.21.3::                 Changes in release 3.21.3
* News-3.21.2::                 Changes in release 3.21.2
* News-3.21.0::                 Changes in release 3.21.0
@end menu

@node News-3.21.33, News-3.21.32, News-3.21.x, News-3.21.x
@appendixsubsec Changes in release 3.21.33

@itemize @bullet
@item
Fixed problem when sending @code{SIGHUP} to @code{mysqld};
@code{mysqld} core dumped when starting from boot on some systems.
@item
Fixed problem with losing a little memory for some connections.
@item
@code{DELETE FROM tbl_name} without a @code{WHERE} condition is now done the
long way when you use @code{LOCK TABLES} or if the table is in use, to
avoid race conditions.
@item
@code{INSERT INTO TABLE (timestamp_column) VALUES (NULL);} didn't set timestamp.
@end itemize

@node News-3.21.32, News-3.21.31, News-3.21.33, News-3.21.x
@appendixsubsec Changes in release 3.21.32

@itemize @bullet
@item
Fixed some possible race conditions when doing many reopen/close on the same
tables under heavy load!  This can happen if you execute @code{mysqladmin
refresh} often. This could in some very rare cases corrupt the header of the
index file and cause error 126 or 138.

@item
Fixed fatal bug in @code{refresh()} when running with the @code{--skip-locking}
option.
There was a ``very small'' time gap after a @code{mysqladmin refresh} when
a table could be corrupted if one thread updated a table while another
thread did @code{mysqladmin refresh} and another thread started a new update
ont the same table before the first thread had finished.
A refresh (or @code{--flush-tables}) will now not return until all used tables
are closed!
@item
@code{SELECT DISTINCT} with a @code{WHERE} clause that didn't match any rows
returned a row in some contexts (bug only in 3.21.31).
@item
@code{GROUP BY} + @code{ORDER BY} returned one empty row when no rows where
found.
@item
Fixed a bug in the range optimizer that wrote
@code{Use_count: Wrong count for ...} in the error log file.
@end itemize

@node News-3.21.31, News-3.21.30, News-3.21.32, News-3.21.x
@appendixsubsec Changes in release 3.21.31
@itemize @bullet
@item
Fixed a sign extension problem for the @code{TINYINT} type on Irix.
@item
Fixed problem with @code{LEFT("constant_string",function)}.
@item
Fixed problem with @code{FIND_IN_SET()}.
@item
@code{LEFT JOIN} core dumped if the second table is used with a constant
@code{WHERE/ON} expression that uniquely identifies one record.
@item
Fixed problems with @code{DATE_FORMAT()} and incorrect dates.
@code{DATE_FORMAT()} now ignores @code{'%'} to make it possible to extend
it more easily in the future.
@end itemize

@node News-3.21.30, News-3.21.29, News-3.21.31, News-3.21.x
@appendixsubsec Changes in release 3.21.30
@itemize @bullet
@item
@code{mysql} now returns an exit code > 0 if the query returned an error.
@item
Saving of command line history to file in @code{mysql} client.
By Tommy Larsen @email{tommy@@mix.hive.no}.
@item
Fixed problem with empty lines that were ignored in @file{mysql.cc}.
@item
Save the pid of the signal handler thread in the pid file instead
of the pid of the main thread.
@item
@email{tommy@@valley.ne.jp} �ˤ�����ܸ쥭��饯�������å�(SJIS, UJIS)�Υ��ݡ���. 
@item
Changed @code{safe_mysqld} to redirect startup messages to
@code{'hostname'.err} instead
of @code{'hostname'.log} to reclaim file space on @code{mysqladmin refresh}.
@item
@code{ENUM} always had the first entry as default value.
@item
@code{ALTER TABLE} wrote two entries to the update log.
@item
@code{sql_acc()} now closes the @code{mysql} grant tables after a reload to
save table space and memory.
@item
Changed @code{LOAD DATA} to use less memory with tables and @code{BLOB}
columns.
@item
Sorting on a function which made a division / 0 produced a wrong set
in some cases.
@item
Fixed @code{SELECT} problem with @code{LEFT()} when using the czech character
set.
@item
Fixed problem in @code{isamchk}; it couldn't repair a packed table in a very
unusual case.
@item
@code{SELECT} statements with @code{&} or @code{|} (bit functions) failed on
columns with @code{NULL} values.
@item
When comparing a field = field, where one of the fields was a part key,
only the length of the part key was compared.
@end itemize

@node News-3.21.29, News-3.21.28, News-3.21.30, News-3.21.x
@appendixsubsec Changes in release 3.21.29
@itemize @bullet
@item
@code{LOCK TABLES} + @code{DELETE from tbl_name} never removed locks properly.
@item
Fixed problem when grouping on an @code{OR} function.
@item
Fixed permission problem with @code{umask()} and creating new databases.
@item
Fixed permission problem on result file with @code{SELECT ... INTO OUTFILE ...}
@item
Fixed problem in range optimizer (core dump) for a very complex query.
@item
Fixed problem when using @code{MIN(integer)} or @code{MAX(integer)} in
@code{GROUP BY}.
@item
Fixed bug on Alpha when using integer keys. (Other keys worked on Alpha).
@item
Fixed bug in @code{WEEK("XXXX-xx-01")}.
@end itemize

@node News-3.21.28, News-3.21.27, News-3.21.29, News-3.21.x
@appendixsubsec Changes in release 3.21.28
@itemize @bullet
@item
Fixed socket permission (clients couldn't connect to Unix socket on Linux).
@item
Fixed bug in record caches; for some queries, you could get
@code{Error from table handler: #} on some operating systems.
@end itemize

@node News-3.21.27, News-3.21.26, News-3.21.28, News-3.21.x
@appendixsubsec Changes in release 3.21.27
@itemize @bullet
@item
Added user level lock functions @code{GET_LOCK(string,timeout)},
@code{RELEASE_LOCK(string)}.
@item
Added @code{opened_tables} to @code{show status}.
@item
Changed connect timeout to 3 seconds to make it somewhat harder
for crackers to kill @code{mysqld} through telnet + TCP/IP.
@item
Fixed bug in range optimizer when using
@code{WHERE key_part_1 >= something AND key_part_2 <= something_else}.
@item
Changed @code{configure} for detection of FreeBSD 3.0 9803xx and above
@item
@code{WHERE} with string_column_key = constant_string didn't always find
all rows if the column had many values differing only with characters of
the same sort value (like e and @'e).
@item
Strings keys looked up with 'ref' were not compared in case-sensitive fashion.
@item
Added @code{umask()} to make log files non-readable for normal users.
@item
Ignore users with old (8-byte) password on startup if not using
@code{--old-protocol} option to @code{mysqld}.
@item
@code{SELECT} which matched all key fields returned the values in the
case of the matched values, not of the found values. (Minor problem.)
@end itemize

@node News-3.21.26, News-3.21.25, News-3.21.27, News-3.21.x
@appendixsubsec Changes in release 3.21.26
@itemize @bullet
@item
@code{FROM_DAYS(0)} now returns "0000-00-00".
@item
In @code{DATE_FORMAT()}, PM and AM were swapped for hours 00 and 12.
@item
Extended the default maximum key size to 256.
@item
Fixed bug when using @code{BLOB}/@code{TEXT} in @code{GROUP BY} with many
tables.
@item
An @code{ENUM} field that is not declared @code{NOT NULL} has @code{NULL} as
the default value.
(Previously, the default value was the first enumeration value.)
@item
Fixed bug in the join optimizer code when using many part keys
on the same key:  @code{INDEX (Organization,Surname(35),Initials(35))}.
@item
Added some tests to the table order optimizer to get some cases with
@code{SELECT ... FROM many_tables} much faster.
@item
Added a retry loop around @code{accept()} to possibly fix some problems on some
Linux machines.
@end itemize

@node News-3.21.25, News-3.21.24, News-3.21.26, News-3.21.x
@appendixsubsec Changes in release 3.21.25
@itemize @bullet
@item
Changed @code{typedef 'string'} to @code{typedef 'my_string'} for better
portability.
@item
You can now kill threads that are waiting on a disk full condition.
@item
Fixed some problems with UDF functions.
@item
Added long options to @code{isamchk}. Try @code{isamchk --help}.
@item
Fixed a bug when using 8 bytes long (alpha); @code{filesort()} didn't work.
Affects @code{DISTINCT}, @code{ORDER BY} and @code{GROUP BY} on 64-bit
processors.
@end itemize

@node News-3.21.24, News-3.21.23, News-3.21.25, News-3.21.x
@appendixsubsec Changes in release 3.21.24
@itemize @bullet
@item
Dynamic loadable functions. Based on source from Alexis Mikhailov.
@item
You couldn't delete from a table if no one had done a @code{SELECT} on the
table.
@item
Fixed problem with range optimizer with many @code{OR} operators on key parts
inside each other.
@item
Recoded @code{MIN()} and @code{MAX()} to work properly with strings and
@code{HAVING}.
@item
Changed default umask value for new files from @code{0664} to @code{0660}.
@item
Fixed problem with @code{LEFT JOIN} and constant expressions in the @code{ON}
part.
@item
Added Italian error messages from @email{brenno@@dewinter.com}.
@item
@code{configure} now works better on OSF1 (tested on 4.0D).
@item
Added hooks to allow @code{LIKE} optimization with international character
support.
@item
Upgraded @code{DBI} to 0.93.
@end itemize

@node News-3.21.23, News-3.21.22, News-3.21.24, News-3.21.x
@appendixsubsec Changes in release 3.21.23
@itemize @bullet
@item
The following symbols are now reserved words:
@code{TIME}, @code{DATE}, @code{TIMESTAMP}, @code{TEXT}, @code{BIT},
@code{ENUM}, @code{NO}, @code{ACTION}, @code{CHECK}, @code{YEAR},
@code{MONTH}, @code{DAY}, @code{HOUR}, @code{MINUTE}, @code{SECOND},
@code{STATUS}, @code{VARIABLES}.
@item
Setting a @code{TIMESTAMP} to @code{NULL} in @code{LOAD DATA INFILE ...} didn't
set the current time for the @code{TIMESTAMP}.
@item
Fix @code{BETWEEN} to recognize binary strings. Now @code{BETWEEN} is
case sensitive.
@item
Added @code{--skip-thread-priority} option to @code{mysqld}, for systems
where @code{mysqld}'s thread scheduling doesn't work properly (BSDI 3.1).
@item
Added ODBC functions @code{DAYNAME()} and @code{MONTHNAME()}.
@item
Added function @code{TIME_FORMAT()}.  This works like @code{DATE_FORMAT()},
but takes a time string (@code{'HH:MM:DD'}) as argument.
@item
Fixed unlikely(?) key optimizer bug when using @code{OR}s of key parts
inside @code{AND}s.
@item
Added command @code{variables} to @code{mysqladmin}.
@item
A lot of small changes to the binary releases.
@item
Fixed a bug in the new protocol from @strong{MySQL} 3.21.20.
@item
Changed @code{ALTER TABLE} to work with Win32 (Win32 can't rename open files).
Also fixed a couple of small bugs in the Win32 version.
@item
All standard @strong{MySQL} clients are now ported to @strong{MySQL}-Win32.
@item
@strong{MySQL} can now be started as a service on NT.
@end itemize

@node News-3.21.22, News-3.21.21a, News-3.21.23, News-3.21.x
@appendixsubsec Changes in release 3.21.22
@itemize @bullet
@item
Starting with this version, all @strong{MySQL} distributions will be
configured, compiled and tested with @code{crash-me} and the benchmarks on
the following platforms: SunOS 5.6 sun4u, SunOS 5.5.1 sun4u, SunOS 4.14 sun4c,
SunOS 5.6 i86pc, Irix 6.3 mips5k, HP-UX 10.20 hppa, AIX 4.2.1 ppc,
OSF1 V4.0 alpha, FreeBSD 2.2.2 i86pc and BSDI 3.1 i386.
@item
Fix @code{COUNT(*)} problems when the @code{WHERE} clause didn't match any
records.  (Bug from 3.21.17.)
@item
Removed that @code{NULL = NULL} is true.  Now you must use @code{IS NULL}
or @code{IS NOT NULL} to test whether or not a value is @code{NULL}.
(This is according to ANSI SQL but may break
old applications that are ported from @code{mSQL}.)
You can get the old behavior by compiling with @code{-DmSQL_COMPLIANT}.
@item
Fixed bug that core dumped when using many @code{LEFT OUTER JOIN} clauses.
@item
Fixed bug in @code{ORDER BY} on string formula with possible @code{NULL} values.
@item
Fixed problem in range optimizer when using <= on sub index.
@item
Added functions @code{DAYOFYEAR()}, @code{DAYOFMONTH()}, @code{MONTH()},
@code{YEAR()}, @code{WEEK()}, @code{QUARTER()}, @code{HOUR()}, @code{MINUTE()},
@code{SECOND()} and @code{FIND_IN_SET()}.
@item
Added command @code{SHOW VARIABLES}.
@item
Added support of ``long constant strings'' from ANSI SQL:
@example
mysql> SELECT 'first ' 'second';       -> 'first second'
@end example
@item
Upgraded mSQL-Mysql-modules to 1.1825.
@item
Upgraded @code{mysqlaccess} to 2.02.
@item
Fixed problem with Russian character set and @code{LIKE}.
@item
Ported to OpenBSD 2.1.
@item
New Dutch error messages.
@end itemize

@node News-3.21.21a, News-3.21.21, News-3.21.22, News-3.21.x
@appendixsubsec Changes in release 3.21.21a
@itemize @bullet
@item
Configure changes for some operating systems.
@end itemize

@node News-3.21.21, News-3.21.20, News-3.21.21a, News-3.21.x
@appendixsubsec Changes in release 3.21.21
@itemize @bullet
@item
Fixed optimizer bug when using
@code{WHERE data_field = date_field2 AND date_field2 = constant}.
@item
Added command @code{SHOW STATUS}.
@item
Removed @file{manual.ps} from the source distribution to make it smaller.
@end itemize

@node News-3.21.20, News-3.21.19, News-3.21.21, News-3.21.x
@appendixsubsec Changes in release 3.21.20
@itemize @bullet
@item
Changed the maximum table name and column name lengths from 32 to 64.
@item
Aliases can now be of ``any'' length.
@item
Fixed @code{mysqladmin stat} to return the right number of queries.
@item
Changed protocol (downward compatible) to mark if a column has the
@code{AUTO_INCREMENT} attribute or is a @code{TIMESTAMP}. This is needed for
the new Java driver.
@item
Added Hebrew sorting order by Zeev Suraski.
@item
Solaris 2.6: Fixed @code{configure} bugs and increased maximum table size
from 2G to 4G.
@end itemize

@node News-3.21.19, News-3.21.18, News-3.21.20, News-3.21.x
@appendixsubsec Changes in release 3.21.19
@itemize @bullet
@item
Upgraded @code{DBD} to 1823. This version implements @code{mysql_use_result} in
@code{DBD-Mysql}.
@item
Benchmarks updated for empress (by Luuk).
@item
Fixed a case of slow range searching.
@item
Configure fixes (@file{Docs} directory).
@item
Added function @code{REVERSE()} (by Zeev Suraski).
@end itemize

@node News-3.21.18, News-3.21.17, News-3.21.19, News-3.21.x
@appendixsubsec Changes in release 3.21.18
@itemize @bullet
@item
Issue error message if client C functions are called in wrong order.
@item
Added automatic reconnect to the @file{libmysql.c} library. If a write command
fails, an automatic reconnect is done.
@item
Small sort sets no longer use temporary files.
@item
Upgraded @code{DBI} to 0.91.
@item
Fixed a couple of problems with @code{LEFT OUTER JOIN}.
@item
Added @code{CROSS JOIN} syntax. @code{CROSS} is now a reserved word.
@item
Recoded @code{yacc}/@code{bison} stack allocation to be even safer and to allow
@strong{MySQL} to handle even bigger expressions.
@item
Fixed a couple of problems with the update log.
@item
@code{ORDER BY} was slow when used with key ranges.
@end itemize

@node News-3.21.17, News-3.21.16, News-3.21.18, News-3.21.x
@appendixsubsec Changes in release 3.21.17
@itemize @bullet
@item
Changed documentation string of @code{--with-unix-socket-path} to avoid
confusion.
@item
Added ODBC and ANSI SQL style @code{LEFT OUTER JOIN}.
@item
The following are new reserved words: @code{LEFT}, @code{NATURAL},
@code{USING}.
@item
The client library now uses the value of the environment variable
@code{MYSQL_HOST} as the default host if it's defined.
@item
@code{SELECT col_name, SUM(expr)} now returns @code{NULL} for @code{col_name}
when there are matching rows.
@item
Fixed problem with comparing binary strings and @code{BLOB}s with ASCII
characters over 127.
@item
Fixed lock problem: when freeing a read lock on a table with multiple
read locks, a thread waiting for a write lock would have been given the lock.
This shouldn't affect data integrity, but could possibly make @code{mysqld}
restart if one thread was reading data that another thread modified.
@item
@code{LIMIT offset,count} didn't work in @code{INSERT ... SELECT}.
@item
Optimized key block caching. This will be quicker than the old algorithm when
using bigger key caches.
@end itemize

@node News-3.21.16, News-3.21.15, News-3.21.17, News-3.21.x
@appendixsubsec Changes in release 3.21.16

@itemize @bullet
@item
Added ODBC 2.0 & 3.0 functions @code{POWER()}, @code{SPACE()},
@code{COT()}, @code{DEGREES()}, @code{RADIANS()}, @code{ROUND(2 arg)}
and @code{TRUNCATE()}.
@item
@strong{WARNING: INCOMPATIBLE CHANGE!!} @code{LOCATE()} parameters were
swapped according to ODBC standard. Fixed.
@item
Added function @code{TIME_TO_SEC()}.
@item
In some cases, default values were not used for @code{NOT NULL} fields.
@item
Timestamp wasn't always updated properly in @code{UPDATE SET ...} statements.
@item
Allow empty strings as default values for @code{BLOB} and @code{TEXT}, to
be compatible with @code{mysqldump}.
@end itemize

@node News-3.21.15, News-3.21.14b, News-3.21.16, News-3.21.x
@appendixsubsec Changes in release 3.21.15

@itemize @bullet
@item
@strong{WARNING: INCOMPATIBLE CHANGE!!} @code{mysqlperl} is now from
Msql-Mysql-modules. This means that @code{connect()} now takes
@code{host}, @code{database}, @code{user}, @code{password} arguments! The old
version took @code{host}, @code{database}, @code{password}, @code{user}.
@item
Allow @code{DATE '1997-01-01'}, @code{TIME '12:10:10'} and
@code{TIMESTAMP '1997-01-01 12:10:10'} formats required by ANSI SQL.
@strong{WARNING: INCOMPATIBLE CHANGE!!} This has the unfortunate
side-effect that you no longer can have columns named @code{DATE}, @code{TIME}
or @code{TIMESTAMP}. :( Old columns can still be accessed through
@code{tablename.columnname}!)
@item
Changed Makefiles to hopefully work better with BSD systems. Also,
@file{manual.dvi} is now included in the distribution to avoid having stupid
@code{make} programs trying to rebuild it.
@item
@code{readline} library upgraded to version 2.1.
@item
A new sortorder german-1. That is a normal ISO-Latin1 with a german sort
order.
@item
Perl @code{DBI}/@code{DBD} is now included in the distribution. @code{DBI}
is now the recommended way to connect to @strong{MySQL} from Perl.
@item
New portable benchmark suite with @code{DBD}, with test results from
@code{mSQL} 2.0.3, @strong{MySQL}, PostgreSQL 6.2.1 and Solid server 2.2.
@item
@code{crash-me} is now included with the benchmarks; This is a Perl program
designed to find as many limits as possible in a SQL server. Tested with
@code{mSQL}, PostgreSQL, Solid and @strong{MySQL}.
@item
Fixed bug in range-optimizer that crashed @strong{MySQL} on some queries.
@item
Table and column name completion for @code{mysql} command line tool, by Zeev
Suraski and Andi Gutmans.
@item
Added new command @code{REPLACE} that works like @code{INSERT} but
replaces conflicting records with the new record. @code{REPLACE INTO
TABLE ... SELECT ...} works also.
@item
Added new commands @code{CREATE DATABASE db_name} and @code{DROP
DATABASE db_name}.
@item
Added @code{RENAME} option to @code{ALTER TABLE}: @code{ALTER TABLE name
RENAME AS new_name}.
@item
@code{make_binary_distribution} now includes @file{libgcc.a} in
@file{libmysqlclient.a}. This should make linking work for people who don't
have @code{gcc}.
@item
Changed @code{net_write()} to @code{my_net_write()} because of a name
conflict with Sybase.
@item
@cindex ODBC compatibility
@cindex Compatibility, with ODBC
New function @code{DAYOFWEEK()} compatible with ODBC.
@item
Stack checking and @code{bison} memory overrun checking to make @strong{MySQL}
safer with weird queries.
@end itemize

@node News-3.21.14b, News-3.21.14a, News-3.21.15, News-3.21.x
@appendixsubsec Changes in release 3.21.14b

@itemize @bullet
@item
Fixed a couple of small @code{configure} problems on some platforms.
@end itemize

@node News-3.21.14a, News-3.21.13, News-3.21.14b, News-3.21.x
@appendixsubsec Changes in release 3.21.14a

@itemize @bullet
@item
Ported to SCO Openserver 5.0.4  with FSU Pthreads.
@item
HP-UX 10.20 should work.
@item
Added new function @code{DATE_FORMAT()}.
@item
Added @code{NOT IN}.
@item
Added automatic removal of 'ODBC function conversions': @code{@{fn now() @}}
@item
Handle ODBC 2.50.3 option flags.
@item
Fixed comparison of @code{DATE} and @code{TIME} values with @code{NULL}.
@item
Changed language name from germany to german to be consistent with
the other language names.
@item
Fixed sorting problem on functions returning a @code{FLOAT}. Previously, the
values were converted to @code{INT}s before sorting.
@item
Fixed slow sorting when sorting on key field when using
@code{key_column=constant}.
@item
Sorting on calculated @code{DOUBLE} values sorted on integer results instead.
@item
@code{mysql} no longer needs a database argument.
@item
Changed the place where @code{HAVING} should be. According to ANSI, it should
be after @code{GROUP BY} but before @code{ORDER BY}. @strong{MySQL} 3.20
incorrectly had it last.
@item
Added Sybase command @code{USE DATABASE} to start using another database.
@item
Added automatic adjusting of number of connections and table cache size
if the maximum number of files that can be opened is less than needed.
This should fix that @code{mysqld} doesn't crash even if you haven't done a
@code{ulimit -n 256} before starting @code{mysqld}.
@item
Added lots of limit checks to make it safer when running with too little
memory or when doing weird queries.
@end itemize

@node News-3.21.13, News-3.21.12, News-3.21.14a, News-3.21.x
@appendixsubsec Changes in release 3.21.13

@itemize @bullet
@item
Added retry of interrupted reads and clearing of @code{errno}.
This makes Linux systems much safer!
@item
Fixed locking bug when using many aliases on the same table in the same
@code{SELECT}.
@item
Fixed bug with @code{LIKE} on number key.
@item
New error message so you can check whether the connection was lost while
the command was running or whether the connection was down from the start.
@item
Added @code{--table} option to @code{mysql} to print in table format.
Moved time and row information after query result.
Added automatic reconnect of lost connections.
@item
Added @code{!=} as a synonym for @code{<>}.
@item
Added function @code{VERSION()} to make easier logs.
@item
New multi-user test @file{tests/fork_test.pl} to put some strain on the
thread library.
@end itemize

@node News-3.21.12, News-3.21.11, News-3.21.13, News-3.21.x
@appendixsubsec Changes in release 3.21.12

@itemize @bullet
@item
Fixed @code{ftruncate()} call in MIT-pthreads. This made @code{isamchk}
destroy the @file{.ISM} files on (Free)BSD 2.x systems.
@item
Fixed broken @code{__P_} patch in MIT-pthreads.
@item
Many memory overrun checks. All string functions now return @code{NULL}
if the returned string should be longer than @code{max_allowed_packet} bytes.
@item
Changed the name of the @code{INTERVAL} type to @code{ENUM}, because
@code{INTERVAL} is used in ANSI SQL.
@item
In some cases, doing a @code{JOIN} + @code{GROUP} + @code{INTO OUTFILE},
the result wasn't grouped.
@item
@code{LIKE} with @code{'_'} as last character didn't work. Fixed.
@item
Added extended ANSI SQL @code{TRIM()} function.
@item
Added @code{CURTIME()}.
@item
Added @code{ENCRYPT()} function by Zeev Suraski.
@item
Fixed better @code{FOREIGN KEY} syntax skipping. New reserved words:
@code{MATCH}, @code{FULL}, @code{PARTIAL}.
@item
@code{mysqld} now allows IP number and hostname to the @code{--bind-address}
option.
@item
Added @code{SET OPTION CHARACTER SET cp1251_koi8} to enable conversions of
data to/from cp1251_koi8.
@item
Lots of changes for Win95 port. In theory, this version should now be
easily portable to Win95.
@item
Changed the @code{CREATE COLUMN} syntax of @code{NOT NULL} columns to be after
the @code{DEFAULT} value, as specified in the ANSI SQL standard. This will
make @code{mysqldump} with @code{NOT NULL} and default values incompatible with
@strong{MySQL} 3.20.
@item
Added many function name aliases so the functions can be used with
ODBC or ANSI SQL92 syntax.
@item
Fixed syntax of @code{ALTER TABLE tbl_name ALTER COLUMN col_name SET DEFAULT
NULL}.
@item
Added @code{CHAR} and @code{BIT} as synonyms for @code{CHAR(1)}.
@item
Fixed core dump when updating as a user who has only @strong{select} privilege.
@item
@code{INSERT ... SELECT ... GROUP BY} didn't work in some cases. An
@code{Invalid use of group function} error occurred.
@item
When using @code{LIMIT}, @code{SELECT} now always uses keys instead of record
scan.  This will give better performance on @code{SELECT} and a @code{WHERE}
that matches many rows.
@item
Added Russian error messages.
@end itemize

@node News-3.21.11, News-3.21.10, News-3.21.12, News-3.21.x
@appendixsubsec Changes in release 3.21.11

@itemize @bullet
@item
Configure changes.
@item
@strong{MySQL} now works with the new thread library on BSD/OS 3.0.
@item
Added new group functions @code{BIT_OR()} and @code{BIT_AND()}.
@item
Added compatibility functions @code{CHECK} and @code{REFERENCES}.
@code{CHECK} is now a reserved word.
@item
Added @code{ALL} option to @code{GRANT} for better compatibility. (@code{GRANT}
is still a dummy function.)
@item
Added partly-translated dutch messages.
@item
Fixed bug in @code{ORDER BY} and @code{GROUP BY} with @code{NULL} columns.
@item
Added function @code{last_insert_id()} to retrieve last @code{AUTO_INCREMENT}
value.  This is intended for clients to ODBC that can't use the
@code{mysql_insert_id()} API function, but can be used by any client.
@item
Added @code{--flush-logs} option to @code{mysqladmin}.
@item
Added command @code{STATUS} to @code{mysql}.
@item
Fixed problem with @code{ORDER BY}/@code{GROUP BY} because of bug in @code{gcc}.
@item
Fixed problem with @code{INSERT ... SELECT ... GROUP BY}.
@end itemize

@node News-3.21.10, News-3.21.9, News-3.21.11, News-3.21.x
@appendixsubsec Changes in release 3.21.10

@itemize @bullet
@item
New @code{mysqlaccess}.
@item
@code{CREATE} now supports all ODBC types and the @code{mSQL} @code{TEXT} type.
All ODBC 2.5 functions are also supported (added @code{REPEAT}). This provides
better portability.
@item
Added text types @code{TINYTEXT}, @code{TEXT}, @code{MEDIUMTEXT} and
@code{LONGTEXT}.  These are actually @code{BLOB}types, but all searching is
done in case-insensitive fashion.
@item
All old @code{BLOB} fields are now @code{TEXT} fields.  This only
changes that all searching on strings is done in case-sensitive fashion.
You must do an @code{ALTER TABLE} and change the field type to @code{BLOB}
if you want to have tests done in case-sensitive fashion.
@item
Fixed some @code{configure} issues.
@item
Made the locking code a bit safer. Fixed very unlikely
deadlock situation.
@item
Fixed a couple of bugs in the range optimizer. Now the new range benchmark
@code{test-select} works.
@end itemize

@node News-3.21.9, News-3.21.8, News-3.21.10, News-3.21.x
@appendixsubsec Changes in release 3.21.9

@itemize @bullet
@item
Added @code{--enable-unix-socket=pathname} option to @code{configure}.
@item
Fixed a couple of portability problems with include files.
@item
Fixed bug in range calculation that could return empty
set when searching on multiple key with only one entry (very rare).
@item
Most things ported to FSU Pthreads, which should allow @strong{MySQL} to
run on SCO. @xref{SCO}.
@end itemize

@node News-3.21.8, News-3.21.7, News-3.21.9, News-3.21.x
@appendixsubsec Changes in release 3.21.8

@itemize @bullet
@item
Works now in Solaris 2.6.
@item
Added handling of calculation of @code{SUM()} functions.
For example, you can now use @code{SUM(column)/COUNT(column)}.
@item
Added handling of trigometric functions:
@code{PI()}, @code{ACOS()}, @code{ASIN()}, @code{ATAN()}, @code{COS()},
@code{SIN()} and @code{TAN()}.
@item
New languages: norwegian, norwegian-ny and portuguese.
@item
Fixed parameter bug in @code{net_print()} in @file{procedure.cc}.
@item
Fixed a couple of memory leaks.
@item
Now allow also the old @code{SELECT ... INTO OUTFILE} syntax.
@item
Fixed bug with @code{GROUP BY} and @code{SELECT} on key with many values.
@item
@code{mysql_fetch_lengths()} sometimes returned incorrect lengths when you used
@code{mysql_use_result()}. This affected at least some cases of
@code{mysqldump --quick}.
@item
Fixed bug in optimization of @code{WHERE const op field}.
@item
Fixed problem when sorting on @code{NULL} fields.
@item
Fixed a couple of 64-bit (Alpha) problems.
@item
Added @code{--pid-file=#} option to @code{mysqld}.
@item
Added date formatting to @code{FROM_UNIXTIME()}, originally by Zeev Suraski.
@item
Fixed bug in @code{BETWEEN} in range optimizer (Did only test = of the first
argument).
@item
Added machine-dependent files for MIT-pthreads i386-SCO. There is probably
more to do to get this to work on SCO 3.5.
@end itemize

@node News-3.21.7, News-3.21.6, News-3.21.8, News-3.21.x
@appendixsubsec Changes in release 3.21.7

@itemize @bullet
@item
Changed @file{Makefile.am} to take advantage of Automake 1.2.
@item
Added the beginnings of a benchmark suite.
@item
Added more secure password handling.
@item
Added new client function @code{mysql_errno()}, to get the error number of
the error message. This makes error checking in the client much easier.
This makes the new server incompatible with the 3.20.x server when running
without @code{--old-protocol}.  The client code is backward compatible.
More information can be found in the @file{README} file!
@item
Fixed some problems when using very long, illegal names.
@end itemize

@node News-3.21.6, News-3.21.5, News-3.21.7, News-3.21.x
@appendixsubsec Changes in release 3.21.6

@itemize @bullet
@item
Fixed more portability issues (incorrect @code{sigwait} and @code{sigset}
defines).
@item
@code{configure} should now be able to detect the last argument to
@code{accept()}.
@end itemize

@node News-3.21.5, News-3.21.4, News-3.21.6, News-3.21.x
@appendixsubsec Changes in release 3.21.5

@itemize @bullet
@item
Should now work with FreeBSD 3.0 if used with
@file{FreeBSD-3.0-libc_r-1.0.diff},
which can be found at @uref{http://www.mysql.com/Download/Patches}.
@item
Added new option @code{-O tmp_table_size=#} to @code{mysqld}.
@item
New function @code{FROM_UNIXTIME(timestamp)} which returns a date string in
'YYYY-MM-DD HH:MM:DD' format.
@item
New function @code{SEC_TO_TIME(seconds)} which returns a string in
'HH:MM:SS' format.
@item
New function @code{SUBSTRING_INDEX()}, originally by Zeev Suraski.
@end itemize

@node News-3.21.4, News-3.21.3, News-3.21.5, News-3.21.x
@appendixsubsec Changes in release 3.21.4

@itemize @bullet
@item
Should now configure and compile on OSF1 4.0 with the DEC compiler.
@item
Configuration and compilation on BSD/OS 3.0 works, but due to some bugs in
BSD/OS 3.0, @code{mysqld} doesn't work on it yet.
@item
Configuration and compilation on FreeBSD 3.0 works, but I couldn't get
@code{pthread_create} to work.
@end itemize

@node News-3.21.3, News-3.21.2, News-3.21.4, News-3.21.x
@appendixsubsec Changes in release 3.21.3

@itemize @bullet
@item
Added reverse check lookup of hostnames to get better security.
@item
Fixed some possible buffer overflows if filenames that are too long are used.
@item
@code{mysqld} doesn't accept hostnames that start with digits followed by a
@code{'.'}, because the hostname may look like an IP number.
@item
Added @code{--skip-networking} option to @code{mysqld}, to only allow socket
connections.  (This will not work with MIT-pthreads!)
@item
Added check of too long table names for alias.
@item
Added check if database name is okay.
@item
Added check if too long table names.
@item
Removed incorrect @code{free()} that killed the server on
@code{CREATE DATABASE} or @code{DROP DATABASE}.
@item
Changed some @code{mysqld} @code{-O} options to better names.
@item
Added @code{-O join_cache_size=#} option to @code{mysqld}.
@item
Added @code{-O max_join_size=#} option to @code{mysqld}, to be able to set a
limit how big queries (in this case big = slow) one should be able to handle
without specifying @code{SET OPTION SQL_BIG_SELECTS=1}.  A # = is about 10
examined records. The default is ``unlimited''.
@item
When comparing a @code{TIME}, @code{DATE}, @code{DATETIME} or @code{TIMESTAMP}
column to a constant, the constant is converted to a time value before
performing the comparison.
This will make it easier to get ODBC (particularly Access97) to work with
the above types. It should also make dates easier to use and the comparisons
should be quicker than before.
@item
Applied patch from Jochen Wiedmann that allows @code{query()} in
@code{mysqlperl} to take a query with @code{\0} in it.
@item
Storing a timestamp with a 2-digit year (@code{YYMMDD}) didn't work.
@item
Fix that timestamp wasn't automatically updated if set in an @code{UPDATE}
clause.
@item
Now the automatic timestamp field is the FIRST timestamp field.
@item
@code{SELECT * INTO OUTFILE}, which didn't correctly if the outfile already
existed.
@item
@code{mysql} now shows the thread ID when starting or doing a reconnect.
@item
Changed the default sort buffer size from 2M to 1M.
@end itemize

@node News-3.21.2, News-3.21.0, News-3.21.3, News-3.21.x
@appendixsubsec Changes in release 3.21.2

@itemize @bullet
@item
The range optimizer is coded, but only 85% tested. It can be enabled with
@code{--new}, but it crashes core a lot yet...
@item
More portable. Should compile on AIX and alpha-digital.
At least the @code{isam} library should be relatively 64-bit clean.
@item
New @code{isamchk} which can detect and fix more problems.
@item
New options for @code{isamlog}.
@item
Using new version of Automake.
@item
Many small portability changes (from the AIX and alpha-digital port)
Better checking of pthread(s) library.
@item
czech error messages by @email{snajdr@@pvt.net}.
@item
Decreased size of some buffers to get fewer problems on systems with little
memory.  Also added more checks to handle ``out of memory'' problems.
@item
@code{mysqladmin}: you can now do @code{mysqladmin kill 5,6,7,8} to kill
multiple threads.
@item
When the maximum connection limit is reached, one extra connection by a user
with the @strong{PROCESS_ACL} privilege is granted.
@item
Added @code{-O backlog=#} option to @code{mysqld}.
@item
Increased maximum packet size from 512K to 1024K for client.
@item
Almost all of the function code is now tested in the internal test suite.
@item
@code{ALTER TABLE} now returns warnings from field conversions.
@item
Port changed to 3306 (got it reserved from ISI).
@item
Added a fix for Visual FoxBase so that any schema name from a table
specification is automatically removed.
@item
New function @code{ASCII()}.
@item
Removed function @code{BETWEEN(a,b,c)}. Use the standard ANSI
synax instead: @code{expr BETWEEN expr AND expr}.
@item
@strong{MySQL} no longer has to use an extra temporary table when sorting
on functions or @code{SUM()} functions.
@item
Fixed bug that you couldn't use @code{tbl_name.field_name} in @code{UPDATE}.
@item
Fixed @code{SELECT DISTINCT} when using 'hidden group'. For example:
@example
mysql> SELECT DISTINCT MOD(some_field,10) FROM test
           GROUP BY some_field;
@end example
Note: @code{some_field} is normally in the @code{SELECT} part. ANSI SQL should
require it.
@end itemize

@node News-3.21.0,  , News-3.21.2, News-3.21.x
@appendixsubsec Changes in release 3.21.0

@itemize @bullet
@item
New reserved words used: @code{INTERVAL}, @code{EXPLAIN}, @code{READ},
@code{WRITE}, @code{BINARY}.
@item
Added ODBC function @code{CHAR(num,...)}.
@item
New operator @code{IN}. This uses a binary search to find a match.
@item
New command @code{LOCK TABLES tbl_name [AS alias] @{READ|WRITE@} ...}
@item
Added @code{--log-update} option to @code{mysqld}, to get a log suitable for
incremental updates.
@item
New command @code{EXPLAIN SELECT ...} to get information about how the
optimizer will do the join.
@item
For easier client code, the client should no longer use
@code{FIELD_TYPE_TINY_BLOB}, @code{FIELD_TYPE_MEDIUM_BLOB},
@code{FIELD_TYPE_LONG_BLOB} or @code{FIELD_TYPE_VAR_STRING} (as
previously returned by @code{mysql_list_fields}).  You should instead only use
@code{FIELD_TYPE_BLOB} or @code{FIELD_TYPE_STRING}.  If you want exact
types, you should use the command @code{SHOW FIELDS}.
@item
Added varbinary syntax: @code{0x######} which can be used as a string
(default) or a number.
@item
@code{FIELD_TYPE_CHAR} is renamed to @code{FIELD_TYPE_TINY}.
@item
Changed all fields to C++ classes.
@item
Removed FORM struct.
@item
Fields with @code{DEFAULT} values no longer need to be @code{NOT NULL}.
@item
New field types:
@table @code
@item ENUM
A string which can take only a couple of defined values. The value is
stored as a 1-3 byte number that is mapped automatically to a string.
This is sorted according to string positions!
@item SET
A string which may have one or many string values separated with ','.
The string is stored as a 1-, 2-, 3-, 4- or 8-byte number where each bit stands
for a specific set member.  This is sorted according to the unsigned value
of the stored packed number.
@end table
@item
Now all function calculation is done with @code{double} or @code{long long}.
This will provide the full 64-bit range with bit functions and fix some
conversions that previously could result in precision losses.  One should
avoid using @code{unsigned long long} columns with full 64-bit range
(numbers bigger than 9223372036854775807) because calculations are done
with @code{signed long long}.
@item
@code{ORDER BY} will now put @code{NULL} field values first. @code{GROUP BY}
will also work with @code{NULL} values.
@item
Full @code{WHERE} with expressions.
@item
New range optimizer that can resolve ranges when some keypart prefix is
constant. Example:
@example
mysql> SELECT * FROM tbl_name
           WHERE key_part_1="customer"
           AND key_part_2>=10 AND key_part_2<=10;
@end example
@end itemize

@node News-3.20.x, News-3.19.x, News-3.21.x, News
@appendixsec Changes in release 3.20.x

Changes from 3.20.18 to 3.20.32b are not documented here because the
3.21 release branched here. And the relevant changes are also
documented as changes to the 3.21 version.

@menu
* News-3.20.18::                Changes in release 3.20.18
* News-3.20.17::                Changes in release 3.20.17
* News-3.20.16::                Changes in release 3.20.16
* News-3.20.15::                Changes in release 3.20.15
* News-3.20.14::                Changes in release 3.20.14
* News-3.20.13::                Changes in release 3.20.13
* News-3.20.11::                Changes in release 3.20.11
* News-3.20.10::                Changes in release 3.20.10
* News-3.20.9::                 Changes in release 3.20.9
* News-3.20.8::                 Changes in release 3.20.8
* News-3.20.7::                 Changes in release 3.20.7
* News-3.20.6::                 Changes in release 3.20.6
* News-3.20.3::                 Changes in release 3.20.3
* News-3.20.0::                 Changes in releases 3.20.0
@end menu

@node News-3.20.18, News-3.20.17, News-3.20.x, News-3.20.x
@appendixsubsec Changes in release 3.20.18

@itemize @bullet
@item
Added @code{-p#} (remove @code{#} directories from path) to @code{isamlog}.
All files are written with a relative path from the database directory
Now @code{mysqld} shouldn't crash on shutdown when using the
@code{--log-isam} option.
@item
New @code{mysqlperl} version. It is now compatible with @code{msqlperl-0.63}.
@item
New @code{DBD} module available at @uref{http://www.mysql.com/Contrib}
site.
@item
Added group function @code{STD()} (standard deviation).
@item
The @code{mysqld} server is now compiled by default without debugging
information.  This will make the daemon smaller and faster.
@item
Now one usually only has to specify the @code{--basedir} option to
@code{mysqld}. All other paths are relative in a normal installation.
@item
@code{BLOB} columns sometimes contained garbage when used with a @code{SELECT}
on more than one table and @code{ORDER BY}.
@item
Fixed that calculations that are not in @code{GROUP BY} work as expected
(ANSI SQL extension).
Example:
@example
mysql> SELECT id,id+1 FROM table GROUP BY id;
@end example
@item
The test of using @code{MYSQL_PWD} was reversed. Now @code{MYSQL_PWD} is
enabled as default in the default release.
@item
Fixed conversion bug which caused @code{mysqld} to core dump with
Arithmetic error on Sparc-386.
@item
Added @code{--unbuffered} option to @code{mysql}, for new @code{mysqlaccess}.
@item
When using overlapping (unnecessary) keys and join over many tables,
the optimizer could get confused and return 0 records.
@end itemize

@node News-3.20.17, News-3.20.16, News-3.20.18, News-3.20.x
@appendixsubsec Changes in release 3.20.17

@itemize @bullet
@item
You can now use @code{BLOB} columns and the functions @code{IS NULL} and
@code{IS NOT NULL} in the @code{WHERE} clause.
@item
All communication packets and row buffers are now allocated dynamically
on demand. The default value of @code{max_allowed_packet} is now 64K for
the server and 512K for the client. This is mainly used to catch
incorrect packets that could trash all memory. The server limit may be
changed when it is started.
@item
Changed stack usage to use less memory.
@item
Changed @code{safe_mysqld} to check for running daemon.
@item
The @code{ELT()} function is renamed to @code{FIELD()}.  The new
@code{ELT()} function returns a value based on an index: @code{FIELD()}
is the inverse of @code{ELT()} Example: @code{ELT(2,"A","B","C")} returns
@code{"B"}. @code{FIELD("B","A","B","C")} returns @code{2}.
@item
@code{COUNT(field)}, where @code{field} could have a @code{NULL} value, now
works.
@item
A couple of bugs fixed in @code{SELECT ... GROUP BY}.
@item
Fixed memory overrun bug in @code{WHERE} with many unoptimizable brace levels.
@item
Fixed some small bugs in the grant code.
@item
If hostname isn't found by @code{get_hostname}, only the IP is checked.
Previously, you got @code{Access denied}.
@item
Inserts of timestamps with values didn't always work.
@item
@code{INSERT INTO ... SELECT ... WHERE} could give the error
@code{Duplicated field}.
@item
Added some tests to @code{safe_mysqld} to make it ``safer''.
@item
@code{LIKE} was case sensitive in some places and case insensitive in others.
Now @code{LIKE} is always case insensitive.
@item
@file{mysql.cc}: Allow @code{'#'} anywhere on the line.
@item
New command @code{SET OPTION SQL_SELECT_LIMIT=#}. See the FAQ for more details.
@item
New version of the @code{mysqlaccess} script.
@item
Change @code{FROM_DAYS()} and @code{WEEKDAY()} to also take a full
@code{TIMESTAMP} or @code{DATETIME} as argument. Before they only took a
number of type @code{YYYYMMDD} or @code{YYMMDD}.
@item
Added new function @code{UNIX_TIMESTAMP(timestamp_column)}.
@end itemize

@node News-3.20.16, News-3.20.15, News-3.20.17, News-3.20.x
@appendixsubsec Changes in release 3.20.16

@itemize @bullet
@item
More changes in MIT-pthreads to get them safer. Fixed also some link
bugs at least in SunOS.
@item
Changed @code{mysqld} to work around a bug in MIT-pthreads. This makes multiple
small @code{SELECT} operations 20 times faster. Now @code{lock_test.pl} should
work.
@item
Added @code{mysql_FetchHash(handle)} to @code{mysqlperl}.
@item
The @code{mysqlbug} script is now distributed built to allow for reporting
bugs that appear during the build with it.
@item
Changed @file{libmysql.c} to prefer @code{getpwuid()} instead of
@code{cuserid()}.
@item
Fixed bug in @code{SELECT} optimizer when using many tables with the same
column used as key to different tables.
@item
Added new latin2 and Russian KOI8 character tables.
@item
Added support for a dummy @code{GRANT} command to satisfy Powerbuilder.
@end itemize

@node News-3.20.15, News-3.20.14, News-3.20.16, News-3.20.x
@appendixsubsec Changes in release 3.20.15

@itemize @bullet
@item
Fixed fatal bug @code{packets out of order} when using MIT-pthreads.
@item
Removed possible loop when a thread waits for command from client
and @code{fcntl()} fails. Thanks to Mike Bretz for finding this bug.
@item
Changed alarm loop in @file{mysqld.cc} because shutdown didn't always
succeed in Linux.
@item
Removed use of @code{termbits} from @file{mysql.cc}.  This conflicted with
@code{glibc} 2.0.
@item
Fixed some syntax errors for at least BSD and Linux.
@item
Fixed bug when doing a @code{SELECT} as superuser without a database.
@item
Fixed bug when doing @code{SELECT} with group calculation to outfile.
@end itemize

@node News-3.20.14, News-3.20.13, News-3.20.15, News-3.20.x
@appendixsubsec Changes in release 3.20.14

@itemize @bullet
@item
If one gives @code{-p} or @code{--password} option to @code{mysql} without
an argument, the user is solicited for the password from the tty.
@item
Added default password from @code{MYSQL_PWD} (by Elmar Haneke).
@item
Added command @code{kill} to @code{mysqladmin} to kill a specific
@strong{MySQL} thread.
@item
Sometimes when doing a reconnect on a down connection this succeeded
first on second try.
@item
Fixed adding an @code{AUTO_INCREMENT} key with @code{ALTER_TABLE}.
@item
@code{AVG()} gave too small value on some @code{SELECT}s with
@code{GROUP BY} and @code{ORDER BY}.
@item
Added new @code{DATETIME} type (by Giovanni Maruzzelli
@email{maruzz@@matrice.it}).
@item
Fixed that define @code{DONT_USE_DEFAULT_FIELDS} works.
@item
Changed to use a thread to handle alarms instead of signals on Solaris to
avoid race conditions.
@item
Fixed default length of signed numbers. (George Harvey
@email{georgeh@@pinacl.co.uk}.)
@item
Allow anything for @code{CREATE INDEX}.
@item
Add prezeros when packing numbers to @code{DATE}, @code{TIME} and
@code{TIMESTAMP}.
@item
Fixed a bug in @code{OR} of multiple tables (gave empty set).
@item
Added many patches to MIT-pthreads. This fixes at least one lookup bug.
@end itemize

@node News-3.20.13, News-3.20.11, News-3.20.14, News-3.20.x
@appendixsubsec Changes in release 3.20.13

@itemize @bullet
@item
Added ANSI SQL94 @code{DATE} and @code{TIME} types.
@item
Fixed bug in @code{SELECT} with @code{AND}-@code{OR} levels.
@item
Added support for Slovenian characters. The @file{Contrib} directory contains
source and instructions for adding other character sets.
@item
Fixed bug with @code{LIMIT} and @code{ORDER BY}.
@item
Allow @code{ORDER BY} and @code{GROUP BY} on items that aren't in the
@code{SELECT} list.
(Thanks to Wim Bonis @email{bonis@@kiss.de}, for pointing this out.)
@item
Allow setting of timestamp values in @code{INSERT}.
@item
Fixed bug with @code{SELECT ... WHERE ... = NULL}.
@item
Added changes for @code{glibc} 2.0. To get @code{glibc} to work, you should
add the @file{gibc-2.0-sigwait-patch} before compiling @code{glibc}.
@item
Fixed bug in @code{ALTER TABLE} when changing a @code{NOT NULL} field to
allow @code{NULL} values.
@item
Added some ANSI92 synonyms as field types to @code{CREATE TABLE}.
@code{CREATE TABLE} now allows @code{FLOAT(4)} and @code{FLOAT(8)} to mean
@code{FLOAT} and @code{DOUBLE}.
@item
New utility program @code{mysqlaccess} by @email{Yves.Carlier@@rug.ac.be}.
This program shows the access rights for a specific user and the grant
rows that determine this grant.
@item
Added @code{WHERE const op field} (by @email{bonis@@kiss.de}).
@end itemize

@node News-3.20.11, News-3.20.10, News-3.20.13, News-3.20.x
@appendixsubsec Changes in release 3.20.11

@itemize @bullet
@item
When using @code{SELECT ... INTO OUTFILE}, all temporary tables are ISAM
instead of HEAP to allow big dumps.
@item
Changed date functions to be string functions. This fixed some ``funny''
side effects when sorting on dates.
@item
Extended @code{ALTER TABLE} according to SQL92.
@item
Some minor compability changes.
@item
Added @code{--port} and @code{--socket} options to all utility programs and
@code{mysqld}.
@item
Fixed MIT-pthreads @code{readdir_r()}. Now @code{mysqladmin create database}
and @code{mysqladmin drop database} should work.
@item
Changed MIT-pthreads to use our @code{tempnam()}. This should fix the ``sort
aborted'' bug.
@item
Added sync of records count in @code{sql_update}. This fixed slow updates
on first connection. (Thanks to Vaclav Bittner for the test.)
@end itemize

@node News-3.20.10, News-3.20.9, News-3.20.11, News-3.20.x
@appendixsubsec Changes in release 3.20.10

@itemize @bullet
@item
New insert type: @code{INSERT INTO ... SELECT ...}
@item
@code{MEDIUMBLOB} fixed.
@item
Fixed bug in @code{ALTER TABLE} and @code{BLOB}s.
@item
@code{SELECT ... INTO OUTFILE} now creates the file in the current
database directory.
@item
@code{DROP TABLE} now can take a list of tables.
@item
Oracle synonym @code{DESCRIBE} (@code{DESC}).
@item
Changes to @code{make_binary_distribution}.
@item
Added some comments to installation instructions about @code{configure}'s
C++ link test.
@item
Added @code{--without-perl} option to @code{configure}.
@item
Lots of small portability changes.
@end itemize

@node News-3.20.9, News-3.20.8, News-3.20.10, News-3.20.x
@appendixsubsec Changes in release 3.20.9

@itemize @bullet
@item
@code{ALTER TABLE} didn't copy null bit. As a result, fields that were allowed
to have @code{NULL} values were always @code{NULL}.
@item
@code{CREATE} didn't take numbers as @code{DEFAULT}.
@item
Some compatibility changes for SunOS.
@item
Removed @file{config.cache} from old distribution.
@end itemize

@node News-3.20.8, News-3.20.7, News-3.20.9, News-3.20.x
@appendixsubsec Changes in release 3.20.8

@itemize @bullet
@item
Fixed bug with @code{ALTER TABLE} and multi-part keys.
@end itemize

@node News-3.20.7, News-3.20.6, News-3.20.8, News-3.20.x
@appendixsubsec Changes in release 3.20.7

@itemize @bullet
@item
New commands: @code{ALTER TABLE}, @code{SELECT ... INTO OUTFILE} and
@code{LOAD DATA INFILE}.
@item
New function: @code{NOW()}.
@item
Added new field @strong{file_priv} to @code{mysql/user} table.
@item
New script @code{add_file_priv} which adds the new field @strong{file_priv}
to the @code{user} table. This script must be executed if you want to
use the new @code{SELECT ... INTO} and @code{LOAD DATA INFILE ...} commands
with a version of @strong{MySQL} earlier than 3.20.7.
@item
Fixed bug in locking code, which made @code{lock_test.pl} test fail.
@item
New files @file{NEW} and @file{BUGS}.
@item
Changed @file{select_test.c} and @file{insert_test.c} to include
@file{config.h}.
@item
Added command @code{status} to @code{mysqladmin} for short logging.
@item
Increased maximum number of keys to 16 and maximum number of key parts to 15.
@item
Use of sub keys. A key may now be a prefix of a string field.
@item
Added @code{-k} option to @code{mysqlshow}, to get key information for a table.
@item
Added long options to @code{mysqldump}.
@end itemize

@node News-3.20.6, News-3.20.3, News-3.20.7, News-3.20.x
@appendixsubsec Changes in release 3.20.6

@itemize @bullet
@item
Portable to more systems because of MIT-pthreads, which will
be used automatically if @code{configure} cannot find a @code{-lpthreads}
library.
@item
Added GNU-style long options to almost all programs. Test with
@code{@kbd{program} --help}.
@item
Some shared library support for Linux.
@item
The FAQ is now in @file{.texi} format and is available in @file{.html},
@file{.txt} and @file{.ps} formats.
@item
Added new SQL function @code{RAND([init])}.
@item
Changed @code{sql_lex} to handle @code{\0} unquoted, but the client can't send
the query through the C API, because it takes a str pointer.
You must use @code{mysql_real_query()} to send the query.
@item
Added API function @code{mysql_get_client_info()}.
@item
@code{mysqld} now uses the @code{N_MAX_KEY_LENGTH} from @file{nisam.h} as
the maximum allowed key length.
@item
The following now works:
@example
mysql> SELECT filter_nr,filter_nr FROM filter ORDER BY filter_nr;
@end example
Previously, this resulted in the error:
@code{Column: 'filter_nr' in order clause is ambiguous}.
@item
@code{mysql} now outputs @code{'\0'}, @code{'\t'}, @code{'\n'} and @code{'\\'}
when encountering ASCII 0, tab, newline or @code{'\'} while writing
tab-separated output.
This is to allow printing of binary data in a portable format.
To get the old behavior, use @code{-r} (or @code{--raw}).
@item
Added german error messages (60 of 80 error messages translated).
@item
Added new API function @code{mysql_fetch_lengths(MYSQL_RES *)}, which
returns an array of of column lengths (of type @code{uint}).
@item
Fixed bug with @code{IS NULL} in @code{WHERE} clause.
@item
Changed the optimizer a little to get better results when searching on a key
part.
@item
Added @code{SELECT} option @code{STRAIGHT_JOIN} to tell the optimizer that
it should join tables in the given order.
@item
Added support for comments starting with @code{'--'} in @file{mysql.cc}
(Postgres syntax).
@item
You can have @code{SELECT} expressions and table columns in a @code{SELECT}
which are not used in the group part. This makes it efficient to implement
lookups.  The column that is used should be a constant for each group because
the value is calculated only once for the first row that is found for a group.
@example
mysql> SELECT id,lookup.text,sum(*) FROM test,lookup
         WHERE test.id=lookup.id GROUP BY id;
@end example
@item
Fixed bug in @code{SUM(function)} (could cause a core dump).
@item
Changed @code{AUTO_INCREMENT} placement in the SQL query:
@example
INSERT into table (auto_field) values (0);
@end example
inserted 0, but it should insert an @code{AUTO_INCREMENT} value.
@item
@file{mysqlshow.c}: Added number of records in table. Had to change the
client code a little to fix this.
@item
@code{mysql} now allows doubled @code{''} or @code{""} within strings for
embedded @code{'} or @code{"}.
@item
New math functions:
@code{EXP()}, @code{LOG()}, @code{SQRT()}, @code{ROUND()}, @code{CEILING()}.
@end itemize

@node News-3.20.3, News-3.20.0, News-3.20.6, News-3.20.x
@appendixsubsec Changes in release 3.20.3

@itemize @bullet
@item
The @code{configure} source now compiles a thread-free client library
@code{-lmysqlclient}. This is the only library that needs to be linked
with client applications.  When using the binary releases, you must
link with @code{-lmysql -lmysys -ldbug -lstrings} as before.
@item
New @code{readline} library from @code{bash-2.0}.
@item
LOTS of small changes to @code{configure} and makefiles (and related source).
@item
It should now be possible to compile in another directory using
@code{VPATH}. Tested with GNU Make 3.75.
@item
@code{safe_mysqld} and @code{mysql.server} changed to be more compatible
between the source and the binary releases.
@item
@code{LIMIT} now takes one or two numeric arguments.
If one argument is given, it indicates the maximum number of rows in
a result. If two arguments are given, the first argument indicates the offset
of the first row to return, the second is the maximum number of rows.
With this it's easy to do a poor man's next page/previous page WWW
application.
@item
Changed name of SQL function @code{FIELDS()} to @code{ELT()}.
Changed SQL function @code{INTERVALL()} to @code{INTERVAL()}.
@item
Made @code{SHOW COLUMNS} a synonym for @code{SHOW FIELDS}.
Added compatibility syntax @code{FRIEND KEY} to @code{CREATE TABLE}. In
@strong{MySQL}, this creates a non-unique key on the given columns.
@item
Added @code{CREATE INDEX} and @code{DROP INDEX} as compatibility functions.
In @strong{MySQL}, @code{CREATE INDEX} only checks if the index exists and
issues an error if it doesn't exist. @code{DROP INDEX} always succeeds.
@item
@file{mysqladmin.c}: added client version to version information.
@item
Fixed core dump bug in @code{sql_acl} (core on new connection).
@item
Removed @code{host}, @code{user} and @code{db} tables from database @code{test}
in the distribution.
@item
@code{FIELD_TYPE_CHAR} can now be signed (-128 - 127) or unsigned (0 - 255)
Previously, it was always unsigned.
@item
Bug fixes in @code{CONCAT()} and @code{WEEKDAY()}.
@item
Changed a lot of source to get @code{mysqld} to be compiled with SunPro
compiler.
@item
SQL functions must now have a @code{'('} immediately after the function name
(no intervening space).
For example, @code{'user('} is regarded as beginning a function call, and
@code{'user ('} is regarded as an identifier @code{user} followed by a
@code{'('}, not as a function call.
@end itemize

@node News-3.20.0,  , News-3.20.3, News-3.20.x
@appendixsubsec Changes in release 3.20.0

@itemize @bullet
@item
The source distribution is done with @code{configure} and Automake.
It will make porting much easier.  The @code{readline} library is included
in the distribution.
@item
Separate client compilation:
the client code should be very easy to compile on systems which
don't have threads.
@item
The old Perl interface code is automatically compiled and installed.
Automatic compiling of @code{DBD} will follow when the new @code{DBD} code
is ported.
@item
Dynamic language support: @code{mysqld} can now be started with Swedish
or English (default) error messages.
@item
New functions: @code{INSERT()}, @code{RTRIM()}, @code{LTRIM()} and
@code{FORMAT()}.
@item
@code{mysqldump} now works correctly for all field types (even
@code{AUTO_INCREMENT}). The format for @code{SHOW FIELDS FROM tbl_name}
is changed so the @code{Type} column contains information suitable for
@code{CREATE TABLE}.  In previous releases, some @code{CREATE TABLE}
information had to be patched when recreating tables.
@item
Some parser bugs from 3.19.5 (@code{BLOB} and @code{TIMESTAMP}) are corrected.
@code{TIMESTAMP} now returns different date information depending on its
create length.
@item
Changed parser to allow a database, table or field name to
start with a number or @code{'_'}.
@item
All old C code from Unireg changed to C++ and cleaned up. This makes
the daemon a little smaller and easier to understand.
@item
A lot of small bug fixes done.
@item
New @file{INSTALL} files (not final version) and some info regarding porting.
@end itemize

@node News-3.19.x,  , News-3.20.x, News
@appendixsec Changes in release 3.19.x

@menu
* News-3.19.5::                 Changes in release 3.19.5
* News-3.19.4::                 Changes in release 3.19.4
* News-3.19.3::                 Changes in release 3.19.3
@end menu

@node News-3.19.5, News-3.19.4, News-3.19.x, News-3.19.x
@appendixsubsec Changes in release 3.19.5

@itemize @bullet
@item
Some new functions, some more optimization on joins.
@item
Should now compile clean on Linux (2.0.x).
@item
Added functions @code{DATABASE()}, @code{USER()}, @code{POW()},
@code{LOG10()} (needed for ODBC).
@item
In a @code{WHERE} with an @code{ORDER BY} on fields from only one table,
the table is now preferred as first table in a multi-join.
@item
@code{HAVING} and @code{IS NULL} or @code{IS NOT NULL} now works.
@item
A group on one column and a sort on a group function (@code{SUM()},
@code{AVG()}...) didn't work together. Fixed.
@item
@code{mysqldump}: Didn't send password to server.
@end itemize

@node News-3.19.4, News-3.19.3, News-3.19.5, News-3.19.x
@appendixsubsec Changes in release 3.19.4

@itemize @bullet
@item
Fixed horrible locking bug when inserting in one thread and reading
in another thread.
@item
Fixed one-off decimal bug.  1.00 was output as 1.0.
@item
Added attribute @code{'Locked'} to process list as info if a query is
locked by another query.
@item
Fixed full magic timestamp. Timestamp length may now be 14, 12, 10, 8, 6, 4
or 2 bytes.
@item
Sort on some numeric functions could sort incorrectly on last number.
@item
@code{IF(arg,syntax_error,syntax_error)} crashed.
@item
Added functions @code{CEILING()}, @code{ROUND()}, @code{EXP()}, @code{LOG()} and @code{SQRT()}.
@item
Enhanced @code{BETWEEN} to handle strings.
@end itemize

@node News-3.19.3,  , News-3.19.4, News-3.19.x
@appendixsubsec Changes in release 3.19.3

@itemize @bullet
@item
Fixed @code{SELECT} with grouping on @code{BLOB} columns not to return
incorrect @code{BLOB} info. Grouping, sorting and distinct on @code{BLOB}
columns will not yet work as
expected (probably it will group/sort by the first 7 characters in the
@code{BLOB}). Grouping on formulas with a fixed string size (use @code{MID()}
on a @code{BLOB}) should work.
@item
When doing a full join (no direct keys) on multiple tables with @code{BLOB}
fields, the @code{BLOB} was garbage on output.
@item
Fixed @code{DISTINCT} with calculated columns.
@end itemize

@node Bugs, TODO, News, Top
@appendix MySQL �Ǥδ��ΤΥ��顼�ȷ礱�Ƥ���ǥ�����

@itemize @bullet
@item
MIT-pthread ����Ѥ���Ȥ���¾�Υǥ��쥯�ȥ�ǥӥ�ɽ���ޤ���
����� MIT-pthread ���ѹ����׵᤹�뤿�ᡢ�桹�ϡ���������������ˤʤ��Ǥ���
@item
@code{BLOB} values can't ``reliably'' be used in @code{GROUP BY} or
@code{ORDER BY} or @code{DISTINCT}. 
�����ξ�硢 @code{BLOB} ����ӤκݤˤϺǽ�� @code{max_sort_length} �Х���
�ʥǥե����1024�ˤ��������Ѥ���ޤ���
����� @code{mysqld} �� @code{-O max_sort_length} ���ץ������ѹ���ǽ�Ǥ���
A workaround for most cases is to use a substring:
@code{SELECT DISTINCT LEFT(blob,2048) FROM tbl_name}.
@item
Calculation is done with @code{BIGINT} or @code{DOUBLE} (both are
normally 64 bits long). It depends on the function which precision one
gets. The general rule is that bit functions are done with @code{BIGINT}
precision, @code{IF}, and @code{ELT()} with @code{BIGINT} or @code{DOUBLE}
precision and the rest with @code{DOUBLE} precision.  One should try to
avoid using bigger unsigned long long values than 63 bits
(9223372036854775807) for anything else than bit fields!
@item
���Ƥ�ʸ�����Υե�����ɡ�@code{BLOB} �� @code{TEXT} �ϤΤ����ơ��ϡ�
���������Ȥ��˺Ǹ�ˤĤ��Ƥ��륹�ڡ�����ư�Ǽ������ޤ���
 @code{CHAR} ���ǤϤ���� OK �ǡ�������ħ�� ANSI SQL92 �˽��äƤ���ȸ��ʤ����Ǥ��礦��
@strong{MySQL} �ΥХ��ϡ� @code{VARCHAR} �Ǥ�Ʊ�ͤ˹ԤäƤ��ޤ����ȤǤ���
@item
��ĤΥơ��֥�� @code{ENUM} �� @code{SET} �ե�����ɤ� 255 �ޤǤ������Ƥޤ���
@item
@code{safe_mysqld} re-directs all messages from @code{mysqld} to the
@code{mysqld} log.  One problem with this is that if you execute
@code{mysqladmin refresh} to close and reopen the log,
@code{stdout} and @code{stderr} are still redirected to the old log.
If you use @code{--log} extensively, you should edit @code{safe_mysqld} to
log to @file{'hostname'.err} instead of @file{'hostname'.log} so you can
easily reclaim the space for the old log by deleting the old one and
executing @code{mysqladmin refresh}.
@item
In the @code{UPDATE} statement, columns are updated from left to right.
If you refer to a updated column, you will get the updated value instead of the
original value. For example:
@example
mysql> UPDATE tbl_name SET KEY=KEY+1,KEY=KEY+1
@end example
will update @code{KEY} with @code{2} instead of with @code{1}.
@item
You can't use temporary tables more than once in the same query.

@example
select * from temporary_table, temporary_table as t2;
@end example

@item
Because @strong{MySQL} allows you to work with table types that doesn't
support transactions (and thus can't @code{rollback} data) some things
behaves a little different in @strong{MySQL} than in other SQL servers:
(This is just to ensure that @strong{MySQL} never need to do a rollback
for a SQL command).  This may be a little akward at times as column
values must be checked in the application, but this will actually give
you a nice speed increase as it allows @strong{MySQL} to do some
optimizations that otherwice would be hard to do.

If you set a colum to a wrong value, @strong{MySQL} will instead of doing
a rollback instead store the @code{best possible value} in the column.

@itemize @bullet
@item
If you try to store a value outside of the range in a numerical column,
@strong{MySQL} will instead store the smallest or biggest possible value in
the column.
@item
If you try to store a string, that doesn't start with a number, into a
numerical column @strong{MySQL} will store 0 into it.
@item
If you try to to store @code{NULL} into a column that doesn't take
@code{NULL} values, @code{MySQL} will store 0 or @code{''} (empty
string) in it instead. (This behavour can however be changed with the
-DDONT_USE_DEFAULT_FIELDS compile option).
@item
@strong{MySQL} allows you to store some wrong date values into
@code{DATE} and @code{DATETIME} columns. (Like 2000-02-31 or 2000-02-00).
If the date is totally wrong, @strong{MySQL} will store the special
0000-00-00 date value in the column.
@item
If you set an @code{enum} to an not supported value, it will be set to
the error value 'empty string', with numeric value 0.
@end itemize
@item
If you execute a @code{PROCEDURE} on a query with returns an empty set then
in some cases the @code{PROCEDURE} will not transform the columns.
@end itemize

The following is known bugs in earlier versions of @strong{MySQL}:

@itemize @bullet
@item
You can get a hanged thread if you do a @code{DROP TABLE} on a table that is
one among many tables that is locked with @code{LOCK TABLES}.

@item
In the following case you can get a core dump:
@enumerate
@item
Delayed insert handler has pending inserts to a table.
@item
@code{LOCK table} with @code{WRITE}
@item
@code{FLUSH TABLES}
@end enumerate

@item
Before @strong{MySQL} 3.23.2 an @code{UPDATE} that updated a key with
a @code{WHERE} on the same key may have failed because the key was used to
search for records and the same row may have been found multiple times:

@example
UPDATE tbl_name SET KEY=KEY+1 WHERE KEY > 100;
@end example

A workaround is to use:

@example
mysql> UPDATE tbl_name SET KEY=KEY+1 WHERE KEY+0 > 100;
@end example

This will work because @strong{MySQL} will not use index on expressions in
the @code{WHERE} clause.
@item
@strong{MySQL} 3.23 ������Ǥϡ����Ƥο��ͷ��ǡ�������ʬ������Ƥ��ޤ��ޤ���
����ϡ����Υե�����ɤ�����ξ���������Ĥ���������ʤ���Фʤ�ʤ��ä�����
�������ȤǤ��� ���Ƥη�̤�10�ʤο����������֤äƤ��ޤ�����
@end itemize

For platform-specific bugs, see the sections about compiling and porting.

@cindex TODO
@node TODO, Porting, Bugs, Top
@appendix MySQL �˾���ä�������� (The TODO)

@menu
* TODO future::                 Things that must done in the very near future
* TODO sometime::               Things that have to be done sometime
* TODO unplanned::              Some things we don't have any plans to do
@end menu

���Υꥹ�ȤΤ��٤Ƥϡ����줬�������������֤˽񤫤�Ƥ��ޤ���
�⤷���ʤ���ͥ���̤˱ƶ���ڤܤ�������С��ɤ����饤���󥹤����ݡ�����Ͽ���ơ�
�桹�ˤ��ʤ������®���ߤ�����Τ���äƤ���������
@xref{Licensing and Support}.

@node TODO future, TODO sometime, TODO, TODO
@appendixsec �ᤤ����˴�λ���ͤФʤ�ʤ����

@itemize @bullet
@item
Fail safe replication.
@item
Optimize, test and document transactions safe tables
@item
���䤤��碌�� @code{select id from t where grp in (select grp from g where u > 100)}
@item
mysqld �ˡ�Ʊ����¿���Υ���饯�������åȤ򥵥ݡ��Ȥ�����
@item
�⤷¾�� disk �� symlink ����Ƥ���ơ��֥���Ф��� @code{ALTER TABLE} ��
�¹Ԥ�����硢����ơ��֥�򤳤� disk �˺�������褦�ˤ���
@item
@code{RENAME table as table, table as table [,...]}
@item
Allow users to change startup options.
@item
FreeBSD and MIT-pthreads;  Do sleeping threads take CPU?
@item
Check if locked threads take any CPU.
@item
Change to use mkstemp() instead of tempnam() for system that supports the call.
We need to add a my_mkstemp() function in mysys and also change the cache
code to not create the filename until we do the actual open.
@item
��������ʬ�Ǥ� JOIN ����� (��Ŭ������)
@item
Entry for @code{DECRYPT()}.
@item
 @file{.frm} �ե������ @code{FOREIGN} ����������򵭲����롣
@item
�����С������ɤΥ�������
@item
Check if @code{lockd} works with modern Linux kernels; If not, we have
to fix @code{lockd}!  To test this, start @code{mysqld} with
@code{--enable-locking} and run the different fork* test suits. They shouldn't
give any errors if @code{lockd} works.
@item
Allow SQL variables in @code{LIMIT}, like in @code{LIMIT @@a,@@b}.
@item
��ư�� @code{DEFAULT} �ͤ�ե�����ɤ��ɲä��ʤ���
@code{DEFAULT} ������ʤ��ե�����ɤ�ޤޤʤ�  @code{INSERT} �λ��Ѥ�
���顼�ˤ���
@item
�����꡼�ȷ�̤Υ���å��塣
This should be done as a separated
module that examines each query and if this is query is in the cache
the cached result should be returned.  When one updates a table one
should remove as few queries as possible from the cache.
This should give a big speed bost on machines with much RAM where
queries are often repeated (like WWW applications).
One idea would be to only cache queries of type:
@code{SELECT CACHED ....}
@item
Fix @file{libmysql.c} to allow two @code{mysql_query()} commands in a row
without reading results or give a nice error message when one does this.
@item
@code{BIT} ���� 1 bit ���褦�˺�Ŭ�� �ʺ� @code{BIT} �ϰ�ʸ���Ȥ�ޤ���
@item
�ʤ������Ĥ��� FreeBSD �����ƥ�� MIT-pthreads @code{ctime()} ��ư���ʤ������ڡ�
@item
Check if locked threads take any CPU.
@item
������ @code{ORDER BY} ���ɲá� This would be handy with functions like:
@code{generate_id(start,step)}.
@item
@code{TIMESTAMP} �� @code{AUTO_INCREMENT} �ե�����ɤ򹹿����ʤ��褦�ˡ�
 @code{IMAGE} ���ץ����� @code{LOAD DATA INFILE} ���ɲá�
@item
@code{LOAD DATA INFILE} �˰ʲ���ʸ�����򤵤��롧
@example
LOAD DATA INFILE 'file_name.txt' INTO TABLE tbl_name
TEXT_FIELDS (text_field1, text_field2, text_field3)
SET table_field1=concatenate(text_field1, text_field2), table_field3=23
IGNORE text_field3
@end example
@item
������ @code{VARCHAR} �Υ��ݡ��� (MyISAM �ˤϤ��Υ��ݡ��Ȥ����ˤ���ޤ�)
@item
 @code{mysql} ���鼫ưŪ�� netscape �˽���
@item
@code{LOCK DATABASES}. (���������ʥ��ץ�����դ���)
@item
@code{NATURAL JOIN}.
@item
Change sort to allocate memory in ``hunks'' to get better memory utilization.
@item
@code{DECIMAL} �� @code{NUMERIC} ���� �ؿ�ɽ���ο������ɤळ�Ȥ�����ޤ���
�����������ˤϡ�
@code{Field_decimal::store(const char *from,uint len)} ��ƥ����ɤ��ʤ��ƤϤʤ�ޤ���
@item
Fix @code{mysql.cc} to do fewer @code{malloc()} calls when hashing field
names.
@item
�ؿ���
ADD_TO_SET(value,set) �� REMOVE_FROM_SET(value,set)
@item
@code{t1 JOIN t2 ON ...} �� @code{t1 JOIN t2 USING ...} �λ��Ѥ��ɲá�
���ߡ� @code{LEFT JOIN} �Τߤ����ѤǤ��ޤ���
@item
@code{unsigned long long} ���δ����ʥ��ݡ��ȡ�
@item
@code{CASE} �ؿ�
@item
@code{show status} �ˤ�ä�¿�����ѿ��� 
@code{INSERT}/@code{DELETE}/@code{UPDATE} ʸ�Υ�����ȡ�
 �쥳���ɤ��ɤ߹��ߤȹ����Υ�����ȡ�
 1�ơ��֥�Ǥ�SELECT��JOIN��ȼ�ä�SELECT�Υ�����ȡ�
 SELECT ��Υơ��֥�ο��Υ�����ȡ�
 �����Хåե��� reaad/write �Υҥåȿ�(�����ͤȼ¿�)�Υ�����ȡ�
 @code{ORDER BY}, @code{GROUP BY}, ����ơ��֥�κ����Υ������
@item
�⤷������������ @code{mysql} �����Ǥ�����硢���ʤ���¾������³����
���äƤ��륯����� kill ���ʤ��ƤϤʤ�ޤ���
�ǽ�Ū�ˤϡ��������ä����Ȥϥ����С���Ǹ��Τ����褦�˻�ߤ�٤��Ǥ���
@item
�ơ��֥�ξ���Τ���Υϥ�ɥ顼���󥿡��ե��������ɲá�
 ����򥷥��ƥ�ơ��֥�Ȥ��ƻȤ���褦�ˡ�
����Ϥ⤷���ʤ������٤ƤΥơ��֥�ˤĤ��ƾ����ꥯ�����Ȥ�������
�����٤��ʤ�Ǥ��礦�� �������ȤƤ������������ޤ��� 
����Ū�ʥơ��֥�ؤ� @code{SHOW INFO FROM tbl_name} �Ǥϼ¹Ԥ����٤��Ǥ���
@item
UNICODE �Υ��ݡ���
@item
@code{NATURAL JOIN}.
@item
Oracle like @code{CONNECT BY PRIOR ...} to search hierarchy structures.
@item
@code{RENAME DATABASE}
@item
@code{mysqladmin copy database new-database}.
@item
Processlist �� queries/thread �ο���ɽ�����٤���
@item
@code{DELETE} �� @code{REPLACE} ���ץ����� @code{UPDATE} ʸ���ɲá� (
����Ϲ�����˵����ä������ν�ʣ���顼�Τ���쥳���ɤ�
���ƺ������Ǥ��礦).
@item
Change the format of @code{DATETIME} to store fractions of seconds.
@item
ANSI92 �� ODBC 3.0 ���Ǥ����Ƥ���ʪ���Ƥ��ɲá�
@item
Change table names from empty strings to @code{NULL} for calculated columns.
@item
Don't use 'Item_copy_string' on numerical values to avoid
number->string->number conversion in case of:
@code{SELECT COUNT(*)*(id+0) FROM table_name GROUP BY id}
@item
Make it possible to use the new GNU regexp library instead of the current
one (The GNU library should be much faster than the old one).
@item
Change that @code{ALTER TABLE} doesn't abort clients that executes
@code{INSERT DELAYED}.
@item
Allow @code{select a from crash_me left join crash_me2 using (a)}; In this
case a is assumed to come from the crash_me table.
@item
@code{LOAD DATA INFILE 'file_name' INTO TABLE 'table_name' ERRORS TO err_table_name}
which would cause any errors/warnings to be logged into the err_table_name
table. That table would have a structure like:

line_number    - line number in data file
error_message  - the error/warning message
and maybe
       data_line      - the line from the data file
@item
Fix that when columns referenced in an @code{UPDATE} clause contains the old
values before the update started.
@item
Allow update of varibles in @code{UPDATE} statements. For example:
@code{UPDATE TABLE foo SET @@a=a+b,a=@@a, b=@@a+c}
@item
@code{myisamchk}, @code{REPAIR} and @code{OPTIMIZE TABLE} should be able
to handle cases where the data and/or index files are symbolic links.
@item
Add simulation of @code{pread()}/@code{pwrite()} on windows to enable
concurrent inserts.
@end itemize

@node TODO sometime, TODO unplanned, TODO future, TODO
@appendixsec ���Ĥ��ϹԤ��٤����

@itemize @bullet
@item
Implement function: @code{get_changed_tables(timeout,table1,table2,...)}
@item
Atomic updates; This includes a language that one can even use for
a set of stored procedures.
@item
@code{update items,month set items.price=month.price where items.id=month.id;}
@item
Change reading through tables to use memmap when possible. Now only
compressed tables use memmap.
@item
Add a new privilege @strong{'Show_priv'} for @code{SHOW} commands.
@item
Make the automatic timestamp code nicer.  Add timestamps to the update
log with @code{SET TIMESTAMP=#;}
@item
Use read/write mutex in some places to get more speed.
@item
Full foreign key support. One probably wants to implement a procedural
language first.
@item
Simple views (first on one table, later on any expression).
@item
Automatically close some tables if a table, temporary table or temporary files
gets error 23 (not enough open files).
@item
When one finds a field=#, change all occurrences of field to #.  Now this
is only done for some simple cases.
@item
Change all const expressions with calculated expressions if possible.
@item
Optimize key = expression. At the moment only key = field or key =
constant are optimized.
@item
Join some of the copy functions for nicer code.
@item
Change @file{sql_yacc.yy} to an inline parser to reduce its size and get
better error messages (5 days).
@item
Change the parser to use only one rule per different number of arguments
in function.
@item
Use of full calculation names in the order part. (For ACCESS97)
@item
@code{UNION}, @code{MINUS}, @code{INTERSECT} and @code{FULL OUTER JOIN}.
(Currently only @code{LEFT OUTER JOIN} is supported)
@item
Allow @code{UNIQUE} on fields that can be @code{NULL}.
@item
@code{SQL_OPTION MAX_SELECT_TIME=#} to put a time limit on a query.
@item
Make the update log to a database.
@item
Negative @code{LIMIT} to retrieve data from the end.
@item
Alarm around client connect/read/write functions.
@item
Make a @code{mysqld} version which isn't multithreaded (3-5 days).
@item
Please note the changes to @code{safe_mysqld}: according to FSSTND (which
Debian tries to follow) PID files should go into @file{/var/run/<progname>.pid}
and log files into @file{/var/log}. It would be nice if you could put the
"DATADIR" in the first declaration of "pidfile" and "log", so the
placement of these files can be changed with a single statement.
@item
Better dynamic record layout to avoid fragmentation.
@item
@code{UPDATE SET blob=read_blob_from_file('my_gif') where id=1;}
@item
Allow a client to request logging.
@item
Add use of @code{zlib()} for @code{gzip}-ed files to @code{LOAD DATA INFILE}.
@item
Fix sorting and grouping of @code{BLOB} columns (partly solved now).
@item
Stored procedures.  This is currently not regarded to be very
important as stored procedures are not very standardized yet.
Another problem is that true stored procedures make it much harder for
the optimizer and in many cases the result is slower than before
We will, on the other hand, add a simple (atomic) update language that
can be used to write loops and such in the @strong{MySQL} server.
@item
Change to use semaphores when counting threads.  One should first implement
a semaphore library to MIT-pthreads.
@item
Don't assign a new @code{AUTO_INCREMENT} value when one sets a column to 0.
Use @code{NULL} instead.
@item
Add full support for @code{JOIN} with parentheses.
@item
Reuse threads for systems with a lot of connections.
@item
As an alternative for one thread / connection manage a pool of threads
to handle the queries.
@item
Allow one to get more than one lock with @code{GET_LOCK}.  When doing this,
one must also handle the possible deadlocks this change will introduce.
@end itemize

Time is given according to amount of work, not real time. TcX's main
business is the use of @strong{MySQL} not the development of it. But
because TcX is a very flexible company, we have put a lot of resources
into the development of @strong{MySQL}.

@node TODO unplanned,  , TODO sometime, TODO
@appendixsec �Ԥ�ͽ��Τʤ�ʪ

@itemize @bullet
@item
Nothing;  In the long run we plan to be fully ANSI 92 / ANSI 99 compliant.
@end itemize

@node Porting, Regexp, TODO, Top
@appendix ¾�Υ����ƥ�ؤΰܿ��ˤĤ���

A working Posix thread library is needed for the server. On Solaris 2.5
we use Sun PThreads (the native thread support in 2.4 and earlier
versions are not good enough) and on Linux we use LinuxThreads by Xavier
Leroy, @email{Xavier.Leroy@@inria.fr}.

The hard part of porting to a new Unix variant without good native
thread support is probably to port MIT-pthreads. See
@file{mit-pthreads/README} and
@uref{http://www.humanfactor.com/pthreads/, Programming POSIX Threads}.

The @strong{MySQL} distribution includes a patched version of
Provenzano's Pthreads from MIT (see
@uref{http://www.mit.edu:8001/people/proven/pthreads.html, MIT Pthreads
web page}). This can be used for some operating systems that do not
have POSIX threads.

It is also possible to use another user level thread package named
FSU Pthreads (see
@uref{http://www.informatik.hu-berlin.de/~mueller/pthreads.html, FSU Pthreads
home page}). This implementation is being used for the SCO port.

See the @file{thr_lock.c} and @file{thr_alarm.c} programs in the @file{mysys}
directory for some tests/examples of these problems.

Both the server and the client need a working C++ compiler (we use @code{gcc}
and have tried SparcWorks). Another compiler that is known to work is the
Irix @code{cc}.

To compile only the client use @code{./configure --without-server}.

There is currently no support for only compiling the server, nor is it
likly to be added unless someone has a good reason for it.

If you want/need to change any @file{Makefile} or the configure script you must
get Automake and Autoconf. We have used the @code{automake-1.2} and
@code{autoconf-2.12} distributions.

All steps needed to remake everything from the most basic files.

@example
/bin/rm */.deps/*.P
/bin/rm -f config.cache
aclocal
autoheader
aclocal
automake
autoconf
./configure --with-debug --prefix='your installation directory'

# The makefiles generated above need GNU make 3.75 or newer.
# (called gmake below)
gmake clean all install init-db
@end example

If you run into problems with a new port, you may have to do some debugging
of @strong{MySQL}!
@xref{Debugging server}.

@strong{Note:} Before you start debugging @code{mysqld}, first get the test
programs @code{mysys/thr_alarm} and @code{mysys/thr_lock} to work.  This
will ensure that your thread installation has even a remote chance to work!

@menu
* Debugging server::            Debugging a @strong{MySQL} server
* Debugging client::            Debugging a @strong{MySQL} client
* RTS-threads::                 Comments about RTS threads
* Thread packages::             Differences between different thread packages
@end menu

@node Debugging server, Debugging client, Porting, Porting
@appendixsec MySQL server �ΥǥХå�

�⤷���ʤ��� @strong{MySQL} �ΤȤƤ⿷�������뵡ǽ��ȤäƤ����硢
 @code{--skip-new} (���������������������Ū�˴����ʵ�ǽ��̵���ˤ��ޤ�)
�ޤ���  @code{--safe-mode} (�������������������뤫�⤷��ʤ�¿���κ�Ŭ����̵���ˤ��ޤ�)
���ץ����� mysqld ��¹Ԥ����뤳�Ȥ��Ǥ��ޤ���
@xref{Crashing}.

�⤷ @code{mysqld} ����ư���ʤ��褦�ʤ顢 @code{my.cnf} ��̵���������å����Ƥ���������
@code{my.cnf} �ΰ����� @code{mysqld --print-defaults} �ǥ����å��Ǥ��ޤ���
�ޤ� @code{mysqld --no-defaults ...} �ǵ�ư���뤳�Ȥˤ�ꡢ
 @code{my.cnf} ��̵�뤹�뤳�Ȥ���ǽ�Ǥ���

�⤷����ȤƤ��ü�����꤬����С����ʤ��ϡ����Ĥ� @strong{MySQL} ��
�ǥХå�����褦��ߤ뤳�Ȥ��Ǥ��ޤ��� �����Ԥ��ˤϡ� @strong{MySQL} ��
 @code{--with-debug} ���ץ�����դ��� configure ���ʤ��ƤϤʤ�ޤ���
@strong{MySQL} ���ǥХå��󥰤�ͭ���ˤ��ƥ���ѥ��뤵��Ƥ��뤫��
�Τ�ˤϡ� @code{mysqld --help} �Ȥ��ޤ��� �⤷ @code{--debug} �ե饰��
�ꥹ�Ȥ���Ƥ���ХǥХå���ͭ���Ǥ��� @code{mysqladmin ver} ��
@code{mysqld} �ΥС�������ꥹ�ȤǤ��ޤ��� ���ξ���
 @code{mysql ... -debug} �ȡ��С�������ֹ��ɽ�������Ǥ��礦��

gcc �� egcs �ξ�硢�侩���� configure �Υ饤��ϡ�

@example
CC=gcc CFLAGS="-O6" CXX=gcc CXXFLAGS="-O6 -felide-constructors -fno-exceptions -fno-rtti" ./configure --prefix=/usr/local/mysql --with-debug
@end example

����� @code{libstdc++} �饤�֥��� C++ ���㳰�ˤ��������򤱤뤳�Ȥ������Ǥ��礦��
(many compilers have problems with C++ exceptions in threaded
code).

If @code{mysqld} stops crashing when you compile it with
@code{--with-debug}, you have probably found a compiler bug or a timing
bug within @strong{MySQL}.  In this case you can try to add @code{-g} to
the @code{CFLAGS} and @code{CXXFLAGS} variables above and not use
@code{--with-debug}. If @code{mysqld} now dies, you can at least
attach to it with @code{gdb} or use @code{gdb} on the core file to find out what happened.

�⤷ @code{mysqld} �����С��Υ���å����ľ�˰������������Ȥ��Ǥ���ʤ顢
���ʤ��Ϥ��Υȥ졼���ե������������뤳�Ȥ��Ǥ��ޤ���

@code{mysqld} �����С���ȥ졼�������ե����� @file{/tmp/mysql.trace} ���ץ����ǵ�ư��
���Υ����ե�����ϤȤƤ��礭���ʤ�ޤ���

@code{mysqld --debug --log}

��

@code{mysqld --debug=d,info,error,query,general,where:O,/tmp/mysql.trace}

����Ͻ��פʥ����Τߤ���Ϥ��ޤ���

 @strong{MySQL} ��ǥХå��� configure ����ȡ���ư��¿���ΰ����ʸ����ؿ���
enable �ˤʤ�ޤ��� �����  @code{mysqld} �ξ��֤��˥����Ǥ��ޤ���
�⤷�����ؿ����ʤˤ� ``ͽ�����̤���'' ��ȯ�������顢������
@code{stderr} �˽񤭽Ф��ޤ��� ����� @code{safe_mysqld} ��������ä� error ������
�񤭽Ф��ޤ��� ���Τ��ȤϤɤ��������Ȥ��Ȥ����ȡ� @strong{MySQL} ��ͽ�����̤��Ȥ�
��������硢�ޤ��ǽ�ˤ��٤����Ȥϡ� @strong{MySQL} ��ǥХå�ͭ���ˤ���
configure ���뤳�ȤǤ��� �ʼ��ˡ�������� @email{mysql@@lists.mysql.com} ��
�᡼������ꡢhelp ��ʹ�����ȤǤ��� ���ƤΥХ���ݡ��ȡ�@strong{MySQL} �ΥС�������
��Ϣ�������ϡ� @code{mysqlbug} ������ץȤ���Ѥ��Ƥ�����������

�ۤȤ�ɤΥ����ƥ�Ǥϡ��⤷ @code{mysqld} ������å��夹��ʤ顢
 @code{gdb} ���� @code{mysqld} ��ư������¿���ξ�������뤳�Ȥ���ǽ�Ǥ���

Linux ��ǤΤ����Ĥ��� @code{gdb} �С������Ǥϡ�
 @code{mysqld} ����åɤΥǥХå����ǽ�ˤ����硢
 @code{run --one-thread} ����Ѥ��ʤ��ƤϤʤ�ޤ���
���ξ�硢���٤ˤ�����Ĥ�active�ʥ���åɤ�������Ĥ��Ȥˤʤ�ޤ���

It's very hard to debug @strong{MySQL} under @code{gdb} if you do a lot of
new connections the whole time as @code{gdb} doesn't free the memory for
old threads.  You can avoid this problem by starting @code{mysqld} with
@code{-O thread_cache_size= 'max_connections +1'}.  In most cases just
using @code{-O thread_cache_size= 5'} will help a lot!

�⤷ Linux ��� gdb 4.17.x ����Ѥ��Ƥ���ʤ顢 @file{.gdb} �ե������
�����ˤ������äơ������ȤΥǥ��쥯�ȥ꡼�˥��󥹥ȡ��뤹�٤��Ǥ���

@example
set print sevenbit off
handle SIGUSR1 nostop noprint
handle SIGUSR2 nostop noprint
handle SIGWAITING nostop noprint
handle SIGLWP nostop noprint
handle SIGPIPE nostop
handle SIGALRM nostop
handle SIGHUP nostop
handle SIGTERM nostop noprint
@end example

If you have problems debugging threads with gdb, you should download
gdb 5.x and try this instead. The new gdb version has very improved
thread handling!

�ʲ��� mysqld �ΥǥХå���Ǥ���

@example
shell> gdb /usr/local/libexec/mysqld
gdb> run
...
back   # mysqld ������å��夷���ݡ������Ԥ��ޤ�
info locals
up
info locals
up
...
(until you get some information about local variables)

quit
@end example

�嵭�ν��Ϥ� @code{mysqlbug} �Ǻ��������᡼��˴ޤߡ�
������ @code{mysql@@lists.mysql.com}. �����äƤ���������

�⤷ @code{mysqld} ���ϥ󥰤���ʤ顢
 @code{strace} �� @code{/usr/proc/bin/pstack} �Τ褦��
�����ƥ�ġ������Ѥ��� @code{mysqld} ���ɤ��ǥϥ󥰤��Ƥ��뤫
Ĵ�٤뤳�Ȥ��Ǥ��ޤ���

�⤷ @code{mysqld} �� CPU �� ���꡼ �򿩤��Ϥ᤿�ꡢ``�ϥ�'' �����ꤹ��ʤ顢
 @code{mysqladmin processlist status} ����Ѥ���ï����¿���λ��֤Τ�����
�������¹Ԥ��Ƥ��뤫�Τ���뤳�Ȥ�����ޤ���
�ѥե����ޥ󥹤�����俷�������饤����Ȥ���³�Ǥ��ʤ��Ȥ��������
�⤷���ʤ����ͤ���ʤ顢
�����Ĥ��Υ�����ɥ��� @code{mysqladmin -i10 processlist status} ��
�¹Ԥ���ΤϤ褤�ͤ��Ǥ��礦�� 

�⤷ @code{mysqld} ��������ϥ󥰤����ꤹ��ʤ顢 @code{mysqld} ��
@code{--log} �ǵ�ư���٤��Ǥ��� �Ƥ� @code{mysqld} �������顢
���ʤ��ϥ����ե�������Ρ� @code{mysqld} �� kill ���륯���������å����ޤ���
@code{mysqld} �� @code{--log} ���ץ����ǵ�ư�������ˡ�
���ƤΥơ��֥�� @code{myisamchk} �ǥ����å����٤��Ǥ���
�����Υ���å�����˥ơ��֥뤬����Ƥ��뤫�⤷��ʤ��Τǡ�
@xref{Maintenance}.

�⤷ @code{mysqld --log} �ǥ����ե��������Ѥ���ʤ顢'hostname' �����ե����롢
����ϥǡ����١����ǥ��쥯�ȥ�ˤ���ޤ��������������å�������������������������
�򸫤Ĥ��ޤ���
mysqld ��Ŭ�ڤ˥���ǥå�������Ѥ���Τ˻��֤��ȤƤ⤫�������Ƥ� @code{SELECT} ʸ��
 @code{EXPLAIN} �Ǽ¹Ԥ��뤳�Ȥ��ߤޤ��� @xref{EXPLAIN, , @code{EXPLAIN}}. 
�ޤ���@code{mysql} ���ޥ�ɥ饤��ǤϽ���ʤ��ä���ʣ���ʥ������ƥ��Ȥ��٤��Ǥ���

�⤷���顼�����ե�����(@file{hostname.err})��� @code{mysqld restarted} �Ȥ���ʸ������ʤ顢
@code{mysqld} ���Ԥ����륯����򸫤Ĥ��ޤ���
�⤷���줬������ʤ顢@code{myisamchk} (@pxref{Maintenance}) �����ƤΥơ��֥������å�����
@strong{MySQL} �����ե�����ˤ��뤽�Υ������ƥ��Ȥ��٤��Ǥ���
�⤷���Τ褦�ʥ������ߤĤ����ʤ顢�ޤ��ǽ�˺ǿ��� @strong{MySQL} �˥��åץ��졼��
���ƤߤƤ��������� �⤷����Ǥ����ǡ����� @code{mysql} �᡼��󥰥ꥹ�Ȥ�
���������֤ˤ�ʤˤ⸫�Ĥ��뤳�Ȥ�����ʤ��ä��ʤ顢 @email{mysql@@lists.mysql.com} ��
�Х���ݡ��Ȥ�Ф��٤��Ǥ��� �᡼��󥰥ꥹ�ȤΥ��������֤ؤΥ�󥯤�
@uref{http://www.mysql.com/doc.html, @strong{MySQL} documentation page}.

�⤷�����ʥơ��֥�򤨤��ꡢ @code{mysqld} ����ˤ����Ĥ��� update ���ޥ�ɤ�
���Ԥ���ʤ顢�ʲ��Τ褦�ˤ��Ƥ��ΥХ��κƸ���ƥ��Ȥ��ޤ���

@itemize @bullet
@item
mysqld daemon ��� (@code{mysqladmin shutdown} ��)
@item
@code{myisamchk -s database/*.MYI} �����ơ��֥������å�. 
@code{myisamchk -r database/table.MYI} �ǰ����ơ��֥������
@item
@code{mysqld} �� @code{--log-update} �ǥ�������. @xref{Update log}.
@item
���줿�ơ��֥����������@code{mysqld server} ����ߡ�
@item
�Хå����åפ�ꥹ�ȥ�
@item
@code{mysqld} server �� @code{--log-update} @strong{�ʤ���} ��ư��
@item
@code{mysql < update-log} �ǺƼ¹ԡ�  update log ��
@strong{MySQL} �ǡ����١����ǥ��쥯�ȥ��
@code{your-hostname.#} �Ȥ���̾������¸����Ƥ��ޤ���
@item
����Ǥ⤷�Ƥӥơ��֥뤬���������ʤ�ʤ顢 @code{ISAM} ���������
�Ƹ���ǽ�ʥХ��򸫤Ĥ������Ȥˤʤ�ޤ���
���Υơ��֥�� update log �� @uref{ftp://www.mysql.com/pub/mysql/secret} ��
FTP �� put ���ޤ��� �����Ϥ����Ǥ���¤�®���������ޤ���
@end itemize

@code{mysqladmin debug} ���ޥ�ɤϻ�����Υ��å������Ѥ��Ƥ�����ꡢ
������λ��Ѥξ����mysql �����ե�����ˤ����Ĥ�����פ��ޤ�
����Ϥ����Ĥ������������Ω���ޤ��� ���Υ��ޥ�ɤϡ� @strong{MySQL} ��
�ǥХå���ǽ�ǥ���ѥ��뤷�Ƥ��ʤ��Ƥ⡢�����Ĥ�����Ω�ľ�����󶡤��ޤ���

�����Ĥ��Υơ��֥�Ǥ�������٤��ʤ�����Ǥ���ʤ顢 @code{OPTIMIZE TABLE} ��
@code{myisamchk} �ǥơ��֥����������Ŭ�����ߤ�٤��Ǥ���
�٤�������ϡ� @code{EXPLAIN} �Ǥ�����å��Ǥ��ޤ���
@xref{Maintenance}.

���Υޥ˥奢��� OS ��ͭ������ ������ɤ�٤��Ǥ���
@xref{Source install system issues}.

@findex DBI->trace
@findex trace DBI method
@tindex DBI_TRACE environment variable
@tindex Environment variable, DBI_TRACE
�⤷ Perl @code{DBI} ����Ѥ��Ƥ���ʤ顢
 @code{trace} �᥽�åɡ����뤤��@code{DBI_TRACE} �Ķ��ѿ���
�ǥХå������ͭ���ˤǤ��ޤ���
@xref{Perl DBI Class, , Perl @code{DBI} Class}.

@node Debugging client, RTS-threads, Debugging server, Porting
@appendixsec Debugging a MySQL client

To be able to debug a @strong{MySQL} client with the integrated debug package,
you should configure @strong{MySQL} with @code{--with-debug}.
@xref{configure options}.

@tindex MYSQL_DEBUG environment variable
@tindex Environment variable, MYSQL_DEBUG
Before running a client, you should set the @code{MYSQL_DEBUG} environment
variable:

@example
shell> MYSQL_DEBUG=d:t:O,/tmp/client.trace
shell> export MYSQL_DEBUG
@end example

This causes clients to generate a trace file in @file{/tmp/client.trace}.

If you have problems with your own client code, you should attempt to
connect to the server and run your query using a client that is known to
work.  Do this by running @code{mysql} in debugging mode (assuming you
have compiled @strong{MySQL} with debugging on):

@example
shell> mysql --debug=d:t:O,/tmp/client.trace
@end example

This will provide useful information in case you mail a bug report.
@xref{Bug reports}.

If your client crashes at some 'legal' looking code, you should check
that your @file{mysql.h} include file matches your mysql library file.
A very common mistake is to use an old @file{mysql.h} file from an old
@strong{MySQL} installation with new @strong{MySQL} library.

@node RTS-threads, Thread packages, Debugging client, Porting
@appendixsec Comments about RTS threads

I have tried to use the RTS thread packages with @strong{MySQL} but
stumbled on the following problems:

They use an old version of a lot of POSIX calls and it is very tedious to
make wrappers for all functions. I am inclined to think that it would
be easier to change the thread libraries to the newest POSIX
specification.

Some wrappers are already written. See @file{mysys/my_pthread.c} for more info.

At least the following should be changed:

@code{pthread_get_specific} should use one argument.
@code{sigwait} should take two arguments.
A lot of functions (at least @code{pthread_cond_wait},
@code{pthread_cond_timedwait})
should return the error code on error. Now they return -1 and set @code{errno}.

Another problem is that user-level threads use the @code{ALRM} signal and this
aborts a lot of functions (@code{read}, @code{write}, @code{open}...).
@strong{MySQL} should do a retry on interrupt on all of these but it is
not that easy to verify it.

The biggest unsolved problem is the following:

To get thread-level alarms I changed @file{mysys/thr_alarm.c} to wait between
alarms with @code{pthread_cond_timedwait()}, but this aborts with error
@code{EINTR}.  I tried to debug the thread library as to why this happens,
but couldn't find any easy solution.

If someone wants to try @strong{MySQL} with RTS threads I suggest the
following:

@itemize @bullet
@item
Change functions @strong{MySQL} uses from the thread library to POSIX.
This shouldn't take that long.
@item
Compile all libraries with the @code{-DHAVE_rts_threads}.
@item
Compile @code{thr_alarm}.
@item
If there are some small differences in the implementation, they may be fixed
by changing @file{my_pthread.h} and @file{my_pthread.c}.
@item
Run @code{thr_alarm}. If it runs without any ``warning'', ``error'' or aborted
messages, you are on the right track. Here follows a successful run on
Solaris:
@example
Main thread: 1
Tread 0 (5) started
Thread: 5  Waiting
process_alarm
Tread 1 (6) started
Thread: 6  Waiting
process_alarm
process_alarm
thread_alarm
Thread: 6  Slept for 1 (1) sec
Thread: 6  Waiting
process_alarm
process_alarm
thread_alarm
Thread: 6  Slept for 2 (2) sec
Thread: 6  Simulation of no alarm needed
Thread: 6  Slept for 0 (3) sec
Thread: 6  Waiting
process_alarm
process_alarm
thread_alarm
Thread: 6  Slept for 4 (4) sec
Thread: 6  Waiting
process_alarm
thread_alarm
Thread: 5  Slept for 10 (10) sec
Thread: 5  Waiting
process_alarm
process_alarm
thread_alarm
Thread: 6  Slept for 5 (5) sec
Thread: 6  Waiting
process_alarm
process_alarm

...
thread_alarm
Thread: 5  Slept for 0 (1) sec
end
@end example
@end itemize

@node Thread packages,  , RTS-threads, Porting
@appendixsec ����åɥѥå������֤ΰ㤤�ϲ���

@strong{MySQL} �ϻ��Ѥ���륹��åɥѥå����������˰�¸���Ƥ��ޤ���
���Τ��ᡢ@strong{MySQL} ���ɤ��ץ�åȥե���������򤹤���ˤϡ�
����åɥѥå����������˽��פǤ��� 

���ʤ��Ȥ�3�ĤΥ����פΥ���åɥѥå�����������ޤ���

@itemize @bullet
@item
���󥰥�ץ�������Υ桼������åɡ�
����å����ؤ��ϥ��顼��Ǵ������졢
����åɥ饤�֥��ϥ��å���ȼ���󥹥�åɰ����ؿ��Τ��٤Ƥ�������ޤ��� 
ư���楹��åɤ��ǡ������Ԥ�ɬ�פ������硢read, write ������ select �ϡ�
�̾¾�Υ���åɤ����ؤ��륹��åɸ�ͭ�� select �Ǵ�������ޤ���
�⤷�桼��������åɥѥå�������ɸ��饤�֥�� (FreeBSD �� BSDI ����å�) ��
���礵��Ƥ���ʤ顢����åɥѥå������Υ����С��إåɤϡ����Ƥ�������������
�ޥåפ��ʤ���Фʤ�ʤ�����åɥѥå�����(MIT-����å�, FSU-����å�, RTS ����å�)
���⾯�ʤ��ʤ�ޤ���
¾�δĶ�(�㤨�� SCO)�Ǥϡ����ƤΥ����ƥॳ����ϥ���åɰ����ʤΤǡ�
�ޥåԥ󥰤ϤȤƤ��ñ�˹Ԥʤ��ޤ�(SCO ��� FSU-����å�)��
Downside: ���ƤΥޥåפ���륳����Ͼ������֤������ꡢ���Ƥξ�����
������ǽ�ˤ��뤳�Ȥϡ��ȤƤ⺤��Ǥ���
�̾����åɥѥå������ˤ�äƽ����Ǥ��ʤ������ƥॳ���뤬�����Ĥ�����ޤ�
(MIT-����åɤȥ����åȤΤ褦��)�� ����åɥ������塼��󥰤Ͼ�˺�
Ŭ�Ȥ����櫓�ǤϤ� ��ޤ��� 
@item
�̤Υץ������ʤ��Υ桼������åɡ�
����å����ؤ��ϥ����ͥ�ˤ�äƹԤʤ�졢���ƤΥǡ����ϥ���åɴ֤Ƕ�ͭ����ޤ���
����åɥѥå������ϡ������ �ɴ֤Υǡ�����ͭ����Ĥ��뤿���ɸ�ॹ��åɥ������������ޤ���
LinuxThreads �Ϥ�����ˡ����Ѥ��Ƥ��ޤ���
Downside: ¿���Υץ�����������å��������٤��Ǥ���
�⤷��ĤΥ���åɤ���̤ȡ��Ĥ���̾�ϥ󥰤��ƻĤꡢ�Ƶ�ư���� ���������
�� kill ����ɬ�פ�����ޤ�������å����ؤ��Ϥ����餫���(expensive)�Ǥ���
@item
�����ͥ륹��åɡ�
����å����ؤ��ϥ���åɥ饤�֥�꤫�����ͥ�ˤ�äƽ������졢
�ȤƤ�®���Ǥ��� ���Ƥϰ�ĤΥץ�������ǹԤʤ��ޤ�����
�����Ĥ��Υ����ƥ�Ǥϡ�@code{ps} ���ۤʤä�����åɤ򼨤��ޤ���
�⤷��ĤΥ���åɤ����ܡ��Ȥ�����硢�ץ��������Τ����ܡ��Ȥ��ޤ���
¿���Υ����ƥॳ����ϥ���åɰ����ǡ������С��إåɤϤȤƤ⾯�ʤ��Ǥ���
Solaris, HP/UX, AIX ������ OSF1 �������ͥ륹��åɤ���äƤ��ޤ��� 
@end itemize

�����Ĥ��Υ����ƥ�Ǥϡ������ͥ륹��åɤϡ������ƥ�饤�֥����ǡ�
�桼����٥륹��åɤ�����ˤ�äƴ�������ޤ���
���ξ�硢����å����ؤ��ϥ���åɥ饤�֥��ˤ�äƤ����Ԥʤ�졢
�����ͥ�ϼºݤˤ� 'thread aware' �ǤϤ���ޤ��� 


@node Regexp, Unireg, Porting, Top
@appendix MySQL ������ɽ����ʸˡ�ˤĤ���

A regular expression (regex) is a powerful way of specifying a complex search.

@strong{MySQL} ������ɽ���� regular Henry Spencers ��������Ѥ��ޤ���
�����Ƥ���� POSIX 1003.2 �˰��פ��뤳�Ȥ�
��Ū�Ǥ���@strong{MySQL} �ϳ�ĥ �С���������Ѥ��ޤ��� 

����Ͼܺ٤�ʤ�����ñ�ʥ�ե���󥹤Ǥ���
��������Τʾ���� Henry Spencers @code{regex(7)} �ޥ˥奢��򸫤Ƥ���������
����ϥ��������ۤ˴ޤޤ�Ƥ��ޤ��� @xref{Credits}.

����ɽ����ʸ������Ȥ߹�碌�Ƶ��Ҥ���ޤ���
��äȤ��ñ�ʾ��ϡ����ü�ʸ���ΰ�ʸ���Ǥ����㤨�С�
regexp @code{hello} �� @code{hello} ��Ŭ�礷�� ¾�ˤ�Ŭ�礷�ޤ��� 

��ñ�Ǥʤ�����ɽ���ϡ�1�Ĥ�ʸ����ʾ��Ŭ��Ǥ���褦�ʡ������Ĥ���
�ü�ʹ�������Ѥ��ޤ����㤨�С�regexp @code{hello|word} ��
ʸ���� @code{hello} ��ʸ���� @code{word} ��Ŭ�礷�ޤ��� 

�����Ƥ����ʣ������ regexp @code{B[an]*s} �ϡ�
ʸ���� @code{Bananas}, @code{Baaaaas}, @code{Bs} �Τɤ줫��
������ @code{B} �ǻϤޤ� @code{a} �� @code{n} ��
Ǥ�դο�³����@code{s} �ǽ����褦��¾��ʸ�����Ŭ�礷�ޤ��� 

����ɽ���Ǥϡ������ü�ʸ��/���������ѤǤ��ޤ���
@table @code
@item ^
ʸ�������ΤλϤޤꡣ
@example
mysql> select "fo\nfo" REGEXP "^fo$";           -> 0
mysql> select "fofo" REGEXP "^fo";              -> 1
@end example
@item $
ʸ�������Τν��ꡣ
@example
mysql> select "fo\no" REGEXP "^fo\no$";         -> 1
mysql> select "fo\no" REGEXP "^fo$";            -> 0
@end example
@item .
Ǥ�դ�ʸ�� (���Դޤ�)��
@example
mysql> select "fofo" REGEXP "^f.*";             -> 1
mysql> select "fo\nfo" REGEXP "^f.*";           -> 1
@end example
@item a*
0�İʾ��ʸ�� @code{a} ���¤ӡ�
@example
mysql> select "Ban" REGEXP "^Ba*n";             -> 1
mysql> select "Baaan" REGEXP "^Ba*n";           -> 1
mysql> select "Bn" REGEXP "^Ba*n";              -> 1
@end example
@item a+
ʸ�� @code{a} �� 1�İʾ��¤֡�
@example
mysql> select "Ban" REGEXP "^Ba+n";             -> 1
mysql> select "Bn" REGEXP "^Ba+n";              -> 0
@end example
@item a?
0 �ޤ��� 1�Ĥ�ʸ�� @code{a}��
@example
mysql> select "Bn" REGEXP "^Ba?n";              -> 1
mysql> select "Ban" REGEXP "^Ba?n";             -> 1
mysql> select "Baan" REGEXP "^Ba?n";            -> 0
@end example
@item de|abc
@code{de} �� @code{abc} �˥ޥå���
@example
mysql> select "pi" REGEXP "pi|apa";             -> 1
mysql> select "axe" REGEXP "pi|apa";            -> 0
mysql> select "apa" REGEXP "pi|apa";            -> 1
mysql> select "apa" REGEXP "^(pi|apa)$";        -> 1
mysql> select "pi" REGEXP "^(pi|apa)$";         -> 1
mysql> select "pix" REGEXP "^(pi|apa)$";        -> 0
@end example
@item (abc)*
ʸ���� @code{abc} �� 0 ��ʾ���¤Ӥ˥ޥå���
@example
mysql> select "pi" REGEXP "^(pi)*$";            -> 1
mysql> select "pip" REGEXP "^(pi)*$";           -> 0
mysql> select "pipi" REGEXP "^(pi)*$";          -> 1
@end example
@item @{1@}
@itemx @{2,3@}
¿����ȯ����Ŭ�礹�� regexp �ε��Ҥ������Ū����ˡ��
The is a more general way of writing regexps that match many
occurrences of the previous atom.
@table @code
@item a*
Can be written as @code{a@{0,@}}.
@item a+
Can be written as @code{a@{1,@}}.
@item a?
Can be written as @code{a@{0,1@}}.
@end table
��������Τˤϡ�1�Ĥ����� i �ȥ����̵����ޤཤ����³�����ȥ�ϡ� 
��̩�˥��ȥ��Ŭ�礹�� @code{i} ����¤Ӥ�Ŭ�礷�ޤ���
���� @code{i} �ȥ���ޤ�ޤཤ����³�����ȥ�ϡ�
���ȥ��Ŭ�礹�� @code{i} ��ʾ���¤Ӥ�Ŭ�礷�ޤ���
���� @code{i} �� @code{j} ��ޤ�������³�����ȥ�ϡ�
���ȥ��Ŭ �礹�� @code{i} �󤫤� @code{j} ��ޤǤ��¤Ӥ�Ŭ�礷�ޤ���

ξ���ΰ����� @code{0 >= value <= RE_DUP_MAX (default 255)} �Ǥʤ��Ȥ� ���ޤ���
�����ơ�2�Ĥ����硢2���ܤ�1���ܤ����礭����Ʊ���Ǥʤ��Ȥ����ޤ��� 
@item [a-dX]
@itemx [^a-dX]
@code{a}, @code{b}, @code{c}, @code{d}, @code{X} �Τɤ줫��ʸ��
 (@code{^} ����Ѥ���Ȥɤ�Ǥ�ʤ�ʸ��) �˥ޥå���
@code{]} ʸ����ޤ��ˤϡ� @code{[} �Τ��Ȥ�³���Ƥ����˽�ɬ�פ�����ޤ���

@code{-} ʸ����ޤ��ˤϺǽ餫�Ǹ�˽�ɬ�פ�����ޤ���
@code{[0-9]} ��Ǥ�� ��10�ʿ��ͤ�Ŭ�礷�ޤ��� @code{[]} �ڥ�������������줿
��̣������ʤ����Ƥ�ʸ���ϡ��ü�ʰ�̣������������켫�Ȥˤ���Ŭ�礷�ޤ��� 
@example
mysql> select "aXbc" REGEXP "[a-dXYZ]";         -> 1
mysql> select "aXbc" REGEXP "^[a-dXYZ]$";       -> 0
mysql> select "aXbc" REGEXP "^[a-dXYZ]+$";      -> 1
mysql> select "aXbc" REGEXP "^[^a-dXYZ]+$";     -> 0
mysql> select "gheis" REGEXP "^[^a-dXYZ]+$";    -> 1
mysql> select "gheisa" REGEXP "^[^a-dXYZ]+$";   -> 0
@end example
@item [[.characters.]]
�ȹ�����(collating element)��ʸ�����¤ӡ�
�¤Ӥϳ��ɽ���ꥹ�Ȥΰ�Ĥ����ǤǤ���
ʣ��ʸ���ξȹ����Ǥ�ޤ���ɽ���ϰ�İʾ��ʸ����Ŭ�礷�ޤ���
�㤨�С��ȹ��¤Ӥ� @code{ch} �ȹ����Ǥ�ޤ��硢
����ɽ�� @code{[[.ch.]]*c} �� @code{chchcc} �κǽ��5ʸ����Ŭ�礷�ޤ��� 

@item [=character_class=]
Ʊ���Υ��饹�����ΰ�Ĥ����������Ƥξȹ����Ǥ�ʸ�����¤Ӥ�ɽ���ޤ������켫�Ȥ�ޤߤޤ���

�㤨�С�@code{o} �� @code{(+)} ��Ʊ�����饹�Υ��ФǤ����硢
 @code{[[=o=]]}, @code{[[=(+)=]]}, @code{[[=(+)=]]} ������Ʊ����Ǥ���
Ʊ�����饹���ϰϤν�λ���֤ˤϤʤ�ޤ���

@item [:character_class:]
���ɽ���������ǡ�@code{[:} �� @code{:]} �dz��줿ʸ�����饹��̾���ϡ�
���Υ��饹��°�������Ƥ�ʸ���Υꥹ�Ȥ�ɽ���ޤ���ɸ��ʸ�����饹̾��: 

@multitable @columnfractions .33 .33 .33
@item alnum @tab digit @tab punct
@item alpha @tab graph @tab space
@item blank @tab lower @tab upper
@item cntrl @tab print @tab xdigit
@end multitable

������ @code{ctype(3)} �ޥ˥奢��ڡ����˵��ܤ���Ƥ���ʸ�����饹��ɽ���ޤ���
�������뤬¾�Τ��󶡤��뤳�Ȥ⤢��ޤ���ʸ�����饹���ϰϤν�λ���֤Ȥ��ƤϻȤ��ޤ��� 
@example
mysql> select "justalnums" REGEXP "[[:alnum:]]+";       -> 1
mysql> select "!!" REGEXP "[[:alnum:]]+";               -> 0
@end example

@item [[:<:]]
@itemx [[:>:]]
���줾�졢ñ��λϤ�Ƚ���ζ�ʸ�����Ŭ�礷�ޤ���ñ��ϡ�ñ��ʸ��������
�ˤʤ�ñ��ʸ�����¤ӤȤ����������ޤ���ñ��ʸ���� alnum ʸ��
 (@code{ctype(3)} ���������ޤ�) �Ȳ���(underscore �� @code{_})�Ǥ���
@example
mysql> select "a word a" REGEXP "[[:<:]]word[[:>:]]";      -> 1
mysql> select "a xword a" REGEXP "[[:<:]]word[[:>:]]";     -> 0
@end example
@end table

@example
mysql> select "weeknights" REGEXP "^(wee|week)(knights|nights)$"; -> 1
@end example

@node Unireg, Public license, Regexp, Top
@appendix UNIREG �Ȥϲ�����

UNIREG �ϲ桹�� tty ���󥿥ե������ӥ���Ǥ���
����ϲ桹�� (@strong{MySQL} �ǻ��Ѥ����) ISAM �ؤ����٥���³�˻��Ѥ��ޤ���
���줬�ȤƤ�®������Ǥ�������� 1979 ǯ���� (UNIX ��� C �� 1986 ǯ����) ¸�ߤ��Ƥ��ޤ����� 

UNIREG �ϼ��Υ���ݡ��ͥ�Ȥ�����ޤ�: 

@itemize @bullet
@item
��ĤΥơ��֥�λ��ȡ�����/�Ȳ�ˡ�
@item
ʣ���Υơ��֥�λ��� (1�����������ϰϤ�)��
@item
�ơ��֥������ (@strong{MySQL} �ǤϺ����Ǥ��ʤ������ι��ܥ�����)��
����� (tty �� ��) WYSIWYG �Ǥ��������꡼��� UNIREG �ץ���ץȤ���ܤ��Ȥ˥ǥ�����Ǥ��ޤ��� 
@item
��ݡ���������
@item
�����Υ桼�ƥ���ƥ� (�ƥ����ȥե�����ؤΥơ��֥�ι�®�������ݡ���/����ݡ� �ȡ��ơ��֥����Ƥβ���...)�� 
@item
���Ϥ�ʣ���ơ��֥�ι��� (�桹�����ˤˤ������Ѥ��ޤ�)��
BASIC �˻��������¿ ���ε�ǽ����äƤ��ޤ���
@item
ưŪ�ʸ���(���ߤϥ��������ǥ��ȥե�����ɸ�)��
ï�����Ѹ�С��������ߤ����Τʤ顢�������ʤ��Ȥ����ʤ������Ĥ��Υե����뤬����ޤ���
@item
����Ū�ˤޤ��ϥХå��ǹ�����¹Ԥ��뵡ǽ�� 
@item
Emacs �˻�����������������ܡ��ɥޥ����դ���
@item
������ 800k �ΥХ��ʥꡣ
@item
@code{convform} �桼�ƥ���ƥ����ۤʤ�ʸ�����åȴ֤� @file{.frm} �ȥƥ����ȥե�������Ѵ����ޤ���
@item
@code{mpack_isam} �桼�ƥ���ƥ��� ISAM �ơ��֥��ѥå����ޤ�(50-80% �������Ǥ��ޤ�)�� 
���Υơ��֥�����̤Υơ��֥��Ʊ���褦�� @strong{MySQL} ���ɤ߹��ߤǤ��ޤ���
1 �쥳�� �ɤ������̲�� / ������������ɬ�פ�����ޤ���
@code{BLOB} �� @code{TEXT} ���ܤ����ȹ�����(�ޤ�)�Ǥ��ޤ��� 
@end itemize

�桹�ϡ�UNIREG ���󥿥ե�������¿���β桹�����ʥǡ����١����򹹿����� 
@strong{MySQL} (�����Ƥ����Ĥ����ü�ʾ�硢UNIREG ��ݡ��������ץ������) ���̤���
Web �ڡ������󶡤��ޤ��� 

UNIREG �� 3M �Υǥ������ΰ����Ѥ������ʤ��Ȥ⼡�Υץ�åȥե�������ư��ޤ�:
 SUN OS 4.x, Solaris, Linux, HP/UX, ICL Unix, DNIX, SCO ���� �� MSDOS�� 

UNIREG �ϸ��ߥ��������ǥ��ȥե�����ɸ�ǤΤ�ͭ���Ǥ��� 

UNIREG �β��ʤ� 10,000 ���������ǥ� kr (�� 1500$ US) �Ǥ���
������������ϥ��ݡ��Ȥ�ޤߤޤ��� UNIREG �ϥХ��ʥ�����ۤ���ޤ�
 (���������Ƥ� ISAM �������� @strong{MySQL} ��˸��Ĥ����ޤ�)��
�̾�桹�ϸܵҤΥ����ȤˤƸܵ��Ѥ˥Х��ʥ�򥳥�ѥ��뤷�ޤ��� 

��������ȯ�� @strong{MySQL} �˽��椷�Ƥ��ޤ���

@page
@c This node name is special
@node Public license, Win license, Unireg, Top
@appendix The MySQL server license for non Microsoft operating systems

@center @strong{MySQL FREE PUBLIC LICENSE}
@center (Version 4, March 5, 1995)

@center Copyright (C) 1995, 1996 TcX AB & MySQL Finland AB & Detron HB
@center Stockholm SWEDEN, Helsingfors FINLAND and Uppsala SWEDEN
@center All rights reserved.

NOTE: This license is not the same as any of the GNU Licenses published
by the Free Software Foundation. Its terms are substantially different
from those of the GNU Licenses. If you are familiar with the GNU
Licenses, please read this license with extra care.

This License applies to the computer program known as "MySQL".  The
"Program", below, refers to such program, and a "work based on the
Program" means either the Program or any derivative work of the Program,
as defined in the United States Copyright Act of 1976, such as a
translation or a modification. The Program is a copyrighted work whose
copyright is held by TcX Datakonsult AB and MySQL Finland AB and Detron
HB.

This License does not apply when running "MySQL" on any Microsoft
operating system. Microsoft operating systems include all versions of
Microsoft Windows NT and Microsoft Windows.

BY MODIFYING OR DISTRIBUTING THE PROGRAM (OR ANY WORK BASED ON THE
PROGRAM), YOU INDICATE YOUR ACCEPTANCE OF THIS LICENSE TO DO SO, AND ALL
ITS TERMS AND CONDITIONS FOR COPYING, DISTRIBUTING OR MODIFYING THE
PROGRAM OR WORKS BASED ON IT. NOTHING OTHER THAN THIS LICENSE GRANTS
YOU PERMISSION TO MODIFY OR DISTRIBUTE THE PROGRAM OR ITS DERIVATIVE
WORKS. THESE ACTIONS ARE PROHIBITED BY LAW. IF YOU DO NOT ACCEPT THESE
TERMS AND CONDITIONS, DO NOT MODIFY OR DISTRIBUTE THE PROGRAM.

@enumerate
@item
Licenses.

Licensor hereby grants you the following rights, provided that you
comply with all of the restrictions set forth in this License and
provided, further, that you distribute an unmodified copy of this
License with the Program:

@enumerate a
@item
You may copy and distribute literal (i.e., verbatim) copies of the
Program's source code as you receive it throughout the world, in any
medium.
@item
You may modify the Program, create works based on the Program and
distribute copies of such throughout the world, in any medium.
@end enumerate

@item
Restrictions.

This license is subject to the following restrictions:
@enumerate a
@item
Distribution of the Program or any work based on the Program by a
commercial organization to any third party is prohibited if any payment is
made in connection with such distribution, whether directly (as in payment
for a copy of the Program) or indirectly (as in payment for some service
related to the Program, or payment for some product or service that
includes a copy of the Program "without charge"; these are only examples,
and not an exhaustive enumeration of prohibited activities). However, the
following methods of distribution involving payment shall not in and of
themselves be a violation of this restriction:

@enumerate A
@item
Posting the Program on a public access information storage and retrieval
service for which a fee is received for retrieving information (such as
an on-line service), provided that the fee is not content-dependent
(i.e., the fee would be the same for retrieving the same volume of
information consisting of random data).
@item
Distributing the Program on a CD-ROM, provided that the files containing
the Program are reproduced entirely and verbatim on such CD-ROM, and
provided further that all information on such CD-ROM be redistributable
for non-commercial purposes without charge.
@end enumerate
@item
Activities other than copying, distribution and modification of the
Program are not subject to this License and they are outside its scope.
Functional use (running) of the Program is not restricted, and any
output produced through the use of the Program is subject to this
license only if its contents constitute a work based on the Program
(independent of having been made by running the Program).
@item
You must meet all of the following conditions with respect to the
distribution of any work based on the Program:
@enumerate A
@item
If you have modified the Program, you must cause your work to carry
prominent notices stating that you have modified the Program's files and
the date of any change;
@item
You must cause any work that you distribute or publish, that in whole or
in part contains or is derived from the Program or any part thereof, to
be licensed as a whole and at no charge to all third parties under the
terms of this License;
@item
If the modified program normally reads commands interactively when run,
you must cause it, at each time the modified program commences
operation, to print or display an announcement including an appropriate
copyright notice and a notice that there is no warranty (or else, saying
that you provide a warranty). Such notice must also state that users
may redistribute the Program only under the conditions of this License
and tell the user how to view the copy of this License included with the
Program. (Exception: if the Program itself is interactive but does not
normally print such an announcement, your work based on the Program is
not required to print an announcement.);
@item
You must accompany any such work based on the Program with the complete
corresponding machine-readable source code, delivered on a medium
customarily used for software interchange. The source code for a work
means the preferred form of the work for making modifications to it.
For an executable work, complete source code means all the source code
for all modules it contains, plus any associated interface definition
files, plus the scripts used to control compilation and installation of
the executable code. However, the source code distributed need not
include anything that is normally distributed (in either source or
binary form) with the major components (compiler, kernel, and so on) of
the operating system on which the executable runs, unless that component
itself accompanies the executable code;
@item
If you distribute any written or printed material at all with the
Program or any work based on the Program, such material must include
either a written copy of this License, or a prominent written indication
that the Program or the work based on the Program is covered by this
License and written instructions for printing and/or displaying the copy
of the License on the distribution medium;
@item
You may not impose any further restrictions on the recipient's
exercise of the rights granted herein.

If distribution of executable or object code is made by offering the
equivalent ability to copy from a designated place, then offering
equivalent ability to copy the source code from the same place counts as
distribution of the source code, even though third parties are not
compelled to copy the source code along with the object code.
@end enumerate
@end enumerate
@item
Reservation of Rights.

No rights are granted to the Program except as expressly set forth
herein. You may not copy, modify, sublicense, or distribute the Program
except as expressly provided under this License. Any attempt otherwise
to copy, modify, sublicense or distribute the Program is void, and will
automatically terminate your rights under this License. However, parties
who have received copies, or rights, from you under this License will not
have their licenses terminated so long as such parties remain in full
compliance.

@item
Other Restrictions.

If the distribution and/or use of the Program is restricted in certain
countries for any reason, Licensor may add an explicit geographical
distribution limitation excluding those countries, so that distribution
is permitted only in or among countries not thus excluded. In such case,
this License incorporates the limitation as if written in the body of
this License.

@item
Limitations.

THE PROGRAM IS PROVIDED TO YOU "AS IS," WITHOUT WARRANTY. THERE IS NO
WARRANTY FOR THE PROGRAM, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT
NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF THIRD PARTY RIGHTS. THE
ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH
YOU.  SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL
NECESSARY SERVICING, REPAIR OR CORRECTION.

IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
WILL LICENSOR, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE
PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS
OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR
THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
POSSIBILITY OF SUCH DAMAGES.
@end enumerate

@c This node name is special
@node Win license, Function Index, Public license, Top
@appendix The MySQL license for Microsoft operating systems

@center @strong{MySQL shareware license for Microsoft operating systems}
@center (Version 1, September 4, 1998)

@center Copyright (C) 1998 TcX AB & MySQL Finland AB & Detron HB
@center Stockholm SWEDEN, Helsingfors FINLAND and Uppsala SWEDEN
@center All rights reserved.

This License applies to the computer program known as "MySQL". 

This License applies when running MySQL on any Microsoft operating system. 
Microsoft operating systems include all versions of Microsoft Windows NT 
and Microsoft Windows.

YOU SHOULD CAREFULLY READ THE FOLLOWING TERMS AND CONDITIONS BEFORE
USING, COPYING OR DISTRIBUTING MySQL. BY USING, COPYING AND DISTRIBUTING
MySQL, YOU INDICATE YOUR ACCEPTANCE OF THIS LICENSE TO DO SO, AND ALL
ITS TERMS AND CONDITIONS FOR USING, COPYING AND DISTRIBUTING MySQL OR
WORKS BASED ON IT.  NOTHING OTHER THAN THIS LICENSE GRANTS YOU
PERMISSION TO USE, COPY OR DISTRIBUTE MySQL OR ITS DERIVATIVE
WORKS. THESE ACTIONS ARE PROHIBITED BY LAW. IF YOU DO NOT ACCEPT THESE
TERMS AND CONDITIONS, DO NOT USE, COPY OR DISTRIBUTE MySQL.

@enumerate
@item
Evaluation and License Registration.

This is an evaluation version of MySQL for Win32. Subject to the terms
below, you are hereby licensed to use MySQL for evaluation purposes
without charge for a period of 30 days. If you use MySQL after the 30
day evaluation period the registration and purchase of a MySQL license
is required.

The price for a MySQL license is currently 200 US dollars and email
support starts from 200 US dollars/year. Quantity discounts are
available. If you pay by credit card, the currency is EURO (The European
Unions common currency) so the prices will differ slightly.

The easiest way to register or find options about how to pay for MySQL
is to use the license form at TcX's secure server at
@uref{https://www.mysql.com/license.htmy}. This can be used also when
paying with credit card over the Internet.

Other applicable methods for paying are SWIFT payments, cheques and
credit cards.

Payment should be made to: 

@example
Postgirot Bank AB
105 06 STOCKHOLM, SWEDEN

TCX DataKonsult AB
BOX 6434
11382 STOCKHOLM, SWEDEN

SWIFT address: PGSI SESS
Account number: 96 77 06 - 3
@end example

Specify: license and/or support and your name and email address.

In Europe and Japan, EuroGiro (that should be cheaper) can be used to
the same account.

If you want to pay by cheque make it payable to "MySQL Finland AB" and
mail it to the address below.

@example
TCX DataKonsult AB
BOX 6434
11382 STOCKHOLM, SWEDEN
@end example
For more information about commercial licensing, please contact: 

@example
David Axmark
Kungsgatan 65 B
753 21 UPPSALA
SWEDEN
Voice Phone +46-18-10 22 80     GMT 9-21. Swedish and English spoken
Fax +46-8-729 69 05             Email *much* preferred. 
E-Mail: mysql-licensing@@mysql.com
@end example

For more about the license prices and commercial support, like email
support, please refer to the MySQL manual. @xref{Cost}. @xref{Support}.

The use of MySQL or any work based on MySQL after the 30-day evaluation
period is in violation of international copyright laws.

@item
Registered version of MySQL.

After you have purchased a MySQL license we will send you a receipt by
paper mail. You are allowed to use MySQL or any work based on MySQL
after the 30-days evaluation period. The use of MySQL is, however,
restricted to one physical computer, but there are no restrictions on
concurrent uses of MySQL or the number of MySQL servers run on the
computer.

We will also email you an address and password for a password-protected
WWW page that always has the newest MySQL-Win32 version. Our current
policy is that a user with the MySQL license can get free upgrades. The
best way to ensure that you get the best possible support is to purchase
commercial support!

@item
Registration for use in education and university or government-sponsored
research.

You may obtain a MySQL license for the use in education and university
or government-sponsored research for free. In that case, send a detailed
application for licensing MySQL for such use to the email address
@email{mysql-licensing@@mysql.com}.

The following information is required in the application:
@itemize @bullet
@item
The name of the school or institute.
@item
A short description of the school or institute and of the type of
education, resarch or other functions it provides.
@item
A detailed report of the use of MySQL in the institution.
@end itemize

In this case you will be provided with a license that entitles you to
use MySQL in a specified manner.

@item
Distribution.

Provided that you verify that you are distributing an evaluation or
educational/research version of MySQL you are hereby licensed to make as
many literal (i.e., verbatim) copies of the evaluation version of MySQL
and documentation as you wish.

@item
Restrictions.

The client code of MySQL is in the Public Domain or under the GPL (for
example the code for readline) license.  You are not allowed to modify,
recompile, translate or create derivative works based upon any part of
the server code of MySQL.

@item
Reservation of Rights.

No rights are granted to MySQL except as expressly set forth herein.
You may not copy or distribute MySQL except as expressly provided under
this License. Any attempt otherwise to copy or distribute MySQL is void,
and will automatically terminate your rights under this License.
However, parties who have received copies, or rights, from you under
this License will not have their licenses terminated so long as such
parties remain in full compliance.

@item
Other Restrictions.

If the distribution and/or use of MySQL is restricted in certain
countries for any reason, the Licensor may add an explicit geographical
distribution limitation excluding those countries, so that distribution
is permitted only in or among countries not thus excluded. In such case,
this License incorporates the limitation as if written in the body of
this License.

@item
Limitations.

MySQL IS PROVIDED TO YOU "AS IS," WITHOUT WARRANTY. THERE IS NO WARRANTY
FOR MySQL, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
PURPOSE AND NONINFRINGEMENT OF THIRD PARTY RIGHTS. THE ENTIRE RISK AS TO
THE QUALITY AND PERFORMANCE OF MySQL IS WITH YOU.  SHOULD MySQL PROVE
DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR
CORRECTION.

IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
WILL THE LICENSOR, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE
MySQL AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
USE OR INABILITY TO USE MySQL (INCLUDING BUT NOT LIMITED TO LOSS OF DATA
OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
PARTIES OR A FAILURE OF MySQL TO OPERATE WITH ANY OTHER PROGRAMS), EVEN
IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
SUCH DAMAGES.
@end enumerate

@page
@node Function Index, Concept Index, Win license, Top
@unnumbered SQL command, type and function index

@printindex fn

@page
@node Concept Index,  , Function Index, Top
@unnumbered Concept Index

@printindex cp

@summarycontents
@contents

@bye