Документ взят из кэша поисковой машины. Адрес оригинального документа : http://old.hcs.cmc.msu.ru/mysql/manual.html
Дата изменения: Wed Oct 6 02:09:11 1999
Дата индексирования: Mon Oct 1 20:09:59 2012
Кодировка:
MySQL Reference Manual for version 3.22.27.

MySQL Reference Manual for version 3.22.27.


1 General Information about MySQL

This is the MySQL reference manual; it documents MySQL version 3.22.27.

MySQL is a very fast, multi-threaded, multi-user and robust SQL (Structured Query Language) database server.

For Unix and OS/2 platforms, MySQL is basically free; for Microsoft platforms you must get a MySQL license after a trial time of 30 days. See section 3 MySQL licensing and support.

The MySQL home page provides the latest information about MySQL.

For a discussion of MySQL's capabilities, see section 1.4 The main features of MySQL.

For installation instructions, see section 4 Installing MySQL. For tips on porting MySQL to new machines or operating systems, see section G Comments on porting to other systems.

For information about upgrading from a 3.21 release, see section 4.16.2 Upgrading from a 3.21 version to 3.22.

For a tutorial introduction to MySQL, see section 8 MySQL Tutorial.

For examples of SQL and benchmarking information, see the benchmarking directory. For source distributions, this is the `bench' directory. For binary distributions, this is the `sql-bench' directory.

For a history of new features and bug fixes, see section D MySQL change history.

For a list of currently known bugs and misfeatures, see section E Known errors and design deficiencies in MySQL.

For future plans, see section F List of things we want to add to MySQL in the future (The TODO).

For a list of all the contributors to this product, see section C Contributors to MySQL.

IMPORTANT:

Send bug (error) reports, questions and comments to the mailing list at

For source distributions, the mysqlbug script can be found in the `scripts' directory. For binary distributions, mysqlbug can be found in the `bin' directory.

If you have any suggestions concerning additions or corrections to this manual, please send them to the MySQL mailing list (mysql@lists.mysql.com) with the following subject line: documentation suggestion: [Insert Topic Here]. See section 2.1 The MySQL mailing lists.

1.1 What is MySQL?

MySQL is a true multi-user, multi-threaded SQL database server. SQL is the most popular database language in the world. MySQL is a client/server implementation that consists of a server daemon mysqld and many different client programs and libraries.

SQL is a standardized language that makes it easy to store, update and access information. For example, you can use SQL to retrieve product information and store customer information for a web site. MySQL is also fast and flexible enough to allow you to store logs and pictures in it.

The main goals of MySQL are speed, robustness and ease of use. MySQL was originally developed because we at TcX needed a SQL server that could handle very large databases an order of magnitude faster than what any database vendor could offer to us. We have now been using MySQL since 1996 in an environment with more than 40 databases containing 10,000 tables, of which more than 500 have more than 7 million rows. This is about 100 gigabytes of mission-critical data.

The base upon which MySQL is built is a set of routines that have been used in a highly demanding production environment for many years. Although MySQL is still under development, it already offers a rich and highly useful function set.

The official way to pronounce MySQL is "My Ess Que Ell" (Not MY-SEQUEL).

1.2 About this manual

This manual is currently available in Texinfo, plain text, Info, HTML, PostScript and PDF versions. Because of their size, PostScript and PDF versions are not included with the main MySQL distribution, but are available for separate download at http://www.mysql.com.

The primary document is the Texinfo file. The HTML version is produced automatically with a modified version of texi2html. The plain text and Info versions are produced with makeinfo. The Postscript version is produced using texi2dvi and dvips. The PDF version is produced with the Ghostscript utility ps2pdf.

This manual is written and maintained by David Axmark, Michael (Monty) Widenius, Paul DuBois and Kim Aldale. For other contributors, see section C Contributors to MySQL.

1.2.1 Conventions used in this manual

This manual uses certain typographical conventions:

constant
Constant-width font is used for command names and options; SQL statements; database, table and column names; C and Perl code; and environment variables. Example: "To see how mysqladmin works, invoke it with the --help option."
`filename'
Constant-width font with surrounding quotes is used for filenames and pathnames. Example: "The distribution is installed under the `/usr/local/' directory."
`c'
Constant-width font with surrounding quotes is also used to indicate character sequences. Example: "To specify a wildcard, use the `%' character."
italic
Italic font is used for emphasis, like this.
boldface
Boldface font is used for access privilege names (e.g., "do not grant the process privilege lightly") and to convey especially strong emphasis.

When commands are shown that are meant to be executed by a particular program, the program is indicated by the prompt shown with the command. For example, shell> indicates a command that you execute from your login shell, and mysql> indicates a command that you execute from the mysql client:

shell> type a shell command here
mysql> type a mysql command here

Shell commands are shown using Bourne shell syntax. If you are using a csh-style shell, you may need to issue commands slightly differently. For example, the sequence to set an environment variable and run a command looks like this in Bourne shell syntax:

shell> VARNAME=value some_command

For csh, you would execute the sequence like this:

shell> setenv VARNAME value
shell> some_command

Database, table and column names often must be substituted into commands. To indicate that such substitution is necessary, this manual uses db_name, tbl_name and col_name. For example, you might see a statement like this:

mysql> SELECT col_name FROM db_name.tbl_name;

This means that if you were to enter a similar statement, you would supply your own database, table and column names, perhaps like this:

mysql> SELECT author_name FROM biblio_db.author_list;

SQL statements may be written in uppercase or lowercase. When this manual shows a SQL statement, uppercase is used for particular keywords if those keywords are under discussion (to emphasize them) and lowercase is used for the rest of the statement. So you might see the following in a discussion of the SELECT statement:

mysql> SELECT count(*) FROM tbl_name;

On the other hand, in a discussion of the COUNT() function, the statement would be written like this:

mysql> select COUNT(*) from tbl_name;

If no particular emphasis is intended, all keywords are written uniformly in uppercase.

In syntax descriptions, square brackets (`[' and `]') are used to indicate optional words or clauses:

DROP TABLE [IF EXISTS] tbl_name

