| ||||||||||||||||
This is the MySQL reference manual; it documents MySQL Version 3.23.27-beta. As MySQL is work in progress, the manual gets updated frequently. There is a very good chance that this version is out of date, unless you are looking at it online. The most recent version of this manual is available at http://www.mysql.com/documentation/ in many different formats. If you have a hard time finding information in the manual, you can try the searchable PHP version at http://www.mysql.com/documentation/manual.php.
MySQL is a very fast, multi-threaded, multi-user, and robust SQL (Structured Query Language) database server.
MySQL is free software. It is licensed with the GNU GENERAL PUBLIC LICENSE http://www.gnu.org/. See section 3 MySQL Licensing and Support.
The MySQL home page provides the latest information about MySQL.
The following list describes some useful sections of the manual:
IMPORTANT:
Reports of errors (often called bugs), as well as questions and comments,
should be sent to the mailing list at mysql@lists.mysql.com.
See section 2.3 How to Report Bugs or Problems.
The mysqlbug script should be used to generate bug reports.
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 manual team at (docs@mysql.com).
This is a reference manual; it does not provide general instruction on SQL or relational database concepts. If you want general information about SQL, see section 1.8 General SQL Information and Tutorials. For books that focus more specifically on MySQL, see section 1.4 Books About MySQL.
The official way to pronounce MySQL is ``My Ess Que Ell'' (not MY-SEQUEL). But we try to avoid correcting people who say MY-SEQUEL.
MySQL core values
We want MySQL to be:
MySQL AB and the people of MySQL AB:
This manual is currently available in Texinfo, plain text, Info, HTML,
PostScript, and PDF versions. The primary document is the Texinfo file.
The HTML version is produced automatically using 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 pdftex.
This manual is written and maintained by David Axmark, Michael (Monty) Widenius, Jeremy Cole, and Paul DuBois. For other contributors, see section D Contributors to MySQL.
This manual uses certain typographical conventions:
constant
mysqladmin works, invoke it with the
--help option.''
When commands are shown that are meant to be executed by a particular
program, the program is indicated by a prompt shown before 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 program:
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
Often, database, table, and column names 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. For example, 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
same 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 (`[' and `]'):
TRIM([[BOTH | LEADING | TRAILING] [remstr] FROM] str)
When one member from a set of choices must be chosen, the alternatives are listed within braces (`{' and `}'):
{DESCRIBE | DESC} tbl_name {col_name | wild}
We once started out 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 nor
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.
While this manual is still the right place for up to date techical information, its primary goal is to contain everything there is to know about MySQL. It is sometimes nice to have a bound book to read in bed or while you travel. Here is a list of books about MySQL (in English):
MySQL
| Available | Barnes and Noble |
| Publisher | New Riders |
| Author | Paul DuBois |
| Pub Date | 1st Edition December 1999 |
| ISBN | 0735709211 |
| Pages | 800 |
| Price | $49.99 US |
| Downloadable examples |
samp_db.tar.gz
|
| Errata | are available here |
In MySQL, Paul DuBois provides you with a comprehensive guide to
one of the most popular relational database systems. Paul has
contributed to the online documentation for MySQL and is an
active member of the MySQL community. The principal MySQL
developer, Monty Widenius, and a network of his fellow developers
reviewed the manuscript, and provided Paul with the kind of insight
no one else could supply.
Instead of merely giving you a general overview of MySQL, Paul
teaches you how to make the most of its capabilities. Through two
sample database applications that run throughout the book, he
gives you solutions to problems you're sure to face. He helps you
integrate MySQL efficiently with third-party tools, such as PHP
and Perl, enabling you to generate dynamic Web pages through
database queries. He teaches you to write programs that access
MySQL databases, and also provides a comprehensive set of
references to column types, operators, functions, SQL syntax,
MySQL programming, C API, Perl DBI, and PHP API.
MySQL simply gives you the kind of information you won't find
anywhere else.
If you use MySQL, this book provides you with:
DBI and PHP APIs for developing
command-line and Web-based applications
DBI API,
and PHP's MySQL-related functions
MySQL & mSQL
| Available | Barnes and Noble |
| Publisher | O'Reilly |
| Authors | Randy Jay Yarger, George Reese & Tim King |
| Pub Date | 1st Edition July 1999 |
| ISBN | 1-56592-434-7, Order Number: 4347 |
| Pages | 506 |
| Price | $34.95 |
This book teaches you how to use MySQL and mSQL, two popular
and robust database products that support key subsets of SQL on both Linux
and UNIX systems. Anyone who knows basic C, Java, Perl, or Python can
write a program to interact with a database, either as a stand-alone
application or through a Web page. This book takes you through the
whole process, from installation and configuration to programming
interfaces and basic administration. Includes ample tutorial
material.
Sams' Teach Yourself MySQL in 21 Days
| Available | Barnes and Noble |
| Publisher | Sams |
| Authors | Mark Maslakowski and Tony Butcher |
| Pub Date | June 2000 |
| ISBN | 0672319144 |
| Pages | 650 |
| Price | $39.99 |
Sams Teach Yourself MySQL in 21 Days is for intermediate Linux users
who want to move into databases. A large share of the audience is Web
developers who need a database to store large amounts of information that can
be retrieved via the Web. Sams' Teach Yourself MySQL in 21 Days is a
practical, step-by-step tutorial. The reader will learn to design and employ
this open source database technology into his/her Web site using practical,
hands-on examples to follow.
E-Commerce Solutions with MySQL
| Available | Barnes and Noble |
| Publisher | Prima Communications, Inc. |
| Authors | N/A |
| Pub Date | January 2000 |
| ISBN | 0761524452 |
| Pages | 500 |
| Price | $39.99 |
No description available.
Professional MySQL Programming
| Available | Barnes and Noble |
| Publisher | Wrox Press, Inc. |
| Authors | N/A |
| Pub Date | July 2000 |
| ISBN | 1861004281 |
| Pages | 1000 |
| Price | $49.99 |
No description available.
PHP3 and MySQL Web Development
| Available | Barnes and Noble |
| Publisher | N/A |
| Authors | William Jason Gilmore |
| Pub Date | October 2000 |
| ISBN | 0672317842 |
| Pages | N/A |
| Price | $49.99 |
No description available.
The following list describes some of the important characteristics of MySQL:
FLOAT, DOUBLE, CHAR, VARCHAR,
TEXT, BLOB, DATE, TIME, DATETIME,
TIMESTAMP, YEAR, SET, and ENUM types. See section 7.3 Column Types.
SELECT and WHERE
parts of queries. Example:
mysql> SELECT CONCAT(first_name, " ", last_name) FROM tbl_name
WHERE income/dependents > 10000 AND age > 30;
GROUP BY and ORDER BY
clauses. Support for group functions (COUNT(),
COUNT(DISTINCT), AVG(), STD(), SUM(),
MAX() and MIN()).
LEFT OUTER JOIN and RIGHT OUTER JOIN with ANSI
SQL and ODBC syntax.
CHAR or VARCHAR field.
INSERT to insert a
subset of a table's columns; those columns that are not explicitly given
values are set to their default values.
libtool for portability.
purify).
myisamchk, a very fast utility for table checking,
optimization, and repair.
See section 15 Maintaining a MySQL installation.
DELETE, INSERT, REPLACE, and UPDATE return
how many rows were changed (affected). It is possible to return the number
of rows matched instead by setting a flag when connecting to the server.
ABS
is a valid column name. The only restriction is that for a function call, no
spaces are allowed between the function name and the `(' that follows it.
See section 7.38 Is MySQL picky about reserved words?.
--help or -?
options to obtain online assistance.
SHOW command can be used to retrieve
information about databases, tables, and indexes. The EXPLAIN command
can be used to determine how the optimizer resolves a query.
This section addresses the questions ``How stable is MySQL?'' and ``Can I depend on MySQL in this project?'' 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).
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 don't know what the gray zones are; this section attempts to indicate those that are currently known. The descriptions deal with Version 3.23.x 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 F 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:
mysql, mysqladmin, mysqlshow,
mysqldump, and mysqlimport.
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.
fcntl() call, which is
fixed by using the --skip-locking option to
mysqld. Some people have reported lockup problems with Version 0.5.
LinuxThreads will need to be recompiled if you plan to use
1000+ concurrent connections. Although it is possible to run that many
connections with the default LinuxThreads (however, you will never go
above 1021), the default stack spacing of 2 MB makes the application
unstable, and we have been able to reproduce a coredump after creating
1021 idle connections. See Linux Notes for more details.
SELECT statements are usually done in one time frame so there shouldn't
be a mutex locking/thread juggling.
LOAD DATA ..., INSERT ... SELECT -- Stable
ALTER TABLE -- Stable
mysqlaccess -- Stable
GRANT -- Stable
MERGE tables is still not that tested. The
other part of the MERGE code is quite well tested.
MySQL AB provides e-mail 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.
MySQL itself has no problems with Year 2000 (Y2K) compliance:
2069; all 2-digit years are regarded to be in the range
1970 to 2069, which means that if you store 01 in a
year column, MySQL treats it as 2001.
YEAR column type
can store years 0 and 1901 to 2155 in 1 byte and display
them using 2 or 4 digits.
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, because 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 will not
give any problems with future dates (they handle dates until the year
9999).
The TIMESTAMP type, which 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.3.6.1 Y2K Issues and Date Types for MySQL's rules for dealing with ambiguous date input data (data containing 2-digit year values).
The following book has been recommended by 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
The following book has also received some recommendations by MySQL users:
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.
Apart from the following links, you can find and download a lot of MySQL programs, tools and APIs from the Contrib directory.
1.9.1 Tutorials and Manuals
mSQL.
mSQL Tcl.
DBI/DBD.
DBI/DBD modules homepage.
There are also many Web pages that use MySQL. See section B Some MySQL users. Send any additions to this list to webmaster@mysql.com. We now require that you show a MySQL logo somewhere to be added (It is okay to have it on a ``used tools'' page or something similar.)
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 mysql-unsubscribe@lists.mysql.com is handled automatically by the 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, because 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
mysql
mysql-digest
mysql list in digest form. That means you get all individual
messages, sent as one large mail message once a day.
bugs
mysqlbug script (if you are running on Windows, you should
include a description of the operating system and the MySQL version).
Preferably, you should test the problem using the latest stable or
development version of MySQL before posting!
Anyone should be able to repeat the bug by just using
mysql test < script on the included test case. All bugs posted on
this list will be corrected or documented in the next MySQL release!
If there are only small code changes involved, we will also post a patch that
fixes the problem.
bugs-digest
bugs list in digest form.
developer
developer-digest
internals
internals-digest
java
java-digest
java list.
win32
win32-digest
win32 list.
myodbc
myodbc-digest
myodbc list.
plusplus
plusplus-digest
plusplus list.
msql-mysql-modules
msql-mysql-modules-digest
msql-mysql-modules 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
myodbc-subscribe@lists.mysql.com or
myodbc-unsubscribe@lists.mysql.com.
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 mysql@lists.mysql.com.
Writing a good bug report takes patience, but doing it right the first time saves time for us and for you. A good bug report containing a full test case for the bug will make it very likely that we will fix it in the next release. 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.
If you can make a test case that clearly shows the bug, you should post
it to the bugs@lists.mysql.com list. Note that on this list you
should only post a full, repeatable bug report using the mysqlbug
script. If you are running on Windows, you should include a
description of the operating system and the MySQL version.
Preferably, you should test the problem using the latest stable or development
version of MySQL before posting! Anyone should be able to repeat the
bug by just using ``mysql test < script'' on the included test case or
run the shell or perl script that is included in the bug report. All bugs
posted on this list will be corrected or documented in the next MySQL
release! If there are only small code changes involved to correct this
problem, we will also post a patch that fixes the problem.
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?'' 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. 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 should be observed!) You should never try to remember what the error message was; instead, copy and paste the entire message into your report!
If you have a problem with MyODBC, you should try to genereate a MyODBC trace file. See section 18.6 Reporting problems with MyODBC.
Please remember that many of the people who will read your report will
do so using an 80-column display. When generating reports or examples
using the mysql command line tool, you should therefore use
the --vertical option (or the \G statement terminator)
for output that would exceed the available width for such a display
(for example, with the EXPLAIN SELECT statement; see the
example below).
Please include the following information in your report:
mysqladmin version. mysqladmin can be
found in the `bin' directory under your MySQL installation
directory.
uname -a.
mysqldump --no-data db_name tbl_name1 tbl_name2 .... This is very easy
to do and is a powerful way to get information about any table in a database
that will help us create a situation matching the one you have.
SELECT statements, you should
always include the output of EXPLAIN SELECT ..., and at least the
number of rows that the SELECT statement produces. The more
information you give about your situation, the more likely it is that someone
can help you! For example, the following is an example of a very good bug
report (it should of course be posted with the mysqlbug script):
Example run using the mysql command line tool (note the use of the
\G statement terminator for statements whose output width would
otherwise exceed that of an 80-column display device):
mysql> SHOW VARIABLES;
mysql> SHOW COLUMNS FROM ...\G
<output from SHOW COLUMNS>
mysql> EXPLAIN SELECT ...\G
<output from EXPLAIN>
mysql> FLUSH STATUS;
mysql> SELECT ...;
<A short version of the output from SELECT,
including the time taken to run the query>
mysql> SHOW STATUS;
<output from SHOW STATUS>
mysqladmin variables extended-status processlist in your mail to
provide some information of how your system is performing!
ftp to
transfer it to ftp://support.mysql.com/pub/mysql/secret/. If the data
are really top secret and you don't want to show them even to us, then go ahead
and provide an example using other names, but please regard this as the last
choice.
mysqld
daemon and that you use to run any MySQL client programs. The
options to programs like mysqld and mysql, and to the
configure script, are often keys to answers and are very relevant!
It is never a bad idea to include them anyway! If you use any modules, such
as Perl or PHP, please include the version number(s) of those as well.
mysqldump and create a `README' file
that describes your problem.
Create a compressed archive of your files using
tar and gzip or zip, and use ftp
to transfer the archive to ftp://support.mysql.com/pub/mysql/secret/.
Then send a short description of the problem to mysql@lists.mysql.com.
mysqlaccess, the output of mysqladmin reload, and all
the error messages you get when trying to connect! When you test your
privileges, you should first run mysqlaccess. After this, execute
mysqladmin reload version and try to connect with the program that
gives you trouble. mysqlaccess can be found in the `bin'
directory under your MySQL installation directory.
parse error, please check your syntax closely! If
you can't find something wrong with it, it's extremely likely that your
current version of MySQL doesn't support the query you are
using. If you are using the current version and the manual at
http://www.mysql.com/documentation/manual.php doesn't cover the
syntax you are using, MySQL doesn't support your query. In this
case, your only options are to implement the syntax yourself or e-mail
mysql-licensing@mysql.com and ask for an offer to implement it!
If the manual covers the syntax you are using, but you have an older version
of MySQL, you should check the MySQL change history to see
when the syntax was implemented. See section E MySQL change history. In this case, you have the
option of upgrading to a newer version of MySQL.
myisamchk or CHECK TABLE/
REPAIR TABLE.
See section 15 Maintaining a MySQL installation.
mysqld
should NEVER crash a table if nothing killed it in the middle
of an update! If you can find the cause of mysqld dying,
it's much easier for us to provide you with a fix for the problem!
See section 20.1 How to determine what is causing problems.
If you are a support customer, please cross-post the bug report to mysql-support@mysql.com for higher priority treatment, as well as 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 18.3 How to report problems with MyODBC.
For solutions to some common problems, see See section 20 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!
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 don't read mail with a browser!
This chapter describes MySQL support and licensing arrangements:
The formal terms of the GPL license can be found at section K GNU General Public License. Basically, our licensing policy and intepretation of the GPL is as follows:
Note that older versions of MySQL are still using a more strict license. See the documentation for that version for more information. If you need a commercial MySQL license, because the GPL license doesn't suit your application, you can buy one at https://order.mysql.com/license.htmy.
For normal internal use, MySQL costs nothing. You do not have to pay us if you do not want to.
A license is required if:
A license is NOT required if:
GNU Library General Public License. The mysql command-line
client includes code from the readline library that is under
the GPL.
For circumstances under which a MySQL license is required, you
need a license per machine that runs the mysqld server. However,
a multiple-CPU machine counts as a single machine, and there is no
restriction on the number of MySQL servers that run on one
machine, or on the number of clients concurrently connected to a server
running on that machine!
If you have any questions as to whether or not a license is required for your particular use of MySQL, please read this again and then contact us. See section 3.4.2 Contact Information.
If you require a MySQL license, the easiest way to pay for it is to use the license form on MySQL's secure server at https://order.mysql.com/license.htmy. Other forms of payment are discussed in section 3.4.1 Payment information.
There are several different copyrights on the MySQL distribution:
mysqlclient library is licensed under the LGPL and
programs in the `client' directory is GPL. Each file has a header
that shows which copyright is used for that file.
getopt) library are covered
by the ``GNU LIBRARY GENERAL PUBLIC LICENSE.'' See section L GNU Library General Public License.
regexp library) are covered
by a Berkeley-style copyright.
readline) library
is covered by the ``GNU GENERAL PUBLIC LICENSE.'' See section K GNU General Public License. This is also available as the file `COPYING' in the
distributions.
One goal is that the SQL client library should be free enough that it is possible to add MySQL support into commercial products without a license. For this reason, we chose the LGPL license for the client code.
This means that you can use MySQL for free with any program that uses any of the free software licenses. MySQL is also free for any end user for his own or company usage.
However, if you use MySQL for something important to you, you may want to help secure its development by purchasing licenses or a support contract. See section 3.5 Types of Commercial Support.
The stable versions of MySQL are still using a more strict license. See the documentation for that version for more information.
This section describes some situations illustrating whether or not you must license the MySQL server. Generally these examples involve providing MySQL as an integral part of a product.
Note that a single MySQL license covers any number of CPUs and
mysqld servers on a machine! There is no artificial limit on the number
of clients that connect to the server in any way.
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 dependent on the use of MySQL and whether you include the MySQL server with your product. There are several cases to consider:
mysqld server. For example, if you've
designed your application around MySQL, then you've really made
a commercial product that requires the engine, so you need a license.
Internet Service Providers (ISPs) often host MySQL servers for their customers. With the GPL license this does not require a license.
On the other hand, we do encourage people to use ISPs that have MySQL support, as this will give them the confidence that if they have some problem with their MySQL installation, their ISP will be able to solve the problem for them (in some cases with the help from the MySQL development team).
All ISPs that want to keep themselves up-to-date should subscribe
to our announce mailing list so that they can be aware of fatal issues
that may be relevant for their MySQL installations.
Note that if the ISP doesn't have a license for MySQL, it should give its customers at least read access to the source of the MySQL installation so that its customer can verify that it is patched correctly.
If you use MySQL in conjunction with a Web server on UNIX, you don't have to pay for a license.
This is true even if you run a commercial Web server that uses MySQL, because you are not selling an embedded MySQL version yourself. However, in this case we would like you to purchase MySQL support, because MySQL is helping your enterprise.
Our current license prices are shown below. These prices are now under review because of the change to a GPL copyright. New prices and terms will be posted on the MySQL web site http://www.mysql.com/ as soon as they are ready.
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 | 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 | Per copy | Minimum | 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 e-mail support contract. Note that OEM licenses only apply for products where the user doesn't have direct access to the MySQL server (embedded system). In other words, the MySQL server should only be used with the application that was supplied you.
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.
A full-price license is not a support agreement and includes very minimal support. This means that we try to answer any relevant questions. 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.5 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 e-mail support | EURO 170 |
| Extended e-mail 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 in price between the two support levels.
Currently we can take SWIFT payments, checks, 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 e-mail address.
In Europe and Japan you can use EuroGiro (that should be less expensive) to the same account.
If you want to pay by check, make it payable to ``MySQL Finland AB'' 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 MySQL AB'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
sales@mysql.com (not mysql@lists.mysql.com!)
with your company information and ask us to bill you.
For commercial licensing, please contact the MySQL licensing team. The much preferred method is by e-mail to licensing@mysql.com. Fax is also possible but handling of these may take much longer (Fax +46-8-729 69 05).
If you represent a business that is interested in partnering with MySQL, please send e-mail to partner@mysql.com.
For timely, precise answers to technical questions about MySQL you should order one of our support contracts. MySQL support is provided by the MySQL developers so the standard is extremely high.
If you are interested in placing a banner advertisement on our Web site, please send e-mail to advertising@mysql.com.
If you are interested in any of the jobs listed in our jobs section, please send e-mail to jobs@mysql.com.
For general discussion amongst our many users, please direct your attention to the appropriate mailing list.
For general information inquires, please send e-mail to info@mysql.com.
For questions or comments about the workings or content of this Web site, please send e-mail to webmaster@mysql.com.
Basic e-mail 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. We at MySQL do give a lot of free support in all the different MySQL lists, and the money we get from basic e-mail support is largely used to make this possible.
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, 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 e-mail 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 mysql-support@mysql.com.
Note that if you have encountered a critical repeatable bug and follow the rules outlined in the manual section of how to report bugs and send it to bugs@lists.mysql.com, we promise to try to fix this as soon as possible, regardless of your support level! See section 2.3 How to Report Bugs or Problems.
Basic e-mail support includes the following types of service:
Extended e-mail support includes everything in basic e-mail support with these additions:
mysqld for your situation.
Login support includes everything in extended e-mail support with these additions:
kill -9 command).
Extended login support includes everything in login support with these additions:
mysql> select MY_FUNC(col1,col2) from table;
This chapter describes how to obtain and install MySQL:
Check the MySQL home page for information about the current version and for downloading instructions.
Our main download mirror is located at:
http://download.sourceforge.net/mirrors/mysql/
If you are interested in becoming a MySQL mirror site, you may
anonymously rsync with: rsync://download.sourceforge.net/mysql/. Please
send e-mail to webmaster@mysql.com notifying us of your mirror to be
added to the list below.
If you have problems downloading from our main site, try using one of the mirrors listed below.
Please report bad or out-of-date mirrors to webmaster@mysql.com.
Europe:
North America:
South America:
Asia:
Australia:
Africa:
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.7) and RedHat Linux Version 6.x.
Note that for many operating systems, the native thread support works only in the latest versions. MySQL has been reported to compile sucessfully on the following operating system/thread package combinations:
glibc 2.0.7+ . See section 4.12.5 Linux Notes (All Linux Versions).