diff options
author | unknown <jcole@tetra.spaceapes.com> | 2001-07-31 08:55:29 -0500 |
---|---|---|
committer | unknown <jcole@tetra.spaceapes.com> | 2001-07-31 08:55:29 -0500 |
commit | d77fe435f49ba0dd7bc69ce7b624f3aed174ce21 (patch) | |
tree | 7e44c0ee7a8d2a579c176437bae539c73d00a6b8 /Docs | |
parent | eaa1ea45f8ea6233892fe6c4746c35f01d2d9c6d (diff) | |
download | mariadb-git-d77fe435f49ba0dd7bc69ce7b624f3aed174ce21.tar.gz |
DocTOC Chapter 2 Complete!
Diffstat (limited to 'Docs')
-rw-r--r-- | Docs/manual.texi | 6086 |
1 files changed, 3075 insertions, 3011 deletions
diff --git a/Docs/manual.texi b/Docs/manual.texi index 7602409709f..18a204069ca 100644 --- a/Docs/manual.texi +++ b/Docs/manual.texi @@ -143,6 +143,7 @@ distribution for that version. * Unireg:: What is Unireg? * GPL license:: GNU General Public License * LGPL license:: GNU Library General Public License +* Placeholder:: * Function Index:: SQL command, type and function index * Concept Index:: Concept Index @@ -5954,29 +5955,20 @@ Nothing; In the long run we plan to be fully ANSI 92 / ANSI 99 compliant. @end itemize @node Installing, Privilege system, Introduction, Top -@chapter Installing MySQL +@chapter MySQL Installation @cindex installing, overview @menu -* Getting MySQL:: How to get @strong{MySQL} -* Which OS:: Operating systems supported by @strong{MySQL} -* Which version:: Which @strong{MySQL} version to use +* Quick Standard Installation:: +* General Installation Issues:: * Many versions:: How and when updates are released -* Installation layouts:: Installation layouts -* Installing binary:: Installing a @strong{MySQL} binary distribution +* MySQL binaries:: MySQL binaries * Installing source:: Installing a @strong{MySQL} source distribution -* Installing source tree:: Installing @strong{MySQL} from development source tree -* Compilation problems:: Problems compiling? -* MIT-pthreads:: MIT-pthreads notes * Perl support:: Perl installation comments -* Source install system issues:: System-specific issues -* Windows:: Windows notes -* OS/2:: OS/2 notes -* MySQL binaries:: MySQL binaries * Post-installation:: Post-installation setup and testing -* Installing many servers:: Installing many servers on the same machine * Upgrade:: Upgrading/Downgrading MySQL +* Operating System Specific Notes:: @end menu This chapter describes how to obtain and install @strong{MySQL}: @@ -6012,14 +6004,186 @@ procedures apply whether you install @strong{MySQL} using a binary or source distribution. @end itemize +@node Quick Standard Installation, General Installation Issues, Installing, Installing +@section Quick Standard Installation of MySQL + +@c This node name is special +@menu +* Linux-RPM:: +* Windows installation:: +@end menu + +@node Linux-RPM, Windows installation, Quick Standard Installation, Quick Standard Installation +@subsection Installing MySQL on Linux + +@cindex RPM file +@cindex RedHat Package Manager + +The recommended way to install @strong{MySQL} on Linux is by using an RPM +file. The @strong{MySQL} RPMs are currently being built on a RedHat Version +6.2 system but should work on other versions of Linux that support @code{rpm} +and use @code{glibc}. + +If you have problems with an RPM file, for example, if you receive the error +``@code{Sorry, the host 'xxxx' could not be looked up}'', see +@ref{Binary notes-Linux}. + +The RPM files you may want to use are: + +@itemize @bullet +@item @code{MySQL-VERSION.i386.rpm} + +The @strong{MySQL} server. You will need this unless you only want to +connect to a @strong{MySQL} server running on another machine. + +@item @code{MySQL-client-VERSION.i386.rpm} + +The standard @strong{MySQL} client programs. You probably always want to +install this package. + +@item @code{MySQL-bench-VERSION.i386.rpm} + +Tests and benchmarks. Requires Perl and msql-mysql-modules RPMs. + +@item @code{MySQL-devel-VERSION.i386.rpm} + +Libraries and include files needed if you want to compile other +@strong{MySQL} clients, such as the Perl modules. + +@item @code{MySQL-VERSION.src.rpm} + +This contains the source code for all of the above packages. It can also +be used to try to build RPMs for other architectures (for example, Alpha +or SPARC). +@end itemize + +To see all files in an RPM package, run: +@example +shell> rpm -qpl MySQL-VERSION.i386.rpm +@end example + +To perform a standard minimal installation, run: + +@example +shell> rpm -i MySQL-VERSION.i386.rpm MySQL-client-VERSION.i386.rpm +@end example + +To install just the client package, run: + +@example +shell> rpm -i MySQL-client-VERSION.i386.rpm +@end example + +The RPM places data in @file{/var/lib/mysql}. The RPM also creates the +appropriate entries in @file{/etc/rc.d/} to start the server automatically +at boot time. (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 @code{mysqld} daemon should be running +and you should now be able to start using @strong{MySQL}. +@xref{Post-installation}. + +If something goes wrong, you can find more information in the binary +installation chapter. @xref{Installing binary}. + +@node Windows installation, , Linux-RPM, Quick Standard Installation +@subsection Installing MySQL on Windows + +The following instructions apply to precompiled binary distributions. +If you download a source distribution, you will have to compile and install +it yourself. + +If you don't have a copy of the @strong{MySQL} distribution, you should +first download one from @uref{http://www.mysql.com/downloads/mysql-3.23.html}. + +If you plan to connect to @strong{MySQL} from some other program, you will +probably also need the @strong{MyODBC} driver. You can find this at the +@strong{MyODBC} download page +(@uref{http://www.mysql.com/downloads/api-myodbc.html}). + +To install either distribution, unzip it in some empty directory and run the +@code{Setup.exe} program. + +By default, @strong{MySQL}-Windows is configured to be installed in +@file{C:\mysql}. If you want to install @strong{MySQL} elsewhere, +install it in @file{C:\mysql} first, then move the installation to +where you want it. If you do move @strong{MySQL}, you must indicate +where everything is located by supplying a @code{--basedir} option when +you start the server. For example, if you have moved the @strong{MySQL} +distribution to @file{D:\programs\mysql}, you must start @code{mysqld} +like this: + +@example +C:\> D:\programs\mysql\bin\mysqld --basedir D:\programs\mysql +@end example + +Use @code{mysqld --help} to display all the options that @code{mysqld} +understands! + +With all newer @strong{MySQL} versions, you can also create a +@file{C:\my.cnf} file that holds any default options for the +@strong{MySQL} server. Copy the file @file{\mysql\my-xxxxx.cnf} to +@file{C:\my.cnf} and edit it to suit your setup. Note that you should +specify all paths with @samp{/} instead of @samp{\}. If you use +@samp{\}, you need to specify it twice, because @samp{\} is the escape +character in @strong{MySQL}. @xref{Option files}. + +Starting with @strong{MySQL} 3.23.38, the Windows distribution includes +both the normal and the @strong{MySQL-Max} binaries. The main benefit +of using the normal @code{mysqld.exe} binary is that it's a little +faster and uses less resources. + +Here is a list of the different @strong{MySQL} servers you can use: + +@multitable @columnfractions .25 .75 +@item @code{mysqld} @tab +Compiled with full debugging and automatic memory allocation checking, +symbolic links, BDB and InnoDB tables. +@item @code{mysqld-opt} @tab +Optimized binary with no support for transactional tables. +@item @code{mysqld-nt} @tab +Optimized binary for NT with support for named pipes. You can run this +version on Win98, but in this case no named pipes are created and you must +have TCP/IP installed. +@item @code{mysqld-max} @tab +Optimized binary with support for symbolic links, BDB and InnoDB tables. +@item @code{mysqld-max-nt} @tab +Like @code{mysqld-max}, but compiled with support for named pipes. +@end multitable + +All of the above binaries are optimized for the Pentium Pro processor but +should work on any Intel processor >= i386. + +NOTE: If you want to use InnoDB tables, there are certain startup +options that must be specified in your @file{my.ini} file! @xref{InnoDB start}. + + +@node General Installation Issues, Many versions, Quick Standard Installation, Installing +@section General Installation Issues + +@c @node Methods of Installation, , , +@c @subsection Methods of Installation + +@c FIX: this needs to be written? + +@menu +* Getting MySQL:: +* Which OS:: +* Which version:: +* Installation layouts:: +@end menu + +@node Getting MySQL, Which OS, General Installation Issues, General Installation Issues +@subsection How to Get MySQL + @cindex downloading @cindex MySQL version @cindex version, latest @cindex getting MySQL @cindex mirror sites @cindex URLS for downloading MySQL -@node Getting MySQL, Which OS, Installing, Installing -@section How to Get MySQL Check the @uref{http://www.mysql.com/, @strong{MySQL} home page} for information about the current version and for downloading instructions. @@ -6787,13 +6951,14 @@ Please report bad or out-of-date mirrors to @email{webmaster@@mysql.com}. @c END_OF_MIRROR_LISTING +@node Which OS, Which version, Getting MySQL, General Installation Issues +@subsection Operating Systems Supported by MySQL + @cindex operating systems, supported @cindex native thread support @cindex thread support @cindex process support @cindex support, for operating systems -@node Which OS, Which version, Getting MySQL, Installing -@section Operating Systems Supported by MySQL We use GNU Autoconf, so it is possible to port @strong{MySQL} to all modern systems with working Posix threads and a C++ compiler. (To compile only the @@ -6920,13 +7085,14 @@ forth more effort into testing on and optimizing for that particular platform. We are just stating our observations to help you make a decision on which platform to use @strong{MySQL} on in your setup. +@node Which version, Installation layouts, Which OS, General Installation Issues +@subsection Which MySQL Version to Use + @cindex MySQL binary distribution @cindex MySQL source distribution @cindex release numbers @cindex version, choosing @cindex choosing, a MySQL version -@node Which version, Many versions, Which OS, Installing -@section Which MySQL Version to Use The first decision to make is whether you want to use the latest development release or the last stable release: @@ -7100,68 +7266,8 @@ Another test is that we use the newest @strong{MySQL} version in our internal production environment, on at least one machine. We have more than 100 gigabytes of data to work with. -@cindex releases, updating -@cindex updating, releases of MySQL -@node Many versions, Installation layouts, Which version, Installing -@section How and When Updates Are Released - -@strong{MySQL} is evolving quite rapidly here at @strong{MySQL AB} and we -want to share this with other @strong{MySQL} users. We try to make a release -when we have very useful features that others seem to have a need for. - -We also try to help out users who request features that are easy to -implement. We take note of what our licensed users want to have, and -we especially take note of what our extended e-mail supported customers -want and try to help them out. - -No one has to download a new release. The News section will tell you if -the new release has something you really want. @xref{News}. - -We use the following policy when updating @strong{MySQL}: - -@itemize @bullet -@item -For each minor update, the last number in the version string is incremented. -When there are major new features or minor incompatibilities with previous -versions, the second number in the version string is incremented. When the -file format changes, the first number is increased. - -@item -Stable tested releases are meant to appear about 1-2 times a year, but -if small bugs are found, a release with only bug fixes will be released. - -@item -Working releases are meant to appear about every 1-8 weeks. - -@item -Binary distributions for some platforms will be made by us for major releases. -Other people may make binary distributions for other systems but probably -less frequently. - -@item -We usually make patches available as soon as we have located and fixed -small bugs. - -@item -For non-critical but annoying bugs, we will make patches available if they -are sent to us. Otherwise we will combine many of them into a larger -patch. - -@item -If there is, by any chance, a fatal bug in a release we will make a new -release as soon as possible. We would like other companies to do this, -too. -@end itemize - -The current stable release is Version 3.23; We have already moved active -development to Version 4.0. Bugs will still be fixed in the stable version. -We don't believe in a complete freeze, as this also leaves out bug fixes -and things that ``must be done.'' ``Somewhat frozen'' means that we may -add small things that ``almost surely will not affect anything that's -already working.'' - -@node Installation layouts, Installing binary, Many versions, Installing -@section Installation Layouts +@node Installation layouts, , Which version, General Installation Issues +@subsection Installation Layouts @cindex installation layouts @cindex layout of installation @@ -7225,485 +7331,132 @@ The header file and library directories are @file{include/mysql} and You can create your own binary installation from a compiled source distribution by executing the script @file{scripts/make_binary_distribution}. -@cindex installing, binary distribution -@cindex binary distributions, installing -@node Installing binary, Installing source, Installation layouts, Installing -@section Installing a MySQL Binary Distribution - -@menu -* Linux-RPM:: Linux RPM files -* Building clients:: Building client programs -* Binary install system issues:: System-specific issues -@end menu - -You need the following tools to install a @strong{MySQL} binary distribution: - -@itemize @bullet -@item -GNU @code{gunzip} to uncompress the distribution. - -@item -A reasonable @code{tar} to unpack the distribution. GNU @code{tar} is -known to work. Sun @code{tar} is known to have problems. -@end itemize - -@cindex RPM, defined -@cindex RedHat Package Manager -An alternative installation method under Linux is to use RPM (RedHat Package -Manager) distributions. @xref{Linux-RPM}. - -@c texi2html fails to split chapters if I use strong for all of this. -If you run into problems, @strong{PLEASE ALWAYS USE} @code{mysqlbug} when -posting questions to @email{mysql@@lists.mysql.com}. Even if the problem -isn't a bug, @code{mysqlbug} gathers system information that will help others -solve your problem. By not using @code{mysqlbug}, you lessen the likelihood -of getting a solution to your problem! You will find @code{mysqlbug} in the -@file{bin} directory after you unpack the distribution. @xref{Bug reports}. - -@cindex commands, for binary distribution -The basic commands you must execute to install and use a @strong{MySQL} -binary distribution are: - -@example -shell> groupadd mysql -shell> useradd -g mysql mysql -shell> cd /usr/local -shell> gunzip < /path/to/mysql-VERSION-OS.tar.gz | tar xvf - -shell> ln -s mysql-VERSION-OS mysql -shell> cd mysql -shell> scripts/mysql_install_db -shell> chown -R root /usr/local/mysql -shell> chown -R mysql /usr/local/mysql/data -shell> chgrp -R mysql /usr/local/mysql -shell> chown -R root /usr/local/mysql/bin -shell> bin/safe_mysqld --user=mysql & -@end example - -@cindex adding, new users -@cindex new users, adding -@cindex users, adding - -You can add new users using the @code{bin/mysql_setpermission} script if -you install the @code{DBI} and @code{Msql-Mysql-modules} Perl modules. - -A more detailed description follows. - -To install a binary distribution, follow the steps below, then proceed -to @ref{Post-installation}, for post-installation setup and testing: - -@enumerate -@item -Pick the directory under which you want to unpack the distribution, and move -into it. In the example below, we unpack the distribution under -@file{/usr/local} and create a directory @file{/usr/local/mysql} into which -@strong{MySQL} is installed. (The following instructions therefore assume -you have permission to create files in @file{/usr/local}. If that directory -is protected, you will need to perform the installation as @code{root}.) - -@item -Obtain a distribution file from one of the sites listed in -@ref{Getting MySQL, , Getting @strong{MySQL}}. - -@strong{MySQL} binary distributions are provided as compressed @code{tar} -archives and have names like @file{mysql-VERSION-OS.tar.gz}, where -@code{VERSION} is a number (for example, @code{3.21.15}), and @code{OS} -indicates the type of operating system for which the distribution is intended -(for example, @code{pc-linux-gnu-i586}). - -@item -If you see a binary distribution marked with the @code{-max} prefix, this -means that the binary has support for transaction-safe tables and other -features. @xref{mysqld-max, , @code{mysqld-max}}. Note that all binaries -are built from the same @strong{MySQL} source distribution. - -@item -Add a user and group for @code{mysqld} to run as: - -@example -shell> groupadd mysql -shell> useradd -g mysql mysql -@end example - -These commands add the @code{mysql} group and the @code{mysql} user. The -syntax for @code{useradd} and @code{groupadd} may differ slightly on different -versions of Unix. They may also be called @code{adduser} and @code{addgroup}. -You may wish to call the user and group something else instead of @code{mysql}. +@node Many versions, MySQL binaries, General Installation Issues, Installing +@section How and When Updates Are Released -@item -Change into the intended installation directory: +@cindex releases, updating +@cindex updating, releases of MySQL -@example -shell> cd /usr/local -@end example +@strong{MySQL} is evolving quite rapidly here at @strong{MySQL AB} and we +want to share this with other @strong{MySQL} users. We try to make a release +when we have very useful features that others seem to have a need for. -@item -Unpack the distribution and create the installation directory: +We also try to help out users who request features that are easy to +implement. We take note of what our licensed users want to have, and +we especially take note of what our extended e-mail supported customers +want and try to help them out. -@example -shell> gunzip < /path/to/mysql-VERSION-OS.tar.gz | tar xvf - -shell> ln -s mysql-VERSION-OS mysql -@end example +No one has to download a new release. The News section will tell you if +the new release has something you really want. @xref{News}. -The first command creates a directory named @file{mysql-VERSION-OS}. The -second command makes a symbolic link to that directory. This lets you refer -more easily to the installation directory as @file{/usr/local/mysql}. +We use the following policy when updating @strong{MySQL}: +@itemize @bullet @item -Change into the installation directory: - -@example -shell> cd mysql -@end example - -You will find several files and subdirectories in the @code{mysql} directory. -The most important for installation purposes are the @file{bin} and -@file{scripts} subdirectories. - -@table @file -@item bin -@tindex PATH environment variable -@tindex environment variable, PATH -This directory contains client programs and the server -You should add the full pathname of this directory to your -@code{PATH} environment variable so that your shell finds the @strong{MySQL} -programs properly. @xref{Environment variables}. - -@item scripts -This directory contains the @code{mysql_install_db} script used to initialize -the @code{mysql} database containing the grant tables that store the server -access permissions. -@end table +For each minor update, the last number in the version string is incremented. +When there are major new features or minor incompatibilities with previous +versions, the second number in the version string is incremented. When the +file format changes, the first number is increased. @item -If you would like to use @code{mysqlaccess} and have the @strong{MySQL} -distribution in some non-standard place, you must change the location where -@code{mysqlaccess} expects to find the @code{mysql} client. Edit the -@file{bin/mysqlaccess} script at approximately line 18. Search for a line -that looks like this: - -@example -$MYSQL = '/usr/local/bin/mysql'; # path to mysql executable -@end example - -Change the path to reflect the location where @code{mysql} actually is -stored on your system. If you do not do this, you will get a @code{Broken -pipe} error when you run @code{mysqlaccess}. +Stable tested releases are meant to appear about 1-2 times a year, but +if small bugs are found, a release with only bug fixes will be released. @item -Create the @strong{MySQL} grant tables (necessary only if you haven't -installed @strong{MySQL} before): -@example -shell> scripts/mysql_install_db -@end example - -Note that @strong{MySQL} versions older than Version 3.22.10 started the -@strong{MySQL} server when you run @code{mysql_install_db}. This is no -longer true! +Working releases are meant to appear about every 1-8 weeks. @item -Change ownership of binaries to @code{root} and ownership of the data -directory to the user that you will run @code{mysqld} as: - -@example -shell> chown -R root /usr/local/mysql -shell> chown -R mysql /usr/local/mysql/data -shell> chgrp -R mysql /usr/local/mysql -@end example - -The first command changes the @code{owner} attribute of the files to the -@code{root} user, the second one changes the @code{owner} attribute of the -data directory to the @code{mysql} user, and the third one changes the -@code{group} attribute to the @code{mysql} group. +Binary distributions for some platforms will be made by us for major releases. +Other people may make binary distributions for other systems but probably +less frequently. @item -If you want to install support for the Perl @code{DBI}/@code{DBD} interface, -see @ref{Perl support}. +We usually make patches available as soon as we have located and fixed +small bugs. @item -If you would like @strong{MySQL} to start automatically when you boot your -machine, you can copy @code{support-files/mysql.server} to the location where -your system has its startup files. More information can be found in the -@code{support-files/mysql.server} script itself and in -@ref{Automatic start}. - -@end enumerate - -After everything has been unpacked and installed, you should initialize -and test your distribution. - -You can start the @strong{MySQL} server with the following command: - -@example -shell> bin/safe_mysqld --user=mysql & -@end example - -@xref{safe_mysqld, , @code{safe_mysqld}}. - -@xref{Post-installation}. - -@cindex RPM file -@cindex RedHat Package Manager -@c This node name is special -@node Linux-RPM, Building clients, Installing binary, Installing binary -@subsection Linux RPM Notes - -The recommended way to install @strong{MySQL} on Linux is by using an RPM -file. The @strong{MySQL} RPMs are currently being built on a RedHat Version -6.2 system but should work on other versions of Linux that support @code{rpm} -and use @code{glibc}. - -If you have problems with an RPM file, for example, if you receive the error -``@code{Sorry, the host 'xxxx' could not be looked up}'', see -@ref{Binary notes-Linux}. - -The RPM files you may want to use are: - -@itemize @bullet -@item @code{MySQL-VERSION.i386.rpm} - -The @strong{MySQL} server. You will need this unless you only want to -connect to a @strong{MySQL} server running on another machine. - -@item @code{MySQL-client-VERSION.i386.rpm} - -The standard @strong{MySQL} client programs. You probably always want to -install this package. - -@item @code{MySQL-bench-VERSION.i386.rpm} - -Tests and benchmarks. Requires Perl and msql-mysql-modules RPMs. - -@item @code{MySQL-devel-VERSION.i386.rpm} - -Libraries and include files needed if you want to compile other -@strong{MySQL} clients, such as the Perl modules. - -@item @code{MySQL-VERSION.src.rpm} - -This contains the source code for all of the above packages. It can also -be used to try to build RPMs for other architectures (for example, Alpha -or SPARC). -@end itemize - -To see all files in an RPM package, run: -@example -shell> rpm -qpl MySQL-VERSION.i386.rpm -@end example - -To perform a standard minimal installation, run: - -@example -shell> rpm -i MySQL-VERSION.i386.rpm MySQL-client-VERSION.i386.rpm -@end example - -To install just the client package, run: - -@example -shell> rpm -i MySQL-client-VERSION.i386.rpm -@end example - -The RPM places data in @file{/var/lib/mysql}. The RPM also creates the -appropriate entries in @file{/etc/rc.d/} to start the server automatically -at boot time. (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 @code{mysqld} daemon should be running -and you should now be able to start using @strong{MySQL}. -@xref{Post-installation}. - -If something goes wrong, you can find more information in the binary -installation chapter. @xref{Installing binary}. - -@cindex client programs, building -@cindex linking -@cindex building, client programs -@cindex programs, client -@node Building clients, Binary install system issues, Linux-RPM, Installing binary -@subsection Building Client Programs - -If you compile @strong{MySQL} clients that you've written yourself or that -you obtain from a third party, they must be linked using the -@code{-lmysqlclient -lz} option on the link command. You may also need to -specify a @code{-L} option to tell the linker where to find the library. For -example, if the library is installed in @file{/usr/local/mysql/lib}, use -@code{-L/usr/local/mysql/lib -lmysqlclient -lz} on the link command. - -For clients that use @strong{MySQL} header files, you may need to specify a -@code{-I} option when you compile them (for example, -@code{-I/usr/local/mysql/include}), so the compiler can find the header -files. - -@node Binary install system issues, , Building clients, Installing binary -@subsection System-specific Issues - -@menu -* Binary notes-Linux:: Linux notes for binary distribution -* Binary notes-HP-UX:: HP-UX notes for binary distribution -@end menu - -The following sections indicate some of the issues that have been observed -on particular systems when installing @strong{MySQL} from a binary -distribution or from RPM files. - -@cindex binary distributions, on Linux -@cindex Linux, binary distribution -@node Binary notes-Linux, Binary notes-HP-UX, Binary install system issues, Binary install system issues -@subsubsection Linux Notes for Binary Distributions - -@strong{MySQL} needs at least Linux Version 2.0. - -The binary release is linked with @code{-static}, which means you do not -normally need to worry about which version of the system libraries you -have. You need not install LinuxThreads, either. A program linked with -@code{-static} is slightly bigger than a dynamically linked program but -also slightly faster (3-5%). One problem, however, is that you can't use -user-definable functions (UDFs) with a statically linked program. If -you are going to write or use UDF functions (this is something only for -C or C++ programmers), you must compile @strong{MySQL} yourself, using -dynamic linking. - -If you are using a @code{libc}-based system (instead of a @code{glibc2} -system), you will probably get some problems with hostname resolving and -@code{getpwnam()} with the binary release. (This is because @code{glibc} -unfortunately depends on some external libraries to resolve hostnames -and @code{getpwent()}, even when compiled with @code{-static}). In this -case you probably get the following error message when you run -@code{mysql_install_db}: - -@example -Sorry, the host 'xxxx' could not be looked up -@end example - -or the following error when you try to run @code{mysqld} with the @code{--user} -option: - -@example -getpwnam: No such file or directory -@end example - -You can solve this problem in one of the following ways: +For non-critical but annoying bugs, we will make patches available if they +are sent to us. Otherwise we will combine many of them into a larger +patch. -@itemize @bullet @item -Get a @strong{MySQL} source distribution (an RPM or the @code{tar.gz} -distribution) and install this instead. -@item -Execute @code{mysql_install_db --force}; This will not execute the -@code{resolveip} test in @code{mysql_install_db}. The downside is that -you can't use host names in the grant tables; you must use IP numbers -instead (except for @code{localhost}). If you are using an old @strong{MySQL} -release that doesn't support @code{--force}, you have to remove the -@code{resolveip} test in @code{mysql_install} with an editor. -@item -Start @code{mysqld} with @code{su} instead of using @code{--user}. +If there is, by any chance, a fatal bug in a release we will make a new +release as soon as possible. We would like other companies to do this, +too. @end itemize -The Linux-Intel binary and RPM releases of @strong{MySQL} are configured -for the highest possible speed. We are always trying to use the fastest -stable compiler available. - -@strong{MySQL} Perl support requires Version Perl 5.004_03 or newer. - -On some Linux 2.2 versions, you may get the error @code{Resource -temporarily unavailable} when you do a lot of new connections to a -@code{mysqld} server over TCP/IP. - -The problem is that Linux has a delay between when you close a TCP/IP -socket and until this is actually freed by the system. As there is only -room for a finite number of TCP/IP slots, you will get the above error if -you try to do too many new TCP/IP connections during a small time, like -when you run the @strong{MySQL} @file{test-connect} benchmark over -TCP/IP. - -We have mailed about this problem a couple of times to different Linux -mailing lists but have never been able to resolve this properly. +The current stable release is Version 3.23; We have already moved active +development to Version 4.0. Bugs will still be fixed in the stable version. +We don't believe in a complete freeze, as this also leaves out bug fixes +and things that ``must be done.'' ``Somewhat frozen'' means that we may +add small things that ``almost surely will not affect anything that's +already working.'' -The only known 'fix' to this problem is to use persistent connections in -your clients or use sockets, if you are running the database server -and clients on the same machine. We hope that the @code{Linux 2.4} -kernel will fix this problem in the future. +@node MySQL binaries, Installing source, Many versions, Installing +@section MySQL Binaries Compiled by MySQL AB -@cindex HP-UX, binary distribution -@cindex binary distributions, on HP-UX -@node Binary notes-HP-UX, , Binary notes-Linux, Binary install system issues -@subsubsection HP-UX Notes for Binary Distributions +@cindex binary distributions -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. +As a service, we at @strong{MySQL AB} provide a set of binary distributions +of @strong{MySQL} that are compiled at our site or at sites where customers +kindly have given us access to their machines. -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} Version 3.22.26 and newer can also be -built with HP's native thread package. +These distributions are generated with @code{scripts/make_binary_distribution} +and are configured with the following compilers and options: -Other configurations that may work: +@table @asis +@item SunOS 4.1.4 2 sun4c with @code{gcc} 2.7.2.1 +@code{CC=gcc CXX=gcc CXXFLAGS="-O3 -felide-constructors" ./configure --prefix=/usr/local/mysql --disable-shared --with-extra-charsets=complex --enable-assembler} -@itemize @bullet -@item -HP 9000/7xx running HP-UX 10.20+ -@item -HP 9000/8xx running HP-UX 10.30 -@end itemize +@item SunOS 5.5.1 (and above) sun4u with @code{egcs} 1.0.3a or 2.90.27 or gcc 2.95.2 and newer +@code{CC=gcc CFLAGS="-O3" CXX=gcc CXXFLAGS="-O3 -felide-constructors -fno-exceptions -fno-rtti" ./configure --prefix=/usr/local/mysql --with-low-memory --with-extra-charsets=complex --enable-assembler} -The following configurations almost definitely won't work: +@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 --with-extra-charsets=complex} -@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 +@item Linux 2.0.33 i386 with @code{pgcc} 2.90.29 (@code{egcs} 1.0.3a) +@code{CFLAGS="-O3 -mpentium -mstack-align-double" CXX=gcc CXXFLAGS="-O3 -mpentium -mstack-align-double -felide-constructors -fno-exceptions -fno-rtti" ./configure --prefix=/usr/local/mysql --enable-assembler --with-mysqld-ldflags=-all-static --with-extra-charsets=complex} -To install the distribution, use one of the commands below, where -@code{/path/to/depot} is the full pathname of the depot file: +@item Linux 2.2.x with x686 with @code{gcc} 2.95.2 +@code{CFLAGS="-O3 -mpentiumpro" CXX=gcc CXXFLAGS="-O3 -mpentiumpro -felide-constructors -fno-exceptions -fno-rtti" ./configure --prefix=/usr/local/mysql --enable-assembler --with-mysqld-ldflags=-all-static --disable-shared --with-extra-charset=complex} -@itemize @bullet -@item -To install everything, including the server, client and development tools: +@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 --with-extra-charsets=complex} -@example -shell> /usr/sbin/swinstall -s /path/to/depot mysql.full -@end example +@item AIX 2 4 with @code{gcc} 2.7.2.2 +@code{CC=gcc CXX=gcc CXXFLAGS=-O3 ./configure --prefix=/usr/local/mysql --with-extra-charsets=complex} -@item -To install only the server: +@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 --with-extra-charsets=complex} -@example -shell> /usr/sbin/swinstall -s /path/to/depot mysql.server -@end example +@item Irix 6.3 IP32 with @code{gcc} 2.8.0 +@code{CC=gcc CXX=gcc CXXFLAGS=-O3 ./configure --prefix=/usr/local/mysql --with-extra-charsets=complex} -@item -To install only the client package: +@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 --with-extra-charsets=complex} -@example -shell> /usr/sbin/swinstall -s /path/to/depot mysql.client -@end example +@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 --with-extra-charsets=complex} +@end table -@item -To install only the development tools: +Anyone who has more optimal options for any of the configurations listed +above can always mail them to the developer's mailing list at +@email{internals@@lists.mysql.com}. -@example -shell> /usr/sbin/swinstall -s /path/to/depot mysql.developer -@end example -@end itemize +RPM distributions prior to @strong{MySQL} Version 3.22 are user-contributed. +Beginning with Version 3.22, the RPMs are generated by us at +@strong{MySQL AB}. -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{/etc/init.d} and @file{/etc/rc2.d} to start the server automatically -at boot time. Obviously, this entails being @code{root} to install. +If you want to compile a debug version of @strong{MySQL}, you should add +@code{--with-debug} or @code{--with-debug=full} to the above configure lines +and remove any @code{-fomit-frame-pointer} options. -To install the HP-UX tar.gz distribution, you must have a copy of GNU -@code{tar}. +@node Installing source, Perl support, MySQL binaries, Installing +@section Installing a MySQL Source Distribution @cindex installing, source distribution @cindex source distribution, installing @cindex installation overview -@node Installing source, Installing source tree, Installing binary, Installing -@section Installing a MySQL Source Distribution Before you proceed with the source installation, check first to see if our binary is available for your platform and if it will work for you. We @@ -7767,6 +7520,9 @@ of getting a solution to your problem! You will find @code{mysqlbug} in the * Quick install:: Quick installation overview * Applying patches:: Applying patches * configure options:: Typical @code{configure} options +* Installing source tree:: +* Compilation problems:: +* MIT-pthreads:: @end menu @node Quick install, Applying patches, Installing source, Installing source @@ -7948,11 +7704,12 @@ running. @xref{Multiple servers}. @xref{Post-installation}. -@cindex patches, applying -@cindex applying, patches @node Applying patches, configure options, Quick install, Installing source @subsection Applying Patches +@cindex patches, applying +@cindex applying, patches + Sometimes patches appear on the mailing list or are placed in the @uref{http://www.mysql.com/Downloads/Patches, patches area} of the @strong{MySQL} Web site. @@ -7988,14 +7745,15 @@ You may need to bring down any currently running server before you run systems do not allow you to install a new version of a program if it replaces the version that is currently executing. +@node configure options, Installing source tree, Applying patches, Installing source +@subsection Typical @code{configure} Options + +@findex without-server option @cindex @code{configure} script @cindex options, configure @cindex configuration options -@findex without-server option @cindex log files @cindex files, log -@node configure options, , Applying patches, Installing source -@subsection Typical @code{configure} Options The @code{configure} script gives you a great deal of control over how you configure your @strong{MySQL} distribution. Typically you do this @@ -8205,12 +7963,12 @@ applications. @xref{Thread-safe clients}. @item Options that pertain to particular systems can be found in the -system-specific sections later in this chapter. @xref{Source install -system issues}. +system-specific section of this manual. +@xref{Operating System Specific Notes}. @end itemize -@node Installing source tree, Compilation problems, Installing source, Installing -@section Installing from the Development Source Tree +@node Installing source tree, Compilation problems, configure options, Installing source +@subsection Installing from the Development Source Tree @cindex development source tree @cindex BitKeeper tree @@ -8310,13 +8068,14 @@ a description. @end enumerate +@node Compilation problems, MIT-pthreads, Installing source tree, Installing source +@subsection Problems Compiling? + @cindex compiling, problems @cindex problems, compiling @cindex reconfiguring @cindex @code{config.cache} file @cindex files, @code{config.cache} -@node Compilation problems, MIT-pthreads, Installing source tree, Installing -@section Problems Compiling? All @strong{MySQL} programs compile cleanly for us with no warnings on Solaris using @code{gcc}. On other systems, warnings may occur due to @@ -8530,10 +8289,11 @@ If you need to debug @code{mysqld} or a @strong{MySQL} client, run link your clients with the new client library. @xref{Debugging client}. @end itemize +@node MIT-pthreads, , Compilation problems, Installing source +@subsection MIT-pthreads Notes + @cindex MIT-pthreads @cindex thread support, non-native -@node MIT-pthreads, Perl support, Compilation problems, Installing -@section MIT-pthreads Notes This section describes some of the issues involved in using MIT-pthreads. @@ -8622,7 +8382,7 @@ needed, but may be interesting for someone.) @cindex Perl, installing @cindex installing, Perl -@node Perl support, Source install system issues, MIT-pthreads, Installing +@node Perl support, Post-installation, Installing source, Installing @section Perl Installation Comments @menu @@ -8906,340 +8666,1022 @@ shell> make perl Finally, you should install this new Perl. Again, the output of @code{make perl} indicates the command to use. -@node Source install system issues, Windows, Perl support, Installing -@section System-specific Issues -The following sections indicate some of the issues that have been observed to -occur on particular systems when installing @strong{MySQL} from a source -distribution. +@node Post-installation, Upgrade, Perl support, Installing +@section Post-installation Setup and Testing + +@cindex post-installation, setup and testing +@cindex testing, post-installation +@cindex setup, post-installation @menu -* Solaris:: Solaris notes -* Solaris 2.7:: Solaris 2.7 / 2.8 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:: HP-UX 11.x notes -* Mac OS X:: Mac OS X notes -* BEOS:: BeOS Notes +* 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 @end menu +Once you've installed @strong{MySQL} (from either a binary or source +distribution), you need to initialize the grant tables, start the server, +and make sure that the server works okay. You may also wish to arrange +for the server to be started and stopped automatically when your system +starts up and shuts down. -@cindex Solaris installation problems -@cindex problems, installing on Solaris -@cindex tar, problems on Solaris -@cindex errors, directory checksum -@cindex checksum errors -@node Solaris, Solaris 2.7, Source install system issues, Source install system issues -@subsection Solaris Notes +Normally you install the grant tables and start the server like this +for installation from a source distribution: +@cindex starting, the server +@cindex server, starting -On Solaris, you may run into trouble even before you get the @strong{MySQL} -distribution unpacked! Solaris @code{tar} can't handle long file names, so -you may see an error like this when you unpack @strong{MySQL}: +@example +shell> ./scripts/mysql_install_db +shell> cd mysql_installation_directory +shell> ./bin/safe_mysqld --user=mysql & +@end example + +For a binary distribution (not RPM or pkg packages), do this: @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 +shell> cd mysql_installation_directory +shell> ./bin/mysql_install_db +shell> ./bin/safe_mysqld --user=mysql & @end example -In this case, you must use GNU @code{tar} (@code{gtar}) to unpack the -distribution. You can find a precompiled copy for Solaris at -@uref{http://www.mysql.com/Downloads/}. +This creates the @code{mysql} database which will hold all database +privileges, the @code{test} database which you can use to test +@strong{MySQL} and also privilege entries for the user that run +@code{mysql_install_db} and a @code{root} user (without any passwords). +This also starts the @code{mysqld} server. -Sun native threads work only on Solaris 2.5 and higher. For Version 2.4 and -earlier, @strong{MySQL} will automatically use MIT-pthreads. -@xref{MIT-pthreads}. +@code{mysql_install_db} will not overwrite any old privilege tables, so +it should be safe to run in any circumstances. If you don't want to +have the @code{test} database you can remove it with @code{mysqladmin -u +root drop test}. -If you get the following error from configure: +Testing is most easily done from the top-level directory of the @strong{MySQL} +distribution. For a binary distribution, this is your installation directory +(typically something like @file{/usr/local/mysql}). For a source +distribution, this is the main directory of your @strong{MySQL} source tree. +@cindex testing, the server + +In the commands shown below in this section and in the following +subsections, @code{BINDIR} is the path to the location in which programs +like @code{mysqladmin} and @code{safe_mysqld} are installed. For a +binary distribution, this is the @file{bin} directory within the +distribution. For a source distribution, @code{BINDIR} is probably +@file{/usr/local/bin}, unless you specified an installation directory +other than @file{/usr/local} when you ran @code{configure}. +@code{EXECDIR} is the location in which the @code{mysqld} server is +installed. For a binary distribution, this is the same as +@code{BINDIR}. For a source distribution, @code{EXECDIR} is probably +@file{/usr/local/libexec}. + +Testing is described in detail below: +@cindex testing, installation + +@enumerate +@item +If necessary, start the @code{mysqld} server and set up the initial +@strong{MySQL} grant tables containing the privileges that determine how +users are allowed to connect to the server. This is normally done with the +@code{mysql_install_db} script: @example -checking for restartable system calls... configure: error can not run test -programs while cross compiling +shell> scripts/mysql_install_db @end example -This means that you have something wrong with your compiler installation! -In this case you should upgrade your compiler to a newer version. You may -also be able to solve this problem by inserting the following row into the -@file{config.cache} file: +Typically, @code{mysql_install_db} needs to be run only the first time you +install @strong{MySQL}. Therefore, if you are upgrading an existing +installation, you can skip this step. (However, @code{mysql_install_db} is +quite safe to use and will not update any tables that already exist, so if +you are unsure of what to do, you can always run @code{mysql_install_db}.) + +@code{mysql_install_db} creates six tables (@code{user}, @code{db}, +@code{host}, @code{tables_priv}, @code{columns_priv}, and @code{func}) in the +@code{mysql} database. A description of the initial privileges is given in +@ref{Default privileges}. Briefly, these privileges allow the @strong{MySQL} +@code{root} user to do anything, and allow anybody to create or use databases +with a name of @code{'test'} or starting with @code{'test_'}. + +If you don't set up the grant tables, the following error will appear in the +log file when you start the server: +@tindex host.frm, problems finding @example -ac_cv_sys_restartable_syscalls=$@{ac_cv_sys_restartable_syscalls='no'@} +mysqld: Can't find file: 'host.frm' @end example -If you are using Solaris on a SPARC, the recommended compiler is -@code{gcc} 2.95.2. You can find this at @uref{http://gcc.gnu.org/}. -Note that @code{egcs} 1.1.1 and @code{gcc} 2.8.1 don't work reliably on -SPARC! +The above may also happen with a binary @strong{MySQL} distribution if you +don't start @strong{MySQL} by executing exactly @code{./bin/safe_mysqld}! +@xref{safe_mysqld, , @code{safe_mysqld}}. -The recommended @code{configure} line when using @code{gcc} 2.95.2 is: +You might need to run @code{mysql_install_db} as @code{root}. However, +if you prefer, you can run the @strong{MySQL} server as an unprivileged +(non-@code{root}) user, provided that user can read and write files in +the database directory. Instructions for running @strong{MySQL} as an +unprivileged user are given in @ref{Changing MySQL user, , Changing +@strong{MySQL} user}. + +If you have problems with @code{mysql_install_db}, see +@ref{mysql_install_db, , @code{mysql_install_db}}. + +There are some alternatives to running the @code{mysql_install_db} +script as it is provided in the @strong{MySQL} distribution: + +@itemize @bullet +@item +You may want to edit @code{mysql_install_db} before running it, to change +the initial privileges that are installed into the grant tables. This is +useful if you want to install @strong{MySQL} on a lot of machines with the +same privileges. In this case you probably should need only to add a few +extra @code{INSERT} statements to the @code{mysql.user} and @code{mysql.db} +tables! + +@item +If you want to change things in the grant tables after installing them, you +can run @code{mysql_install_db}, then use @code{mysql -u root mysql} to +connect to the grant tables as the @strong{MySQL} @code{root} user and issue +SQL statements to modify the grant tables directly. + +@item +It is possible to re-create the grant tables completely after they have +already been created. You might want to do this if you've already installed +the tables but then want to re-create them after editing +@code{mysql_install_db}. +@end itemize + +For more information about these alternatives, see @ref{Default privileges}. + +@item +Start the @strong{MySQL} server like this: @example -CC=gcc CFLAGS="-O3" \ -CXX=gcc CXXFLAGS="-O3 -felide-constructors -fno-exceptions -fno-rtti" \ -./configure --prefix=/usr/local/mysql --with-low-memory --enable-assembler +shell> cd mysql_installation_directory +shell> bin/safe_mysqld & @end example -If you have a ultra sparc, you can get 4 % more performance by adding -"-mcpu=v8 -Wa,-xarch=v8plusa" to CFLAGS and CXXFLAGS. +If you have problems starting the server, see @ref{Starting server}. -If you have the Sun Workshop (SunPro) 4.2 (or newer) compiler, you can -run @code{configure} like this: +@item +Use @code{mysqladmin} to verify that the server is running. The following +commands provide a simple test to check that the server is up and responding +to connections: @example -CC=cc CFLAGS="-Xa -fast -xO4 -native -xstrconst -mt" \ -CXX=CC CXXFLAGS="-noex -xO4 -mt" \ -./configure --prefix=/usr/local/mysql --enable-assembler +shell> BINDIR/mysqladmin version +shell> BINDIR/mysqladmin variables @end example -You may also have to edit the @code{configure} script to change this line: +The output from @code{mysqladmin version} varies slightly depending on your +platform and version of @strong{MySQL}, but should be similar to that shown +below: @example -#if !defined(__STDC__) || __STDC__ != 1 +shell> BINDIR/mysqladmin version +mysqladmin Ver 8.14 Distrib 3.23.32, for linux on i586 +Copyright (C) 2000 MySQL AB & MySQL Finland AB & TCX DataKonsult AB +This software comes with ABSOLUTELY NO WARRANTY. This is free software, +and you are welcome to modify and redistribute it under the GPL license + +Server version 3.23.32-debug +Protocol version 10 +Connection Localhost via Unix socket +TCP port 3306 +UNIX socket /tmp/mysql.sock +Uptime: 16 sec + +Threads: 1 Questions: 9 Slow queries: 0 Opens: 7 Flush tables: 2 Open tables: 0 Queries per second avg: 0.000 Memory in use: 132K Max memory used: 16773K @end example -to this: +To get a feeling for what else you can do with @code{BINDIR/mysqladmin}, +invoke it with the @code{--help} option. + +@item +Verify that you can shut down the server: +@cindex server, shutdown +@cindex shutting down, the server @example -#if !defined(__STDC__) +shell> BINDIR/mysqladmin -u root shutdown @end example -If you turn on @code{__STDC__} with the @code{-Xc} option, the Sun compiler -can't compile with the Solaris @file{pthread.h} header file. This is a Sun -bug (broken compiler or broken include file). +@item +Verify that you can restart the server. Do this using @code{safe_mysqld} or +by invoking @code{mysqld} directly. For example: -If @code{mysqld} issues the error message shown below when you run it, you have -tried to compile @strong{MySQL} with the Sun compiler without enabling the -multi-thread option (@code{-mt}): +@cindex server, restart +@cindex restarting, the server @example -libc internal error: _rmutex_unlock: rmutex not held +shell> BINDIR/safe_mysqld --log & @end example -Add @code{-mt} to @code{CFLAGS} and @code{CXXFLAGS} and try again. +If @code{safe_mysqld} fails, try running it from the @strong{MySQL} +installation directory (if you are not already there). If that doesn't work, +see @ref{Starting server}. -If you get the following error when compiling @strong{MySQL} with @code{gcc}, -it means that your @code{gcc} is not configured for your version of Solaris: +@item +Run some simple tests to verify that the server is working. +The output should be similar to what is shown below: @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' +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 -The proper thing to do in this case is to get the newest version of -@code{gcc} and compile it with your current @code{gcc} compiler! At -least for Solaris 2.5, almost all binary versions of @code{gcc} have -old, unusable include files that will break all programs that use -threads (and possibly other programs)! +There is also a benchmark suite in the @file{sql-bench} directory (under the +@strong{MySQL} installation directory) that you can use to compare how +@strong{MySQL} performs on different platforms. The @file{sql-bench/Results} +directory contains the results from many runs against different databases and +platforms. To run all tests, execute these commands: -Solaris doesn't provide static versions of all system libraries -(@code{libpthreads} and @code{libdl}), so you can't compile @strong{MySQL} -with @code{--static}. If you try to do so, you will get the error: +@example +shell> cd sql-bench +shell> run-all-tests +@end example + +If you don't have the @file{sql-bench} directory, you are probably using an +RPM for a binary distribution. (Source distribution RPMs include the +benchmark directory.) In this case, you must first install the benchmark +suite before you can use it. Beginning with @strong{MySQL} Version 3.22, +there are benchmark RPM files named @file{mysql-bench-VERSION-i386.rpm} that +contain benchmark code and data. + +If you have a source distribution, you can also run the tests in the +@file{tests} subdirectory. For example, to run @file{auto_increment.tst}, do +this: @example -ld: fatal: library -ldl: not found +shell> BINDIR/mysql -vvf test < ./tests/auto_increment.tst +@end example -or +The expected results are shown in the @file{./tests/auto_increment.res} file. +@end enumerate -undefined reference to `dlopen' +@node mysql_install_db, Starting server, Post-installation, Post-installation +@subsection Problems Running @code{mysql_install_db} +@cindex @code{mysql_install_db} script +@cindex scripts, @code{mysql_install_db} + +The purpose of the @code{mysql_install_db} script is to generate new +@strong{MySQL} privilege tables. It will not affect any other data! +It will also not do anything if you already have @strong{MySQL} privilege +tables installed! + +If you want to re-create your privilege tables, you should take down +the @code{mysqld} server, if it's running, and then do something like: + +@example +mv mysql-data-directory/mysql mysql-data-directory/mysql-old +mysql_install_db @end example -If too many processes try to connect very rapidly to @code{mysqld}, you will -see this error in the @strong{MySQL} log: +This section lists problems you might encounter when you run +@code{mysql_install_db}: + +@table @strong +@item @code{mysql_install_db} doesn't install the grant tables + +You may find that @code{mysql_install_db} fails to install the grant +tables and terminates after displaying the following messages: @example -Error in accept: Protocol error +starting mysqld daemon with databases from XXXXXX +mysql daemon ended @end example -You might try starting the server with the @code{--set-variable back_log=50} -option as a workaround for this. @xref{Command-line options}. +In this case, you should examine the log file very carefully! The log +should be located in the directory @file{XXXXXX} named by the error message, +and should indicate why @code{mysqld} didn't start. If you don't understand +what happened, include the log when you post a bug report using +@code{mysqlbug}! +@xref{Bug reports}. -If you are linking your own @strong{MySQL} client, you might get the -following error when you try to execute it: +@item There is already a @code{mysqld} daemon running + +In this case, you probably don't have to run @code{mysql_install_db} at +all. You have to run @code{mysql_install_db} only once, when you install +@strong{MySQL} the first time. + +@item Installing a second @code{mysqld} daemon doesn't work when one daemon is running +This can happen when you already have an existing @strong{MySQL} +installation, but want to put a new installation in a different place (for +example, for testing, or perhaps you simply want to run two installations at +the same time). Generally the problem that occurs when you try to run the +second server is that it tries to use the same socket and port as the old one. +In this case you will get the error message: @code{Can't start server: Bind on +TCP/IP port: Address already in use} or @code{Can't start server : Bind on +unix socket...}. @xref{Installing many servers}. + +@item You don't have write access to @file{/tmp} +@cindex write access, tmp +@cindex temporary file, write access +@cindex files, @code{tmp} + +If you don't have write access to create a socket file at the default place +(in @file{/tmp}) or permission to create temporary files in @file{/tmp,} +you will get an error when running @code{mysql_install_db} or when +starting or using @code{mysqld}. + +You can specify a different socket and temporary directory as follows: + +@tindex TMPDIR environment variable +@tindex MYSQL_UNIX_PORT environment variable +@tindex Environment variable, TMPDIR +@tindex Environment variable, MYSQL_UNIX_PORT @example -ld.so.1: ./my: fatal: libmysqlclient.so.#: open failed: No such file or directory +shell> TMPDIR=/some_tmp_dir/ +shell> MYSQL_UNIX_PORT=/some_tmp_dir/mysqld.sock +shell> export TMPDIR MYSQL_UNIX_PORT @end example -The problem can be avoided by one of the following methods: +@file{some_tmp_dir} should be the path to some directory for which you +have write permission. @xref{Environment variables}. + +After this you should be able to run @code{mysql_install_db} and start +the server with these commands: + +@example +shell> scripts/mysql_install_db +shell> BINDIR/safe_mysqld & +@end example + +@item @code{mysqld} crashes immediately + +If you are running RedHat Version 5.0 with a version of @code{glibc} older than +2.0.7-5, you should make sure you have installed all @code{glibc} patches! +There is a lot of information about this in the @strong{MySQL} mail +archives. Links to the mail archives are available online at +@uref{http://www.mysql.com/documentation/}. +Also, see @ref{Linux}. + +You can also start @code{mysqld} manually using the @code{--skip-grant-tables} +option and add the privilege information yourself using @code{mysql}: + +@example +shell> BINDIR/safe_mysqld --skip-grant-tables & +shell> BINDIR/mysql -u root mysql +@end example + +From @code{mysql}, manually execute the SQL commands in +@code{mysql_install_db}. Make sure you run @code{mysqladmin +flush-privileges} or @code{mysqladmin reload} afterward to tell the server to +reload the grant tables. +@end table + +@node Starting server, Automatic start, mysql_install_db, Post-installation +@subsection Problems Starting the MySQL Server +@cindex server, starting problems +@cindex problems, starting the server + +If you are going to use tables that support transactions (BDB, InnoDB), +you should first create a my.cnf file and set startup options +for the table types you plan to use. @xref{Table types}. + +Generally, you start the @code{mysqld} server in one of three ways: @itemize @bullet @item -Link the client with the following flag (instead of @code{-Lpath}): -@code{-Wl,r/full-path-to-libmysqlclient.so}. +By invoking @code{mysql.server}. This script is used primarily at +system startup and shutdown, and is described more fully in +@ref{Automatic start}. @item -Copy @file{libmysqclient.so} to @file{/usr/lib}. +By invoking @code{safe_mysqld}, which tries to determine the proper options +for @code{mysqld} and then runs it with those options. @xref{safe_mysqld, , +@code{safe_mysqld}}. -@tindex LD_RUN_PATH environment variable -@tindex Environment variable, LD_RUN_PATH @item -Add the pathname of the directory where @file{libmysqlclient.so} is located -to the @code{LD_RUN_PATH} environment variable before running your client. -@end itemize - -When using the @code{--with-libwrap} configure option, you must also -include the libraries that @file{libwrap.a} needs: +On NT you should install @code{mysqld} as a service as follows: +@example +bin\mysqld-nt --install # Install MySQL as a service +@end example +You can now start/stop @code{mysqld} as follows: @example ---with-libwrap="/opt/NUtcpwrapper-7.6/lib/libwrap.a -lnsl -lsocket +NET START mysql +NET STOP mysql @end example -If you have problems with configure trying to link with @code{-lz} and -you don't have @code{zlib} installed, you have two options: +Note that in this case you can't use any other options for @code{mysqld}! -@itemize @bullet -@item -If you want to be able to use the compressed communication protocol, -you need to get and install zlib from ftp.gnu.org. +You can remove the service as follows: +@example +bin\mysqld-nt --remove # remove MySQL as a service +@end example @item -Configure with @code{--with-named-z-libs=no}. +By invoking @code{mysqld} directly. @end itemize -If you are using gcc and have problems with loading @code{UDF} functions -into @strong{MySQL}, try adding @code{-lgcc} to the link line for the -@code{UDF} function. +When the @code{mysqld} daemon starts up, it changes directory to the +data directory. This is where it expects to write log files and the pid +(process ID) file, and where it expects to find databases. -If you would like @strong{MySQL} to start automatically, you can copy -@file{support-files/mysql.server} to @file{/etc/init.d} and create a -symbolic link to it named @file{/etc/rc3.d/S99mysql.server}. +The data directory location is hardwired in when the distribution is +compiled. However, if @code{mysqld} expects to find the data directory +somewhere other than where it really is on your system, it will not work +properly. If you have problems with incorrect paths, you can find out +what options @code{mysqld} allows and what the default path settings are by +invoking @code{mysqld} with the @code{--help} option. You can override the +defaults by specifying the correct pathnames as command-line arguments to +@code{mysqld}. (These options can be used with @code{safe_mysqld} as well.) -@node Solaris 2.7, Solaris x86, Solaris, Source install system issues -@subsection Solaris 2.7/2.8 Notes +Normally you should need to tell @code{mysqld} only the base directory under +which @strong{MySQL} is installed. You can do this with the @code{--basedir} +option. You can also use @code{--help} to check the effect of changing path +options (note that @code{--help} @emph{must} be the final option of the +@code{mysqld} command). For example: -You can normally use a Solaris 2.6 binary on Solaris 2.7 and 2.8. Most -of the Solaris 2.6 issues also apply for Solaris 2.7 and 2.8. +@example +shell> EXECDIR/mysqld --basedir=/usr/local --help +@end example -Note that @strong{MySQL} Version 3.23.4 and above should be able to autodetect -new versions of Solaris and enable workarounds for the following problems! +Once you determine the path settings you want, start the server without +the @code{--help} option. -Solaris 2.7 / 2.8 has some bugs in the include files. You may see the -following error when you use @code{gcc}: +Whichever method you use to start the server, if it fails to start up +correctly, check the log file to see if you can find out why. Log files +are located in the data directory (typically +@file{/usr/local/mysql/data} for a binary distribution, +@file{/usr/local/var} for a source distribution, +@file{\mysql\data\mysql.err} on Windows.) Look in the data directory for +files with names of the form @file{host_name.err} and +@file{host_name.log} where @code{host_name} is the name of your server +host. Then check the last few lines of these files: @example -/usr/include/widec.h:42: warning: `getwc' redefined -/usr/include/wchar.h:326: warning: this is the location of the previous -definition +shell> tail host_name.err +shell> tail host_name.log @end example -If this occurs, you can do the following to fix the problem: +If you find something like the following in the log file: +@example +000729 14:50:10 bdb: Recovery function for LSN 1 27595 failed +000729 14:50:10 bdb: warning: ./test/t1.db: No such file or directory +000729 14:50:10 Can't init databases +@end example -Copy @code{/usr/include/widec.h} to -@code{.../lib/gcc-lib/os/gcc-version/include} and change line 41 from: +This means that you didn't start @code{mysqld} with @code{--bdb-no-recover} +and Berkeley DB found something wrong with its log files when it +tried to recover your databases. To be able to continue, you should +move away the old Berkeley DB log file from the database directory to +some other place, where you can later examine these. The log files are +named @file{log.0000000001}, where the number will increase over time. + +If you are running @code{mysqld} with BDB table support and @code{mysqld} core +dumps at start this could be because of some problems with the BDB +recover log. In this case you can try starting @code{mysqld} with +@code{--bdb-no-recover}. If this helps, then you should remove all +@file{log.*} files from the data directory and try starting @code{mysqld} +again. + +If you get the following error, it means that some other program (or another +@code{mysqld} server) is already using the TCP/IP port or socket +@code{mysqld} is trying to use: @example -#if !defined(lint) && !defined(__lint) +Can't start server: Bind on TCP/IP port: Address already in use + or +Can't start server : Bind on unix socket... +@end example -to +Use @code{ps} to make sure that you don't have another @code{mysqld} server +running. If you can't find another server running, you can try to execute +the command @code{telnet your-host-name tcp-ip-port-number} and press +@code{RETURN} a couple of times. If you don't get an error message like +@code{telnet: Unable to connect to remote host: Connection refused}, +something is using the TCP/IP port @code{mysqld} is trying to use. +See @ref{mysql_install_db} and @ref{Multiple servers}. -#if !defined(lint) && !defined(__lint) && !defined(getwc) +If @code{mysqld} is currently running, you can find out what path settings +it is using by executing this command: + +@example +shell> mysqladmin variables @end example -Alternatively, you can edit @file{/usr/include/widec.h} directly. Either -way, after you make the fix, you should remove @file{config.cache} and run -@code{configure} again! +or -If you get errors like this when you run @code{make}, it's because -@code{configure} didn't detect the @file{curses.h} file (probably -because of the error in @file{/usr/include/widec.h}): +@example +shell> mysqladmin -h 'your-host-name' variables +@end example + +If @code{safe_mysqld} starts the server but you can't connect to it, +you should make sure you have an entry in @file{/etc/hosts} that looks like +this: @example -In file included from mysql.cc:50: -/usr/include/term.h:1060: syntax error before `,' -/usr/include/term.h:1081: syntax error before `;' +127.0.0.1 localhost @end example -The solution to this is to do one of the following: +This problem occurs only on systems that don't have a working thread +library and for which @strong{MySQL} must be configured to use MIT-pthreads. + +If you can't get @code{mysqld} to start you can try to make a trace file +to find the problem. @xref{Making trace files}. + +If you are using InnoDB tables, refer to the InnoDB-specific startup +options. @xref{InnoDB start}. + +If you are using BDB (Berkeley DB) tables, you should familiarize +yourself with the different BDB specific startup options. @xref{BDB start}. + +@node Automatic start, , Starting server, Post-installation +@subsection Starting and Stopping MySQL Automatically +@cindex starting, the server automatically +@cindex stopping, the server +@cindex server, starting and stopping + +The @code{mysql.server} and @code{safe_mysqld} scripts can be used to start +the server automatically at system startup time. @code{mysql.server} can also +be used to stop the server. + +The @code{mysql.server} script can be used to start or stop the server +by invoking it with @code{start} or @code{stop} arguments: + +@example +shell> mysql.server start +shell> mysql.server stop +@end example + +@code{mysql.server} can be found in the @file{share/mysql} directory +under the @strong{MySQL} installation directory or in the @file{support-files} +directory of the @strong{MySQL} source tree. + +Before @code{mysql.server} starts the server, it changes directory to +the @strong{MySQL} installation directory, then invokes @code{safe_mysqld}. +You might need to edit @code{mysql.server} if you have a binary distribution +that you've installed in a non-standard location. Modify it to @code{cd} +into the proper directory before it runs @code{safe_mysqld}. If you want the +server to run as some specific user, add an appropriate @code{user} line +to the @file{/etc/my.cnf} file, as shown later in this section. + +@code{mysql.server stop} brings down the server by sending a signal to it. +You can take down the server manually by executing @code{mysqladmin shutdown}. + +You might want to add these start and stop commands to the appropriate places +in your @file{/etc/rc*} files when you start using @strong{MySQL} for +production applications. Note that if you modify @code{mysql.server}, then +upgrade @strong{MySQL} sometime, your modified version will be overwritten, +so you should make a copy of your edited version that you can reinstall. + +If your system uses @file{/etc/rc.local} to start external scripts, you +should append the following to it: +@example +/bin/sh -c 'cd /usr/local/mysql ; ./bin/safe_mysqld --user=mysql &' +@end example + +You can also add options for @code{mysql.server} in a global +@file{/etc/my.cnf} file. A typical @file{/etc/my.cnf} file might look like +this: + +@example +[mysqld] +datadir=/usr/local/mysql/var +socket=/tmp/mysqld.sock +port=3306 +user=mysql + +[mysql.server] +basedir=/usr/local/mysql +@end example + +The @code{mysql.server} script understands the following options: +@code{datadir}, @code{basedir}, and @code{pid-file}. + +The following table shows which option groups each of the startup scripts +read from option files: + +@multitable @columnfractions .20 .80 +@item @strong{Script} @tab @strong{Option groups} +@item @code{mysqld} @tab @code{mysqld} and @code{server} +@item @code{mysql.server} @tab @code{mysql.server}, @code{mysqld}, and @code{server} +@item @code{safe_mysqld} @tab @code{mysql.server}, @code{mysqld}, and @code{server} +@end multitable + +@xref{Option files}. + +@node Upgrade, Operating System Specific Notes, Post-installation, Installing +@section Upgrading/Downgrading MySQL + +@cindex upgrading +@cindex downgrading + +You can always move the @strong{MySQL} form and data files between +different versions on the same architecture as long as you have the same +base version of @strong{MySQL}. The current base version is +3. If you change the character set when running @strong{MySQL} (which may +also change the sort order), you must run @code{myisamchk -r -q} on all +tables. Otherwise your indexes may not be ordered correctly. + +If you are afraid of new versions, you can always rename your old +@code{mysqld} to something like @code{mysqld}-'old-version-number'. If +your new @code{mysqld} then does something unexpected, you can simply shut it +down and restart with your old @code{mysqld}! + +When you do an upgrade you should also back up your old databases, of course. + +If after an upgrade, you experience problems with recompiled client programs, +like @code{Commands out of sync} or unexpected core dumps, you probably have +used an old header or library file when compiling your programs. In this +case you should check the date for your @file{mysql.h} file and +@file{libmysqlclient.a} library to verify that they are from the new +@strong{MySQL} distribution. If not, please recompile your programs! + +If you get some problems that the new @code{mysqld} server doesn't want to +start or that you can't connect without a password, check that you don't +have some old @file{my.cnf} file from your old installation! You can +check this with: @code{program-name --print-defaults}. If this outputs +anything other than the program name, you have an active @code{my.cnf} +file that will affect things! + +It is a good idea to rebuild and reinstall the @code{Msql-Mysql-modules} +distribution whenever you install a new release of @strong{MySQL}, +particularly if you notice symptoms such as all your @code{DBI} scripts +dumping core after you upgrade @strong{MySQL}. + +@menu +* Upgrading-from-3.22:: Upgrading from a 3.22 version to 3.23 +* Upgrading-from-3.21:: Upgrading from a 3.21 version to 3.22 +* Upgrading-from-3.20:: Upgrading from a 3.20 version to 3.21 +* Upgrading-to-arch:: Upgrading to another architecture +@end menu + +@node Upgrading-from-3.22, Upgrading-from-3.21, Upgrade, Upgrade +@subsection Upgrading From Version 3.22 to Version 3.23 + +@cindex compatibility, between MySQL versions +@cindex upgrading, 3.22 to 3.23 + +@strong{MySQL} Version 3.23 supports tables of the new @code{MyISAM} type and +the old @code{ISAM} type. You don't have to convert your old tables to +use these with Version 3.23. By default, all new tables will be created with +type @code{MyISAM} (unless you start @code{mysqld} with the +@code{--default-table-type=isam} option). You can change an @code{ISAM} +table to a @code{MyISAM} table with @code{ALTER TABLE table_name TYPE=MyISAM} +or the Perl script @code{mysql_convert_table_format}. + +Version 3.22 and 3.21 clients will work without any problems with a Version +3.23 server. + +The following lists tell what you have to watch out for when upgrading to +Version 3.23: @itemize @bullet @item -Configure with @code{CFLAGS=-DHAVE_CURSES_H CXXFLAGS=-DHAVE_CURSES_H ./configure}. +All tables that uses the @code{tis620} character set must be fixed +with @code{myisamchk -r} or @code{REPAIR TABLE}. @item -Edit @file{/usr/include/widec.h} as indicted above and rerun configure. +If you do a @code{DROP DATABASE} on a symbolic linked database, both the +link and the original database is deleted. (This didn't happen in 3.22 +because configure didn't detect the @code{readlink} system call). @item -Remove the @code{#define HAVE_TERM} line from @file{config.h} file and -run @code{make} again. -@end itemize +@code{OPTIMIZE TABLE} now only works for @strong{MyISAM} tables. +For other table types, you can use @code{ALTER TABLE} to optimize the table. +During @code{OPTIMIZE TABLE} the table is now locked from other threads. -If you get a problem that your linker can't find @code{-lz} when linking -your client program, the problem is probably that your @file{libz.so} file is -installed in @file{/usr/local/lib}. You can fix this by one of the -following methods: +@item +The @strong{MySQL} client @code{mysql} is now by default started with the +option @code{--no-named-commands (-g)}. This option can be disabled with +@code{--enable-named-commands (-G)}. This may cause incompatibility problems in +some cases, for example in SQL scripts that use named commands without a +semicolon! Long format commands still work from the first line. -@itemize @bullet @item -Add @file{/usr/local/lib} to @code{LD_LIBRARY_PATH}. +If you are using the @code{german} character sort order, you must repair +all your tables with @code{isamchk -r}, as we have made some changes in +the sort order! @item -Add a link to @file{libz.so} from @file{/lib}. +The default return type of @code{IF} will now depend on both arguments +and not only the first argument. + +@item +@code{AUTO_INCREMENT} will not work with negative numbers. The reason +for this is that negative numbers caused problems when wrapping from -1 to 0. +@code{AUTO_INCREMENT} is now for MyISAM tables handled at a lower level and +is much faster than before. For MyISAM tables old numbers are also not reused +anymore, even if you delete some rows from the table. + +@item +@code{CASE}, @code{DELAYED}, @code{ELSE}, @code{END}, @code{FULLTEXT}, +@code{INNER}, @code{RIGHT}, @code{THEN} and @code{WHEN} are now reserved words. + +@item +@code{FLOAT(X)} is now a true floating-point type and not a value with a +fixed number of decimals. + +@item +When declaring @code{DECIMAL(length,dec)} the length argument no longer +includes a place for the sign or the decimal point. + +@item +A @code{TIME} string must now be of one of the following formats: +@code{[[[DAYS] [H]H:]MM:]SS[.fraction]} or +@code{[[[[[H]H]H]H]MM]SS[.fraction]} + +@item +@code{LIKE} now compares strings using the same character comparison rules +as @code{'='}. If you require the old behavior, you can compile +@strong{MySQL} with the @code{CXXFLAGS=-DLIKE_CMP_TOUPPER} flag. + +@item +@code{REGEXP} is now case insensitive for normal (not binary) strings. + +@item +When you check/repair tables you should use @code{CHECK TABLE} +or @code{myisamchk} for @code{MyISAM} tables (@code{.MYI}) and +@code{isamchk} for ISAM (@code{.ISM}) tables. + +@item +If you want your @code{mysqldump} files to be compatible between +@strong{MySQL} Version 3.22 and Version 3.23, you should not use the +@code{--opt} or @code{--full} option to @code{mysqldump}. + +@item +Check all your calls to @code{DATE_FORMAT()} to make sure there is a +@samp{%} before each format character. (Later @strong{MySQL} Version 3.22 +did allow this syntax.) @item -If you are using Solaris 8, you can install the optional zlib from your -Solaris 8 CD distribution. +@code{mysql_fetch_fields_direct} is now a function (it was a macro) and +it returns a pointer to a @code{MYSQL_FIELD} instead of a +@code{MYSQL_FIELD}. @item -Configure @strong{MySQL} with the @code{--with-named-z-libs=no} option. +@code{mysql_num_fields()} can no longer be used on a @code{MYSQL*} object (it's +now a function that takes @code{MYSQL_RES*} as an argument. You should now +use @code{mysql_field_count()} instead. + +@item +In @strong{MySQL} Version 3.22, the output of @code{SELECT DISTINCT ...} was +almost always sorted. In Version 3.23, you must use @code{GROUP BY} or +@code{ORDER BY} to obtain sorted output. + +@item +@code{SUM()} now returns @code{NULL}, instead of 0, if there is no matching +rows. This is according to ANSI SQL. + +@item +An @code{AND} or @code{OR} with @code{NULL} values will now return +@code{NULL} instead of 0. This mostly affects queries that use @code{NOT} +on an @code{AND/OR} expression as @code{NOT NULL} = @code{NULL}. +@code{LPAD()} and @code{RPAD()} will shorten the result string if it's longer +than the length argument. @end itemize -@node Solaris x86, SunOS, Solaris 2.7, Source install system issues -@subsection Solaris x86 Notes +@node Upgrading-from-3.21, Upgrading-from-3.20, Upgrading-from-3.22, Upgrade +@subsection Upgrading from Version 3.21 to Version 3.22 -On Solaris 2.8 on x86, @strong{mysqld} will core dump if you run -'strip' in. +@cindex compatibility, between MySQL versions +@cindex upgrading, 3.21 to 3.22 -If you are using @code{gcc} or @code{egcs} on Solaris x86 and you -experience problems with core dumps under load, you should use the -following @code{configure} command: +Nothing that affects compatibility has changed between Version 3.21 and 3.22. +The only pitfall is that new tables that are created with @code{DATE} type +columns will use the new way to store the date. You can't access these new +fields from an old version of @code{mysqld}. + +After installing @strong{MySQL} Version 3.22, you should start the new server +and then run the @code{mysql_fix_privilege_tables} script. This will add the +new privileges that you need to use the @code{GRANT} command. If you forget +this, you will get @code{Access denied} when you try to use @code{ALTER +TABLE}, @code{CREATE INDEX}, or @code{DROP INDEX}. If your @strong{MySQL} root +user requires a password, you should give this as an argument to +@code{mysql_fix_privilege_tables}. + +The C API interface to @code{mysql_real_connect()} has changed. If you have +an old client program that calls this function, you must place a @code{0} for +the new @code{db} argument (or recode the client to send the @code{db} +element for faster connections). You must also call @code{mysql_init()} +before calling @code{mysql_real_connect()}! This change was done to allow +the new @code{mysql_options()} function to save options in the @code{MYSQL} +handler structure. + +The @code{mysqld} variable @code{key_buffer} has changed names to +@code{key_buffer_size}, but you can still use the old name in your +startup files. + +@node Upgrading-from-3.20, Upgrading-to-arch, Upgrading-from-3.21, Upgrade +@subsection Upgrading from Version 3.20 to Version 3.21 +@cindex upgrading, 3.20 to 3.21 + +If you are running a version older than Version 3.20.28 and want to +switch to Version 3.21, you need to do the following: + +You can start the @code{mysqld} Version 3.21 server with @code{safe_mysqld +--old-protocol} to use it with clients from a Version 3.20 distribution. +In this case, the new client function @code{mysql_errno()} will not +return any server error, only @code{CR_UNKNOWN_ERROR} (but it +works for client errors), and the server uses the old @code{password()} +checking rather than the new one. + +If you are @strong{NOT} using the @code{--old-protocol} option to +@code{mysqld}, you will need to make the following changes: + +@itemize @bullet +@item +All client code must be recompiled. If you are using ODBC, you must get +the new @strong{MyODBC} 2.x driver. +@item +The script @code{scripts/add_long_password} must be run to convert the +@code{Password} field in the @code{mysql.user} table to @code{CHAR(16)}. +@item +All passwords must be reassigned in the @code{mysql.user} table (to get 62-bit +rather than 31-bit passwords). +@item +The table format hasn't changed, so you don't have to convert any tables. +@end itemize + +@strong{MySQL} Version 3.20.28 and above can handle the new @code{user} table +format without affecting clients. If you have a @strong{MySQL} version earlier +than Version 3.20.28, passwords will no longer work with it if you convert the +@code{user} table. So to be safe, you should first upgrade to at least Version +3.20.28 and then upgrade to Version 3.21. + +@cindex Protocol mismatch +The new client code works with a 3.20.x @code{mysqld} server, so +if you experience problems with 3.21.x, you can use the old 3.20.x server +without having to recompile the clients again. + +If you are not using the @code{--old-protocol} option to @code{mysqld}, +old clients will issue the error message: @example -CC=gcc CFLAGS="-O3 -fomit-frame-pointer -DHAVE_CURSES_H" \ -CXX=gcc \ -CXXFLAGS="-O3 -fomit-frame-pointer -felide-constructors -fno-exceptions -fno-rtti -DHAVE_CURSES_H" \ -./configure --prefix=/usr/local/mysql +ERROR: Protocol mismatch. Server Version = 10 Client Version = 9 @end example -This will avoid problems with the @code{libstdc++} library and with C++ -exceptions. +The new Perl @code{DBI}/@code{DBD} interface also supports the old +@code{mysqlperl} interface. The only change you have to make if you use +@code{mysqlperl} is to change the arguments to the @code{connect()} function. +The new arguments are: @code{host}, @code{database}, @code{user}, +@code{password} (the @code{user} and @code{password} arguments have changed +places). +@xref{Perl DBI Class, , Perl @code{DBI} Class}. -If this doesn't help, you should compile a debug version and run -it with a trace file or under @code{gdb}. @xref{Using gdb on mysqld}. +The following changes may affect queries in old applications: -@node SunOS, Linux, Solaris x86, Source install system issues -@subsection SunOS 4 Notes +@itemize @bullet +@item +@code{HAVING} must now be specified before any @code{ORDER BY} clause. +@item +The parameters to @code{LOCATE()} have been swapped. +@item +There are some new reserved words. The most notable are @code{DATE}, +@code{TIME}, and @code{TIMESTAMP}. +@end itemize -On SunOS 4, MIT-pthreads is needed to compile @strong{MySQL}, which in turn -means you will need GNU @code{make}. +@node Upgrading-to-arch, , Upgrading-from-3.20, Upgrade +@subsection Upgrading to Another Architecture -Some SunOS 4 systems have problems with dynamic libraries and @code{libtool}. -You can use the following @code{configure} line to avoid this problem: +@cindex upgrading, different architecture + +If you are using @strong{MySQL} Version 3.23, you can copy the @code{.frm}, +@code{.MYI}, and @code{.MYD} files between different architectures that +support the same floating-point format. (@strong{MySQL} takes care of any +byte swapping issues.) + +The @strong{MySQL} @code{ISAM} data and index files (@file{.ISD} and +@file{*.ISM}, respectively) are architecture-dependent and in some cases +OS-dependent. If you want to move your applications to another machine +that has a different architecture or OS than your current machine, you +should not try to move a database by simply copying the files to the +other machine. Use @code{mysqldump} instead. + +By default, @code{mysqldump} will create a file full of SQL statements. +You can then transfer the file to the other machine and feed it as input +to the @code{mysql} client. + +Try @code{mysqldump --help} to see what options are available. +If you are moving the data to a newer version of @strong{MySQL}, you should use +@code{mysqldump --opt} with the newer version to get a fast, compact dump. + +The easiest (although not the fastest) way to move a database between two +machines is to run the following commands on the machine on which the +database is located: @example -shell> ./configure --disable-shared --with-mysqld-ldflags=-all-static +shell> mysqladmin -h 'other hostname' create db_name +shell> mysqldump --opt db_name \ + | mysql -h 'other hostname' db_name @end example -When compiling @code{readline}, you may get warnings about duplicate defines. -These may be ignored. +If you want to copy a database from a remote machine over a slow network, +you can use: -When compiling @code{mysqld}, there will be some @code{implicit declaration -of function} warnings. These may be ignored. +@example +shell> mysqladmin create db_name +shell> mysqldump -h 'other hostname' --opt --compress db_name \ + | mysql db_name +@end example + +You can also store the result in a file, then transfer the file to the +target machine and load the file into the database there. For example, +you can dump a database to a file on the source machine like this: -@node Linux, Alpha-DEC-UNIX, SunOS, Source install system issues +@example +shell> mysqldump --quick db_name | gzip > db_name.contents.gz +@end example + +(The file created in this example is compressed.) Transfer the file +containing the database contents to the target machine and run these commands +there: + +@example +shell> mysqladmin create db_name +shell> gunzip < db_name.contents.gz | mysql db_name +@end example + +@cindex @code{mysqldump} +@cindex @code{mysqlimport} +You can also use @code{mysqldump} and @code{mysqlimport} to accomplish +the database transfer. +For big tables, this is much faster than simply using @code{mysqldump}. +In the commands shown below, @code{DUMPDIR} represents the full pathname +of the directory you use to store the output from @code{mysqldump}. + +First, create the directory for the output files and dump the database: + +@example +shell> mkdir DUMPDIR +shell> mysqldump --tab=DUMPDIR db_name +@end example + +Then transfer the files in the @code{DUMPDIR} directory to some corresponding +directory on the target machine and load the files into @strong{MySQL} +there: + +@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 + +Also, don't forget to copy the @code{mysql} database, because that's where the +grant tables (@code{user}, @code{db}, @code{host}) are stored. You may have +to run commands as the @strong{MySQL} @code{root} user on the new machine +until you have the @code{mysql} database in place. + +After you import the @code{mysql} database on the new machine, execute +@code{mysqladmin flush-privileges} so that the server reloads the grant table +information. + +@node Operating System Specific Notes, , Upgrade, Installing +@section Operating System Specific Notes + +@menu +* Linux:: +* Windows:: +* Solaris:: +* Solaris 2.7:: +* Solaris x86:: +* BSD Notes:: +* Mac OS X:: +* Other Unix Notes:: +* SCO Unixware:: +* BeOS:: +* Novell Netware:: +@end menu + +@node Linux, Windows, Operating System Specific Notes, Operating System Specific Notes @subsection Linux Notes (All Linux Versions) +@menu +* Binary notes-Linux:: +* Linux-x86:: Linux-x86 notes +* Linux-SPARC:: Linux-SPARC notes +* Linux-Alpha:: Linux-Alpha notes +* Linux-PowerPC:: +* Linux-MIPS:: +* Linux-IA64:: Linux-Ia64 notes +@end menu + The notes below regarding @strong{glibc} apply only to the situation when you build @strong{MySQL} yourself. If you are running Linux on an x86 machine, in most cases it is @@ -9492,18 +9934,86 @@ The following @code{configure} line should work with @code{fcc/FCC}: CC=fcc CFLAGS="-O -K fast -K lib -K omitfp -Kpreex -D_GNU_SOURCE -DCONST=const -DNO_STRTOLL_PROTO" CXX=FCC CXXFLAGS="-O -K fast -K lib -K omitfp -K preex --no_exceptions --no_rtti -D_GNU_SOURCE -DCONST=const -Dalloca=__builtin_alloca -DNO_STRTOLL_PROTO '-D_EXTERN_INLINE=static __inline'" ./configure --prefix=/usr/local/mysql --enable-assembler --with-mysqld-ldflags=-all-static --disable-shared --with-low-memory @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 -* Linux-Ia64:: Linux-Ia64 notes -@end menu +@node Binary notes-Linux, Linux-x86, Linux, Linux +@subsubsection Linux Notes for Binary Distributions + +@cindex binary distributions, on Linux +@cindex Linux, binary distribution + +@strong{MySQL} needs at least Linux Version 2.0. + +The binary release is linked with @code{-static}, which means you do not +normally need to worry about which version of the system libraries you +have. You need not install LinuxThreads, either. A program linked with +@code{-static} is slightly bigger than a dynamically linked program but +also slightly faster (3-5%). One problem, however, is that you can't use +user-definable functions (UDFs) with a statically linked program. If +you are going to write or use UDF functions (this is something only for +C or C++ programmers), you must compile @strong{MySQL} yourself, using +dynamic linking. + +If you are using a @code{libc}-based system (instead of a @code{glibc2} +system), you will probably get some problems with hostname resolving and +@code{getpwnam()} with the binary release. (This is because @code{glibc} +unfortunately depends on some external libraries to resolve hostnames +and @code{getpwent()}, even when compiled with @code{-static}). In this +case you probably get the following error message when you run +@code{mysql_install_db}: + +@example +Sorry, the host 'xxxx' could not be looked up +@end example + +or the following error when you try to run @code{mysqld} with the @code{--user} +option: -@node Linux-x86, Linux-RedHat50, Linux, Linux +@example +getpwnam: No such file or directory +@end example + +You can solve this problem in one of the following ways: + +@itemize @bullet +@item +Get a @strong{MySQL} source distribution (an RPM or the @code{tar.gz} +distribution) and install this instead. +@item +Execute @code{mysql_install_db --force}; This will not execute the +@code{resolveip} test in @code{mysql_install_db}. The downside is that +you can't use host names in the grant tables; you must use IP numbers +instead (except for @code{localhost}). If you are using an old @strong{MySQL} +release that doesn't support @code{--force}, you have to remove the +@code{resolveip} test in @code{mysql_install} with an editor. +@item +Start @code{mysqld} with @code{su} instead of using @code{--user}. +@end itemize + +The Linux-Intel binary and RPM releases of @strong{MySQL} are configured +for the highest possible speed. We are always trying to use the fastest +stable compiler available. + +@strong{MySQL} Perl support requires Version Perl 5.004_03 or newer. + +On some Linux 2.2 versions, you may get the error @code{Resource +temporarily unavailable} when you do a lot of new connections to a +@code{mysqld} server over TCP/IP. + +The problem is that Linux has a delay between when you close a TCP/IP +socket and until this is actually freed by the system. As there is only +room for a finite number of TCP/IP slots, you will get the above error if +you try to do too many new TCP/IP connections during a small time, like +when you run the @strong{MySQL} @file{test-connect} benchmark over +TCP/IP. + +We have mailed about this problem a couple of times to different Linux +mailing lists but have never been able to resolve this properly. + +The only known 'fix' to this problem is to use persistent connections in +your clients or use sockets, if you are running the database server +and clients on the same machine. We hope that the @code{Linux 2.4} +kernel will fix this problem in the future. + +@node Linux-x86, Linux-SPARC, Binary notes-Linux, Linux @subsubsection Linux-x86 Notes @strong{MySQL} requires @code{libc} Version 5.4.12 or newer. It's known to @@ -9548,9 +10058,7 @@ under the @strong{MySQL} installation directory or in the If @code{mysqld} always core dumps when it starts up, the problem may be that you have an old @file{/lib/libc.a}. Try renaming it, then remove @file{sql/mysqld} and do a new @code{make install} and try again. This -problem has been reported on some Slackware installations. RedHat Version 5.0 -also has a similar problem with some new @code{glibc} versions. -@xref{Linux-RedHat50}. +problem has been reported on some Slackware installations. If you get the following error when linking @code{mysqld}, it means that your @file{libg++.a} is not installed correctly: @@ -9566,84 +10074,8 @@ You can avoid using @file{libg++.a} by running @code{configure} like this: shell> CXX=gcc ./configure @end example -@node Linux-RedHat50, Linux-RedHat51, Linux-x86, Linux -@subsubsection RedHat Version 5.0 Notes - -If you have any problems with @strong{MySQL} on RedHat, you should start by -upgrading @code{glibc} to the newest possible version! - -If you install all the official RedHat patches (including -@code{glibc-2.0.7-19} and @code{glibc-devel-2.0.7-19}), both the -binary and source distributions of @strong{MySQL} should work without -any trouble! - -The updates are needed because there is a bug in @code{glibc} 2.0.5 in how -@code{pthread_key_create} variables are freed. With @code{glibc} 2.0.5, you -must use a statically linked @strong{MySQL} binary distribution. If you -want to compile from source, you must install the corrected version of -LinuxThreads from @uref{http://www.mysql.com/Downloads/Linux} or upgrade your -@code{glibc}. - -If you have an incorrect version of @code{glibc} or LinuxThreads, the symptom -is that @code{mysqld} crashes after each connection. For example, -@code{mysqladmin version} will crash @code{mysqld} when it finishes! - -Another symptom of incorrect libraries is that @code{mysqld} crashes at -once when it starts. On some Linux systems, this can be fixed by configuring -like this: - -@example -shell> ./configure --with-mysqld-ldflags=-all-static -@end example - -On Redhat Version 5.0, the easy way out is to install the @code{glibc} -2.0.7-19 RPM and run @code{configure} @strong{without} the -@code{--with-mysqld-ldflags=-all-static} option. - -For the source distribution of @code{glibc} 2.0.7, a patch that is easy to -apply and is tested with @strong{MySQL} may be found at: - -@example -@uref{http://www.mysql.com/Downloads/Linux/glibc-2.0.7-total-patch.tar.gz} -@end example - -If you experience crashes like these when you build @strong{MySQL}, you can -always download the newest binary version of @strong{MySQL}. This is -statically-linked to avoid library conflicts and should work on all Linux -systems! - -@strong{MySQL} comes with an internal debugger that can generate -trace files with a lot of information that can be used to find and solve a -wide range of different problems. -@xref{Debugging server}. - -@node Linux-RedHat51, Linux-SPARC, Linux-RedHat50, Linux -@subsubsection RedHat Version 5.1 notes - -The @code{glibc} of RedHat Version 5.1 (@code{glibc} 2.0.7-13) has a memory -leak, so to get a stable @strong{MySQL} version, you must upgrade @code{glibc}, -to 2.0.7-19, downgrade @code{glibc} or use a binary version of @code{mysqld}. -If you don't do this, you will encounter memory problems (out of memory, etc.). -The most common error in this case is: - -@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 - -After you have upgraded to @code{glibc} 2.0.7-19, you can configure -@strong{MySQL} with dynamic linking (the default), but you @strong{cannot} -run @code{configure} with the @code{--with-mysqld-ldflags=-all-static} option -until you have installed @code{glibc} 2.0.7-19 from source! - -You can check which version of @code{glibc} you have with @code{rpm -q glibc}. - -Another reason for the above error is if you try to use more threads -than your Linux kernel is configured for. In this case you should raise -the limits in @file{include/linux/tasks.h} and recompile your kernel! - -@node Linux-SPARC, Linux-Alpha, Linux-RedHat51, Linux -@subsubsection Linux-SPARC Notes +@node Linux-SPARC, Linux-Alpha, Linux-x86, Linux +@subsubsection Linux SPARC Notes In some implementations, @code{readdir_r()} is broken. The symptom is that @code{SHOW DATABASES} always returns an empty set. This can be fixed by @@ -9658,8 +10090,8 @@ that is available at @code{vger.rutgers.edu} (a version of Linux that was never merged with the official 2.0.30). You must also install LinuxThreads Version 0.6 or newer. -@node Linux-Alpha, MKLinux, Linux-SPARC, Linux -@subsubsection Linux-Alpha Notes +@node Linux-Alpha, Linux-PowerPC, Linux-SPARC, Linux +@subsubsection Linux Alpha Notes @strong{MySQL} Version 3.23.12 is the first @strong{MySQL} version that is tested on Linux-Alpha. If you plan to use @strong{MySQL} on Linux-Alpha, @@ -9704,21 +10136,21 @@ resulting image will core dump at start. In other words, @strong{DON'T} use @code{--with-mysqld-ldflags=-all-static} with @code{gcc}. @end itemize -@node MKLinux, Qube2, Linux-Alpha, Linux -@subsubsection MkLinux Notes +@node Linux-PowerPC, Linux-MIPS, Linux-Alpha, Linux +@subsubsection Linux PowerPC Notes @strong{MySQL} should work on MkLinux with the newest @code{glibc} package (tested with @code{glibc} 2.0.7). -@node Qube2, Linux-Ia64, MKLinux, Linux -@subsubsection Qube2 Linux Notes +@node Linux-MIPS, Linux-IA64, Linux-PowerPC, Linux +@subsubsection Linux MIPS Notes To get @strong{MySQL} to work on Qube2, (Linux Mips), you need the newest @code{glibc} libraries (@code{glibc-2.0.7-29C2} is known to work). You must also use the @code{egcs} C++ compiler (@code{egcs-1.0.2-9}, @code{gcc 2.95.2} or newer). -@node Linux-Ia64, , Qube2, Linux +@node Linux-IA64, , Linux-MIPS, Linux @subsubsection Linux IA64 Notes To get @strong{MySQL} to compile on Linux Ia64, we had to do the following @@ -9746,933 +10178,15 @@ make_install and @strong{mysqld} should be ready to run. -@node Alpha-DEC-UNIX, Alpha-DEC-OSF1, Linux, Source install system issues -@subsection Alpha-DEC-UNIX Notes (Tru64) - -If you are using egcs 1.1.2 on Digital Unix, you should upgrade to gcc -2.95.2, as egcs on DEC has some serious bugs! - -When compiling threaded programs under Digital Unix, the documentation -recommends using the @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 -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 detect only errors, not warnings. - -If you start the server directly from the command line, you may have problems -with it dying when you log out. (When you log out, your outstanding processes -receive a @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. -@xref{safe_mysqld, , @code{safe_mysqld}}. - -If you get a problem when compiling mysys/get_opt.c, just remove the -line #define _NO_PROTO from the start of that file! - -If you are using Compac's CC compiler, the following configure line should -work: - -@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/local/mysql \ ---with-low-memory \ ---enable-large-files \ ---enable-shared=yes \ ---with-named-thread-libs="-lpthread -lmach -lexc -lc" -gnumake -@end example - -If you get a problem with libtool, when compiling with shared libraries -as above, when linking @code{mysql}, you should be able to get around -this by issuing: - -@example -cd mysql -/bin/sh ../libtool --mode=link cxx -pthread -O3 -DDBUG_OFF \ --O4 -ansi_alias -ansi_args -fast -inline speed \ --speculate all \ -arch host -DUNDEF_HAVE_GETHOSTBYNAME_R \ --o mysql mysql.o readline.o sql_string.o completion_hash.o \ -../readline/libreadline.a -lcurses \ -../libmysql/.libs/libmysqlclient.so -lm -cd .. -gnumake -gnumake install -scripts/mysql_install_db -@end example - -@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 -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 -touch include/c_asm.h -CC=gcc CFLAGS=-I./include \ -CXX=gcc CXXFLAGS=-O3 \ -./configure --prefix=/usr/local/mysql -@end example - -Note that the following problems with the @code{ld} program can be fixed -by downloading the latest DEC (Compaq) patch kit from: -@uref{http://ftp.support.compaq.com/public/unix/}. - -On OSF1 V4.0D and compiler "DEC C V5.6-071 on Digital Unix V4.0 (Rev. 878)" -the compiler had some strange behavior (undefined @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 -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 -noexceptions -nortti -export CC CFLAGS CXX CXXFLAGS -./configure --prefix=/usr/mysql/mysql --with-mysqld-ldflags=-all-static --disable-shared --with-named-thread-libs="-lmach -lexc -lc" -@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 add @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 Version 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 definitely need all the POSIX patches on this page, for pthreads support: - -@uref{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 - -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 -CC=gcc CXX=gcc CXXFLAGS=-O3 \ -./configure --prefix=/usr/local/mysql --with-thread-safe-client --with-named-thread-libs=-lpthread -@end example - -On Irix 6.5.11 with native Irix C and C++ compilers ver. 7.3.1.2, the -following is reported to work - -@example -CC=cc CXX=CC CFLAGS='-O3 -n32 -TARG:platform=IP22 -I/usr/local/include \ --L/usr/local/lib' CXXFLAGS='-O3 -n32 -TARG:platform=IP22 \ --I/usr/local/include -L/usr/local/lib' ./configure --prefix=/usr/local/mysql \ ---with-berkeley-db --with-innodb \ ---with-libwrap=/usr/local --with-named-curses-libs=/usr/local/lib/libncurses.a -@end example - -@node FreeBSD, NetBSD, SGI-Irix, Source install system issues -@subsection FreeBSD Notes - -FreeBSD 3.x is recommended for running @strong{MySQL} since the thread package -is much more integrated. - -The easiest and therefor the preferred way to install is to use the -mysql-server and mysql-client ports available on @uref{http://www.freebsd.org}. - -Using these gives you: -@itemize @bullet -@item -A working @strong{MySQL} with all optimizations known to work on your version -of FreeBSD enabled. - -@item -Automatic configuration and build. - -@item -Startup scripts installed in /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 - -It is recommended you use MIT-pthreads on FreeBSD 2.x and native threads on -Versions 3 and up. It is possible to run with native threads on some late -2.2.x versions but you may encounter problems shutting down @code{mysqld}. - -The @strong{MYSQL} Makefiles require GNU make (@code{gmake}) to work. -If you want to compile @strong{MYSQL} you need to install GNU make -first. - -Be sure to have your name resolver setup correct. Otherwise you may -experience resolver delays or failures when connecting to @code{mysqld}. - -Make sure that the @code{localhost} entry in the @file{/etc/hosts} file is -correct (otherwise you will have problems connecting to the database). The -@file{/etc/hosts} file should start with a line: - -@example -127.0.0.1 localhost localhost.your.domain -@end example - -If you notice that @code{configure} will use MIT-pthreads, you should read -the 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 is also known to have a very low default file handle limit. -@xref{Not enough file handles}. Uncomment the ulimit -n section in -safe_mysqld or raise the limits for the @code{mysqld} user in /etc/login.conf -(and rebuild it with cap_mkdb /etc/login.conf). Also be sure you set the -appropriate class for this user in the password file if you are not -using the default (use: chpass mysqld-user-name). @xref{safe_mysqld, , -@code{safe_mysqld}}. - -If you get problems with the current date in @strong{MySQL}, setting the -@code{TZ} variable will probably help. @xref{Environment variables}. - -To get a secure and stable system you should only use FreeBSD kernels -that are marked @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 Notes - -@menu -* OpenBSD 2.5:: OpenBSD 2.5 Notes -* OpenBSD 2.8:: OpenBSD 2.8 Notes -@end menu - -@node OpenBSD 2.5, OpenBSD 2.8, OpenBSD, OpenBSD -@subsubsection OpenBSD 2.5 Notes - -On OpenBSD Version 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 OpenBSD 2.8, , OpenBSD 2.5, OpenBSD -@subsubsection OpenBSD 2.8 Notes - -Our users have reported that OpenBSD 2.8 has a threading bug which causes -problems with @strong{MySQL}. The OpenBSD Developers have fixed the problem, -but as of January 25th, 2001, it's only available in the ``-current'' branch. -The symptoms of this threading bug are: slow response, high load, high CPU -usage, and crashes. - -@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 Version 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}. - -If you get problems with the current date in @strong{MySQL}, setting the -@code{TZ} variable will probably help. @xref{Environment variables}. - -@node BSDI3, BSDI4, BSDI2, BSDI -@subsubsection BSD/OS Version 3.x Notes - -Upgrade to BSD/OS Version 3.1. If that is not possible, install -BSDIpatch M300-038. - -Use the following command when configuring @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{mysqld}! This will run -all threads with the same priority; on BSDI Version 3.1, this gives better -performance (at least until BSDI fixes their thread scheduler). - -If you get the error @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 Version 4.x Notes - -BSDI Version 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 Version 4.x systems, you may get problems with shared libraries. -The symptom is that you can't execute any client programs, for example, -@code{mysqladmin}. In this case you need to reconfigure not to use -shared libraries with the @code{--disable-shared} option to configure. - -Some customers have had problems on BSDI 4.0.1 that the @code{mysqld} -binary after a while can't open tables. This is because some -library/system related bug causes @code{mysqld} to change current -directory without asking for this! - -The fix is to either upgrade to 3.23.34 or after running @code{configure} -remove the line @code{#define HAVE_REALPATH} from @code{config.h} -before running make. - -Note that the above means that you can't symbolic link a database directories -to another database directory or symbolic link a table to another database -on BSDI! (Making a symbolic link to another disk is ok). - -@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 @strong{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.x 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{http://www.mysql.com/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.x There are a lot of problems -without a good port. The port for this product requires the SCO Unix -Development system. Without it, you are missing the libraries and the -linker that is needed. - -@item -To build FSU Pthreads on your system, do the following: - -@enumerate a -@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 -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. -You should also use gcc 2.95.2 or newer! - -The following @code{configure} command should work: - -@example -shell> ./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 \ - --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{http://www.mysql.com/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 re-entrant in FSU Pthreads. SCO claims -that its libraries' functions are re-entrant, so they must be reentrant with -FSU Pthreads. FSU Pthreads on OpenServer tries to use the SCO scheme to -make re-entrant libraries. - -@item -FSU Pthreads (at least the version at @uref{http://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{Makefile} in -DBI-xxx and each subdirectory. - -Note that the following assumes gcc 2.95.2 or newer: - -@example -OLD: NEW: -CC = cc CC = gcc -CCCDLFLAGS = -KPIC -W1,-Bexport CCCDLFLAGS = -fpic -CCDLFLAGS = -wl,-Bexport CCDLFLAGS = - -LD = ld LD = gcc -G -fpic -LDDLFLAGS = -G -L/usr/local/lib LDDLFLAGS = -L/usr/local/lib -LDFLAGS = -belf -L/usr/local/lib LDFLAGS = -L/usr/local/lib - -LD = ld LD = gcc -G -fpic -OPTIMISE = -Od OPTIMISE = -O1 - -OLD: -CCCFLAGS = -belf -dy -w0 -U M_XENIX -DPERL_SCO5 -I/usr/local/include - -NEW: -CCFLAGS = -U M_XENIX -DPERL_SCO5 -I/usr/local/include -@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 Version 7.0 Notes - -You must use a version of @strong{MySQL} at least as recent as Version 3.22.13 -because that version fixes some portability problems under Unixware. - -We have been able to compile @strong{MySQL} with the following @code{configure} -command on Unixware Version 7.0.1: - -@example -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 -@cindex problems, installing on IBM-AIX - -Automatic detection of @code{xlC} is missing from Autoconf, so a -@code{configure} command something like this is needed when compiling -@strong{MySQL} (This example uses the IBM compiler): - -@example -export CC="xlc_r -ma -O3 -qstrict -qoptimize=3 -qmaxmem=8192 " -export CXX="xlC_r -ma -O3 -qstrict -qoptimize=3 -qmaxmem=8192" -export CFLAGS="-I /usr/local/include" -export LDLFAGS="-L /usr/local/lib" -export CPPFLAGS=$CFLAGS -export CXXFLAGS=$CFLAGS - -./configure --prefix=/usr/local \ - --localstatedir=/var/mysql \ - --sysconfdir=/etc/mysql \ - --sbindir='/usr/local/bin' \ - --libexecdir='/usr/local/bin' \ - --enable-thread-safe-client \ - --enable-large-files -@end example - -Above are the options used to compile the @strong{MySQL} distribution that -can be found at @uref{http://www-frec.bull.com/}. - -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.). There are also some known problems with IBM's assembler, -which may cause it to generate bad code when used with gcc. - -We recommend the following @code{configure} line with @code{egcs} and -@code{gcc 2.95} on AIX: - -@example -CC="gcc -pipe -mcpu=power -Wa,-many" \ -CXX="gcc -pipe -mcpu=power -Wa,-many" \ -CXXFLAGS="-felide-constructors -fno-exceptions -fno-rtti" \ -./configure --prefix=/usr/local/mysql --with-low-memory -@end example - -The @code{-Wa,-many} is necessary for the compile to be successful. IBM is -aware of this problem but is in to hurry to fix it because of the workaround -available. We don't know if the @code{-fno-exceptions} is required with -@code{gcc 2.95}, but as @strong{MySQL} doesn't use exceptions and the above -option generates faster code, we recommend that you should always use this -option with @code{egcs / gcc}. - -If you get a problem with assembler code try changing the -mcpu=xxx to -match your cpu. Typically power2, power, or powerpc may need to be used, -alternatively you might need to use 604 or 604e. I'm not positive but I -would think using "power" would likely be safe most of the time, even on -a power2 machine. - -If you don't know what your cpu is then do a "uname -m", this will give -you back a string that looks like "000514676700", with a format of -xxyyyyyymmss where xx and ss are always 0's, yyyyyy is a unique system -id and mm is the id of the CPU Planar. A chart of these values can be -found at -@uref{http://www.rs6000.ibm.com/doc_link/en_US/a_doc_lib/cmds/aixcmds5/uname.htm}. -This will give you a machine type and a machine model you can use to -determine what type of cpu you have. - -If you have problems with signals (@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=/usr/local/mysql --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. - -For AIX 4.2.1 and gcc you have to do the following changes. - -After configuring, edit @file{config.h} and @file{include/my_config.h} -and change the line that says - -@example -#define HAVE_SNPRINTF 1 -@end example - -to - -@example -#undef HAVE_SNPRINTF -@end example - -And finally, in @file{mysqld.cc} you need to add a prototype for initgoups. - -@example -#ifdef _AIX41 -extern "C" int initgroups(const char *,int); -#endif -@end example - -@node HP-UX 10.20, HP-UX 11.x, IBM-AIX, Source install system issues -@subsection HP-UX Version 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 using gcc 2.95 on HP-UX. Don't use high optimization -flags (like -O6) as this may not be safe on HP-UX. - -Note that MIT-pthreads can't be compiled with the HP-UX compiler -because it can't compile @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, Mac OS X, HP-UX 10.20, Source install system issues -@subsection HP-UX Version 11.x Notes - -For HP-UX Version 11.x we recommend @strong{MySQL} Version 3.23.15 or later. - -Because of some critical bugs in the standard HP-UX libraries, you should -install the following patches before trying to run @strong{MySQL} on HP-UX 11.0: - -@example -PHKL_22840 Streams cumulative -PHNE_22397 ARPA cumulative -@end example - -This will solve a problem that one gets @code{EWOULDBLOCK} from @code{recv()} -and @code{EBADF} from @code{accept()} in threaded applications. - -If you are using @code{gcc} 2.95.1 on an unpatched HP-UX 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 ... -/usr/include/sys/pthread.h:440: previous declaration ... -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 (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 -O3 -fpic" CXX=gcc CXXFLAGS="-felide-constructors -fno-exceptions -fno-rtti -O3" ./configure --prefix=/usr/local/mysql --disable-shared -@end example - -Here is some information that a HP-UX Version 11.x user sent us about compiling -@strong{MySQL} with HP-UX:x compiler: - -@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. - - configuration: - ./configure --with-pthread \ - --prefix=/source-control/mysql \ - --with-named-thread-libs=-lpthread \ - --with-low-memory - - added '#define _CTYPE_INCLUDED' to include/m_ctype.h. This - symbol is the one defined in HP's /usr/include/ctype.h: - - /* Don't include std ctype.h when this is included */ - #define _CTYPE_H - #define __CTYPE_INCLUDED - #define _CTYPE_INCLUDED - #define _CTYPE_USING /* Don't put names in global namespace. */ -@end example - -@itemize @bullet -@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 -If you get the following error from @code{configure} - -@example -checking for cc option to accept ANSI C... no -configure: error: MySQL requires a ANSI C compiler (and a C++ compiler). Try gcc. See the Installation chapter in the Reference Manual. -@end example - -Check that you don't have the path to the K&R compiler before the path -to the HP-UX C and C++ compiler. - -@node Mac OS X, BEOS, HP-UX 11.x, Source install system issues -@subsection Mac OS X Notes - -@menu -* Mac OS X Public Data:: -* Mac OS X Server:: -@end menu - -@node Mac OS X Public Data, Mac OS X Server, Mac OS X, Mac OS X -@subsubsection Mac OS X Public beta - -@strong{MySQL} should work without any problems on Mac OS X Public Beta -(Darwin). You don't need the pthread patches for this OS! - -@node Mac OS X Server, , Mac OS X Public Data, Mac OS X -@subsubsection Mac OS X Server - -Before trying to configure @strong{MySQL} on Mac OS X server you must -first install the pthread package from -@uref{http://www.prnet.de/RegEx/mysql.html}. - -Our binary for Mac OS X is compiled on Rhapsody 5.5 with the following -configure line: - -@example -CC=gcc CFLAGS="-O2 -fomit-frame-pointer" CXX=gcc CXXFLAGS="-O2 -fomit-frame-pointer" ./configure --prefix=/usr/local/mysql "--with-comment=Official MySQL binary" --with-extra-charsets=complex --disable-shared -@end example - -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/bin/mysqladmin' -@end example - -@node BEOS, , Mac OS X, Source install system issues -@subsection BeOS Notes - -We are really interested in getting @strong{MySQL} to work on BeOS, but -unfortunately we don't have any person who knows BeOS or has time to do -a port. - -We are interested in finding someone to do a port, and we will help them -with any technical questions they may have while doing the port. - -We have previously talked with some BeOS developers that have said that -@strong{MySQL} is 80% ported to BeOS, but we haven't heard from them -in a while. - -@node Windows, OS/2, Source install system issues, Installing -@section Windows Notes +@node Windows, Solaris, Linux, Operating System Specific Notes +@subsection Windows Notes This section describes installation and use of @strong{MySQL} on Windows. This information is also provided in the @file{README} file that comes with the @strong{MySQL} Windows distribution. @menu -* Windows installation:: Installing @strong{MySQL} on Windows * Win95 start:: Starting @strong{MySQL} on Win95 / Win98 * NT start:: Starting @strong{MySQL} on NT / Win2000 * Windows running:: Running @strong{MySQL} on Windows @@ -10682,79 +10196,8 @@ with the @strong{MySQL} Windows distribution. * Windows vs Unix:: @strong{MySQL}-Windows compared to Unix @strong{MySQL} @end menu -@node Windows installation, Win95 start, Windows, Windows -@subsection Installing MySQL on Windows - -The following instructions apply to precompiled binary distributions. -If you download a source distribution, you will have to compile and install -it yourself. - -If you don't have a copy of the @strong{MySQL} distribution, you should -first download one from @uref{http://www.mysql.com/downloads/mysql-3.23.html}. - -If you plan to connect to @strong{MySQL} from some other program, you will -probably also need the @strong{MyODBC} driver. You can find this at the -@strong{MyODBC} download page -(@uref{http://www.mysql.com/downloads/api-myodbc.html}). - -To install either distribution, unzip it in some empty directory and run the -@code{Setup.exe} program. - -By default, @strong{MySQL}-Windows is configured to be installed in -@file{C:\mysql}. If you want to install @strong{MySQL} elsewhere, -install it in @file{C:\mysql} first, then move the installation to -where you want it. If you do move @strong{MySQL}, you must indicate -where everything is located by supplying a @code{--basedir} option when -you start the server. For example, if you have moved the @strong{MySQL} -distribution to @file{D:\programs\mysql}, you must start @code{mysqld} -like this: - -@example -C:\> D:\programs\mysql\bin\mysqld --basedir D:\programs\mysql -@end example - -Use @code{mysqld --help} to display all the options that @code{mysqld} -understands! - -With all newer @strong{MySQL} versions, you can also create a -@file{C:\my.cnf} file that holds any default options for the -@strong{MySQL} server. Copy the file @file{\mysql\my-xxxxx.cnf} to -@file{C:\my.cnf} and edit it to suit your setup. Note that you should -specify all paths with @samp{/} instead of @samp{\}. If you use -@samp{\}, you need to specify it twice, because @samp{\} is the escape -character in @strong{MySQL}. @xref{Option files}. - -Starting with @strong{MySQL} 3.23.38, the Windows distribution includes -both the normal and the @strong{MySQL-Max} binaries. The main benefit -of using the normal @code{mysqld.exe} binary is that it's a little -faster and uses less resources. - -Here is a list of the different @strong{MySQL} servers you can use: - -@multitable @columnfractions .25 .75 -@item @code{mysqld} @tab -Compiled with full debugging and automatic memory allocation checking, -symbolic links, BDB and InnoDB tables. -@item @code{mysqld-opt} @tab -Optimized binary with no support for transactional tables. -@item @code{mysqld-nt} @tab -Optimized binary for NT with support for named pipes. You can run this -version on Win98, but in this case no named pipes are created and you must -have TCP/IP installed. -@item @code{mysqld-max} @tab -Optimized binary with support for symbolic links, BDB and InnoDB tables. -@item @code{mysqld-max-nt} @tab -Like @code{mysqld-max}, but compiled with support for named pipes. -@end multitable - -All of the above binaries are optimized for the Pentium Pro processor but -should work on any Intel processor >= i386. - -NOTE: If you want to use InnoDB tables, there are certain startup -options that must be specified in your @file{my.ini} file! @xref{InnoDB start}. - -@node Win95 start, NT start, Windows installation, Windows -@subsection Starting MySQL on Windows 95 or Windows 98 +@node Win95 start, NT start, Windows, Windows +@subsubsection Starting MySQL on Windows 95 or Windows 98 @strong{MySQL} uses TCP/IP to connect a client to a server. (This will allow any machine on your network to connect to your @strong{MySQL} @@ -10801,7 +10244,7 @@ The last option is to start @code{mysqld} with @code{--standalone doesn't start. @xref{Making trace files}. @node NT start, Windows running, Win95 start, Windows -@subsection Starting MySQL on Windows NT or Windows 2000 +@subsubsection Starting MySQL on Windows NT or Windows 2000 The Win95/Win98 section also applies to @strong{MySQL} on NT/Win2000, with the following differences: @@ -10890,7 +10333,7 @@ The last version gives you a debug trace in @file{C:\mysqld.trace}. @xref{Making trace files}. @node Windows running, Windows and SSH, NT start, Windows -@subsection Running MySQL on Windows +@subsubsection Running MySQL on Windows @cindex TCP/IP @cindex named pipes @@ -10975,10 +10418,11 @@ and change privileges with @code{GRANT} and @code{REVOKE} commands. @xref{GRANT}. @c FIX this is ugly, real ugly. +@node Windows and SSH, Windows symbolic links, Windows running, Windows +@subsubsection Connecting to a Remote MySQL from Windows with SSH + @cindex SSH @cindex connecting, remotely with SSH -@node Windows and SSH, Windows symbolic links, Windows running, Windows -@subsection Connecting to a Remote MySQL from Windows with SSH Here is a note about how to connect to get a secure connection to remote @strong{MySQL} server with SSH (by David Carlson @email{dcarlson@@mplcomm.com}): @@ -11018,11 +10462,12 @@ for the @strong{MySQL} host server --- not @code{yourmysqlservername}. You should now have an ODBC connection to @strong{MySQL}, encrypted using SSH. +@node Windows symbolic links, Windows compiling, Windows and SSH, Windows +@subsubsection Splitting Data Across Different Disks on Windows + @cindex symbolic links @cindex using multiple disks to start data @cindex disks, splitting data across -@node Windows symbolic links, Windows compiling, Windows and SSH, Windows -@subsection Splitting Data Across Different Disks on Windows Beginning with @strong{MySQL} Version 3.23.16, the @code{mysqld-max} and @code{mysql-max-nt} servers in the @strong{MySQL} distribution are @@ -11056,10 +10501,11 @@ In @strong{MySQL} 4.0 we will enable symlinks by default. Then you should instead use the @code{skip-symlink} option if you want to disable this. +@node Windows compiling, Windows vs Unix, Windows symbolic links, Windows +@subsubsection Compiling MySQL Clients on Windows + @cindex compiling, on Windows @cindex Windows, compiling on -@node Windows compiling, Windows vs Unix, Windows symbolic links, Windows -@subsection Compiling MySQL Clients on Windows In your source files, you should include @file{windows.h} before you include @file{mysql.h}: @@ -11078,10 +10524,11 @@ with the static @file{mysqlclient.lib} library. Note that as the mysqlclient libraries are compiled as threaded libraries, you should also compile your code to be multi-threaded! +@node Windows vs Unix, , Windows compiling, Windows +@subsubsection MySQL-Windows Compared to Unix MySQL + @cindex Windows, versus Unix @cindex operating systems, Windows versus Unix -@node Windows vs Unix, , Windows compiling, Windows -@subsection MySQL-Windows Compared to Unix MySQL @strong{MySQL}-Windows has by now proven itself to be very stable. This version of @strong{MySQL} has the same features as the corresponding Unix version @@ -11269,1578 +10716,1435 @@ provided by Windows. Other Windows-specific issues are described in the @file{README} file that comes with the @strong{MySQL}-Windows distribution. -@node OS/2, MySQL binaries, Windows, 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: +@node Solaris, Solaris 2.7, Windows, Operating System Specific Notes +@subsection Solaris Notes + +@cindex Solaris installation problems +@cindex problems, installing on Solaris +@cindex tar, problems on Solaris +@cindex errors, directory checksum +@cindex checksum errors + +On Solaris, you may run into trouble even before you get the @strong{MySQL} +distribution unpacked! Solaris @code{tar} can't handle long file names, so +you may see an error like this when you unpack @strong{MySQL}: @example -SET EMXOPT=-c -n -h1024 +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 -If you don't do this, you will probably run into the following error: +In this case, you must use GNU @code{tar} (@code{gtar}) to unpack the +distribution. You can find a precompiled copy for Solaris at +@uref{http://www.mysql.com/Downloads/}. + +Sun native threads work only on Solaris 2.5 and higher. For Version 2.4 and +earlier, @strong{MySQL} will automatically use MIT-pthreads. +@xref{MIT-pthreads}. + +If you get the following error from configure: @example -File 'xxxx' not found (Errcode: 24) +checking for restartable system calls... configure: error can not run test +programs while cross compiling @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 filenames such as HPFS, FAT32, etc. +This means that you have something wrong with your compiler installation! +In this case you should upgrade your compiler to a newer version. You may +also be able to solve this problem by inserting the following row into the +@file{config.cache} file: -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}. +@example +ac_cv_sys_restartable_syscalls=$@{ac_cv_sys_restartable_syscalls='no'@} +@end example -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}. +If you are using Solaris on a SPARC, the recommended compiler is +@code{gcc} 2.95.2. You can find this at @uref{http://gcc.gnu.org/}. +Note that @code{egcs} 1.1.1 and @code{gcc} 2.8.1 don't work reliably on +SPARC! -Dynamic module support is compiled in but not fully tested. Dynamic -modules should be compiled using the Pthreads run-time library. +The recommended @code{configure} line when using @code{gcc} 2.95.2 is: @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 +CC=gcc CFLAGS="-O3" \ +CXX=gcc CXXFLAGS="-O3 -felide-constructors -fno-exceptions -fno-rtti" \ +./configure --prefix=/usr/local/mysql --with-low-memory --enable-assembler @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: +If you have a ultra sparc, you can get 4 % more performance by adding +"-mcpu=v8 -Wa,-xarch=v8plusa" to CFLAGS and CXXFLAGS. + +If you have the Sun Workshop (SunPro) 4.2 (or newer) compiler, you can +run @code{configure} like this: @example -mysql> CREATE FUNCTION metaphon RETURNS STRING SONAME "example.so"; +CC=cc CFLAGS="-Xa -fast -xO4 -native -xstrconst -mt" \ +CXX=CC CXXFLAGS="-noex -xO4 -mt" \ +./configure --prefix=/usr/local/mysql --enable-assembler @end example -Is OS/2, the module would be named @file{example.udf}, but you would not -specify the module extension: +You may also have to edit the @code{configure} script to change this line: @example -mysql> CREATE FUNCTION metaphon RETURNS STRING SONAME "example"; +#if !defined(__STDC__) || __STDC__ != 1 @end example -@cindex binary distributions -@node MySQL binaries, Post-installation, OS/2, Installing -@section MySQL Binaries +to this: -As a service, we at @strong{MySQL AB} provide a set of binary distributions -of @strong{MySQL} that are compiled at our site or at sites where customers -kindly have given us access to their machines. +@example +#if !defined(__STDC__) +@end example -These distributions are generated with @code{scripts/make_binary_distribution} -and are configured with the following compilers and options: +If you turn on @code{__STDC__} with the @code{-Xc} option, the Sun compiler +can't compile with the Solaris @file{pthread.h} header file. This is a Sun +bug (broken compiler or broken include file). -@table @asis -@item SunOS 4.1.4 2 sun4c with @code{gcc} 2.7.2.1 -@code{CC=gcc CXX=gcc CXXFLAGS="-O3 -felide-constructors" ./configure --prefix=/usr/local/mysql --disable-shared --with-extra-charsets=complex --enable-assembler} +If @code{mysqld} issues the error message shown below when you run it, you have +tried to compile @strong{MySQL} with the Sun compiler without enabling the +multi-thread option (@code{-mt}): -@item SunOS 5.5.1 (and above) sun4u with @code{egcs} 1.0.3a or 2.90.27 or gcc 2.95.2 and newer -@code{CC=gcc CFLAGS="-O3" CXX=gcc CXXFLAGS="-O3 -felide-constructors -fno-exceptions -fno-rtti" ./configure --prefix=/usr/local/mysql --with-low-memory --with-extra-charsets=complex --enable-assembler} +@example +libc internal error: _rmutex_unlock: rmutex not held +@end example -@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 --with-extra-charsets=complex} +Add @code{-mt} to @code{CFLAGS} and @code{CXXFLAGS} and try again. -@item Linux 2.0.33 i386 with @code{pgcc} 2.90.29 (@code{egcs} 1.0.3a) -@code{CFLAGS="-O3 -mpentium -mstack-align-double" CXX=gcc CXXFLAGS="-O3 -mpentium -mstack-align-double -felide-constructors -fno-exceptions -fno-rtti" ./configure --prefix=/usr/local/mysql --enable-assembler --with-mysqld-ldflags=-all-static --with-extra-charsets=complex} +If you get the following error when compiling @strong{MySQL} with @code{gcc}, +it means that your @code{gcc} is not configured for your version of Solaris: -@item Linux 2.2.x with x686 with @code{gcc} 2.95.2 -@code{CFLAGS="-O3 -mpentiumpro" CXX=gcc CXXFLAGS="-O3 -mpentiumpro -felide-constructors -fno-exceptions -fno-rtti" ./configure --prefix=/usr/local/mysql --enable-assembler --with-mysqld-ldflags=-all-static --disable-shared --with-extra-charset=complex} +@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 -@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 --with-extra-charsets=complex} +The proper thing to do in this case is to get the newest version of +@code{gcc} and compile it with your current @code{gcc} compiler! At +least for Solaris 2.5, almost all binary versions of @code{gcc} have +old, unusable include files that will break all programs that use +threads (and possibly other programs)! -@item AIX 2 4 with @code{gcc} 2.7.2.2 -@code{CC=gcc CXX=gcc CXXFLAGS=-O3 ./configure --prefix=/usr/local/mysql --with-extra-charsets=complex} +Solaris doesn't provide static versions of all system libraries +(@code{libpthreads} and @code{libdl}), so you can't compile @strong{MySQL} +with @code{--static}. If you try to do so, you will get the error: -@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 --with-extra-charsets=complex} +@example +ld: fatal: library -ldl: not found -@item Irix 6.3 IP32 with @code{gcc} 2.8.0 -@code{CC=gcc CXX=gcc CXXFLAGS=-O3 ./configure --prefix=/usr/local/mysql --with-extra-charsets=complex} +or -@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 --with-extra-charsets=complex} +undefined reference to `dlopen' +@end example -@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 --with-extra-charsets=complex} -@end table +If too many processes try to connect very rapidly to @code{mysqld}, you will +see this error in the @strong{MySQL} log: -Anyone who has more optimal options for any of the configurations listed -above can always mail them to the developer's mailing list at -@email{internals@@lists.mysql.com}. +@example +Error in accept: Protocol error +@end example -RPM distributions prior to @strong{MySQL} Version 3.22 are user-contributed. -Beginning with Version 3.22, the RPMs are generated by us at -@strong{MySQL AB}. +You might try starting the server with the @code{--set-variable back_log=50} +option as a workaround for this. @xref{Command-line options}. -If you want to compile a debug version of @strong{MySQL}, you should add -@code{--with-debug} or @code{--with-debug=full} to the above configure lines -and remove any @code{-fomit-frame-pointer} options. +If you are linking your own @strong{MySQL} client, you might get the +following error when you try to execute it: -@cindex post-installation, setup and testing -@cindex testing, post-installation -@cindex setup, post-installation -@node Post-installation, Installing many servers, MySQL binaries, Installing -@section Post-installation Setup and Testing +@example +ld.so.1: ./my: fatal: libmysqlclient.so.#: open failed: No such file or directory +@end example -@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 -* Command-line options:: Command-line options -* Option files:: Option files -@end menu +The problem can be avoided by one of the following methods: -Once you've installed @strong{MySQL} (from either a binary or source -distribution), you need to initialize the grant tables, start the server, -and make sure that the server works okay. You may also wish to arrange -for the server to be started and stopped automatically when your system -starts up and shuts down. +@itemize @bullet +@item +Link the client with the following flag (instead of @code{-Lpath}): +@code{-Wl,r/full-path-to-libmysqlclient.so}. -Normally you install the grant tables and start the server like this -for installation from a source distribution: -@cindex starting, the server -@cindex server, starting +@item +Copy @file{libmysqclient.so} to @file{/usr/lib}. -@example -shell> ./scripts/mysql_install_db -shell> cd mysql_installation_directory -shell> ./bin/safe_mysqld --user=mysql & -@end example +@tindex LD_RUN_PATH environment variable +@tindex Environment variable, LD_RUN_PATH +@item +Add the pathname of the directory where @file{libmysqlclient.so} is located +to the @code{LD_RUN_PATH} environment variable before running your client. +@end itemize -For a binary distribution (not RPM or pkg packages), do this: +When using the @code{--with-libwrap} configure option, you must also +include the libraries that @file{libwrap.a} needs: @example -shell> cd mysql_installation_directory -shell> ./bin/mysql_install_db -shell> ./bin/safe_mysqld --user=mysql & +--with-libwrap="/opt/NUtcpwrapper-7.6/lib/libwrap.a -lnsl -lsocket @end example -This creates the @code{mysql} database which will hold all database -privileges, the @code{test} database which you can use to test -@strong{MySQL} and also privilege entries for the user that run -@code{mysql_install_db} and a @code{root} user (without any passwords). -This also starts the @code{mysqld} server. +If you have problems with configure trying to link with @code{-lz} and +you don't have @code{zlib} installed, you have two options: -@code{mysql_install_db} will not overwrite any old privilege tables, so -it should be safe to run in any circumstances. If you don't want to -have the @code{test} database you can remove it with @code{mysqladmin -u -root drop test}. +@itemize @bullet +@item +If you want to be able to use the compressed communication protocol, +you need to get and install zlib from ftp.gnu.org. -Testing is most easily done from the top-level directory of the @strong{MySQL} -distribution. For a binary distribution, this is your installation directory -(typically something like @file{/usr/local/mysql}). For a source -distribution, this is the main directory of your @strong{MySQL} source tree. -@cindex testing, the server +@item +Configure with @code{--with-named-z-libs=no}. +@end itemize -In the commands shown below in this section and in the following -subsections, @code{BINDIR} is the path to the location in which programs -like @code{mysqladmin} and @code{safe_mysqld} are installed. For a -binary distribution, this is the @file{bin} directory within the -distribution. For a source distribution, @code{BINDIR} is probably -@file{/usr/local/bin}, unless you specified an installation directory -other than @file{/usr/local} when you ran @code{configure}. -@code{EXECDIR} is the location in which the @code{mysqld} server is -installed. For a binary distribution, this is the same as -@code{BINDIR}. For a source distribution, @code{EXECDIR} is probably -@file{/usr/local/libexec}. +If you are using gcc and have problems with loading @code{UDF} functions +into @strong{MySQL}, try adding @code{-lgcc} to the link line for the +@code{UDF} function. -Testing is described in detail below: -@cindex testing, installation +If you would like @strong{MySQL} to start automatically, you can copy +@file{support-files/mysql.server} to @file{/etc/init.d} and create a +symbolic link to it named @file{/etc/rc3.d/S99mysql.server}. -@enumerate -@item -If necessary, start the @code{mysqld} server and set up the initial -@strong{MySQL} grant tables containing the privileges that determine how -users are allowed to connect to the server. This is normally done with the -@code{mysql_install_db} script: + +@node Solaris 2.7, Solaris x86, Solaris, Operating System Specific Notes +@subsection Solaris 2.7/2.8 Notes + +You can normally use a Solaris 2.6 binary on Solaris 2.7 and 2.8. Most +of the Solaris 2.6 issues also apply for Solaris 2.7 and 2.8. + +Note that @strong{MySQL} Version 3.23.4 and above should be able to autodetect +new versions of Solaris and enable workarounds for the following problems! + +Solaris 2.7 / 2.8 has some bugs in the include files. You may see the +following error when you use @code{gcc}: @example -shell> scripts/mysql_install_db +/usr/include/widec.h:42: warning: `getwc' redefined +/usr/include/wchar.h:326: warning: this is the location of the previous +definition @end example -Typically, @code{mysql_install_db} needs to be run only the first time you -install @strong{MySQL}. Therefore, if you are upgrading an existing -installation, you can skip this step. (However, @code{mysql_install_db} is -quite safe to use and will not update any tables that already exist, so if -you are unsure of what to do, you can always run @code{mysql_install_db}.) - -@code{mysql_install_db} creates six tables (@code{user}, @code{db}, -@code{host}, @code{tables_priv}, @code{columns_priv}, and @code{func}) in the -@code{mysql} database. A description of the initial privileges is given in -@ref{Default privileges}. Briefly, these privileges allow the @strong{MySQL} -@code{root} user to do anything, and allow anybody to create or use databases -with a name of @code{'test'} or starting with @code{'test_'}. +If this occurs, you can do the following to fix the problem: -If you don't set up the grant tables, the following error will appear in the -log file when you start the server: +Copy @code{/usr/include/widec.h} to +@code{.../lib/gcc-lib/os/gcc-version/include} and change line 41 from: -@tindex host.frm, problems finding @example -mysqld: Can't find file: 'host.frm' +#if !defined(lint) && !defined(__lint) + +to + +#if !defined(lint) && !defined(__lint) && !defined(getwc) @end example -The above may also happen with a binary @strong{MySQL} distribution if you -don't start @strong{MySQL} by executing exactly @code{./bin/safe_mysqld}! -@xref{safe_mysqld, , @code{safe_mysqld}}. +Alternatively, you can edit @file{/usr/include/widec.h} directly. Either +way, after you make the fix, you should remove @file{config.cache} and run +@code{configure} again! -You might need to run @code{mysql_install_db} as @code{root}. However, -if you prefer, you can run the @strong{MySQL} server as an unprivileged -(non-@code{root}) user, provided that user can read and write files in -the database directory. Instructions for running @strong{MySQL} as an -unprivileged user are given in @ref{Changing MySQL user, , Changing -@strong{MySQL} user}. +If you get errors like this when you run @code{make}, it's because +@code{configure} didn't detect the @file{curses.h} file (probably +because of the error in @file{/usr/include/widec.h}): -If you have problems with @code{mysql_install_db}, see -@ref{mysql_install_db, , @code{mysql_install_db}}. +@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 -There are some alternatives to running the @code{mysql_install_db} -script as it is provided in the @strong{MySQL} distribution: +The solution to this is to do one of the following: @itemize @bullet @item -You may want to edit @code{mysql_install_db} before running it, to change -the initial privileges that are installed into the grant tables. This is -useful if you want to install @strong{MySQL} on a lot of machines with the -same privileges. In this case you probably should need only to add a few -extra @code{INSERT} statements to the @code{mysql.user} and @code{mysql.db} -tables! +Configure with @code{CFLAGS=-DHAVE_CURSES_H CXXFLAGS=-DHAVE_CURSES_H ./configure}. @item -If you want to change things in the grant tables after installing them, you -can run @code{mysql_install_db}, then use @code{mysql -u root mysql} to -connect to the grant tables as the @strong{MySQL} @code{root} user and issue -SQL statements to modify the grant tables directly. +Edit @file{/usr/include/widec.h} as indicted above and rerun configure. @item -It is possible to re-create the grant tables completely after they have -already been created. You might want to do this if you've already installed -the tables but then want to re-create them after editing -@code{mysql_install_db}. +Remove the @code{#define HAVE_TERM} line from @file{config.h} file and +run @code{make} again. @end itemize -For more information about these alternatives, see @ref{Default privileges}. +If you get a problem that your linker can't find @code{-lz} when linking +your client program, the problem is probably that your @file{libz.so} file is +installed in @file{/usr/local/lib}. You can fix this by one of the +following methods: +@itemize @bullet @item -Start the @strong{MySQL} server like this: +Add @file{/usr/local/lib} to @code{LD_LIBRARY_PATH}. -@example -shell> cd mysql_installation_directory -shell> bin/safe_mysqld & -@end example +@item +Add a link to @file{libz.so} from @file{/lib}. -If you have problems starting the server, see @ref{Starting server}. +@item +If you are using Solaris 8, you can install the optional zlib from your +Solaris 8 CD distribution. @item -Use @code{mysqladmin} to verify that the server is running. The following -commands provide a simple test to check that the server is up and responding -to connections: +Configure @strong{MySQL} with the @code{--with-named-z-libs=no} option. +@end itemize -@example -shell> BINDIR/mysqladmin version -shell> BINDIR/mysqladmin variables -@end example -The output from @code{mysqladmin version} varies slightly depending on your -platform and version of @strong{MySQL}, but should be similar to that shown -below: +@node Solaris x86, BSD Notes, Solaris 2.7, Operating System Specific Notes +@subsection Solaris x86 Notes -@example -shell> BINDIR/mysqladmin version -mysqladmin Ver 8.14 Distrib 3.23.32, for linux on i586 -Copyright (C) 2000 MySQL AB & MySQL Finland AB & TCX DataKonsult AB -This software comes with ABSOLUTELY NO WARRANTY. This is free software, -and you are welcome to modify and redistribute it under the GPL license +On Solaris 2.8 on x86, @strong{mysqld} will core dump if you run +'strip' in. -Server version 3.23.32-debug -Protocol version 10 -Connection Localhost via Unix socket -TCP port 3306 -UNIX socket /tmp/mysql.sock -Uptime: 16 sec +If you are using @code{gcc} or @code{egcs} on Solaris x86 and you +experience problems with core dumps under load, you should use the +following @code{configure} command: -Threads: 1 Questions: 9 Slow queries: 0 Opens: 7 Flush tables: 2 Open tables: 0 Queries per second avg: 0.000 Memory in use: 132K Max memory used: 16773K +@example +CC=gcc CFLAGS="-O3 -fomit-frame-pointer -DHAVE_CURSES_H" \ +CXX=gcc \ +CXXFLAGS="-O3 -fomit-frame-pointer -felide-constructors -fno-exceptions -fno-rtti -DHAVE_CURSES_H" \ +./configure --prefix=/usr/local/mysql @end example -To get a feeling for what else you can do with @code{BINDIR/mysqladmin}, -invoke it with the @code{--help} option. +This will avoid problems with the @code{libstdc++} library and with C++ +exceptions. -@item -Verify that you can shut down the server: -@cindex server, shutdown -@cindex shutting down, the server +If this doesn't help, you should compile a debug version and run +it with a trace file or under @code{gdb}. @xref{Using gdb on mysqld}. -@example -shell> BINDIR/mysqladmin -u root shutdown -@end example -@item -Verify that you can restart the server. Do this using @code{safe_mysqld} or -by invoking @code{mysqld} directly. For example: +@node BSD Notes, Mac OS X, Solaris x86, Operating System Specific Notes +@subsection BSD Notes -@cindex server, restart -@cindex restarting, the server +@menu +* FreeBSD:: +* NetBSD:: +* OpenBSD:: +* OpenBSD 2.5:: +* OpenBSD 2.8:: +* BSDI:: +* BSDI2:: +* BSDI3:: +* BSDI4:: +@end menu -@example -shell> BINDIR/safe_mysqld --log & -@end example -If @code{safe_mysqld} fails, try running it from the @strong{MySQL} -installation directory (if you are not already there). If that doesn't work, -see @ref{Starting server}. +@node FreeBSD, NetBSD, BSD Notes, BSD Notes +@subsubsection FreeBSD Notes + +FreeBSD 3.x is recommended for running @strong{MySQL} since the thread package +is much more integrated. + +The easiest and therefor the preferred way to install is to use the +mysql-server and mysql-client ports available on @uref{http://www.freebsd.org}. +Using these gives you: +@itemize @bullet @item -Run some simple tests to verify that the server is working. -The output should be similar to what is shown below: +A working @strong{MySQL} with all optimizations known to work on your version +of FreeBSD enabled. -@example -shell> BINDIR/mysqlshow -+-----------+ -| Databases | -+-----------+ -| mysql | -+-----------+ +@item +Automatic configuration and build. -shell> BINDIR/mysqlshow mysql -Database: mysql -+--------------+ -| Tables | -+--------------+ -| columns_priv | -| db | -| func | -| host | -| tables_priv | -| user | -+--------------+ +@item +Startup scripts installed in /usr/local/etc/rc.d. -shell> BINDIR/mysql -e "select host,db,user from db" mysql -+------+--------+------+ -| host | db | user | -+------+--------+------+ -| % | test | | -| % | test_% | | -+------+--------+------+ -@end example +@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 -There is also a benchmark suite in the @file{sql-bench} directory (under the -@strong{MySQL} installation directory) that you can use to compare how -@strong{MySQL} performs on different platforms. The @file{sql-bench/Results} -directory contains the results from many runs against different databases and -platforms. To run all tests, execute these commands: +It is recommended you use MIT-pthreads on FreeBSD 2.x and native threads on +Versions 3 and up. It is possible to run with native threads on some late +2.2.x versions but you may encounter problems shutting down @code{mysqld}. -@example -shell> cd sql-bench -shell> run-all-tests -@end example +The @strong{MYSQL} Makefiles require GNU make (@code{gmake}) to work. +If you want to compile @strong{MYSQL} you need to install GNU make +first. -If you don't have the @file{sql-bench} directory, you are probably using an -RPM for a binary distribution. (Source distribution RPMs include the -benchmark directory.) In this case, you must first install the benchmark -suite before you can use it. Beginning with @strong{MySQL} Version 3.22, -there are benchmark RPM files named @file{mysql-bench-VERSION-i386.rpm} that -contain benchmark code and data. +Be sure to have your name resolver setup correct. Otherwise you may +experience resolver delays or failures when connecting to @code{mysqld}. -If you have a source distribution, you can also run the tests in the -@file{tests} subdirectory. For example, to run @file{auto_increment.tst}, do -this: +Make sure that the @code{localhost} entry in the @file{/etc/hosts} file is +correct (otherwise you will have problems connecting to the database). The +@file{/etc/hosts} file should start with a line: @example -shell> BINDIR/mysql -vvf test < ./tests/auto_increment.tst +127.0.0.1 localhost localhost.your.domain @end example -The expected results are shown in the @file{./tests/auto_increment.res} file. -@end enumerate - -@node mysql_install_db, Starting server, Post-installation, Post-installation -@subsection Problems Running @code{mysql_install_db} -@cindex @code{mysql_install_db} script -@cindex scripts, @code{mysql_install_db} - -The purpose of the @code{mysql_install_db} script is to generate new -@strong{MySQL} privilege tables. It will not affect any other data! -It will also not do anything if you already have @strong{MySQL} privilege -tables installed! +If you notice that @code{configure} will use MIT-pthreads, you should read +the MIT-pthreads notes. @xref{MIT-pthreads}. -If you want to re-create your privilege tables, you should take down -the @code{mysqld} server, if it's running, and then do something like: +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 -mv mysql-data-directory/mysql mysql-data-directory/mysql-old -mysql_install_db +shell> rm config.cache +shell> ./configure --with-mit-threads @end example -This section lists problems you might encounter when you run -@code{mysql_install_db}: - -@table @strong -@item @code{mysql_install_db} doesn't install the grant tables +FreeBSD is also known to have a very low default file handle limit. +@xref{Not enough file handles}. Uncomment the ulimit -n section in +safe_mysqld or raise the limits for the @code{mysqld} user in /etc/login.conf +(and rebuild it with cap_mkdb /etc/login.conf). Also be sure you set the +appropriate class for this user in the password file if you are not +using the default (use: chpass mysqld-user-name). @xref{safe_mysqld, , +@code{safe_mysqld}}. -You may find that @code{mysql_install_db} fails to install the grant -tables and terminates after displaying the following messages: +If you get problems with the current date in @strong{MySQL}, setting the +@code{TZ} variable will probably help. @xref{Environment variables}. -@example -starting mysqld daemon with databases from XXXXXX -mysql daemon ended -@end example +To get a secure and stable system you should only use FreeBSD kernels +that are marked @code{-STABLE}. -In this case, you should examine the log file very carefully! The log -should be located in the directory @file{XXXXXX} named by the error message, -and should indicate why @code{mysqld} didn't start. If you don't understand -what happened, include the log when you post a bug report using -@code{mysqlbug}! -@xref{Bug reports}. -@item There is already a @code{mysqld} daemon running +@node NetBSD, OpenBSD, FreeBSD, BSD Notes +@subsubsection NetBSD notes -In this case, you probably don't have to run @code{mysql_install_db} at -all. You have to run @code{mysql_install_db} only once, when you install -@strong{MySQL} the first time. +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. -@item Installing a second @code{mysqld} daemon doesn't work when one daemon is running -This can happen when you already have an existing @strong{MySQL} -installation, but want to put a new installation in a different place (for -example, for testing, or perhaps you simply want to run two installations at -the same time). Generally the problem that occurs when you try to run the -second server is that it tries to use the same socket and port as the old one. -In this case you will get the error message: @code{Can't start server: Bind on -TCP/IP port: Address already in use} or @code{Can't start server : Bind on -unix socket...}. @xref{Installing many servers}. +@node OpenBSD, OpenBSD 2.5, NetBSD, BSD Notes +@subsubsection OpenBSD Notes -@item You don't have write access to @file{/tmp} -@cindex write access, tmp -@cindex temporary file, write access -@cindex files, @code{tmp} +@menu +* OpenBSD 2.5:: OpenBSD 2.5 Notes +* OpenBSD 2.8:: OpenBSD 2.8 Notes +@end menu -If you don't have write access to create a socket file at the default place -(in @file{/tmp}) or permission to create temporary files in @file{/tmp,} -you will get an error when running @code{mysql_install_db} or when -starting or using @code{mysqld}. +@node OpenBSD 2.5, OpenBSD 2.8, OpenBSD, BSD Notes +@subsubsection OpenBSD 2.5 Notes -You can specify a different socket and temporary directory as follows: +On OpenBSD Version 2.5, you can compile @strong{MySQL} with native threads +with the following options: -@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 +CFLAGS=-pthread CXXFLAGS=-pthread ./configure --with-mit-threads=no @end example -@file{some_tmp_dir} should be the path to some directory for which you -have write permission. @xref{Environment variables}. +@node OpenBSD 2.8, BSDI, OpenBSD 2.5, BSD Notes +@subsubsection OpenBSD 2.8 Notes -After this you should be able to run @code{mysql_install_db} and start -the server with these commands: +Our users have reported that OpenBSD 2.8 has a threading bug which causes +problems with @strong{MySQL}. The OpenBSD Developers have fixed the problem, +but as of January 25th, 2001, it's only available in the ``-current'' branch. +The symptoms of this threading bug are: slow response, high load, high CPU +usage, and crashes. -@example -shell> scripts/mysql_install_db -shell> BINDIR/safe_mysqld & -@end example -@item @code{mysqld} crashes immediately +@node BSDI, BSDI2, OpenBSD 2.8, BSD Notes +@subsubsection BSD/OS Notes -If you are running RedHat Version 5.0 with a version of @code{glibc} older than -2.0.7-5, you should make sure you have installed all @code{glibc} patches! -There is a lot of information about this in the @strong{MySQL} mail -archives. Links to the mail archives are available online at -@uref{http://www.mysql.com/documentation/}. -Also, see @ref{Linux}. +@menu +* BSDI2:: BSD/OS 2.x notes +* BSDI3:: BSD/OS 3.x notes +* BSDI4:: BSD/OS 4.x notes +@end menu -You can also start @code{mysqld} manually using the @code{--skip-grant-tables} -option and add the privilege information yourself using @code{mysql}: +@node BSDI2, BSDI3, BSDI, BSD Notes +@subsubsection BSD/OS Version 2.x Notes + +If you get the following error when compiling @strong{MySQL}, your +@code{ulimit} value for virtual memory is too low: @example -shell> BINDIR/safe_mysqld --skip-grant-tables & -shell> BINDIR/mysql -u root mysql +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 -From @code{mysql}, manually execute the SQL commands in -@code{mysql_install_db}. Make sure you run @code{mysqladmin -flush-privileges} or @code{mysqladmin reload} afterward to tell the server to -reload the grant tables. -@end table +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 Starting server, Automatic start, mysql_install_db, Post-installation -@subsection Problems Starting the MySQL Server -@cindex server, starting problems -@cindex problems, starting the server +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}. -If you are going to use tables that support transactions (BDB, InnoDB), -you should first create a my.cnf file and set startup options -for the table types you plan to use. @xref{Table types}. +If you get problems with the current date in @strong{MySQL}, setting the +@code{TZ} variable will probably help. @xref{Environment variables}. -Generally, you start the @code{mysqld} server in one of three ways: +@node BSDI3, BSDI4, BSDI2, BSD Notes +@subsubsection BSD/OS Version 3.x Notes -@itemize @bullet -@item -By invoking @code{mysql.server}. This script is used primarily at -system startup and shutdown, and is described more fully in -@ref{Automatic start}. +Upgrade to BSD/OS Version 3.1. If that is not possible, install +BSDIpatch M300-038. -@item -By invoking @code{safe_mysqld}, which tries to determine the proper options -for @code{mysqld} and then runs it with those options. @xref{safe_mysqld, , -@code{safe_mysqld}}. +Use the following command when configuring @strong{MySQL}: -@item -On NT you should install @code{mysqld} as a service as follows: @example -bin\mysqld-nt --install # Install MySQL as a service +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 -You can now start/stop @code{mysqld} as follows: +The following is also known to work: + @example -NET START mysql -NET STOP mysql +shell> env CC=gcc CXX=gcc CXXFLAGS=-O3 \ + ./configure \ + --prefix=/usr/local/mysql \ + --with-unix-socket-path=/var/mysql/mysql.sock @end example -Note that in this case you can't use any other options for @code{mysqld}! +You can change the directory locations if you wish, or just use the +defaults by not specifying any locations. -You can remove the service as follows: -@example -bin\mysqld-nt --remove # remove MySQL as a service -@end example +If you have problems with performance under heavy load, try using the +@code{--skip-thread-priority} option to @code{mysqld}! This will run +all threads with the same priority; on BSDI Version 3.1, this gives better +performance (at least until BSDI fixes their thread scheduler). -@item -By invoking @code{mysqld} directly. -@end itemize +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}. -When the @code{mysqld} daemon starts up, it changes directory to the -data directory. This is where it expects to write log files and the pid -(process ID) file, and where it expects to find databases. +@node BSDI4, , BSDI3, BSD Notes +@subsubsection BSD/OS Version 4.x Notes -The data directory location is hardwired in when the distribution is -compiled. However, if @code{mysqld} expects to find the data directory -somewhere other than where it really is on your system, it will not work -properly. If you have problems with incorrect paths, you can find out -what options @code{mysqld} allows and what the default path settings are by -invoking @code{mysqld} with the @code{--help} option. You can override the -defaults by specifying the correct pathnames as command-line arguments to -@code{mysqld}. (These options can be used with @code{safe_mysqld} as well.) +BSDI Version 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. -Normally you should need to tell @code{mysqld} only the base directory under -which @strong{MySQL} is installed. You can do this with the @code{--basedir} -option. You can also use @code{--help} to check the effect of changing path -options (note that @code{--help} @emph{must} be the final option of the -@code{mysqld} command). For example: +On some BSDI Version 4.x systems, you may get problems with shared libraries. +The symptom is that you can't execute any client programs, for example, +@code{mysqladmin}. In this case you need to reconfigure not to use +shared libraries with the @code{--disable-shared} option to configure. -@example -shell> EXECDIR/mysqld --basedir=/usr/local --help -@end example +Some customers have had problems on BSDI 4.0.1 that the @code{mysqld} +binary after a while can't open tables. This is because some +library/system related bug causes @code{mysqld} to change current +directory without asking for this! -Once you determine the path settings you want, start the server without -the @code{--help} option. +The fix is to either upgrade to 3.23.34 or after running @code{configure} +remove the line @code{#define HAVE_REALPATH} from @code{config.h} +before running make. -Whichever method you use to start the server, if it fails to start up -correctly, check the log file to see if you can find out why. Log files -are located in the data directory (typically -@file{/usr/local/mysql/data} for a binary distribution, -@file{/usr/local/var} for a source distribution, -@file{\mysql\data\mysql.err} on Windows.) Look in the data directory for -files with names of the form @file{host_name.err} and -@file{host_name.log} where @code{host_name} is the name of your server -host. Then check the last few lines of these files: +Note that the above means that you can't symbolic link a database directories +to another database directory or symbolic link a table to another database +on BSDI! (Making a symbolic link to another disk is ok). -@example -shell> tail host_name.err -shell> tail host_name.log -@end example -If you find something like the following in the log file: -@example -000729 14:50:10 bdb: Recovery function for LSN 1 27595 failed -000729 14:50:10 bdb: warning: ./test/t1.db: No such file or directory -000729 14:50:10 Can't init databases -@end example +@node Mac OS X, Other Unix Notes, BSD Notes, Operating System Specific Notes +@subsection Mac OS X Notes -This means that you didn't start @code{mysqld} with @code{--bdb-no-recover} -and Berkeley DB found something wrong with its log files when it -tried to recover your databases. To be able to continue, you should -move away the old Berkeley DB log file from the database directory to -some other place, where you can later examine these. The log files are -named @file{log.0000000001}, where the number will increase over time. +@menu +* Mac OS X Public Beta:: +* Mac OS X Server:: +@end menu -If you are running @code{mysqld} with BDB table support and @code{mysqld} core -dumps at start this could be because of some problems with the BDB -recover log. In this case you can try starting @code{mysqld} with -@code{--bdb-no-recover}. If this helps, then you should remove all -@file{log.*} files from the data directory and try starting @code{mysqld} -again. -If you get the following error, it means that some other program (or another -@code{mysqld} server) is already using the TCP/IP port or socket -@code{mysqld} is trying to use: +@node Mac OS X Public Beta, Mac OS X Server, Mac OS X, Mac OS X +@subsubsection Mac OS X Public Beta -@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 +@strong{MySQL} should work without any problems on Mac OS X Public Beta +(Darwin). You don't need the pthread patches for this OS! -Use @code{ps} to make sure that you don't have another @code{mysqld} server -running. If you can't find another server running, you can try to execute -the command @code{telnet your-host-name tcp-ip-port-number} and press -@code{RETURN} a couple of times. If you don't get an error message like -@code{telnet: Unable to connect to remote host: Connection refused}, -something is using the TCP/IP port @code{mysqld} is trying to use. -See @ref{mysql_install_db} and @ref{Multiple servers}. -If @code{mysqld} is currently running, you can find out what path settings -it is using by executing this command: +@node Mac OS X Server, , Mac OS X Public Beta, Mac OS X +@subsubsection Mac OS X Server -@example -shell> mysqladmin variables -@end example +Before trying to configure @strong{MySQL} on Mac OS X server you must +first install the pthread package from +@uref{http://www.prnet.de/RegEx/mysql.html}. -or +Our binary for Mac OS X is compiled on Rhapsody 5.5 with the following +configure line: @example -shell> mysqladmin -h 'your-host-name' variables +CC=gcc CFLAGS="-O2 -fomit-frame-pointer" CXX=gcc CXXFLAGS="-O2 -fomit-frame-pointer" ./configure --prefix=/usr/local/mysql "--with-comment=Official MySQL binary" --with-extra-charsets=complex --disable-shared @end example -If @code{safe_mysqld} starts the server but you can't connect to it, -you should make sure you have an entry in @file{/etc/hosts} that looks like -this: +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 -127.0.0.1 localhost +alias mysql '/usr/local/mysql/bin/mysql' +alias mysqladmin '/usr/local/mysql/bin/mysqladmin' @end example -This problem occurs only on systems that don't have a working thread -library and for which @strong{MySQL} must be configured to use MIT-pthreads. -If you can't get @code{mysqld} to start you can try to make a trace file -to find the problem. @xref{Making trace files}. +@node Other Unix Notes, SCO Unixware, Mac OS X, Operating System Specific Notes +@subsection Other Unix Notes -If you are using InnoDB tables, refer to the InnoDB-specific startup -options. @xref{InnoDB start}. +@menu +* Binary notes-HP-UX:: +* HP-UX 10.20:: +* HP-UX 11.x:: +* IBM-AIX:: +* SunOS:: +* Alpha-DEC-UNIX:: +* Alpha-DEC-OSF1:: +* SGI-Irix:: +* SCO:: +@end menu -If you are using BDB (Berkeley DB) tables, you should familiarize -yourself with the different BDB specific startup options. @xref{BDB start}. -@node Automatic start, Command-line options, Starting server, Post-installation -@subsection Starting and Stopping MySQL Automatically -@cindex starting, the server automatically -@cindex stopping, the server -@cindex server, starting and stopping +@node Binary notes-HP-UX, HP-UX 10.20, Other Unix Notes, Other Unix Notes +@subsubsection HP-UX Notes for Binary Distributions -The @code{mysql.server} and @code{safe_mysqld} scripts can be used to start -the server automatically at system startup time. @code{mysql.server} can also -be used to stop the server. +@cindex HP-UX, binary distribution +@cindex binary distributions, on HP-UX -The @code{mysql.server} script can be used to start or stop the server -by invoking it with @code{start} or @code{stop} arguments: +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. -@example -shell> mysql.server start -shell> mysql.server stop -@end example +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} Version 3.22.26 and newer can also be +built with HP's native thread package. -@code{mysql.server} can be found in the @file{share/mysql} directory -under the @strong{MySQL} installation directory or in the @file{support-files} -directory of the @strong{MySQL} source tree. +Other configurations that may work: -Before @code{mysql.server} starts the server, it changes directory to -the @strong{MySQL} installation directory, then invokes @code{safe_mysqld}. -You might need to edit @code{mysql.server} if you have a binary distribution -that you've installed in a non-standard location. Modify it to @code{cd} -into the proper directory before it runs @code{safe_mysqld}. If you want the -server to run as some specific user, add an appropriate @code{user} line -to the @file{/etc/my.cnf} file, as shown later in this section. +@itemize @bullet +@item +HP 9000/7xx running HP-UX 10.20+ +@item +HP 9000/8xx running HP-UX 10.30 +@end itemize -@code{mysql.server stop} brings down the server by sending a signal to it. -You can take down the server manually by executing @code{mysqladmin shutdown}. +The following configurations almost definitely won't work: -You might want to add these start and stop commands to the appropriate places -in your @file{/etc/rc*} files when you start using @strong{MySQL} for -production applications. Note that if you modify @code{mysql.server}, then -upgrade @strong{MySQL} sometime, your modified version will be overwritten, -so you should make a copy of your edited version that you can reinstall. +@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 pathname of the depot file: + +@itemize @bullet +@item +To install everything, including the server, client and development tools: -If your system uses @file{/etc/rc.local} to start external scripts, you -should append the following to it: @example -/bin/sh -c 'cd /usr/local/mysql ; ./bin/safe_mysqld --user=mysql &' +shell> /usr/sbin/swinstall -s /path/to/depot mysql.full @end example -You can also add options for @code{mysql.server} in a global -@file{/etc/my.cnf} file. A typical @file{/etc/my.cnf} file might look like -this: +@item +To install only the server: @example -[mysqld] -datadir=/usr/local/mysql/var -socket=/tmp/mysqld.sock -port=3306 -user=mysql - -[mysql.server] -basedir=/usr/local/mysql +shell> /usr/sbin/swinstall -s /path/to/depot mysql.server @end example -The @code{mysql.server} script understands the following options: -@code{datadir}, @code{basedir}, and @code{pid-file}. +@item +To install only the client package: -The following table shows which option groups each of the startup scripts -read from option files: +@example +shell> /usr/sbin/swinstall -s /path/to/depot mysql.client +@end example -@multitable @columnfractions .20 .80 -@item @strong{Script} @tab @strong{Option groups} -@item @code{mysqld} @tab @code{mysqld} and @code{server} -@item @code{mysql.server} @tab @code{mysql.server}, @code{mysqld}, and @code{server} -@item @code{safe_mysqld} @tab @code{mysql.server}, @code{mysqld}, and @code{server} -@end multitable +@item +To install only the development tools: -@xref{Option files}. +@example +shell> /usr/sbin/swinstall -s /path/to/depot mysql.developer +@end example +@end itemize -@findex command-line options -@cindex options, command-line -@cindex mysqld options -@node Command-line options, Option files, Automatic start, Post-installation -@subsection mysqld Command-line Options +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{/etc/init.d} and @file{/etc/rc2.d} to start the server automatically +at boot time. Obviously, this entails being @code{root} to install. -@code{mysqld} accepts the following command-line options: +To install the HP-UX tar.gz distribution, you must have a copy of GNU +@code{tar}. -@table @code -@item --ansi -Use ANSI SQL syntax instead of MySQL syntax. @xref{ANSI mode}. -@item -b, --basedir=path -Path to installation directory. All paths are usually resolved relative to -this. +@node HP-UX 10.20, HP-UX 11.x, Binary notes-HP-UX, Other Unix Notes +@subsubsection HP-UX Version 10.20 Notes -@item --big-tables -Allow big result sets by saving all temporary sets on file. It solves -most 'table full' errors, but also slows down the queries where -in-memory tables would suffice. Since Version 3.23.2, @strong{MySQL} is -able to solve it automatically by using memory for small temporary -tables and switching to disk tables where necessary. +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! -@item --bind-address=IP -IP address to bind to. +We recommend using gcc 2.95 on HP-UX. Don't use high optimization +flags (like -O6) as this may not be safe on HP-UX. -@item --character-sets-dir=path -Directory where character sets are. @xref{Character sets}. +Note that MIT-pthreads can't be compiled with the HP-UX compiler +because it can't compile @code{.S} (assembler) files. -@item --chroot=path -Chroot @code{mysqld} daemon during startup. Recommended security measure. It will -somewhat limit @code{LOAD DATA INFILE} and @code{SELECT ... INTO OUTFILE} -though. +The following configure line should work: -@item --core-file -Write a core file if @code{mysqld} dies. For some systems you must also -specify @code{--core-file-size} to @code{safe_mysqld}. @xref{safe_mysqld, , -@code{safe_mysqld}}. +@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 -@item -h, --datadir=path -Path to the database root. +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! -@item --default-character-set=charset -Set the default character set. @xref{Character sets}. -@item --default-table-type=type -Set the default table type for tables. @xref{Table types}. +@node HP-UX 11.x, IBM-AIX, HP-UX 10.20, Other Unix Notes +@subsubsection HP-UX Version 11.x Notes -@item --debug[...]= -If @strong{MySQL} is configured with @code{--with-debug}, you can use this -option to get a trace file of what @code{mysqld} is doing. -@xref{Making trace files}. +For HP-UX Version 11.x we recommend @strong{MySQL} Version 3.23.15 or later. -@item --delay-key-write-for-all-tables -Don't flush key buffers between writes for any @code{MyISAM} table. -@xref{Server parameters}. +Because of some critical bugs in the standard HP-UX libraries, you should +install the following patches before trying to run @strong{MySQL} on HP-UX 11.0: -@item --enable-locking -Enable system locking. Note that if you use this option on a system -which a not fully working lockd() (as on Linux) you will easily get -mysqld to deadlock. +@example +PHKL_22840 Streams cumulative +PHNE_22397 ARPA cumulative +@end example -@item -T, --exit-info -This is a bit mask of different flags one can use for debugging the -mysqld server; One should not use this option if one doesn't know -exactly what it does! +This will solve a problem that one gets @code{EWOULDBLOCK} from @code{recv()} +and @code{EBADF} from @code{accept()} in threaded applications. -@item --flush -Flush all changes to disk after each SQL command. Normally @strong{MySQL} -only does a write of all changes to disk after each SQL command and lets -the operating system handle the syncing to disk. -@xref{Crashing}. +If you are using @code{gcc} 2.95.1 on an unpatched HP-UX 11.x system, +you will get the error: -@item -?, --help -Display short help and exit. +@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 ... +/usr/include/sys/pthread.h:440: previous declaration ... +In file included from item.h:306, + from mysql_priv.h:158, + from item.cc:19: +@end example -@item --init-file=file -Read SQL commands from this file at startup. +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 (details below). -@item -L, --language=... -Client error messages in given language. May be given as a full path. -@xref{Languages}. +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: -@item -l, --log[=file] -Log connections and queries to file. @xref{Query log}. +@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 -@item --log-isam[=file] -Log all ISAM/MyISAM changes to file (only used when debugging ISAM/MyISAM). +After this, the following configure line should work: -@item --log-slow-queries[=file] -Log all queries that have taken more than @code{long_query_time} seconds to -execute to file. @xref{Slow query log}. +@example +CFLAGS="-fomit-frame-pointer -O3 -fpic" CXX=gcc CXXFLAGS="-felide-constructors -fno-exceptions -fno-rtti -O3" ./configure --prefix=/usr/local/mysql --disable-shared +@end example -@item --log-update[=file] -Log updates to @code{file.#} where @code{#} is a unique number if not given. -@xref{Update log}. +Here is some information that a HP-UX Version 11.x user sent us about compiling +@strong{MySQL} with HP-UX:x compiler: -@item --log-long-format -Log some extra information to update log. If you are using -@code{--log-slow-queries} then queries that are not using indexes are logged -to the slow query log. +@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. -@item --low-priority-updates -Table-modifying operations (@code{INSERT}/@code{DELETE}/@code{UPDATE}) -will have lower priority than selects. It can also be done via -@code{@{INSERT | REPLACE | UPDATE | DELETE@} LOW_PRIORITY ...} to lower -the priority of only one query, or by -@code{SET OPTION SQL_LOW_PRIORITY_UPDATES=1} to change the priority in one -thread. @xref{Table locking}. + configuration: + ./configure --with-pthread \ + --prefix=/source-control/mysql \ + --with-named-thread-libs=-lpthread \ + --with-low-memory -@item --memlock -Lock the @code{mysqld} process in memory. This works only if your -system supports the @code{mlockall()} system call (like Solaris). This -may help if you have a problem where the operating system is causing -@code{mysqld} to swap on disk. + added '#define _CTYPE_INCLUDED' to include/m_ctype.h. This + symbol is the one defined in HP's /usr/include/ctype.h: -@item --myisam-recover [=option[,option...]]] where option is one of DEFAULT, BACKUP, FORCE or QUICK. -If this option is used, @code{mysqld} will on open check if the table is -marked as crashed or if if the table wasn't closed properly. (The last -option only works if you are running with @code{--skip-locking}). If this -is the case @code{mysqld} will run check on the table. If the table was corrupted, -@code{mysqld} will attempt to repair it. + /* 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 -The following options affects how the repair works. +@itemize @bullet +@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 -@multitable @columnfractions .3 .7 -@item DEFAULT @tab The same as not giving any option to - @code{--myisam-recover}. -@item BACKUP @tab If the data table was changed during recover, save a - backup of the @file{table_name.MYD} data file as - @file{table_name-datetime.BAK}. -@item FORCE @tab Run recover even if we will loose more than one row - from the .MYD file. -@item QUICK @tab Don't check the rows in the table if there isn't any - delete blocks. -@end multitable +If you get the following error from @code{configure} -Before a table is automatically repaired, @strong{MySQL} will add a note -about this in the error log. If you want to be able to recover from most -things without user intervention, you should use the options -@code{BACKUP,FORCE}. This will force a repair of a table even if some rows -would be deleted, but it will keep the old data file as a backup so that -you can later examine what happened. +@example +checking for cc option to accept ANSI C... no +configure: error: MySQL requires a ANSI C compiler (and a C++ compiler). Try gcc. See the Installation chapter in the Reference Manual. +@end example -@item --pid-file=path -Path to pid file used by @code{safe_mysqld}. +Check that you don't have the path to the K&R compiler before the path +to the HP-UX C and C++ compiler. -@item -P, --port=... -Port number to listen for TCP/IP connections. -@item -o, --old-protocol -Use the 3.20 protocol for compatibility with some very old clients. -@xref{Upgrading-from-3.20}. +@node IBM-AIX, SunOS, HP-UX 11.x, Other Unix Notes +@subsubsection IBM-AIX notes -@item --one-thread -Only use one thread (for debugging under Linux). @xref{Debugging server}. +@cindex problems, installing on IBM-AIX -@item -O, --set-variable var=option -Give a variable a value. @code{--help} lists variables. You can find a full -description for all variables in the @code{SHOW VARIABLES} section in this -manual. @xref{SHOW VARIABLES}. The tuning server parameters section includes -information of how to optimize these. @xref{Server parameters}. +Automatic detection of @code{xlC} is missing from Autoconf, so a +@code{configure} command something like this is needed when compiling +@strong{MySQL} (This example uses the IBM compiler): -@item --safe-mode -Skip some optimize stages. Implies @code{--skip-delay-key-write}. +@example +export CC="xlc_r -ma -O3 -qstrict -qoptimize=3 -qmaxmem=8192 " +export CXX="xlC_r -ma -O3 -qstrict -qoptimize=3 -qmaxmem=8192" +export CFLAGS="-I /usr/local/include" +export LDLFAGS="-L /usr/local/lib" +export CPPFLAGS=$CFLAGS +export CXXFLAGS=$CFLAGS -@item --safe-show-database -Don't show databases for which the user doesn't have any privileges. +./configure --prefix=/usr/local \ + --localstatedir=/var/mysql \ + --sysconfdir=/etc/mysql \ + --sbindir='/usr/local/bin' \ + --libexecdir='/usr/local/bin' \ + --enable-thread-safe-client \ + --enable-large-files +@end example -@item --secure -IP numbers returned by the @code{gethostbyname()} system call are -checked to make sure they resolve back to the original hostname. This -makes it harder for someone on the outside to get access by pretending -to be another host. This option also adds some sanity checks of -hostnames. The option is turned off by default in @strong{MySQL} Version 3.21 -because sometimes it takes a long time to perform backward resolutions. -@strong{MySQL} Version 3.22 caches hostnames (unless @code{--skip-host-cache} -is used) and has this option enabled by default. +Above are the options used to compile the @strong{MySQL} distribution that +can be found at @uref{http://www-frec.bull.com/}. -@item --skip-concurrent-insert -Turn off the ability to select and insert at the same time on @code{MyISAM} -tables. (This is only to be used if you think you have found a bug in this -feature). +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). -@item --skip-delay-key-write -Ignore the @code{delay_key_write} option for all tables. -@xref{Server parameters}. +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.). There are also some known problems with IBM's assembler, +which may cause it to generate bad code when used with gcc. -@item --skip-grant-tables -This option causes the server not to use the privilege system at all. This -gives everyone @emph{full access} to all databases! (You can tell a running -server to start using the grant tables again by executing @code{mysqladmin -flush-privileges} or @code{mysqladmin reload}.) +We recommend the following @code{configure} line with @code{egcs} and +@code{gcc 2.95} on AIX: -@item --skip-host-cache -Never use host name cache for faster name-ip resolution, but query DNS server -on every connect instead. @xref{DNS}. +@example +CC="gcc -pipe -mcpu=power -Wa,-many" \ +CXX="gcc -pipe -mcpu=power -Wa,-many" \ +CXXFLAGS="-felide-constructors -fno-exceptions -fno-rtti" \ +./configure --prefix=/usr/local/mysql --with-low-memory +@end example -@item --skip-locking -Don't use system locking. To use @code{isamchk} or @code{myisamchk} you must -shut down the server. @xref{Stability}. Note that in @strong{MySQL} Version -3.23 you can use @code{REPAIR} and @code{CHECK} to repair/check @code{MyISAM} -tables. +The @code{-Wa,-many} is necessary for the compile to be successful. IBM is +aware of this problem but is in to hurry to fix it because of the workaround +available. We don't know if the @code{-fno-exceptions} is required with +@code{gcc 2.95}, but as @strong{MySQL} doesn't use exceptions and the above +option generates faster code, we recommend that you should always use this +option with @code{egcs / gcc}. -@item --skip-name-resolve -Hostnames are not resolved. All @code{Host} column values in the grant tables -must be IP numbers or @code{localhost}. @xref{DNS}. +If you get a problem with assembler code try changing the -mcpu=xxx to +match your cpu. Typically power2, power, or powerpc may need to be used, +alternatively you might need to use 604 or 604e. I'm not positive but I +would think using "power" would likely be safe most of the time, even on +a power2 machine. -@item --skip-networking -Don't listen for TCP/IP connections at all. All interaction with -@code{mysqld} must be made via Unix sockets. This option is highly -recommended for systems where only local requests are allowed. @xref{DNS}. +If you don't know what your cpu is then do a "uname -m", this will give +you back a string that looks like "000514676700", with a format of +xxyyyyyymmss where xx and ss are always 0's, yyyyyy is a unique system +id and mm is the id of the CPU Planar. A chart of these values can be +found at +@uref{http://www.rs6000.ibm.com/doc_link/en_US/a_doc_lib/cmds/aixcmds5/uname.htm}. +This will give you a machine type and a machine model you can use to +determine what type of cpu you have. -@item --skip-new -Don't use new, possible wrong routines. Implies @code{--skip-delay-key-write}. -This will also set default table type to @code{ISAM}. @xref{ISAM}. +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: -@item --skip-symlink -Don't delete or rename files that a symlinked file in the data directory -points to. +@example +shell> CFLAGS=-DDONT_USE_THR_ALARM CXX=gcc \ + CXXFLAGS="-felide-constructors -fno-exceptions -fno-rtti -DDONT_USE_THR_ALARM" \ + ./configure --prefix=/usr/local/mysql --with-debug --with-low-memory +@end example -@item --skip-safemalloc -If @strong{MySQL} is configured with @code{--with-debug=full}, all programs -will check the memory for overruns for every memory allocation and memory -freeing. As this checking is very slow, you can avoid this, when you don't -need memory checking, by using this option. +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. -@item --skip-show-database -Don't allow 'SHOW DATABASE' commands, unless the user has @strong{process} -privilege. +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. -@item --skip-stack-trace -Don't write stack traces. This option is useful when you are running -@code{mysqld} under a debugger. @xref{Debugging server}. +For AIX 4.2.1 and gcc you have to do the following changes. -@item --skip-thread-priority -Disable using thread priorities for faster response time. +After configuring, edit @file{config.h} and @file{include/my_config.h} +and change the line that says -@item --socket=path -Socket file to use for local connections instead of default -@code{/tmp/mysql.sock}. +@example +#define HAVE_SNPRINTF 1 +@end example -@item transaction-isolation= @{ READ-UNCOMMITTED | READ-COMMITTED | REPEATABLE-READ | SERIALIZABLE @} -Sets the default transaction isolation level. @xref{SET TRANSACTION}. +to -@item -t, --tmpdir=path -Path for temporary files. It may be useful if your default @code{/tmp} -directory resides on a partition too small to hold temporary tables. +@example +#undef HAVE_SNPRINTF +@end example -@item -u, --user=user_name -Run @code{mysqld} daemon as user @code{user_name}. This option is -@emph{mandatory} when starting @code{mysqld} as root. +And finally, in @file{mysqld.cc} you need to add a prototype for initgoups. -@item -V, --version -Output version information and exit. +@example +#ifdef _AIX41 +extern "C" int initgroups(const char *,int); +#endif +@end example -@item -W, --warnings -Print out warnings like @code{Aborted connection...} to the @code{.err} file. -@xref{Communication errors}. -@end table -@cindex default options -@cindex option files -@cindex creating, default startup options -@cindex startup options, default -@node Option files, , Command-line options, Post-installation -@subsection Option Files +@node SunOS, Alpha-DEC-UNIX, IBM-AIX, Other Unix Notes +@subsubsection SunOS 4 Notes -@strong{MySQL} can, since Version 3.22, read default startup options for the -server and for clients from option files. +On SunOS 4, MIT-pthreads is needed to compile @strong{MySQL}, which in turn +means you will need GNU @code{make}. -@strong{MySQL} reads default options from the following files on Unix: +Some SunOS 4 systems have problems with dynamic libraries and @code{libtool}. +You can use the following @code{configure} line to avoid this problem: -@tindex .my.cnf file -@multitable @columnfractions .3 .7 -@item @strong{Filename} @tab @strong{Purpose} -@item @code{/etc/my.cnf} @tab Global options -@item @code{DATADIR/my.cnf} @tab Server-specific options -@item @code{defaults-extra-file} @tab The file specified with --defaults-extra-file=# -@item @code{~/.my.cnf} @tab User-specific options -@end multitable +@example +shell> ./configure --disable-shared --with-mysqld-ldflags=-all-static +@end example -@code{DATADIR} is the @strong{MySQL} data directory (typically -@file{/usr/local/mysql/data} for a binary installation or -@file{/usr/local/var} for a source installation). Note that this is the -directory that was specified at configuration time, not the one specified -with @code{--datadir} when @code{mysqld} starts up! (@code{--datadir} has no -effect on where the server looks for option files, because it looks for them -before it processes any command-line arguments.) +When compiling @code{readline}, you may get warnings about duplicate defines. +These may be ignored. -@strong{MySQL} reads default options from the following files on Windows: +When compiling @code{mysqld}, there will be some @code{implicit declaration +of function} warnings. These may be ignored. -@multitable @columnfractions .3 .7 -@item @strong{Filename} @tab @strong{Purpose} -@item @code{windows-system-directory\my.ini} @tab Global options -@item @code{C:\my.cnf} @tab Global options -@item @code{C:\mysql\data\my.cnf} @tab Server-specific options -@end multitable -Note that on Windows, you should specify all paths with @code{/} instead of -@code{\}. If you use @code{\}, you need to specify this twice, as -@code{\} is the escape character in @strong{MySQL}. +@node Alpha-DEC-UNIX, Alpha-DEC-OSF1, SunOS, Other Unix Notes +@subsubsection Alpha-DEC-UNIX Notes (Tru64) -@cindex Environment variables -@strong{MySQL} tries to read option files in the order listed above. If -multiple option files exist, an option specified in a file read later takes -precedence over the same option specified in a file read earlier. Options -specified on the command line take precedence over options specified in any -option file. Some options can be specified using environment variables. -Options specified on the command line or in option files take precedence over -environment variable values. @xref{Environment variables}. +If you are using egcs 1.1.2 on Digital Unix, you should upgrade to gcc +2.95.2, as egcs on DEC has some serious bugs! -The following programs support option files: @code{mysql}, -@code{mysqladmin}, @code{mysqld}, @code{mysqldump}, @code{mysqlimport}, -@code{mysql.server}, @code{myisamchk}, and @code{myisampack}. +When compiling threaded programs under Digital Unix, the documentation +recommends using 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: -You can use option files to specify any long option that a program supports! -Run the program with @code{--help} to get a list of available options. +@example +CC="cc -pthread" CXX="cxx -pthread -O" \ +./configure --with-named-thread-libs="-lpthread -lmach -lexc -lc" +@end example -An option file can contain lines of the following forms: +When compiling @code{mysqld}, you may see a couple of warnings like this: -@table @code -@item #comment -Comment lines start with @samp{#} or @samp{;}. Empty lines are ignored. +@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 -@item [group] -@code{group} is the name of the program or group for which you want to set -options. After a group line, any @code{option} or @code{set-variable} lines -apply to the named group until the end of the option file or another group -line is given. +You can safely ignore these warnings. They occur because @code{configure} +can detect only errors, not warnings. -@item option -This is equivalent to @code{--option} on the command line. +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: -@item option=value -This is equivalent to @code{--option=value} on the command line. +@example +shell> nohup mysqld [options] & +@end example -@item set-variable = variable=value -This is equivalent to @code{--set-variable variable=value} on the command line. -This syntax must be used to set a @code{mysqld} variable. -@end table +@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. +@xref{safe_mysqld, , @code{safe_mysqld}}. -The @code{client} group allows you to specify options that apply to all -@strong{MySQL} clients (not @code{mysqld}). This is the perfect group to use -to specify the password you use to connect to the server. (But make -sure the option file is readable and writable only by yourself.) +If you get a problem when compiling mysys/get_opt.c, just remove the +line #define _NO_PROTO from the start of that file! -Note that for options and values, all leading and trailing blanks are -automatically deleted. You may use the escape sequences @samp{\b}, -@samp{\t}, @samp{\n}, @samp{\r}, @samp{\\}, and @samp{\s} in your value string -(@samp{\s} == blank). +If you are using Compac's CC compiler, the following configure line should +work: -Here is a typical global option file: +@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/local/mysql \ +--with-low-memory \ +--enable-large-files \ +--enable-shared=yes \ +--with-named-thread-libs="-lpthread -lmach -lexc -lc" +gnumake +@end example + +If you get a problem with libtool, when compiling with shared libraries +as above, when linking @code{mysql}, you should be able to get around +this by issuing: @example -[client] -port=3306 -socket=/tmp/mysql.sock +cd mysql +/bin/sh ../libtool --mode=link cxx -pthread -O3 -DDBUG_OFF \ +-O4 -ansi_alias -ansi_args -fast -inline speed \ +-speculate all \ -arch host -DUNDEF_HAVE_GETHOSTBYNAME_R \ +-o mysql mysql.o readline.o sql_string.o completion_hash.o \ +../readline/libreadline.a -lcurses \ +../libmysql/.libs/libmysqlclient.so -lm +cd .. +gnumake +gnumake install +scripts/mysql_install_db +@end example -[mysqld] -port=3306 -socket=/tmp/mysql.sock -set-variable = key_buffer_size=16M -set-variable = max_allowed_packet=1M -[mysqldump] -quick +@node Alpha-DEC-OSF1, SGI-Irix, Alpha-DEC-UNIX, Other Unix Notes +@subsubsection 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 +CC=cc CFLAGS=-O CXX=gcc CXXFLAGS=-O3 \ +./configure --prefix=/usr/local/mysql @end example -Here is typical user option file: +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 -[client] -# The following password will be sent to all standard MySQL clients -password=my_password +touch include/c_asm.h +CC=gcc CFLAGS=-I./include \ +CXX=gcc CXXFLAGS=-O3 \ +./configure --prefix=/usr/local/mysql +@end example -[mysql] -no-auto-rehash -set-variable = connect_timeout=2 +Note that the following problems with the @code{ld} program can be fixed +by downloading the latest DEC (Compaq) patch kit from: +@uref{http://ftp.support.compaq.com/public/unix/}. -[mysqlhotcopy] -interactive-timeout +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 +CC=gcc CXX=gcc CXXFLAGS=-O3 ./configure --prefix=/usr/local/mysql @end example -@tindex .my.cnf file -If you have a source distribution, you will find sample configuration -files named @file{my-xxxx.cnf} in the @file{support-files} directory. -If you have a binary distribution, look in the @file{DIR/support-files} -directory, where @code{DIR} is the pathname to the @strong{MySQL} -installation directory (typically @file{/usr/local/mysql}). Currently -there are sample configuration files for small, medium, large, and very -large systems. You can copy @file{my-xxxx.cnf} to your home directory -(rename the copy to @file{.my.cnf}) to experiment with this. +With the Digital compiler "C++ V6.1-029", the following should work: -All @strong{MySQL} clients that support option files support the -following options: +@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 -noexceptions -nortti +export CC CFLAGS CXX CXXFLAGS +./configure --prefix=/usr/mysql/mysql --with-mysqld-ldflags=-all-static --disable-shared --with-named-thread-libs="-lmach -lexc -lc" +@end example -@multitable @columnfractions .40 .60 -@item --no-defaults @tab Don't read any option files. -@item --print-defaults @tab Print the program name and all options that it will get. -@item --defaults-file=full-path-to-default-file @tab Only use the given configuration file. -@item --defaults-extra-file=full-path-to-default-file @tab Read this configuration file after the global configuration file but before the user configuration file. -@end multitable +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'}. -Note that the above options must be first on the command line to work! -@code{--print-defaults} may however be used directly after the -@code{--defaults-xxx-file} commands. +The @code{alloca()} function also may have an incorrect prototype in +@code{/usr/include/alloca.h}. This warning resulting from this can be ignored. -Note for developers: Option file handling is implemented simply by -processing all matching options (that is, options in the appropriate group) -before any command-line arguments. This works nicely for programs that use -the last instance of an option that is specified multiple times. If you have -an old program that handles multiply-specified options this way but doesn't -read option files, you need add only two lines to give it that capability. -Check the source code of any of the standard @strong{MySQL} clients to see -how to do this. +@code{configure} will use the following thread libraries automatically: +@code{--with-named-thread-libs="-lpthread -lmach -lexc -lc"}. -In shell scripts you can use the @file{my_print_defaults} command to parse the -config files: +When using @code{gcc}, you can also try running @code{configure} like this: @example - -shell> my_print_defaults client mysql ---port=3306 ---socket=/tmp/mysql.sock ---no-auto-rehash +shell> CFLAGS=-D_PTHREAD_USE_D4 CXX=gcc CXXFLAGS=-O3 ./configure .... @end example -The above output contains all options for the groups 'client' and 'mysql'. +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: -@node Installing many servers, Upgrade, Post-installation, Installing -@section Installing Many Servers on the Same Machine -@cindex post-install, many servers -@cindex Installing many servers -@cindex Starting many servers +@example +shell> CFLAGS=-DDONT_USE_THR_ALARM \ + CXXFLAGS=-DDONT_USE_THR_ALARM \ + ./configure ... +@end example -In some cases you may want to have many different @code{mysqld} daemons -(servers) running on the same machine. You may for example want to run -a new version of @strong{MySQL} for testing together with an old version -that is in production. Another case is when you want to give different -users access to different @code{mysqld} servers that they manage themselves. +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. -One way to get a new server running is by starting it with a different -socket and port as follows: +With @code{gcc} 2.95.2, you will probably run into the following compile error: -@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 & +sql_acl.cc:1456: Internal compiler error in `scan_region', at except.c:2566 +Please submit a full bug report. @end example -The environment variables appendix includes a list of other environment -variables you can use to affect @code{mysqld}. @xref{Environment variables}. +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 add @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. -The above is the quick and dirty way that one commonly uses for testing. -The nice thing with this is that all connections you do in the above shell -will automatically be directed to the new running server! -If you need to do this more permanently, you should create an option -file for each server. @xref{Option files}. In your startup script that -is executed at boot time (mysql.server?) you should specify for both -servers: +@node SGI-Irix, SCO, Alpha-DEC-OSF1, Other Unix Notes +@subsubsection SGI Irix Notes -@code{safe_mysqld --default-file=path-to-option-file} +If you are using Irix Version 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: -At least the following options should be different per server: +@example +shell> chcap "CAP_SCHED_MGT+epi" /opt/mysql/libexec/mysqld +@end example -@table @code -@item port=# -@item socket=path -@item pid-file=path -@end table +You may have to undefine some things in @file{config.h} after running +@code{configure} and before compiling. -The following options should be different, if they are used: +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. -@table @code -@item log=path -@item log-bin=path -@item log-update=path -@item log-isam=path -@item bdb-logdir=path -@end table +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 -If you want more performance, you can also specify the following differently: +At the very minimum, you should install the latest kernel rollup, the +latest @code{rld} rollup, and the latest @code{libc} rollup. -@table @code -@item tmpdir=path -@item bdb-tmpdir=path -@end table +You definitely need all the POSIX patches on this page, for pthreads support: -@xref{Command-line options}. +@uref{http://support.sgi.com/surfzone/patches/patchset/6.2_posix.rps.html} -If you are installing binary @strong{MySQL} versions (.tar files) and -start them with @code{./bin/safe_mysqld} then in most cases the only -option you need to add/change is the @code{socket} and @code{port} -argument to @code{safe_mysqld}. +If you get the something like the following error when compiling +@file{mysql.cc}: -@node Upgrade, , Installing many servers, Installing -@section Upgrading/Downgrading MySQL -@cindex upgrading -@cindex downgrading +@example +"/usr/include/curses.h", line 82: error(1084): invalid combination of type +@end example -You can always move the @strong{MySQL} form and data files between -different versions on the same architecture as long as you have the same -base version of @strong{MySQL}. The current base version is -3. If you change the character set when running @strong{MySQL} (which may -also change the sort order), you must run @code{myisamchk -r -q} on all -tables. Otherwise your indexes may not be ordered correctly. +Type the following in the top-level directory of your @strong{MySQL} source +tree: -If you are afraid of new versions, you can always rename your old -@code{mysqld} to something like @code{mysqld}-'old-version-number'. If -your new @code{mysqld} then does something unexpected, you can simply shut it -down and restart with your old @code{mysqld}! +@example +shell> extra/replace bool curses_bool < /usr/include/curses.h > include/curses.h +shell> make +@end example -When you do an upgrade you should also back up your old databases, of course. +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 after an upgrade, you experience problems with recompiled client programs, -like @code{Commands out of sync} or unexpected core dumps, you probably have -used an old header or library file when compiling your programs. In this -case you should check the date for your @file{mysql.h} file and -@file{libmysqlclient.a} library to verify that they are from the new -@strong{MySQL} distribution. If not, please recompile your programs! +If you are compiling with @code{gcc}, you can use the following +@code{configure} command: -If you get some problems that the new @code{mysqld} server doesn't want to -start or that you can't connect without a password, check that you don't -have some old @file{my.cnf} file from your old installation! You can -check this with: @code{program-name --print-defaults}. If this outputs -anything other than the program name, you have an active @code{my.cnf} -file that will affect things! +@example +CC=gcc CXX=gcc CXXFLAGS=-O3 \ +./configure --prefix=/usr/local/mysql --with-thread-safe-client --with-named-thread-libs=-lpthread +@end example -It is a good idea to rebuild and reinstall the @code{Msql-Mysql-modules} -distribution whenever you install a new release of @strong{MySQL}, -particularly if you notice symptoms such as all your @code{DBI} scripts -dumping core after you upgrade @strong{MySQL}. +On Irix 6.5.11 with native Irix C and C++ compilers ver. 7.3.1.2, the +following is reported to work -@menu -* Upgrading-from-3.22:: Upgrading from a 3.22 version to 3.23 -* Upgrading-from-3.21:: Upgrading from a 3.21 version to 3.22 -* Upgrading-from-3.20:: Upgrading from a 3.20 version to 3.21 -* Upgrading-to-arch:: Upgrading to another architecture -@end menu +@example +CC=cc CXX=CC CFLAGS='-O3 -n32 -TARG:platform=IP22 -I/usr/local/include \ +-L/usr/local/lib' CXXFLAGS='-O3 -n32 -TARG:platform=IP22 \ +-I/usr/local/include -L/usr/local/lib' ./configure --prefix=/usr/local/mysql \ +--with-berkeley-db --with-innodb \ +--with-libwrap=/usr/local --with-named-curses-libs=/usr/local/lib/libncurses.a +@end example -@cindex compatibility, between MySQL versions -@cindex upgrading, 3.22 to 3.23 -@node Upgrading-from-3.22, Upgrading-from-3.21, Upgrade, Upgrade -@subsection Upgrading From Version 3.22 to Version 3.23 -@strong{MySQL} Version 3.23 supports tables of the new @code{MyISAM} type and -the old @code{ISAM} type. You don't have to convert your old tables to -use these with Version 3.23. By default, all new tables will be created with -type @code{MyISAM} (unless you start @code{mysqld} with the -@code{--default-table-type=isam} option). You can change an @code{ISAM} -table to a @code{MyISAM} table with @code{ALTER TABLE table_name TYPE=MyISAM} -or the Perl script @code{mysql_convert_table_format}. +@node SCO, , SGI-Irix, Other Unix Notes +@subsubsection SCO Notes -Version 3.22 and 3.21 clients will work without any problems with a Version -3.23 server. +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''. -The following lists tell what you have to watch out for when upgrading to -Version 3.23: +For the moment the recommended compiler on OpenServer is gcc 2.95.2. With this +you should be able to compile @strong{MySQL} with just: -@itemize @bullet -@item -All tables that uses the @code{tis620} character set must be fixed -with @code{myisamchk -r} or @code{REPAIR TABLE}. +@example +CC=gcc CXX=gcc ./configure ... (options) +@end example + +@enumerate @item -If you do a @code{DROP DATABASE} on a symbolic linked database, both the -link and the original database is deleted. (This didn't happen in 3.22 -because configure didn't detect the @code{readlink} system call). +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 -@code{OPTIMIZE TABLE} now only works for @strong{MyISAM} tables. -For other table types, you can use @code{ALTER TABLE} to optimize the table. -During @code{OPTIMIZE TABLE} the table is now locked from other threads. +You need the port of GCC 2.5.x 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 -The @strong{MySQL} client @code{mysql} is now by default started with the -option @code{--no-named-commands (-g)}. This option can be disabled with -@code{--enable-named-commands (-G)}. This may cause incompatibility problems in -some cases, for example in SQL scripts that use named commands without a -semicolon! Long format commands still work from the first line. +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{http://www.mysql.com/Downloads/SCO/FSU-threads-3.5c.tar.gz}. + @item -If you are using the @code{german} character sort order, you must repair -all your tables with @code{isamchk -r}, as we have made some changes in -the sort order! -@item The default return type of @code{IF} will now depend on both arguments -and not only the first argument. -@item @code{AUTO_INCREMENT} will not work with negative numbers. The reason -for this is that negative numbers caused problems when wrapping from -1 to 0. -@code{AUTO_INCREMENT} is now for MyISAM tables handled at a lower level and -is much faster than before. For MyISAM tables old numbers are also not reused -anymore, even if you delete some rows from the table. -@item @code{CASE}, @code{DELAYED}, @code{ELSE}, @code{END}, @code{FULLTEXT}, @code{INNER}, @code{RIGHT}, @code{THEN} and @code{WHEN} are now reserved words. -@item @code{FLOAT(X)} is now a true floating-point type and not a value with -a fixed number of decimals. -@item When declaring @code{DECIMAL(length,dec)} the length argument no -longer includes a place for the sign or the decimal point. -@item A @code{TIME} string must now be of one of the following formats: -@code{[[[DAYS] [H]H:]MM:]SS[.fraction]} or -@code{[[[[[H]H]H]H]MM]SS[.fraction]} -@item @code{LIKE} now compares strings using the same character -comparison rules as @code{'='}. If you require the old behavior, you -can compile @strong{MySQL} with the @code{CXXFLAGS=-DLIKE_CMP_TOUPPER} -flag. -@item @code{REGEXP} is now case insensitive for normal (not binary) strings. -@item When you check/repair tables you should use @code{CHECK TABLE} -or @code{myisamchk} for @code{MyISAM} tables (@code{.MYI}) and -@code{isamchk} for ISAM (@code{.ISM}) tables. -@item If you want your @code{mysqldump} files to be compatible between -@strong{MySQL} Version 3.22 and Version 3.23, you should not use the -@code{--opt} or @code{--full} option to @code{mysqldump}. -@item Check all your calls to @code{DATE_FORMAT()} to make sure there is a -@samp{%} before each format character. (Later @strong{MySQL} Version 3.22 -did allow this syntax.) +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.x There are a lot of problems +without a good port. The port for this product requires the SCO Unix +Development system. Without it, you are missing the libraries and the +linker that is needed. + @item -@code{mysql_fetch_fields_direct} is now a function (it was a macro) and -it returns a pointer to a @code{MYSQL_FIELD} instead of a -@code{MYSQL_FIELD}. +To build FSU Pthreads on your system, do the following: + +@enumerate a @item -@code{mysql_num_fields()} can no longer be used on a @code{MYSQL*} object (it's -now a function that takes @code{MYSQL_RES*} as an argument. You should now -use @code{mysql_field_count()} instead. +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 -In @strong{MySQL} Version 3.22, the output of @code{SELECT DISTINCT ...} was -almost always sorted. In Version 3.23, you must use @code{GROUP BY} or -@code{ORDER BY} to obtain sorted output. +Run @code{make}. + @item -@code{SUM()} now returns @code{NULL}, instead of 0, if there is no matching -rows. This is according to ANSI SQL. -@item An @code{AND} or @code{OR} with @code{NULL} values will now return -@code{NULL} instead of 0. This mostly affects queries that use @code{NOT} -on an @code{AND/OR} expression as @code{NOT NULL} = @code{NULL}. -@code{LPAD()} and @code{RPAD()} will shorten the result string if it's longer -than the length argument. -@end itemize +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 -@cindex compatibility, between MySQL versions -@node Upgrading-from-3.21, Upgrading-from-3.20, Upgrading-from-3.22, Upgrade -@subsection Upgrading from Version 3.21 to Version 3.22 -@cindex upgrading, 3.21 to 3.22 +@item +Remember to use GNU @code{make} when making @strong{MySQL}. -Nothing that affects compatibility has changed between Version 3.21 and 3.22. -The only pitfall is that new tables that are created with @code{DATE} type -columns will use the new way to store the date. You can't access these new -fields from an old version of @code{mysqld}. +@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. -After installing @strong{MySQL} Version 3.22, you should start the new server -and then run the @code{mysql_fix_privilege_tables} script. This will add the -new privileges that you need to use the @code{GRANT} command. If you forget -this, you will get @code{Access denied} when you try to use @code{ALTER -TABLE}, @code{CREATE INDEX}, or @code{DROP INDEX}. If your @strong{MySQL} root -user requires a password, you should give this as an argument to -@code{mysql_fix_privilege_tables}. +@item +With SCO 3.2V5.0.5, you should use FSU Pthreads version 3.5c or newer. +You should also use gcc 2.95.2 or newer! -The C API interface to @code{mysql_real_connect()} has changed. If you have -an old client program that calls this function, you must place a @code{0} for -the new @code{db} argument (or recode the client to send the @code{db} -element for faster connections). You must also call @code{mysql_init()} -before calling @code{mysql_real_connect()}! This change was done to allow -the new @code{mysql_options()} function to save options in the @code{MYSQL} -handler structure. +The following @code{configure} command should work: -The @code{mysqld} variable @code{key_buffer} has changed names to -@code{key_buffer_size}, but you can still use the old name in your -startup files. +@example +shell> ./configure --prefix=/usr/local/mysql --disable-shared +@end example -@node Upgrading-from-3.20, Upgrading-to-arch, Upgrading-from-3.21, Upgrade -@subsection Upgrading from Version 3.20 to Version 3.21 -@cindex upgrading, 3.20 to 3.21 +@item +With SCO 3.2V4.2, you should use FSU Pthreads version 3.5c or newer. +The following @code{configure} command should work: -If you are running a version older than Version 3.20.28 and want to -switch to Version 3.21, you need to do the following: +@example +shell> CFLAGS="-D_XOPEN_XPG4" CXX=gcc CXXFLAGS="-D_XOPEN_XPG4" \ + ./configure \ + --prefix=/usr/local/mysql \ + --with-named-thread-libs="-lgthreads -lsocket -lgen -lgthreads" \ + --with-named-curses-libs="-lcurses" +@end example -You can start the @code{mysqld} Version 3.21 server with @code{safe_mysqld ---old-protocol} to use it with clients from a Version 3.20 distribution. -In this case, the new client function @code{mysql_errno()} will not -return any server error, only @code{CR_UNKNOWN_ERROR} (but it -works for client errors), and the server uses the old @code{password()} -checking rather than the new one. +You may get some problems with some include files. In this case, you can +find new SCO-specific include files at +@uref{http://www.mysql.com/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 -If you are @strong{NOT} using the @code{--old-protocol} option to -@code{mysqld}, you will need to make the following changes: +SCO development notes: @itemize @bullet @item -All client code must be recompiled. If you are using ODBC, you must get -the new @strong{MyODBC} 2.x driver. +@strong{MySQL} should automatically detect FSU Pthreads and link @code{mysqld} +with @code{-lgthreads -lsocket -lgthreads}. + @item -The script @code{scripts/add_long_password} must be run to convert the -@code{Password} field in the @code{mysql.user} table to @code{CHAR(16)}. +The SCO development libraries are re-entrant in FSU Pthreads. SCO claims +that its libraries' functions are re-entrant, so they must be reentrant with +FSU Pthreads. FSU Pthreads on OpenServer tries to use the SCO scheme to +make re-entrant libraries. + @item -All passwords must be reassigned in the @code{mysql.user} table (to get 62-bit -rather than 31-bit passwords). +FSU Pthreads (at least the version at @uref{http://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 -The table format hasn't changed, so you don't have to convert any tables. +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 -@strong{MySQL} Version 3.20.28 and above can handle the new @code{user} table -format without affecting clients. If you have a @strong{MySQL} version earlier -than Version 3.20.28, passwords will no longer work with it if you convert the -@code{user} table. So to be safe, you should first upgrade to at least Version -3.20.28 and then upgrade to Version 3.21. - -@cindex Protocol mismatch -The new client code works with a 3.20.x @code{mysqld} server, so -if you experience problems with 3.21.x, you can use the old 3.20.x server -without having to recompile the clients again. +If you want to install DBI on SCO, you have to edit the @file{Makefile} in +DBI-xxx and each subdirectory. -If you are not using the @code{--old-protocol} option to @code{mysqld}, -old clients will issue the error message: +Note that the following assumes gcc 2.95.2 or newer: @example -ERROR: Protocol mismatch. Server Version = 10 Client Version = 9 -@end example +OLD: NEW: +CC = cc CC = gcc +CCCDLFLAGS = -KPIC -W1,-Bexport CCCDLFLAGS = -fpic +CCDLFLAGS = -wl,-Bexport CCDLFLAGS = -The new Perl @code{DBI}/@code{DBD} interface also supports the old -@code{mysqlperl} interface. The only change you have to make if you use -@code{mysqlperl} is to change the arguments to the @code{connect()} function. -The new arguments are: @code{host}, @code{database}, @code{user}, -@code{password} (the @code{user} and @code{password} arguments have changed -places). -@xref{Perl DBI Class, , Perl @code{DBI} Class}. +LD = ld LD = gcc -G -fpic +LDDLFLAGS = -G -L/usr/local/lib LDDLFLAGS = -L/usr/local/lib +LDFLAGS = -belf -L/usr/local/lib LDFLAGS = -L/usr/local/lib -The following changes may affect queries in old applications: +LD = ld LD = gcc -G -fpic +OPTIMISE = -Od OPTIMISE = -O1 -@itemize @bullet -@item -@code{HAVING} must now be specified before any @code{ORDER BY} clause. -@item -The parameters to @code{LOCATE()} have been swapped. -@item -There are some new reserved words. The most notable are @code{DATE}, -@code{TIME}, and @code{TIMESTAMP}. -@end itemize +OLD: +CCCFLAGS = -belf -dy -w0 -U M_XENIX -DPERL_SCO5 -I/usr/local/include -@cindex upgrading, different architecture -@node Upgrading-to-arch, , Upgrading-from-3.20, Upgrade -@subsection Upgrading to Another Architecture +NEW: +CCFLAGS = -U M_XENIX -DPERL_SCO5 -I/usr/local/include +@end example -If you are using @strong{MySQL} Version 3.23, you can copy the @code{.frm}, -@code{.MYI}, and @code{.MYD} files between different architectures that -support the same floating-point format. (@strong{MySQL} takes care of any -byte swapping issues.) +This is because the Perl dynaloader will not load the @code{DBI} modules +if they were compiled with @code{icc} or @code{cc}. -The @strong{MySQL} @code{ISAM} data and index files (@file{.ISD} and -@file{*.ISM}, respectively) are architecture-dependent and in some cases -OS-dependent. If you want to move your applications to another machine -that has a different architecture or OS than your current machine, you -should not try to move a database by simply copying the files to the -other machine. Use @code{mysqldump} instead. +Perl works best when compiled with @code{cc}. -By default, @code{mysqldump} will create a file full of SQL statements. -You can then transfer the file to the other machine and feed it as input -to the @code{mysql} client. -Try @code{mysqldump --help} to see what options are available. -If you are moving the data to a newer version of @strong{MySQL}, you should use -@code{mysqldump --opt} with the newer version to get a fast, compact dump. +@node SCO Unixware, BeOS, Other Unix Notes, Operating System Specific Notes +@subsection SCO Unixware Version 7.0 Notes -The easiest (although not the fastest) way to move a database between two -machines is to run the following commands on the machine on which the -database is located: +You must use a version of @strong{MySQL} at least as recent as Version 3.22.13 +because that version fixes some portability problems under Unixware. + +We have been able to compile @strong{MySQL} with the following @code{configure} +command on Unixware Version 7.0.1: @example -shell> mysqladmin -h 'other hostname' create db_name -shell> mysqldump --opt db_name \ - | mysql -h 'other hostname' db_name +CC=cc CXX=CC ./configure --prefix=/usr/local/mysql @end example -If you want to copy a database from a remote machine over a slow network, -you can use: +If you want to use @code{gcc}, you must use @code{gcc} 2.95.2 or newer. + + +@menu +* OS/2:: +@end menu + +@node OS/2, , SCO Unixware, SCO Unixware +@subsubsection 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 -shell> mysqladmin create db_name -shell> mysqldump -h 'other hostname' --opt --compress db_name \ - | mysql db_name +SET EMXOPT=-c -n -h1024 @end example -You can also store the result in a file, then transfer the file to the -target machine and load the file into the database there. For example, -you can dump a database to a file on the source machine like this: +If you don't do this, you will probably run into the following error: @example -shell> mysqldump --quick db_name | gzip > db_name.contents.gz +File 'xxxx' not found (Errcode: 24) @end example -(The file created in this example is compressed.) Transfer the file -containing the database contents to the target machine and run these commands -there: +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 filenames 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 run-time library. @example -shell> mysqladmin create db_name -shell> gunzip < db_name.contents.gz | mysql db_name +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 -@cindex @code{mysqldump} -@cindex @code{mysqlimport} -You can also use @code{mysqldump} and @code{mysqlimport} to accomplish -the database transfer. -For big tables, this is much faster than simply using @code{mysqldump}. -In the commands shown below, @code{DUMPDIR} represents the full pathname -of the directory you use to store the output from @code{mysqldump}. - -First, create the directory for the output files and dump the database: +@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 -shell> mkdir DUMPDIR -shell> mysqldump --tab=DUMPDIR db_name +mysql> CREATE FUNCTION metaphon RETURNS STRING SONAME "example.so"; @end example -Then transfer the files in the @code{DUMPDIR} directory to some corresponding -directory on the target machine and load the files into @strong{MySQL} -there: +Is OS/2, the module would be named @file{example.udf}, but you would not +specify the module extension: @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 +mysql> CREATE FUNCTION metaphon RETURNS STRING SONAME "example"; @end example -Also, don't forget to copy the @code{mysql} database, because that's where the -grant tables (@code{user}, @code{db}, @code{host}) are stored. You may have -to run commands as the @strong{MySQL} @code{root} user on the new machine -until you have the @code{mysql} database in place. -After you import the @code{mysql} database on the new machine, execute -@code{mysqladmin flush-privileges} so that the server reloads the grant table -information. +@node BeOS, Novell Netware, SCO Unixware, Operating System Specific Notes +@subsection BeOS Notes + +We are really interested in getting @strong{MySQL} to work on BeOS, but +unfortunately we don't have any person who knows BeOS or has time to do +a port. + +We are interested in finding someone to do a port, and we will help them +with any technical questions they may have while doing the port. + +We have previously talked with some BeOS developers that have said that +@strong{MySQL} is 80% ported to BeOS, but we haven't heard from them +in a while. + + +@node Novell Netware, , BeOS, Operating System Specific Notes +@subsection Novell Netware Notes + +We are really interested in getting @strong{MySQL} to work on Netware, but +unfortunately we don't have any person who knows Netware or has time to do +a port. + +We are interested in finding someone to do a port, and we will help them +with any technical questions they may have while doing the port. + + + @node Privilege system, Reference, Installing, Top @chapter The MySQL Access Privilege System + @cindex system, security @cindex access privileges @cindex privileges, access @@ -50746,7 +50050,7 @@ queries with @code{EXPLAIN}. You should also read the OS-specific section in this manual for problems that may be unique to your environment. -@xref{Source install system issues}. +@xref{Operating System Specific Notes}. @menu * Compiling for debugging:: @@ -52101,7 +51405,7 @@ Public License instead of this License. @page -@node LGPL license, Function Index, GPL license, Top +@node LGPL license, Placeholder, GPL license, Top @appendix GNU LESSER GENERAL PUBLIC LICENSE @cindex LGPL, Lesser General Public License @cindex LGPL, GNU Library General Public License @@ -52667,7 +51971,767 @@ Ty Coon, President of Vice That's all there is to it! -@node Function Index, Concept Index, LGPL license, Top +@node Placeholder, Function Index, LGPL license, Top +@appendix Pieces of the manual in transit + + +@menu +* Installing binary:: +* Building clients:: +* Command-line options:: +* Option files:: +* Installing many servers:: +@end menu + +@node Installing binary, Building clients, Placeholder, Placeholder +@appendixsec Installing a MySQL Binary Distribution + +@cindex installing, binary distribution +@cindex binary distributions, installing + +@menu +* Linux-RPM:: Linux RPM files +* Building clients:: Building client programs +@end menu + +You need the following tools to install a @strong{MySQL} binary distribution: + +@itemize @bullet +@item +GNU @code{gunzip} to uncompress the distribution. + +@item +A reasonable @code{tar} to unpack the distribution. GNU @code{tar} is +known to work. Sun @code{tar} is known to have problems. +@end itemize + +@cindex RPM, defined +@cindex RedHat Package Manager +An alternative installation method under Linux is to use RPM (RedHat Package +Manager) distributions. @xref{Linux-RPM}. + +@c texi2html fails to split chapters if I use strong for all of this. +If you run into problems, @strong{PLEASE ALWAYS USE} @code{mysqlbug} when +posting questions to @email{mysql@@lists.mysql.com}. Even if the problem +isn't a bug, @code{mysqlbug} gathers system information that will help others +solve your problem. By not using @code{mysqlbug}, you lessen the likelihood +of getting a solution to your problem! You will find @code{mysqlbug} in the +@file{bin} directory after you unpack the distribution. @xref{Bug reports}. + +@cindex commands, for binary distribution +The basic commands you must execute to install and use a @strong{MySQL} +binary distribution are: + +@example +shell> groupadd mysql +shell> useradd -g mysql mysql +shell> cd /usr/local +shell> gunzip < /path/to/mysql-VERSION-OS.tar.gz | tar xvf - +shell> ln -s mysql-VERSION-OS mysql +shell> cd mysql +shell> scripts/mysql_install_db +shell> chown -R root /usr/local/mysql +shell> chown -R mysql /usr/local/mysql/data +shell> chgrp -R mysql /usr/local/mysql +shell> chown -R root /usr/local/mysql/bin +shell> bin/safe_mysqld --user=mysql & +@end example + +@cindex adding, new users +@cindex new users, adding +@cindex users, adding + +You can add new users using the @code{bin/mysql_setpermission} script if +you install the @code{DBI} and @code{Msql-Mysql-modules} Perl modules. + +A more detailed description follows. + +To install a binary distribution, follow the steps below, then proceed +to @ref{Post-installation}, for post-installation setup and testing: + +@enumerate +@item +Pick the directory under which you want to unpack the distribution, and move +into it. In the example below, we unpack the distribution under +@file{/usr/local} and create a directory @file{/usr/local/mysql} into which +@strong{MySQL} is installed. (The following instructions therefore assume +you have permission to create files in @file{/usr/local}. If that directory +is protected, you will need to perform the installation as @code{root}.) + +@item +Obtain a distribution file from one of the sites listed in +@ref{Getting MySQL, , Getting @strong{MySQL}}. + +@strong{MySQL} binary distributions are provided as compressed @code{tar} +archives and have names like @file{mysql-VERSION-OS.tar.gz}, where +@code{VERSION} is a number (for example, @code{3.21.15}), and @code{OS} +indicates the type of operating system for which the distribution is intended +(for example, @code{pc-linux-gnu-i586}). + +@item +If you see a binary distribution marked with the @code{-max} prefix, this +means that the binary has support for transaction-safe tables and other +features. @xref{mysqld-max, , @code{mysqld-max}}. Note that all binaries +are built from the same @strong{MySQL} source distribution. + +@item +Add a user and group for @code{mysqld} to run as: + +@example +shell> groupadd mysql +shell> useradd -g mysql mysql +@end example + +These commands add the @code{mysql} group and the @code{mysql} user. The +syntax for @code{useradd} and @code{groupadd} may differ slightly on different +versions of Unix. They may also be called @code{adduser} and @code{addgroup}. +You may wish to call the user and group something else instead of @code{mysql}. + +@item +Change into the intended installation directory: + +@example +shell> cd /usr/local +@end example + +@item +Unpack the distribution and create the installation directory: + +@example +shell> gunzip < /path/to/mysql-VERSION-OS.tar.gz | tar xvf - +shell> ln -s mysql-VERSION-OS mysql +@end example + +The first command creates a directory named @file{mysql-VERSION-OS}. The +second command makes a symbolic link to that directory. This lets you refer +more easily to the installation directory as @file{/usr/local/mysql}. + +@item +Change into the installation directory: + +@example +shell> cd mysql +@end example + +You will find several files and subdirectories in the @code{mysql} directory. +The most important for installation purposes are the @file{bin} and +@file{scripts} subdirectories. + +@table @file +@item bin +@tindex PATH environment variable +@tindex environment variable, PATH +This directory contains client programs and the server +You should add the full pathname of this directory to your +@code{PATH} environment variable so that your shell finds the @strong{MySQL} +programs properly. @xref{Environment variables}. + +@item scripts +This directory contains the @code{mysql_install_db} script used to initialize +the @code{mysql} database containing the grant tables that store the server +access permissions. +@end table + +@item +If you would like to use @code{mysqlaccess} and have the @strong{MySQL} +distribution in some non-standard place, you must change the location where +@code{mysqlaccess} expects to find the @code{mysql} client. Edit the +@file{bin/mysqlaccess} script at approximately line 18. Search for a line +that looks like this: + +@example +$MYSQL = '/usr/local/bin/mysql'; # path to mysql executable +@end example + +Change the path to reflect the location where @code{mysql} actually is +stored on your system. If you do not do this, you will get a @code{Broken +pipe} error when you run @code{mysqlaccess}. + +@item +Create the @strong{MySQL} grant tables (necessary only if you haven't +installed @strong{MySQL} before): +@example +shell> scripts/mysql_install_db +@end example + +Note that @strong{MySQL} versions older than Version 3.22.10 started the +@strong{MySQL} server when you run @code{mysql_install_db}. This is no +longer true! + +@item +Change ownership of binaries to @code{root} and ownership of the data +directory to the user that you will run @code{mysqld} as: + +@example +shell> chown -R root /usr/local/mysql +shell> chown -R mysql /usr/local/mysql/data +shell> chgrp -R mysql /usr/local/mysql +@end example + +The first command changes the @code{owner} attribute of the files to the +@code{root} user, the second one changes the @code{owner} attribute of the +data directory to the @code{mysql} user, and the third one changes the +@code{group} attribute to the @code{mysql} group. + +@item +If you want to install support for the Perl @code{DBI}/@code{DBD} interface, +see @ref{Perl support}. + +@item +If you would like @strong{MySQL} to start automatically when you boot your +machine, you can copy @code{support-files/mysql.server} to the location where +your system has its startup files. More information can be found in the +@code{support-files/mysql.server} script itself and in +@ref{Automatic start}. + +@end enumerate + +After everything has been unpacked and installed, you should initialize +and test your distribution. + +You can start the @strong{MySQL} server with the following command: + +@example +shell> bin/safe_mysqld --user=mysql & +@end example + +@xref{safe_mysqld, , @code{safe_mysqld}}. + +@xref{Post-installation}. + + +@node Building clients, Command-line options, Installing binary, Placeholder +@appendixsec Building Client Programs + +@cindex client programs, building +@cindex linking +@cindex building, client programs +@cindex programs, client + +If you compile @strong{MySQL} clients that you've written yourself or that +you obtain from a third party, they must be linked using the +@code{-lmysqlclient -lz} option on the link command. You may also need to +specify a @code{-L} option to tell the linker where to find the library. For +example, if the library is installed in @file{/usr/local/mysql/lib}, use +@code{-L/usr/local/mysql/lib -lmysqlclient -lz} on the link command. + +For clients that use @strong{MySQL} header files, you may need to specify a +@code{-I} option when you compile them (for example, +@code{-I/usr/local/mysql/include}), so the compiler can find the header +files. + + +@node Command-line options, Option files, Building clients, Placeholder +@appendixsec mysqld Command-line Options + +@findex command-line options +@cindex options, command-line +@cindex mysqld options + +@code{mysqld} accepts the following command-line options: + +@table @code +@item --ansi +Use ANSI SQL syntax instead of MySQL syntax. @xref{ANSI mode}. + +@item -b, --basedir=path +Path to installation directory. All paths are usually resolved relative to +this. + +@item --big-tables +Allow big result sets by saving all temporary sets on file. It solves +most 'table full' errors, but also slows down the queries where +in-memory tables would suffice. Since Version 3.23.2, @strong{MySQL} is +able to solve it automatically by using memory for small temporary +tables and switching to disk tables where necessary. + +@item --bind-address=IP +IP address to bind to. + +@item --character-sets-dir=path +Directory where character sets are. @xref{Character sets}. + +@item --chroot=path +Chroot @code{mysqld} daemon during startup. Recommended security measure. It will +somewhat limit @code{LOAD DATA INFILE} and @code{SELECT ... INTO OUTFILE} +though. + +@item --core-file +Write a core file if @code{mysqld} dies. For some systems you must also +specify @code{--core-file-size} to @code{safe_mysqld}. @xref{safe_mysqld, , +@code{safe_mysqld}}. + +@item -h, --datadir=path +Path to the database root. + +@item --default-character-set=charset +Set the default character set. @xref{Character sets}. + +@item --default-table-type=type +Set the default table type for tables. @xref{Table types}. + +@item --debug[...]= +If @strong{MySQL} is configured with @code{--with-debug}, you can use this +option to get a trace file of what @code{mysqld} is doing. +@xref{Making trace files}. + +@item --delay-key-write-for-all-tables +Don't flush key buffers between writes for any @code{MyISAM} table. +@xref{Server parameters}. + +@item --enable-locking +Enable system locking. Note that if you use this option on a system +which a not fully working lockd() (as on Linux) you will easily get +mysqld to deadlock. + +@item -T, --exit-info +This is a bit mask of different flags one can use for debugging the +mysqld server; One should not use this option if one doesn't know +exactly what it does! + +@item --flush +Flush all changes to disk after each SQL command. Normally @strong{MySQL} +only does a write of all changes to disk after each SQL command and lets +the operating system handle the syncing to disk. +@xref{Crashing}. + +@item -?, --help +Display short help and exit. + +@item --init-file=file +Read SQL commands from this file at startup. + +@item -L, --language=... +Client error messages in given language. May be given as a full path. +@xref{Languages}. + +@item -l, --log[=file] +Log connections and queries to file. @xref{Query log}. + +@item --log-isam[=file] +Log all ISAM/MyISAM changes to file (only used when debugging ISAM/MyISAM). + +@item --log-slow-queries[=file] +Log all queries that have taken more than @code{long_query_time} seconds to +execute to file. @xref{Slow query log}. + +@item --log-update[=file] +Log updates to @code{file.#} where @code{#} is a unique number if not given. +@xref{Update log}. + +@item --log-long-format +Log some extra information to update log. If you are using +@code{--log-slow-queries} then queries that are not using indexes are logged +to the slow query log. + +@item --low-priority-updates +Table-modifying operations (@code{INSERT}/@code{DELETE}/@code{UPDATE}) +will have lower priority than selects. It can also be done via +@code{@{INSERT | REPLACE | UPDATE | DELETE@} LOW_PRIORITY ...} to lower +the priority of only one query, or by +@code{SET OPTION SQL_LOW_PRIORITY_UPDATES=1} to change the priority in one +thread. @xref{Table locking}. + +@item --memlock +Lock the @code{mysqld} process in memory. This works only if your +system supports the @code{mlockall()} system call (like Solaris). This +may help if you have a problem where the operating system is causing +@code{mysqld} to swap on disk. + +@item --myisam-recover [=option[,option...]]] where option is one of DEFAULT, BACKUP, FORCE or QUICK. +If this option is used, @code{mysqld} will on open check if the table is +marked as crashed or if if the table wasn't closed properly. (The last +option only works if you are running with @code{--skip-locking}). If this +is the case @code{mysqld} will run check on the table. If the table was corrupted, +@code{mysqld} will attempt to repair it. + +The following options affects how the repair works. + +@multitable @columnfractions .3 .7 +@item DEFAULT @tab The same as not giving any option to + @code{--myisam-recover}. +@item BACKUP @tab If the data table was changed during recover, save a + backup of the @file{table_name.MYD} data file as + @file{table_name-datetime.BAK}. +@item FORCE @tab Run recover even if we will loose more than one row + from the .MYD file. +@item QUICK @tab Don't check the rows in the table if there isn't any + delete blocks. +@end multitable + +Before a table is automatically repaired, @strong{MySQL} will add a note +about this in the error log. If you want to be able to recover from most +things without user intervention, you should use the options +@code{BACKUP,FORCE}. This will force a repair of a table even if some rows +would be deleted, but it will keep the old data file as a backup so that +you can later examine what happened. + +@item --pid-file=path +Path to pid file used by @code{safe_mysqld}. + +@item -P, --port=... +Port number to listen for TCP/IP connections. + +@item -o, --old-protocol +Use the 3.20 protocol for compatibility with some very old clients. +@xref{Upgrading-from-3.20}. + +@item --one-thread +Only use one thread (for debugging under Linux). @xref{Debugging server}. + +@item -O, --set-variable var=option +Give a variable a value. @code{--help} lists variables. You can find a full +description for all variables in the @code{SHOW VARIABLES} section in this +manual. @xref{SHOW VARIABLES}. The tuning server parameters section includes +information of how to optimize these. @xref{Server parameters}. + +@item --safe-mode +Skip some optimize stages. Implies @code{--skip-delay-key-write}. + +@item --safe-show-database +Don't show databases for which the user doesn't have any privileges. + +@item --secure +IP numbers returned by the @code{gethostbyname()} system call are +checked to make sure they resolve back to the original hostname. This +makes it harder for someone on the outside to get access by pretending +to be another host. This option also adds some sanity checks of +hostnames. The option is turned off by default in @strong{MySQL} Version 3.21 +because sometimes it takes a long time to perform backward resolutions. +@strong{MySQL} Version 3.22 caches hostnames (unless @code{--skip-host-cache} +is used) and has this option enabled by default. + +@item --skip-concurrent-insert +Turn off the ability to select and insert at the same time on @code{MyISAM} +tables. (This is only to be used if you think you have found a bug in this +feature). + +@item --skip-delay-key-write +Ignore the @code{delay_key_write} option for all tables. +@xref{Server parameters}. + +@item --skip-grant-tables +This option causes the server not to use the privilege system at all. This +gives everyone @emph{full access} to all databases! (You can tell a running +server to start using the grant tables again by executing @code{mysqladmin +flush-privileges} or @code{mysqladmin reload}.) + +@item --skip-host-cache +Never use host name cache for faster name-ip resolution, but query DNS server +on every connect instead. @xref{DNS}. + +@item --skip-locking +Don't use system locking. To use @code{isamchk} or @code{myisamchk} you must +shut down the server. @xref{Stability}. Note that in @strong{MySQL} Version +3.23 you can use @code{REPAIR} and @code{CHECK} to repair/check @code{MyISAM} +tables. + +@item --skip-name-resolve +Hostnames are not resolved. All @code{Host} column values in the grant tables +must be IP numbers or @code{localhost}. @xref{DNS}. + +@item --skip-networking +Don't listen for TCP/IP connections at all. All interaction with +@code{mysqld} must be made via Unix sockets. This option is highly +recommended for systems where only local requests are allowed. @xref{DNS}. + +@item --skip-new +Don't use new, possible wrong routines. Implies @code{--skip-delay-key-write}. +This will also set default table type to @code{ISAM}. @xref{ISAM}. + +@item --skip-symlink +Don't delete or rename files that a symlinked file in the data directory +points to. + +@item --skip-safemalloc +If @strong{MySQL} is configured with @code{--with-debug=full}, all programs +will check the memory for overruns for every memory allocation and memory +freeing. As this checking is very slow, you can avoid this, when you don't +need memory checking, by using this option. + +@item --skip-show-database +Don't allow 'SHOW DATABASE' commands, unless the user has @strong{process} +privilege. + +@item --skip-stack-trace +Don't write stack traces. This option is useful when you are running +@code{mysqld} under a debugger. @xref{Debugging server}. + +@item --skip-thread-priority +Disable using thread priorities for faster response time. + +@item --socket=path +Socket file to use for local connections instead of default +@code{/tmp/mysql.sock}. + +@item transaction-isolation= @{ READ-UNCOMMITTED | READ-COMMITTED | REPEATABLE-READ | SERIALIZABLE @} +Sets the default transaction isolation level. @xref{SET TRANSACTION}. + +@item -t, --tmpdir=path +Path for temporary files. It may be useful if your default @code{/tmp} +directory resides on a partition too small to hold temporary tables. + +@item -u, --user=user_name +Run @code{mysqld} daemon as user @code{user_name}. This option is +@emph{mandatory} when starting @code{mysqld} as root. + +@item -V, --version +Output version information and exit. + +@item -W, --warnings +Print out warnings like @code{Aborted connection...} to the @code{.err} file. +@xref{Communication errors}. +@end table + +@node Option files, Installing many servers, Command-line options, Placeholder +@appendixsec Option Files + +@cindex default options +@cindex option files +@cindex creating, default startup options +@cindex startup options, default + +@strong{MySQL} can, since Version 3.22, read default startup options for the +server and for clients from option files. + +@strong{MySQL} reads default options from the following files on Unix: + +@tindex .my.cnf file +@multitable @columnfractions .3 .7 +@item @strong{Filename} @tab @strong{Purpose} +@item @code{/etc/my.cnf} @tab Global options +@item @code{DATADIR/my.cnf} @tab Server-specific options +@item @code{defaults-extra-file} @tab The file specified with --defaults-extra-file=# +@item @code{~/.my.cnf} @tab User-specific options +@end multitable + +@code{DATADIR} is the @strong{MySQL} data directory (typically +@file{/usr/local/mysql/data} for a binary installation or +@file{/usr/local/var} for a source installation). Note that this is the +directory that was specified at configuration time, not the one specified +with @code{--datadir} when @code{mysqld} starts up! (@code{--datadir} has no +effect on where the server looks for option files, because it looks for them +before it processes any command-line arguments.) + +@strong{MySQL} reads default options from the following files on Windows: + +@multitable @columnfractions .3 .7 +@item @strong{Filename} @tab @strong{Purpose} +@item @code{windows-system-directory\my.ini} @tab Global options +@item @code{C:\my.cnf} @tab Global options +@item @code{C:\mysql\data\my.cnf} @tab Server-specific options +@end multitable + +Note that on Windows, you should specify all paths with @code{/} instead of +@code{\}. If you use @code{\}, you need to specify this twice, as +@code{\} is the escape character in @strong{MySQL}. + +@cindex Environment variables +@strong{MySQL} tries to read option files in the order listed above. If +multiple option files exist, an option specified in a file read later takes +precedence over the same option specified in a file read earlier. Options +specified on the command line take precedence over options specified in any +option file. Some options can be specified using environment variables. +Options specified on the command line or in option files take precedence over +environment variable values. @xref{Environment variables}. + +The following programs support option files: @code{mysql}, +@code{mysqladmin}, @code{mysqld}, @code{mysqldump}, @code{mysqlimport}, +@code{mysql.server}, @code{myisamchk}, and @code{myisampack}. + +You can use option files to specify any long option that a program supports! +Run the program with @code{--help} to get a list of available options. + +An option file can contain lines of the following forms: + +@table @code +@item #comment +Comment lines start with @samp{#} or @samp{;}. Empty lines are ignored. + +@item [group] +@code{group} is the name of the program or group for which you want to set +options. After a group line, any @code{option} or @code{set-variable} lines +apply to the named group until the end of the option file or another group +line is given. + +@item option +This is equivalent to @code{--option} on the command line. + +@item option=value +This is equivalent to @code{--option=value} on the command line. + +@item set-variable = variable=value +This is equivalent to @code{--set-variable variable=value} on the command line. +This syntax must be used to set a @code{mysqld} variable. +@end table + +The @code{client} group allows you to specify options that apply to all +@strong{MySQL} clients (not @code{mysqld}). This is the perfect group to use +to specify the password you use to connect to the server. (But make +sure the option file is readable and writable only by yourself.) + +Note that for options and values, all leading and trailing blanks are +automatically deleted. You may use the escape sequences @samp{\b}, +@samp{\t}, @samp{\n}, @samp{\r}, @samp{\\}, and @samp{\s} in your value string +(@samp{\s} == blank). + +Here is a typical global option file: + +@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 + +Here is typical user option file: + +@example +[client] +# The following password will be sent to all standard MySQL clients +password=my_password + +[mysql] +no-auto-rehash +set-variable = connect_timeout=2 + +[mysqlhotcopy] +interactive-timeout + +@end example + +@tindex .my.cnf file +If you have a source distribution, you will find sample configuration +files named @file{my-xxxx.cnf} in the @file{support-files} directory. +If you have a binary distribution, look in the @file{DIR/support-files} +directory, where @code{DIR} is the pathname to the @strong{MySQL} +installation directory (typically @file{/usr/local/mysql}). Currently +there are sample configuration files for small, medium, large, and very +large systems. You can copy @file{my-xxxx.cnf} to your home directory +(rename the copy to @file{.my.cnf}) to experiment with this. + +All @strong{MySQL} clients that support option files support the +following options: + +@multitable @columnfractions .40 .60 +@item --no-defaults @tab Don't read any option files. +@item --print-defaults @tab Print the program name and all options that it will get. +@item --defaults-file=full-path-to-default-file @tab Only use the given configuration file. +@item --defaults-extra-file=full-path-to-default-file @tab Read this configuration file after the global configuration file but before the user configuration file. +@end multitable + +Note that the above options must be first on the command line to work! +@code{--print-defaults} may however be used directly after the +@code{--defaults-xxx-file} commands. + +Note for developers: Option file handling is implemented simply by +processing all matching options (that is, options in the appropriate group) +before any command-line arguments. This works nicely for programs that use +the last instance of an option that is specified multiple times. If you have +an old program that handles multiply-specified options this way but doesn't +read option files, you need add only two lines to give it that capability. +Check the source code of any of the standard @strong{MySQL} clients to see +how to do this. + +In shell scripts you can use the @file{my_print_defaults} command to parse the +config files: + +@example + +shell> my_print_defaults client mysql +--port=3306 +--socket=/tmp/mysql.sock +--no-auto-rehash +@end example + +The above output contains all options for the groups 'client' and 'mysql'. + + +@node Installing many servers, , Option files, Placeholder +@appendixsec Installing Many Servers on the Same Machine + +@cindex post-install, many servers +@cindex Installing many servers +@cindex Starting many servers + +In some cases you may want to have many different @code{mysqld} daemons +(servers) running on the same machine. You may for example want to run +a new version of @strong{MySQL} for testing together with an old version +that is in production. Another case is when you want to give different +users access to different @code{mysqld} servers that they manage themselves. + +One way to get a new server running is by starting it with a different +socket and port as follows: + +@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 appendix includes a list of other environment +variables you can use to affect @code{mysqld}. @xref{Environment variables}. + +The above is the quick and dirty way that one commonly uses for testing. +The nice thing with this is that all connections you do in the above shell +will automatically be directed to the new running server! + +If you need to do this more permanently, you should create an option +file for each server. @xref{Option files}. In your startup script that +is executed at boot time (mysql.server?) you should specify for both +servers: + +@code{safe_mysqld --default-file=path-to-option-file} + +At least the following options should be different per server: + +@table @code +@item port=# +@item socket=path +@item pid-file=path +@end table + +The following options should be different, if they are used: + +@table @code +@item log=path +@item log-bin=path +@item log-update=path +@item log-isam=path +@item bdb-logdir=path +@end table + +If you want more performance, you can also specify the following differently: + +@table @code +@item tmpdir=path +@item bdb-tmpdir=path +@end table + +@xref{Command-line options}. + +If you are installing binary @strong{MySQL} versions (.tar files) and +start them with @code{./bin/safe_mysqld} then in most cases the only +option you need to add/change is the @code{socket} and @code{port} +argument to @code{safe_mysqld}. + + + +@node Function Index, Concept Index, Placeholder, Top @unnumbered SQL command, type and function index @printindex fn |