When a syntax element consists of a number of alternatives, the alternatives are separated by vertical bars (`|'). When one member from a set of choices may be chosen, the alternatives are listed within square brackets. When one member from a set of choices must be chosen, the alternatives are listed within braces (`{' and `}'):

TRIM([[BOTH | LEADING | TRAILING] [remstr] FROM] str)
{DESCRIBE | DESC} tbl_name {col_name | wild}

1.3 History of MySQL

We once started off with the intention of using mSQL to connect to our tables using our own fast low-level (ISAM) routines. However, after some testing we came to the conclusion that mSQL was not fast enough or flexible enough for our needs. This resulted in a new SQL interface to our database but with almost the same API interface as mSQL. This API was chosen to ease porting of third-party code.

The derivation of the name MySQL is not perfectly clear. Our base directory and a large number of our libraries and tools have had the prefix "my" for well over 10 years. However, Monty's daughter (some years younger) is also named My. So which of the two gave its name to MySQL is still a mystery, even for us.

1.4 The main features of MySQL

The following list describes some of the important characteristics of MySQL:

1.5 How stable is MySQL?

This section addresses the questions, "how stable is MySQL?" and, "can I depend on MySQL in this project?" Here we will try to clarify some issues and to answer some of the more important questions that seem to concern many people. This section has been put together from information gathered from the mailing list (which is very active in reporting bugs).

At TcX, MySQL has worked without any problems in our projects since mid-1996. When MySQL was released to a wider public, we noticed that there were some pieces of "untested code" that were quickly found by the new users who made queries in a manner different than our own. Each new release has had fewer portability problems than the previous one (even though each has had many new features), and we hope that it will be possible to label one of the next releases "stable".

Each release of MySQL has been usable and there have been problems only when users start to use code from "the gray zones". Naturally, outside users can't know what the gray zones are; this section attempts to indicate those that are currently known. The descriptions deal with the 3.22.x version of MySQL. All known and reported bugs are fixed in the latest version, with the exception of the bugs listed in the bugs section, which are things that are "design"-related. See section E Known errors and design deficiencies in MySQL.

MySQL is written in multiple layers and different independent modules. These modules are listed below with an indication of how well-tested each of them is:

The ISAM table handler -- Stable
This manages storage and retrieval of all data in MySQL 3.22 and earlier versions. In all MySQL releases there hasn't been a single (reported) bug in this code. The only known way to get a corrupted table is to kill the server in the middle of an update. Even that is unlikely to destroy any data beyond rescue, because all data are flushed to disk between each query. There hasn't been a single bug report about lost data because of bugs in MySQL, either.
The MyISAM table handler -- Beta
This is new in MySQL 3.23. It's largely based on the ISAM table code but has a lot of new very useful features.
The parser and lexical analyser -- Stable
There hasn't been a single reported bug in this system for a long time.
The C client code -- Stable
No known problems. In early 3.20 releases, there were some limitations in the send/receive buffer size. As of 3.21.x, the buffer size is now dynamic up to a default of 24M.
Standard client programs -- Stable
These include mysql, mysqladmin and mysqlshow, mysqldump, and mysqlimport.
Basic SQL -- Stable
The basic SQL function system and string classes and dynamic memory handling. Not a single reported bug in this system.
Query optimizer -- Stable
Range optimizer -- Gamma
Join optimizer -- Stable
Locking -- Gamma
This is very system-dependent. On some systems there are big problems using standard OS locking (fcntl()). In these cases, you should run the MySQL daemon with the --skip-locking flag. Problems are known to occur on some Linux systems and on SunOS when using NFS-mounted file systems.
Linux threads -- Gamma
The only problem found has been with the fcntl() call, which is fixed by using the --skip-locking option to mysqld. Some people have reported lockup problems with the 0.5 release.
Solaris 2.5+ pthreads -- Stable
We use this for all our production work.
MIT-pthreads (Other systems) -- Gamma
There have been no reported bugs since 3.20.15 and no known bugs since 3.20.16. On some systems, there is a "misfeature" where some operations are quite slow (a 1/20 second sleep is done between each query). Of course, MIT-pthreads may slow down everything a bit, but index-based SELECT statements are usually done in one time frame so there shouldn't be a mutex locking/thread juggling.
Other thread implementions -- Alpha - Beta
The ports to other systems are still very new and may have bugs, possibly in MySQL, but most often in the thread implementation itself.
LOAD DATA ..., INSERT ... SELECT -- Stable
Some people have thought they have found bugs here, but these usually have turned out to be misunderstandings. Please check the manual before reporting problems!
ALTER TABLE -- Stable
Small changes in 3.22.12.
DBD -- Stable
Now maintained by Jochen Wiedmann
mysqlaccess -- Stable
Written and maintained by Yves Carlier
GRANT -- Gamma
Big changes made in MySQL 3.22.12.
MyODBC (uses ODBC SDK 2.5) -- Beta
It seems to work well with some programs.

TcX provides email support for paying customers, but the MySQL mailing list usually provides answers to common questions. Bugs are usually fixed right away with a patch; for serious bugs, there is almost always a new release.

1.6 Year 2000 compliance

MySQL itself has no problems with Year 2000 (Y2K) compliance:

You may run into problems with applications that use MySQL in a way that is not Y2K-safe. For example, many old applications store or manipulate years using 2-digit values (which are ambiguous) rather than 4-digit values. This problem may be compounded by applications that use values such as 00 or 99 as "missing" value indicators.

Unfortunately, these problems may be difficult to fix, since different applications may be written by different programmers, each of whom may use a different set of conventions and date-handling functions.

Here is a simple demonstration illustrating that MySQL doesn't have any problems with dates until the year 2030!

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

13 rows in set (0.00 sec)

This shows that the DATE and DATETIME types are will not give any problems with future dates (they handle dates until the year 9999).

The TIMESTAMP type, that is used to store the current time, has a range up to only 2030-01-01. TIMESTAMP has a range of 1970 to 2030 on 32-bit machines (signed value). On 64-bit machines it handles times up to 2106 (unsigned value).

Even though MySQL is Y2K-compliant, it is your responsibility to provide unambiguous input. See section 7.2.6.1 Y2K issues and date types for MySQL's rules for dealing with ambiguous date input data (data containing 2-digit year values).

1.7 General SQL information and tutorials

This book has been recommended by a several people on the MySQL mailing list:

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

This book has also received some recommendations on the mailing list:

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

A SQL tutorial is available on the net at http://www.geocities.com/SiliconValley/Vista/2207/sql1.html

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

1.8 Useful MySQL-related links

1.8.1 Commercial applications that support MySQL

1.8.2 SQL Clients

1.8.3 Web development tools that support MySQL

1.8.4 Databse design tools with MySQL support

1.8.5 Web servers with MySQL tools

1.8.6 Extensions for other programs

1.8.7 ODBC related links

1.8.8 API related links

1.8.9 Other MySQL-related links

1.8.10 SQL and database interfaces

1.8.11 Examples of MySQL use

1.8.12 General database links

There are also many web pages that use MySQL. See section A Some MySQL users. Send any additions to this list to MySQL logo somewhere (It is okay to have it on a "used tools" page or something similar) to be added.

2 MySQL mailing lists and how to ask questions or report errors (bugs)

2.1 The MySQL mailing lists

To subscribe to the main MySQL mailing list, send a message to the electronic mail address mysql-subscribe@lists.mysql.com.

To unsubscribe from the main MySQL mailing list, send a message to the electronic mail address mysql-unsubscribe@lists.mysql.com.

Only the address to which you send your messages is significant. The subject line and the body of the message are ignored.

If your reply address is not valid, you can specify your address explicitly. Adding a hyphen to the subscribe or unsubscribe command word, followed by your address with the `@' character in your address replaced by a `='. For example, to subscribe john@host.domain, send a message to mysql-subscribe-john=host.domain@lists.mysql.com.

Mail to mysql-subscribe@lists.mysql.com or ezmlm mailing list processor. Information about ezmlm is available at the ezmlm Website.

To post a message to the list itself, send your message to mysql@lists.mysql.com. However, please do not send mail about subscribing or unsubscribing to mysql@lists.mysql.com, since any mail sent to that address is distributed automatically to thousands of other users.

Your local site may have many subscribers to mysql@lists.mysql.com. If so, it may have a local mailing list, so that messages sent from lists.mysql.com to your site are propagated to the local list. In such cases, please contact your system administrator to be added to or dropped from the local MySQL list.

The following MySQL mailing lists exist:

announce
This is for announcement of new versions of MySQL and related programs. This is a low volume list that we think all MySQL users should be on.
mysql
The main list for general MySQL discussion. Please note that some topics are better discussed on the more-specialized lists. If you post to the wrong list, you may not get an answer!
mysql-digest
The mysql list in digest form. That means you get all individual messages, sent as one large mail message once a day.
java
Discussion about MySQL and Java. Mostly about the JDBC drivers.
java-digest
A digest version of the java list.
win32
All things concerning MySQL on Microsoft operating systems such as Windows NT.
win32-digest
A digest version of the win32 list.
myodbc
All things concerning connecting to MySQL with ODBC.
myodbc-digest
A digest version of the myodbc list.
msql-mysql-modules
A list about the Perl support in MySQL.
msql-mysql-modules-digest
A digest version of the msql-mysql-modules list.
developer
A list for people who work on the MySQL code.
developer-digest
A digest version of the developer list.

You subscribe or unsubscribe to all lists in the same way as described above. In your subscribe or unsubscribe message, just put the appropriate mailing list name rather than mysql. For example, to subscribe to or unsubscribe from the myodbc list, send a message to

2.2 Asking questions or reporting bugs

Before posting a bug report or question, please do the following:

If you can't find an answer in the manual or the archives, check with your local MySQL expert. If you still can't find an answer to your question, go ahead and read the next section about how to send mail to

2.3 How to report bugs or problems

Writing a good bug report takes patience, but doing it right the first time saves time for us and for you. This section will help you write your report correctly so that you don't waste your time doing things that may not help us much or at all.

We encourage everyone to use the mysqlbug script to generate a bug report (or a report about any problem), if possible. mysqlbug can be found in the `scripts' directory in the source distribution, or, for a binary distribution, in the `bin' directory under your MySQL installation directory. If you are unable to use mysqlbug, you should still include all the necessary information listed in this section.

The mysqlbug script helps you generate a report by determining much of the following information automatically, but if something important is missing, please include it with your message! Please read this section carefully and make sure that all the information described here is included in your report.

Remember that it is possible to respond to a message containing too much information, but not to one containing too little. Often people omit facts because they think they know the cause of a problem and assume that some details don't matter. A good principle is: if you are in doubt about stating something, state it! It is a thousand times faster and less troublesome to write a couple of lines more in your report than to be forced to ask again and wait for the answer because you didn't include enough information the first time.

The most common errors are that people don't indicate the version number of the MySQL distribution they are using, or don't indicate what platform they have MySQL installed on (including the platform version number). This is highly relevant information and in 99 cases out of 100 the bug report is useless without it! Very often we get questions like "Why doesn't this work for me?" and then we find that the feature requested wasn't implemented in that MySQL version, or that a bug described in a report has been fixed already in newer MySQL versions. Sometimes the error is platform dependent; in such cases, it is next to impossible to fix anything without knowing the operating system and the version number of the platform.

Remember also to provide information about your compiler, if it is related to the problem. Often people find bugs in compilers and think the problem is MySQL related. Most compilers are under development all the time and become better version by version, too. To determine whether or not your problem depends on your compiler, we need to know what compiler is used. Note that every compiling problem should be regarded as a bug report and reported accordingly.

It is most helpful when a good description of the problem is included in the bug report. That is, a good example of all the things you did that led to the problem and the problem itself exactly described. The best reports are those that include a full example showing how to reproduce the bug or problem.

If a program produces an error message, it is very important to include the message in your report! If we try to search for something from the archives using programs, it is better that the error message reported exactly matches the one that the program produces. (Even the case sensitivity should be observed!) You should never try to remember what the error message was; instead, copy and paste the entire message into your report!

Please include the following information in your report:

If you are a support customer, please cross-post the bug report to the appropriate mailing list to see if someone else has experienced (and perhaps solved) the problem.

For information on reporting bugs in MyODBC, see section 16.2 How to report problems with MyODBC.

For solutions to some common problems, see See section 18 Problems and common errors.

When answers are sent to you individually and not to the mailing list, it is considered good etiquette to summarize the answers and send the summary to the mailing list so that others may have the benefit of responses you received that helped you solve your problem!

2.4 Guidelines for answering questions on the mailing list

If you consider your answer to have broad interest, you may want to post it to the mailing list instead of replying directly to the individual who asked. Try to make your answer general enough that people other than the original poster may benefit from it. When you post to the list, please make sure that your answer is not a duplication of a previous answer.

Try to summarize the essential part of the question in your reply; don't feel obliged to quote the entire original message.

Please don't post mail messages from your browser with HTML mode turned on! Many users doesn't read mail with a browser!

3 MySQL licensing and support

This chapter describes MySQL licensing and support arrangements, including:

3.1 MySQL licensing policy

The formal terms of the license for non-Microsoft operating systems such as Unix or OS/2 are specified in section J The MySQL server license for non Microsoft operating systems. Basically, our licensing policy is as follows:

For use under Microsoft operating systems (Win95/Win98/WinNT), you need a MySQL license after a trial period of 30 days, with the exception that licenses may be obtained upon request at no cost for educational use or for university- or government-sponsored research settings. See section K The MySQL license for Microsoft operating systems. A shareware version of MySQL-Win32 that you can try before buying is available at http://www.mysql.com/mysql_w32.htmy. After you have paid, you will get a password that will enable you to access the newest MySQL-Win32 version.

If you have any questions as to whether or not a license is required for your particular use of MySQL, please contact us. See section 3.5.2 Contact information.

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

3.2 Copyrights used by MySQL

There are several different copyrights on the MySQL distribution:

  1. The MySQL-specific source needed to build the mysqlclient library and programs in the `client' directory is in the public domain. Each file that is in the public domain has a header which clearly states so. This includes everything in the `client' directory and some parts of the mysys, mystring and dbug libraries.
  2. Some small parts of the source (GNU getopt) are covered by the "GNU LIBRARY LIBRARY GENERAL PUBLIC LICENSE". See the `mysys/COPYING.LIB' file.
  3. Some small parts of the source (GNU readline) are covered by the "GNU GENERAL PUBLIC LICENSE". See the `readline/COPYING' file.
  4. Some parts of the source (the regexp library) are covered by a Berkeley style copyright.
  5. The other source needed for the MySQL server on non-Microsoft platforms is covered by the "MySQL FREE PUBLIC LICENSE", which is based on the "Aladdin FREE PUBLIC LICENSE." See section J The MySQL server license for non Microsoft operating systems. When running MySQL on any Microsoft operating system, other licensing applies.

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

3.2.1 Possible future copyright changes

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

3.3 Distributing MySQL commercially

This section is a clarification of the license terms that are set forth in the "MySQL FREE PUBLIC LICENSE" (FPL). See section J The MySQL server license for non Microsoft operating systems.

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

You may not include MySQL "free" in a package containing anything for which a charge is being made, except as noted below.

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

  1. The organization complies with the other provisions of the FPL, which include among other things a requirement to distribute the full source code of MySQL and of any derived work, and to distribute the FPL itself along with MySQL;
  2. The only charge for downloading MySQL is a charge based on the distribution service and not one based on the content of the information being retrieved (i.e., the charge would be the same for retrieving a random collection of bits of the same size);
  3. The server or BBS is accessible to the general public, i.e., the phone number or IP address is not kept secret, and anyone may obtain access to the information (possibly by paying a subscription or access fee that is not dependent on or related to purchasing anything else).

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

3.4 Example licensing situations

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

Note that a single MySQL license covers any number of CPUs/users/customers/mysqld servers on a machine!

3.4.1 Selling products that use MySQL

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

3.4.2 Selling MySQL-related services

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

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

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

3.4.3 ISP MySQL services

Internet Service Providers (ISPs) often host MySQL servers for their customers.

If you are an ISP that allows customers to install and administer MySQL for themselves on your machine with no assistance from you, neither you nor your customer need a MySQL license.

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

3.4.4 Running a web server using MySQL

If you use MySQL in conjunction with a web server, you don't have to pay for a license.

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

3.5 MySQL licensing and support costs

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

Number of licenses Price per copy Total
1 US $200 US $200
10 pack US $150 US $1500
50 pack US $120 US $6000

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

Number of licenses Price per copy Minimum at one time Minimum payment
100-999 US $40 100 US $4000
1000-2499 US $25 200 US $5000
2500-4999 US $20 400 US $8000

For OEM purchases, you must act as the middle-man for eventual problems or extension requests from your users. We also require that OEM customers have at least an extended email support contract.

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

After buying 10 MySQL licenses, you will get a personal copy of the pack_isam utility. You are not allowed to redistribute this utility but you can distribute tables packed with it.

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

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

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

Type of support Cost per year
Basic email support EURO 170
Extended email support EURO 1000
Login support EURO 2000
Extended login support EURO 5000

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

3.5.1 Payment information

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

Payment should be made to:

Postgirot Bank AB
105 06 STOCKHOLM, SWEDEN

TCX DataKonsult AB
BOX 6434
11382 STOCKHOLM, SWEDEN

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

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

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

If you want to pay by cheque, make it payable to "Monty Program KB" and mail it to the address below:

TCX DataKonsult AB
BOX 6434, Torsgatan 21
11382 STOCKHOLM, SWEDEN

If you want to pay by credit card over the Internet, you can use TcX's secure license form.

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

+46-8-729 69 05

If you want us to bill you, you can use the license form and write "bill us" in the comment field. You can also mail a message to with your company information and ask us to bill you.

3.5.2 Contact information

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

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

3.6 Types of commercial support

3.6.1 Basic email support

Basic email support is a very inexpensive support option and should be thought of more as a way to support our development of MySQL than as a real support option.

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

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

REMEMBER! to ALWAYS include your registration number and expiration date when you send a message to

Basic email support includes the following types of service:

3.6.2 Extended email support

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

3.6.3 Login support

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

3.6.4 Extended login support

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

4 Installing MySQL

This chapter describes how to obtain and install MySQL:

4.1 How to get MySQL

Check the MySQL home page for information about the current version and for downloading instructions.

However, the Internet connection at TcX is not so fast; we would prefer that you do the actual downloading from one of the mirror sites listed below.

Please report bad or out of date mirrors to webmaster@mysql.com.

Europe:

North America:

South America:

Asia:

Australia:

Africa:

4.2 Operating systems supported by MySQL

We use GNU Autoconf so it is possible to port MySQL to all modern systems with working Posix threads and a C++ compiler. (To compile only the client code, a C++ compiler is required but not threads.) We use and develop the software ourselves primarily on Sun Solaris (versions 2.5 & 2.6) and to a lesser extent on RedHat Linux 5.0.

MySQL has been reported to compile sucessfully on the following operating system/thread package combinations. Note that for many operating systems, the native thread support works only in the latest versions.

4.3 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:

The second decision to make is whether you want to use a source distribution or a binary distribution:

The MySQL naming scheme uses release numbers that consist of three numbers and a suffix. For example, a release name like mysql-3.21.17-beta is interpreted like this:

All versions of MySQL are run through our standard tests and benchmarks to ensure that they are relatively safe to use. Since the standard tests are extended over time to check for all previously found bugs, the test suite keeps getting better.

Note that all releases have been tested at least with:

An internal test suite
This is part of a production system for a customer. It has many tables with hundreds of megabytes of data.
The MySQL benchmark suite
This runs a range of common queries. It is also a test to see whether the latest batch of optimizations actually made the code faster. See section 11 The MySQL benchmark suite.
The crash-me test
This tries to determine what features the database supports and what its capabilities and limitations are. See section 11 The MySQL benchmark suite.

Another test is that we use the newest MySQL version in our internal production environment, on at least one machine. We have more than 100 gigabytes of data to work with.

4.4 How and when updates are released

MySQL is evolving quite rapidly here at TcX and we want to share this with other 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 also take note of what our licensed users want to have and we especially take note of what our extended email 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. See section D MySQL change history.

We use the following policy when updating MySQL:

The current stable release is 3.22; We have already moved active development to 3.23. 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".

4.5 Installation layouts

This section describes the default layout of the directories created by installing binary and source distributions.

A binary distribution is installed by unpacking it at the installation location you choose (typically `/usr/local/mysql') and creates the following directories in that location:

Directory Contents of directory
`bin' Client programs and the mysqld server
`data' Log files, databases
`include' Include (header) files
`lib' Libraries
`scripts' mysql_install_db
`share/mysql' Error message files
`sql-bench' Benchmarks

A source distribution is installed after you configure and compile it. By default, the installation step installs files under `/usr/local', in the following subdirectories:

Directory Contents of directory
`bin' Client programs and scripts
`include/mysql' Include (header) files
`info' Documentation in Info format
`lib/mysql' Libraries
`libexec' The mysqld server
`share/mysql' Error message files
`sql-bench' Benchmarks and crash-me test
`var' Databases and log files.

Within an installation directory, the layout of a source installation differs from that of a binary installation in the following ways:

4.6 Installing a MySQL binary distribution

You need the following tools to install a MySQL binary distribution:

An alternative installation method under Linux is to use RPM (RedHat Package Manager) distributions. See section 4.6.1 Linux RPM notes.

If you run into problems, PLEASE ALWAYS USE mysqlbug when posting questions to mysql@lists.mysql.com. Even if the problem isn't a bug, mysqlbug gathers system information that will help others solve your problem. By not using mysqlbug, you lessen the likelihood of getting a solution to your problem! You will find mysqlbug in the `bin' directory after you unpack the distribution. See section 2.3 How to report bugs or problems.

The basic commands you must execute to install and use a MySQL binary distribution are:

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

You can add new users using the bin/mysql_setpermission script if you install the DBI and Msql-Mysql-modules Perl modules.

Here follows a more detailed description:

To install a binary distribution, follow the steps below, then proceed to section 4.15 Post-installation setup and testing, for post-installation setup and testing:

  1. Pick the directory under which you want to unpack the distribution, and move into it. In the example below, we unpack the distribution under `/usr/local' and create a directory `/usr/local/mysql' into which MySQL is installed. (The following instructions therefore assume you have permission to create files in `/usr/local'. If that directory is protected, you will need to perform the installation as root.)
  2. Obtain a distribution file from one of the sites listed in section 4.1 How to get MySQL. MySQL binary distributions are provided as compressed tar archives and have names like `mysql-VERSION-OS.tar.gz', where VERSION is a number (e.g., 3.21.15), and OS indicates the type of operating system for which the distribution is intended (e.g., pc-linux-gnu-i586).
  3. Unpack the distribution and create the installation directory:
    shell> gunzip < mysql-VERSION-OS.tar.gz | tar xvf -
    shell> ln -s mysql-VERSION-OS mysql
    
    The first command creates a directory named `mysql-VERSION-OS'. The second command makes a symbolic link to that directory. This lets you refer more easily to the installation directory as `/usr/local/mysql'.
  4. Change into the installation directory:
    shell> cd mysql
    
    You will find several files and subdirectories in the mysql directory. The most important for installation purposes are the `bin' and `scripts' subdirectories.
    `bin'
    This directory contains client programs and the server You should add the full pathname of this directory to your PATH environment variable so that your shell finds the MySQL programs properly.
    `scripts'
    This directory contains the mysql_install_db script used to initialize the server access permissions.
  5. If you would like to use mysqlaccess and have the MySQL distribution in some nonstandard place, you must change the location where mysqlaccess expects to find the mysql client. Edit the `bin/mysqlaccess' script at approximately line 18. Search for a line that looks like this:
    $MYSQL     = '/usr/local/bin/mysql';    # path to mysql executable
    
    Change the path to reflect the location where mysql actually is stored on your system. If you do not do this, you will get a broken pipe error when you run mysqlaccess.
  6. Create the MySQL grant tables (necessary only if you haven't installed MySQL before):
    shell> scripts/mysql_install_db
    
    Note that MySQL versions older than 3.22.10 started the MySQL server when you run mysql_install_db. This is no longer true!
  7. If you want to install support for the Perl DBI/DBD interface, see section 4.10 Perl installation comments.
  8. If you would like MySQL to start automatically when you boot your machine, you can copy support-files/mysql.server to the location where your system has its startup files. More information can be found in the support-files/mysql.server script itself, and in section 4.15.3 Starting and stopping MySQL automatically.

After everything has been unpacked and installed, you should initialize and test your distribution.

You can start the MySQL server with the following command:

shell> bin/safe_mysqld &

See section 4.15 Post-installation setup and testing.

4.6.1 Linux RPM notes

The recommended way to install MySQL on Linux is by using an RPM file. The MySQL RPMs are currently being built on a RedHat 5.2 system but should work on other versions of Linux that support rpm and use glibc.

If you have problems with an RPM file, for example Sorry, the host 'xxxx' could not be looked up, see section 4.6.3.1 Linux notes.

The RPM files you may want to use are:

To see all files in an RPM package:

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

To perform a standard minimal installation, run this command:

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

To install just the client package:

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

The RPM places data in `/var/lib/mysql'. The RPM also creates the appropriate entries in `/sbin/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 MySQL startup file if you made any changes to it, so you don't lose your changes.)

After installing the RPM file(s), go to the binary install section and use the instructions there, starting from the step that creates the MySQL grant tables. See section 4.6 Installing a MySQL binary distribution.

4.6.2 Building client programs

If you compile MySQL clients that you've written yourself or that you obtain from a third party, they must be linked using the -lmysqlclient option on the link command. You may also need to specify a -L option to tell the linker where to find the library. For example, if the library is installed in `/usr/local/mysql/lib', use -L/usr/local/mysql/lib -lmysqlclient on the link command.

For clients that use MySQL header files, you may need to specify a -I option when you compile them (for example, -I/usr/local/mysql/include), so the compiler can find the header files.

4.6.3 System-specific issues

The following sections indicate some of the issues that have been observed to occur on particular systems when installing MySQL from a binary distribution.

4.6.3.1 Linux notes

MySQL needs at least Linux 2.0.

The binary release is linked with -static, which means you not normally need not worry about which version of the system libraries you have. You need not install LinuxThreads, either. A program linked with -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 MySQL yourself, using dynamic linking.

If you are using a libc-based system (instead of a glibc2 system), you will probably get some problems with hostname resolving and getpwnam() with the binary release. (This is because glibc unfortunately depends on some external libraries to resolve hostnames and getwpent() , even when compiled with -static). In this case you probably get the following error message when you run mysql_install_db:

Sorry, the host 'xxxx' could not be looked up

or the following error when you try to run mysqld with the --user option:

getpwnam: No such file or directory

You can solve this problem one of the following ways:

The Linux-Intel binary and RPM releases of MySQL are configured for the highest possible speed. We are always trying to use the fastest stable compiler available.

MySQL Perl support requires Perl 5.004_03 or newer.

4.6.3.2 HP-UX notes

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

The HP version of MySQL was compiled on an HP 9000/8xx server under HP-UX 10.20, and uses MIT-pthreads. It is known to work well under this configuration. MySQL 3.22.26 and newer can also be built with HP's native thread package.

Other configurations that may work:

The following configurations almost definitely won't work:

To install the distribution, use one of the commands below, where /path/to/depot is the full pathname of the depot file:

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

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

4.7 Installing a MySQL source distribution

You need the following tools to build and install MySQL from source:

If you run into problems, PLEASE ALWAYS USE mysqlbug when posting questions to mysql@lists.mysql.com. Even if the problem isn't a bug, mysqlbug gathers system information that will help others solve your problem. By not using mysqlbug, you lessen the likelihood of getting a solution to your problem! You will find mysqlbug in the `scripts' directory after you unpack the distribution. See section 2.3 How to report bugs or problems.

4.7.1 Quick installation overview

The basic commands you must execute to install a MySQL source distribution are (from an unpacked tar file):

shell> configure
shell> make
shell> make install
shell> scripts/mysql_install_db
shell> /usr/local/mysql/bin/safe_mysqld &

If you start from a source RPM, then do the following.

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

This will make a binary RPM that you can install.

You can add new users using the bin/mysql_setpermission script if you install the DBI and Msql-Mysql-modules Perl modules.

Here follows a more detailed description:

To install a source distribution, follow the steps below, then proceed to section 4.15 Post-installation setup and testing, for post-installation initialization and testing.

  1. Pick the directory under which you want to unpack the distribution, and move into it.
  2. Obtain a distribution file from one of the sites listed in section 4.1 How to get MySQL. MySQL source distributions are provided as compressed tar archives and have names like `mysql-VERSION.tar.gz', where VERSION is a number like 3.22.27.
  3. Unpack the distribution into the current directory:
    shell> gunzip < mysql-VERSION.tar.gz | tar xvf -
    
    This command creates a directory named `mysql-VERSION'.
  4. Change into the top-level directory of the unpacked distribution:
    shell> cd mysql-VERSION
    
  5. Configure the release and compile everything:
    shell> ./configure --prefix=/usr/local/mysql
    shell> make
    
    When you run configure, you might want to specify some options. Run ./configure --help for a list of options. section 4.7.3 Typical configure options, discusses some of the more useful options. If configure fails, and you are going to send mail to lines from `config.log' that you think can help solve the problem. Also include the last couple of lines of output from configure if configure aborts. Post the bug report using the mysqlbug script. See section 2.3 How to report bugs or problems. If the compile fails, see section 4.8 Problems compiling?, for help with a number of common problems.
  6. Install everything:
    shell> make install
    
    You might need to run this command as root.
  7. Create the MySQL grant tables (necessary only if you haven't installed MySQL before):
    shell> scripts/mysql_install_db
    
    Note that MySQL versions older than 3.22.10 started the MySQL server when you run mysql_install_db. This is no longer true!
  8. If you want to install support for the Perl DBI/DBD interface, see section 4.10 Perl installation comments.
  9. If you would like MySQL to start automatically when you boot your machine, you can copy support-files/mysql.server to the location where your system has its startup files. More information can be found in the support-files/mysql.server script itself, and in section 4.15.3 Starting and stopping MySQL automatically.

After everything has been installed, you should initialize and test your distribution.

You can start the MySQL server with the following command, where BINDIR is the directory in which safe_mysqld is installed (`/usr/local/bin' by default):

shell> BINDIR/safe_mysqld &

If that command fails immediately with mysqld daemon ended then you can find some information in the file `mysql-data-directory/'hostname'.err'. The likely reason is that you already have another mysqld server running. See section 19.3 Running multiple MySQL servers on the same machine.

See section 4.15 Post-installation setup and testing.

4.7.2 Applying patches

Sometimes patches appear on the mailing list or are placed in the patches area of the MySQL FTP site.

To apply a patch from the mailing list, save the message in which the patch appears in a file, change into the top-level directory of your MySQL source tree and run these commands:

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

Patches from the FTP site are distributed as plain text files or as files compressed with gzip files. Apply a plain patch as shown above for mailing list patches. To apply a compressed patch, change into the top-level directory of your MySQL source tree and run these commands:

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

After applying a patch, follow the instructions for a normal source install, beginning with the ./configure step. After running the make install step, restart your MySQL server.

You may need to bring down any currently running server before you run make install. (Use mysqladmin shutdown to do this.) Some systems do not allow you to install a new version of a program if it replaces the version that is currently executing.

4.7.3 Typical configure options

The configure script gives you a great deal of control over how you configure your MySQL distribution. Typically you do this using options on the configure command line. You can also affect configure using certain environment variables. For a list of options supported by configure, run this command:

shell> ./configure --help

Some of the more commonly-used configure options are described below:

4.8 Problems compiling?

All MySQL programs compile cleanly for us with no warnings on Solaris using gcc. On other systems, warnings may occur due to differences in system include files. See section 4.9 MIT-pthreads notes, for warnings that may occur when using MIT-pthreads. For other problems, check the list below.

The solution to many problems involves reconfiguring. If you do need to reconfigure, take note of the following:

To prevent old configuration information or object files from being used, run these commands before rerunning configure:

shell> rm config.cache
shell> make clean

Alternatively, you can run make distclean.

The list below describes some of the problems compiling MySQL that have been found to occur most often:

4.9 MIT-pthreads notes

This section describes some of the issues involved in using MIT-pthreads.

Note that on Linux you should NOT use MIT-pthreads but install LinuxThreads! See section 4.11.5 Linux notes (all Linux versions).

If your system does not provide native thread support, you will need to build MySQL using the MIT-pthreads package. This includes most FreeBSD systems, SunOS 4.x, Solaris 2.4 and earlier, and some others. See section 4.2 Operating systems supported by MySQL.

4.10 Perl installation comments

4.10.1 Installing Perl on Unix

Perl support for MySQL is provided by means of the DBI/DBD client interface. See section 20.5 MySQL Perl API. The Perl DBD/DBI client code requires Perl 5.004 or later. The interface will not work if you have an older version of Perl.

MySQL Perl support also requires that you've installed MySQL client programming support. If you installed MySQL from RPM files, client programs are in the client RPM, but client programming support is in the developer RPM. Make sure you've installed the latter RPM.

As of release 3.22.8, Perl support is distributed separately from the main MySQL distribution. If you want to install Perl support, the files you will need can be obtained from http://www.mysql.com/Contrib.

The Perl distributions are provided as compressed tar archives and have names like `MODULE-VERSION.tar.gz', where MODULE is the module name and VERSION is the version number. You should get the Data-Dumper, DBI, and Msql-Mysql-modules distributions and install them in that order. The installation procedure is shown below. The example shown is for the Data-Dumper module, but the procedure is the same for all three distributions.

  1. Unpack the distribution into the current directory:
    shell> gunzip < Data-Dumper-VERSION.tar.gz | tar xvf -
    
    This command creates a directory named `Data-Dumper-VERSION'.
  2. Change into the top-level directory of the unpacked distribution:
    shell> cd Data-Dumper-VERSION
    
  3. Build the distribution and compile everything:
    shell> perl Makefile.PL
    shell> make
    shell> make test
    shell> make install
    

The make test command is important, because it verifies that the module is working. Note that when you run that command during the Msql-Mysql-modules installation to exercise the interface code, the MySQL server must be running or the test will fail.

It is a good idea to rebuild and reinstall the Msql-Mysql-modules distribution whenever you install a new release of MySQL, particularly if you notice symptoms such as all your DBI scripts dumping core after you upgrade MySQL.

If you don't have the right to install Perl modules in the system directory or if you to install local Perl modules, the following reference may help you:

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

Look under the heading Installing New Modules that Require Locally Installed Modules.

4.10.2 Installing ActiveState Perl on Win32

To install the MySQL DBD module with ActiveState Perl on Win32, you should do the following:

If you can't get the above to work, you should instead install the MyODBC driver and connect to MySQL server through ODBC.

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

4.10.3 Installing the MySQL Perl distribution on Win32

The MySQL Perl distribution contains DBI, DBD:MySQL and DBD:ODBC.

4.10.4 Problems using the Perl DBI/DBD interface

If Perl reports that it can't find the ../mysql/mysql.so module, then the problem is probably that Perl can't locate the shared library `libmysqlclient.so'.

You can fix this by any of the following methods:

If you get the following errors from DBD-mysql, you are probably using gcc (or using an old binary compiled with gcc):

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

Add -L/usr/lib/gcc-lib/... -lgcc to the link command when the `mysql.so' library gets built (check the output from make for `mysql.so' when you compile the Perl client). The -L option should specify the pathname of the directory where `libgcc.a' is located on your system.

Another cause of this problem may be that Perl and MySQL aren't both compiled with gcc. In this case, you can solve the mismatch by compiling both with gcc.

If you want to use the Perl module on a system that doesn't support dynamic linking (like SCO) you can generate a static version of Perl that includes DBI and DBD-mysql. The way this works is that you generate a version of Perl with the DBI code linked in and install it on top of your current Perl. Then you use that to build a version of Perl that additionally has the DBD code linked in, and install that.

On SCO, you must have the following environment variables set:

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

First, create a Perl that includes a statically-linked DBI by running these commands in the directory where your DBI distribution is located:

shell> perl Makefile.PL LINKTYPE=static
shell> make
shell> make install
shell> make perl

Then you must install the new Perl. The output of make perl will indicate the exact make command you will need to execute to perform the installation. On SCO, this is make -f Makefile.aperl inst_perl MAP_TARGET=perl.

Next, use the just-created Perl to create another Perl that also includes a statically-linked DBD::mysql by running these commands in the directory where your Msql-Mysql-modules distribution is located:

shell> perl Makefile.PL LINKTYPE=static
shell> make
shell> make install
shell> make perl

Finally, you should install this new Perl. Again, the output of make perl indicates the command to use.

4.11 System-specific issues

The following sections indicate some of the issues that have been observed to occur on particular systems when installing MySQL from a source distribution.

4.11.1 Solaris notes

On Solaris, you may run into trouble even before you get the MySQL distribution unpacked! Solaris tar can't handle long file names, so you may see an error like this when you unpack MySQL:

x mysql-3.22.12-beta/bench/Results/ATIS-mysql_odbc-NT_4.0-cmp-db2,informix,ms-sql,mysql,oracle,solid,sybase, 0 bytes, 0 tape blocks
tar: directory checksum error

In this case, you must use GNU tar (gtar) to unpack the distribution. You can find a precompiled copy for Solaris at http://www.mysql.com/Downloads/.

Sun native threads work only on Solaris 2.5 and higher. For 2.4 and earlier versions, MySQL will automatically use MIT-pthreads. See section 4.9 MIT-pthreads notes.

If you get the following error from configure:

checking for restartable system calls... configure: error can not run test
programs while cross compiling

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 config.cache file:

ac_cv_sys_restartable_syscalls=${ac_cv_sys_restartable_syscalls='no'}

If you are using Solaris on a SPARC, the recommended compiler is egcs 1.1.2 or newer. You can find this at http://egcs.cygnus.com/. Note that egs 1.1.1 and gcc 2.8.1 don't work reliably on SPARC!

The recommended configure line when using egcs 1.1.2 is:

shell> CC=gcc CFLAGS="-O6" \
       CXX=gcc CXXFLAGS="-O6 -felide-constructors -fno-exceptions -fno-rtti" \
       ./configure --prefix=/usr/local/mysql --with-low-memory

If you have the Sun Workshop 4.2 compiler, you can run configure like this:

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

shell> CC=cc CFLAGS="-Xa -fast -xO4 -native -xstrconst -mt" \
       CXX=CC CXXFLAGS="-noex -XO4 -mt" \
       ./configure

You may also have to edit the configure script to change this line:

#if !defined(__STDC__) || __STDC__ != 1

to this:

#if !defined(__STDC__)

If you turn on __STDC__ with the -Xc option, the Sun compiler can't compile with the Solaris `pthread.h' header file. This is a Sun bug (broken compiler or broken include file).

If mysqld issues the error message shown below when you run it, you have tried to compile MySQL with the Sun compiler without enabling the multi-thread option (-mt):

libc internal error: _rmutex_unlock: rmutex not held

Add -mt to CFLAGS and CXXFLAGS and try again.

If you get the following error when compiling MySQL with gcc, it means that your gcc is not configured for your version of Solaris!

shell> gcc -O3 -g -O2 -DDBUG_OFF  -o thr_alarm ...
./thr_alarm.c: In function `signal_hand':
./thr_alarm.c:556: too many arguments to function `sigwait'

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

Solaris doesn't provide static versions of all system libraries (libpthreads and libdl), so you can't compile MySQL with --static. If you try to do so, you will get the error:

ld: fatal: library -ldl: not found

If too many processes try to connect very rapidly to mysqld, you will see this error in the MySQL log:

Error in accept: Protocol error

You might try starting the server with the --set-variable back_log=50 option as a workaround for this.

If you are linking your own MySQL client, you might get the following error when you try to execute it:

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

The problem can be avoided by one of the following methods:

4.11.2 Solaris 2.7 notes

You can normally use a Solaris 2.6 binary on Solaris 2.7. Most of the Solaris 2.6 issues also apply for Solaris 2.7.

Note that MySQL 3.23.4 and above should be able to autodetect Solaris 2.7 and enable workarounds for the following problems!

Solaris 2.7 has some bugs in the include files. You may see the following error when you use gcc:

/usr/include/widec.h:42: warning: `getwc' redefined
/usr/include/wchar.h:326: warning: this is the location of the previous
definition

If this occurs, you can do the following to fix the problem:

Copy /usr/include/widec.h to .../lib/gcc-lib/os/gcc-version/include and change line 41 from:

#if     !defined(lint) && !defined(__lint)

to

#if     !defined(lint) && !defined(__lint) && !defined(getwc)

Alternatively, you can edit `/usr/include/widec.h' directly. Either way, after you make the fix, you should remove `config.cache' and run configure again!

If you get errors like this when you run make, it's because configure didn't detect the `curses.h' file (probably because of the error in /usr/include/widec.h:

In file included from mysql.cc:50:
/usr/include/term.h:1060: syntax error before `,'
/usr/include/term.h:1081: syntax error before `;'

The solution to this is to do one of the following steps:

4.11.3 Solaris x86 notes

If you are using gcc or egcs on Solaris x86 and you experience problems with core dumps under load, you should use the following configure command:

shell> CC=gcc CFLAGS="-O6 -fomit-frame-pointer" \
       CXX=gcc \
       CXXFLAGS="-O6 -fomit-frame-pointer -felide-constructors -fno-exceptions -fno-rtti" \
       ./configure --prefix=/usr/local/mysql

This will avoid problems with the libstdc++ library and with C++ exceptions.

If this doesn't help, you should compile a debug version and run it with a trace file or under gdb. See section G.1 Debugging a MySQL server.

4.11.4 SunOS 4 notes

On SunOS 4, MIT-pthreads is needed to compile MySQL, which in turn means you will need GNU make.

Some SunOS 4 systems have problems with dynamic libraries and libtool. You can use the following configure line to avoid this problem:

shell> ./configure --disable-shared --with-mysqld-ldflags=-all-static

When compiling readline, you may get warnings about duplicate defines. These may be ignored.

When compiling mysqld, there will be some implicit declaration of function warnings. These may be ignored.

4.11.5 Linux notes (all Linux versions)

MySQL uses LinuxThreads on Linux. If you are using an old Linux version that doesn't have glibc2, you must install LinuxThreads before trying to compile MySQL. http://www.mysql.com/Downloads/Linux

If you can't start mysqld or if mysql_install_db doesn't work, please continue reading! This only happens on Linux system with problems in the LinuxThreads or libc/glibc libraries. There are a lot of simple workarounds to get MySQL to work! The simplest is to use the binary version of MySQL (not the RPM) for Linux x86. One nice aspect of this version is that it's probably 10% faster than any version you would compile yourself! See section 10.3 How compiling and linking affects the speed of MySQL.

One known problem with the binary distribution is that with older Linux systems that use libc (like RedHat 4.x or Slackware), you will get some non-fatal problems with hostname resolution See section 4.6.3.1 Linux notes.

isamchk hangs with libc.so.5.3.12. Upgrading to the newest libc fixes this problem.

When using LinuxThreads you will see a minimum of three processes running. These are in fact threads. There will be one thread for the LinuxThreads manager, one thread to handle connections, and one thread to handle alarms and signals.

If you see a dead mysqld daemon process with ps, this usually means that you have found a bug in MySQL or you have got a corrupted table. See section 18.1 What to do if MySQL keeps crashing.

If you are using LinuxThreads and mysqladmin shutdown doesn't work, you must upgrade to LinuxThreads 0.7.1 or newer.

If you are using RedHat, you might get errors like this:

/usr/bin/perl is needed...
/usr/sh is needed...
/usr/sh is needed...

If so, you should upgrade your version of rpm to `rpm-2.4.11-1.i386.rpm' and `rpm-devel-2.4.11-1.i386.rpm' (or later).

You can get the upgrades of libraries to RedHat 4.2 from ftp://ftp.redhat.com/updates/4.2/i386. Or http://www.sunsite.unc.edu/pub/Linux/distributions/redhat/code/rpm/ for other distributions.

If you are linking your own MySQL client and get the error:

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

when executing them, the problem can be avoided by one of the following methods:

If you are using the Fujitsu compiler (fcc / FCC) you will have some problems compiling MySQL because the Linux header files are very gcc oriented.

The following configure line should work with 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

4.11.5.1 Linux-x86 notes

MySQL requires libc version 5.4.12 or newer. It's known to work with libc 5.4.46. glibc version 2.0.6 and later should also work. There have been some problems with the glibc RPMs from RedHat so if you have problems, check whether or not there are any updates! The glibc 2.0.7-19 and 2.0.7-29 RPMs are known to work.

On some older Linux distributions, configure may produce an error like this:

Syntax error in sched.h. Change _P to __P in the /usr/include/sched.h file.
See the Installation chapter in the Reference Manual.

Just do what the error message says and add an extra underscore to the _P macro that has only one underscore, then try again.

You may get some warnings when compiling; those shown below can be ignored:

mysqld.cc -o objs-thread/mysqld.o
mysqld.cc: In function `void init_signals()':
mysqld.cc:315: warning: assignment of negative value `-1' to `long unsigned int'
mysqld.cc: In function `void * signal_hand(void *)':
mysqld.cc:346: warning: assignment of negative value `-1' to `long unsigned int'

In Debian GNU/Linux, if you want MySQL to start automatically when the system boots, do the following:

shell> cp support-files/mysql.server /etc/init.d/mysql.server
shell> /usr/sbin/update-rc.d mysql.server defaults 99

mysql.server can be found in the `share/mysql' directory under the MySQL installation directory, or in the `support-files' directory of the MySQL source tree.

If mysqld always core dumps when it starts up, the problem may be that you have an old `/lib/libc.a'. Try renaming it, then remove `sql/mysqld' and do a new make install and try again. This problem has been reported on some Slackware installations. RedHat 5.0 has also a similar problem with some new glibc versions. See section 4.11.5.2 RedHat 5.0 notes.

If you get the following error when linking mysqld, it means that your `libg++.a' is not installed correctly:

/usr/lib/libc.a(putc.o): In function `_IO_putc':
putc.o(.text+0x0): multiple definition of `_IO_putc'

You can avoid using `libg++.a' by running configure like this:

shell> CXX=gcc ./configure

4.11.5.2 RedHat 5.0 notes

If you have any problems with MySQL on RedHat, you should start by upgrading glibc to the newest possible version!

If you install all the official RedHat patches (including glibc-2.0.7-19 and glibc-devel-2.0.7-19), both the binary and source distributions of MySQL should work without any trouble!

The updates are needed since there is a bug in glibc 2.0.5 in how pthread_key_create variables are freed. With glibc 2.0.5, you must use a statically-linked MySQL binary distribution. If you want to compile from source, you must install the corrected version of LinuxThreads from http://www.mysql.com/Downloads/Linux or upgrade your glibc.

If you have an incorrect version of glibc or LinuxThreads, the symptom is that mysqld crashes after each connection. For example, mysqladmin version will crash mysqld when it finishes!

Another symptom of incorrect libraries is that mysqld crashes at once when it starts. On some Linux systems, this can be fixed by configuring like this:

shell> ./configure --with-mysqld-ldflags=-all-static

On Redhat 5.0, the easy way out is to install the glibc 2.0.7-19 RPM and run configure without the --with-mysqld-ldflags=-all-static option.

For the source distribution of glibc 2.0.7, a patch that is easy to apply and is tested with MySQL may be found at:

http://www.mysql.com/Download/Linux/glibc-2.0.7-total-patch.tar.gz

If you experience crashes like these when you build MySQL, you can always download the newest binary version of MySQL. This is statically-linked to avoid library conflicts and should work on all Linux systems!

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. See section G.1 Debugging a MySQL server.

4.11.5.3 RedHat 5.1 notes

The glibc of RedHat 5.1 (glibc 2.0.7-13) has a memory leak, so to get a stable MySQL version, you must upgrade glibc to 2.0.7-19, downgrade glibc or use a binary version of mysqld. If you don't do this, you will encounter memory problems (out of memory, etc., etc.). The most common error in this case is:

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

After you have upgraded to glibc 2.0.7-19, you can configure MySQL with dynamic linking (the default), but you cannot run configure with the --with-mysqld-ldflags=-all-static option until you have installed glibc 2.0.7-19 from source!

You can check which version of glibc you have with rpm -q glibc.

4.11.5.4 Linux-SPARC notes

In some implementations, readdir_r() is broken. The symptom is that SHOW DATABASES always returns an empty set. This can be fixed by removing HAVE_READDIR_R from `config.h' after configuring and before compiling.

Some problems will require patching your Linux installation. The patch can be found at http://www.mysql.com/patches/Linux-sparc-2.0.30.diff. This patch is against the Linux distribution `sparclinux-2.0.30.tar.gz' that is available at vger.rutgers.edu (a version of Linux that was never merged with the official 2.0.30). You must also install LinuxThreads 0.6 or newer.

Thanks to jacques@solucorp.qc.ca for this information.

4.11.5.5 Linux-Alpha notes

The big problem on Linux-Alpha is that there are still some problems with threads in glibc on this platform. You should start by getting the newest glibc version you can find.

Note that before you run any programs that use threads (like mysqld, thr_alarm or thr_lock), you should raise the shared memory limit (with ulimit). The MySQL benchmarks are known to fail if you forget to do this!

Configure MySQL with the following command:

shell> CC=gcc CCFLAGS="-Dalpha_linux_port" \
       CXX=gcc CXXFLAGS="-O3 -Dalpha_linux_port -felide-constructors -fno-exceptions -fno-rtti" \
       ./configure --prefix=/usr/local/mysql

Try to compile mysys/thr_lock and mysys/thr_alarm. Test that these programs work! (Invoke each one with no arguments. Each should end with test_succeeded if everything was okay.)

After installing MySQL, uncomment the ulimit command in safe_mysqld and add options to increase shared memory.

Note that Linux-Alpha is still an alpha-quality platform for MySQL. With the newest glibc, you have a very good chance of it working.

If you have problems with signals (MySQL dies unexpectedly under high load) you may have found an OS bug with threads and signals. In this case you can tell MySQL not to use signals by configuring with:

shell> CFLAGS=-DDONT_USE_THR_ALARM \
       CXXFLAGS=-DDONT_USE_THR_ALARM \
       ./configure ...

This doesn't affect the performance of MySQL, but has the side effect that you can't kill clients that are "sleeping" on a connection with mysqladmin kill or mysqladmin shutdown. Instead, the client will die when it issues its next command.

4.11.5.6 MkLinux notes

MySQL should work on MkLinux with the newest glibc package (tested with glibc 2.0.7).

4.11.5.7 Qube2 Linux notes

To get MySQL to work on Qube2, (Linux Mips), you need the newest glibc libraries (glibc-2.0.7-29C2 is known to work). You must also use the egcs C++ compiler (egcs-1.0.2-9 or newer).

4.11.6 Alpha-DEC-Unix notes

When compiling threaded programs under Digital UNIX, the documentation recommends using the -pthread option for cc and cxx and the libraries -lmach -lexc (in addition to -lpthread). You should run configure something like this:

shell> CC="cc -pthread" CXX="cxx -pthread -O" \
       ./configure --with-named-thread-libs="-lpthread -lmach -lexc -lc"

When compiling mysqld, you may see a couple of warnings like this:

mysqld.cc: In function void handle_connections()':
mysqld.cc:626: passing long unsigned int *' as argument 3 of
accept(int,sockadddr *, int *)'

You can safely ignore these warnings. They occur because configure can detect only errors, not warnings.

If you start the server directly from the command line, you may have problems with it dying when you log out. (When you log out, your outstanding processes receive a SIGHUP signal.) If so, try starting the server like this:

shell> nohup mysqld [options] &

nohup causes the command following it to ignore any SIGHUP signal sent from the terminal. Alternatively, start the server by running safe_mysqld, which invokes mysqld using nohup for you.

4.11.7 Alpha-DEC-OSF1 notes

If you have problems compiling and have DEC CC and gcc installed, try running configure like this:

shell> CC=cc CFLAGS=-O CXX=gcc CXXFLAGS=-O3 \
       ./configure --prefix=/usr/local/mysql

If you get problems with the `c_asm.h' file, you can create and use a 'dummy' `c_asm.h' file with:

shell> touch include/c_asm.h
shell> CC=gcc CFLAGS=-I./include \
       CXX=gcc CXXFLAGS=-O3 \
       ./configure --prefix=/usr/local/mysql

On OSF1 V4.0D and compiler "DEC C V5.6-071 on Digital UNIX V4.0 (Rev. 878)" the compiler had some strange behavior (undefined asm symbols). /bin/ld also appears to be broken (problems with _exit undefined errors occuring while linking mysqld). On this system, we have managed to compile MySQL with the following configure line, after replacing /bin/ld with the version from OSF 4.0C:

shell> CC=gcc CXX=gcc CXXFLAGS=-O3 ./configure --prefix=/usr/local/mysql

In some versions of OSF1, the alloca() function is broken. Fix this by removing the line in `config.h' that defines 'HAVE_ALLOCA'.

The alloca() function also may have an incorrect prototype in /usr/include/alloca.h. This warning resulting from this can be ignored.

configure will use the following thread libraries automatically: --with-named-thread-libs="-lpthread -lmach -lexc -lc".

When using gcc, you can also try running configure like this:

shell> CFLAGS=-D_PTHREAD_USE_D4 CXX=gcc CXXFLAGS=-O3 ./configure ....

If you have problems with signals (MySQL dies unexpectedly under high load) you may have found an OS bug with threads and signals. In this case you can tell MySQL not to use signals by configuring with:

shell> CFLAGS=-DDONT_USE_THR_ALARM \
       CXXFLAGS=-DDONT_USE_THR_ALARM \
       ./configure ...

This doesn't affect the performance of MySQL, but has the side effect that you can't kill clients that are "sleeping" on a connection with mysqladmin kill or mysqladmin shutdown. Instead, the client will die when it issues its next command.

4.11.8 SGI-Irix notes

You may have to undefine some things in `config.h' after running configure and before compiling.

In some Irix implementations, the alloca() function is broken. If the mysqld server dies on some SELECT statements, remove the lines from `config.h' that define HAVE_ALLOC and HAVE_ALLOCA_H. If mysqladmin create doesn't work, remove the line from `config.h' that defines HAVE_READDIR_R. You may have to remove the HAVE_TERM_H line as well.

SGI recommends that you install all of the patches on this page as a set: http://support.sgi.com/surfzone/patches/patchset/6.2_indigo.rps.html

At the very minimum, you should install the latest kernel rollup, the latest rld rollup, and the latest libc rollup.

You definately need all the POSIX patches on this page, for pthreads support:

http://support.sgi.com/surfzone/patches/patchset/6.2_posix.rps.html

If you get the something like the following error when compiling `mysql.cc':

"/usr/include/curses.h", line 82: error(1084): invalid combination of type

Then type the following in the top-level directory of your MySQL source tree:

shell> extra/replace bool curses_bool < /usr/include/curses.h > include/curses.h
shell> make

There have also been reports of scheduling problems. If only one thread is running, things go slow. Avoid this by starting another client. This may lead to a 2-to-10-fold increase in execution speed thereafter for the other thread. This is a poorly-understood problem with Irix threads; you may have to improvise to find solutions until this can be fixed.

If you are compiling with gcc, you can use the following configure command:

shell> CC=gcc CXX=gcc CXXFLAGS=-O3 \
       ./configure --prefix=/usr/local/mysql --with-thread-safe-client --with-named-thread-libs=-lpthread

4.11.9 FreeBSD notes

The easiest and therefor the preferred way to install is to use the mysql-server and mysql-client ports available on http://www.freebsd.org

Using these gives you:

It is recomended to use MIT-pthreads on FreeBSD 2.x and native threads on versions 3 and up. It is possible to run with with native threads on some late 2.2.x versions but you may encounter problems shutting down mysqld.

Be sure to have your name resolver setup correct. Otherwise you may experience resolver delays or failures when connecting to mysqld.

Make sure that the localhost entry in the `/etc/hosts' file is correct (otherwise you will have problems connecting to the database). The `/etc/hosts' file should start with a line:

127.0.0.1       localhost localhost.your.domain

If you notice that configure will use MIT-pthreads, you should read the MIT-pthreads notes. See section 4.9 MIT-pthreads notes.

If you get an error from make install that it can't find `/usr/include/pthreads', configure didn't detect that you need MIT-pthreads. This is fixed by executing these commands:

shell> rm config.cache
shell> ./configure --with-mit-threads

The behavior of FreeBSD make is slightly different from that of GNU make. If you have make-related problems, you should install GNU make.

FreeBSD is also known to have a very low default file handle limit. See section 18.11 File not found. Uncomment the ulimit -n section in safe_mysqld or raise the limits for the mysqld user in /etc/login.conf (and rebuild it witg 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)

If you have a problem with SELECT NOW() returning values in GMT and not your local time, you have to set the TZ environment variable to your current timezone. This should be done for the environment in which the server runs, for example, in safe_mysqld or mysql.server.

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

4.11.10 NetBSD notes

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

4.11.11 BSD/OS notes

4.11.11.1 BSD/OS 2.x notes

If you get the following error when compiling MySQL, your ulimit value for virtual memory is too low:

item_func.h: In method `Item_func_ge::Item_func_ge(const Item_func_ge &)':
item_func.h:28: virtual memory exhausted
make[2]: *** [item_func.o] Error 1

Try using ulimit -v 80000 and run make again. If this doesn't work and you are using bash, try switching to csh or sh; some BSDI users have reported problems with bash and ulimit.

If you are using gcc, you may also use have to use the --with-low-memory flag for configure to be able to compile `sql_yacc.cc'.

If you have a problem with SELECT NOW() returning values in GMT and not your local time, you have to set the TZ environment variable to your current timezone. This should be done for the environment in which the ser