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 different manner. 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.
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).
The basic questions this section answers are, "how stable is MySQL?" and, "can I depend on MySQL in this project?"
This is about the 3.21.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 file which are things that are "design"-related.
MySQL is written in multiple layers and different independent modules. Here is a list of the different modules and how well-tested each of them is:
mysql, mysqladmin and mysqlshow -- Stable
mysqldump and mysqlimport -- Beta
GROUP BY, ORDER BY and related function COUNT() -- Beta
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 the 0.5 release.
SELECT
statements, a SELECT is usually done in one time frame so there
shouldn't be a mutex locking/thread juggling.
LOAD DATA ..., INSERT ... SELECT -- Stable
ALTER TABLE -- Gamma
mysqlaccess -- Beta
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.
Well, 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 a very useful feature 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 on what our licensed users want to have and we especially take notes 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.
If there is, by any chance, a fatal bug in a release we will make a new release as soon as possible. We would like other companies to do this, too. :)
The 3.21.x version incorporates major portability changes for many different systems. When the 3.21 release is stable, we will remove the alpha/beta suffix and move active development to 3.22. 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".
If you are running an old system and want to upgrade, but don't want to take chances with 3.21, you should upgrade to 3.20.32. We have tried to fix only fatal bugs and make small, relatively safe changes in this version.
If you are trying MySQL for the first time, or have little time to test that MySQL works on your current system, you should use 3.21.
If MySQL crashes or is terminated without all data having been written to disk (for example, if the computer is turned off), the tables may become corrupted. To check a table, use the following commands:
isamchk tbl_name
isamchk without options or
with the --silent option.
isamchk -e tbl_name
isamchk will normally stop after the first error it finds. If you want
to obtain more information, you can add the --verbose (-v)
switch. This causes isamchk to keep going, up through a maximum of
20 errors. In normal usage, a simple isamchk (with no arguments
other than the table name) is safe enough!
isamchk -e -i tbl_name
At TcX, we run a cron job to check all our important tables once a week:
35 0 * * 0 /path/to/isamchk -s /path/to/dbs/*/*.ISM
This prints out information about crashed tables so we can examine and repair
them when needed. The -s option causes isamchk to run
in silent mode, printing messages only when errors occur.
As we haven't had any unexpectedly crashed tables (tables that become corrupted for reasons other than hardware trouble) for a couple of years now (this is really true), once a week is more than enough for us.
Of course, whenever the machine has done a reboot in the middle of an update, you usually need to check all the tables that could have been affected. (This is an "expected crashed table".)
We recommend that to start with, you execute isamchk -s each
night on all tables that have been updated during the last 24 hours,
until you come to trust MySQL as much as we do.
Naturally, you could add a test to safe_mysqld that runs isamchk
to check all tables that have been modified during the last 24 hours
if there is an old `.pid' file left after a reboot. The `.pid'
file is removed by mysqld when it terminates normally. Its presence
at system startup time indicates that mysqld terminated abnormally.
The file format that MySQL uses to store data has been extensively
tested, but there are always circumstances that may cause tables
to become corrupted, such as the mysqld process being killed
in the middle of a write, a hardware error or an unexpected shutdown of
the computer.
The symptoms of a corrupted table are usually that queries abort unexpectedly and that you observe errors such as these:
In these cases, you must repair your tables. The isamchk external
utility can usually detect and fix most things that go
wrong. See section 13.2 The MySQL table check, optimize and repair program.
If you are going to use isamchk on very large files, you should first
decide how much memory you want it to use. (isamchk runs faster with
more memory.) For example, if you have more than 32M RAM, try:
shell> isamchk -O sortbuffer=16M -O keybuffer=16M \
-O readbuffer=1M -O writebuffer=1M ....
The repair process involves up to four parts, described below. Before you
begin, you should cd to the database directory and
check the permissions of the table files. Make sure they are readable to the
Unix user that mysqld runs as. If it turns out you need to modify
files, they must also be writable to that user.
Each table tbl_name corresponds to three files:
| File | Purpose |
| `tbl_name.frm' | Table definition (form) file |
| `tbl_name.ISD' | Data file |
| `tbl_name.ISM' | Index file |
Part 1: Checking your tables
isamchk *.ISM or (isamchk -e *.ISM if you have more time).
isamchk announces an
error. Use the -s (silent) option to suppress unnecessary information.
Part 2: Easy safe repair
out of
memory errors), or if isamchk crashes, go to part 3.
isamchk -r -q tbl_name. This will attempt to repair the
index file without touching the data file.
If the data file contains everything that it should and the delete links point
at the correct locations within the data file, this should work and the table
is fixed. Start repairing the next table. Otherwise, proceed to the next step.
isamchk -r tbl_name. This will remove incorrect records and
deleted records from the data file and reconstruct the index file.
isamchk --safe-recover tbl_name. This is a
little slower than isamchk --recover tbl_name, but should work in all
cases.
Part 3: Difficult repair
shell> mysql db_name mysql> DELETE FROM tbl_name; mysql> quit
isamchk -r -q
should work now.
Part 4: Very difficult repair
isamchk -r.
You can always move the MySQL form and data files between
different versions on the same architecture as long as you have the same
base version of MySQL. The current base version is
3. If you change the character set by recompiling MySQL (which may
also change the sort order), you must run isamchk -r -q on all tables.
If you are paranoid and/or afraid of new versions, you can always rename your
old mysqld to something like mysqld-'old-version-number'.
If your new mysqld then does something unexpected you can simply shut it
down and restart with your old mysqld!
When you do an upgrade you should, of course, also take a backup of your old databases. Sometimes it's good to be a little paranoid!
If, after an upgrade, you experience problems with recompiled client programs, like 'Commands out sync' or unexpected core dumps, you probably have included an old `mysql.h' file when compiling your programs. In this case you should check the date for your `mysql.h' file and `libmysql.a' library to verify that they are from the same MySQL distribution. If not, please recompile your programs!
Nothing that affects compatibility has changed between 3.21 and 3.22. The
only pitfall is that new tables that are created with DATE type
columns will use the new way to store the date. You can't access these new
fields from an old version of mysqld.
The C interface to mysql_real_connect() has changed. If you have an
old client program that calls this function, you must place a 0 for the new
DB argument (or recode the client to send the db element for faster
connections).
If you already have a version older than 3.20.28 running and want to switch to 3.21.# you need to do the following:
You can start the mysqld 3.21 server with safe_mysqld
--old-protocol to use it with clients from the 3.20 distribution.
In this case, the new client function mysql_errno() will not
return any server error, only CR_UNKNOWN_ERROR, (but it
works for client errors) and the server uses the old password() checking
rather than the new one.
If you are NOT using the --old-protocol option to mysqld,
you will need to make the following changes:
scripts/add_long_password must be run to convert the
password field in the mysql.user table to CHAR(16).
mysql.user table (to get 62-bit
rather than 31-bit passwords).
MySQL 3.20.28 and above can handle the new user table format
without affecting clients. If you have a MySQL version earlier than
3.20.28, passwords will no longer work on it if you convert the user
table. So to be safe, you should first upgrade to at least 3.20.28 and
then upgrade to 3.21.#.
The new client code works with a 3.20.# mysqld server, so
if you experience problems with 3.21.#, you can use the old 3.20.# server
without having to recompile the clients again.
If you are not using the --old-protocol option to mysqld,
old clients will issue the error message:
ERROR: Protocol mismatch. Server Version = 10 Client Version = 9
The new Perl DBI/DBD interface also supports the old mysqlperl
interface. The only change you have to make if you use mysqlperl is
to change the arguments to the connect() function. The new arguments
are: host, database, user, password
(the user and password arguments have changed places).
The following changes may affect queries in old applications:
HAVING must now be specified before any ORDER BY clause.
LOCATE() has been swapped.
DATE,
TIME and TIMESTAMP.
Currently the MySQL data (`*.ISD') and index
(`*.ISD') files are architecture-dependent and in some case
OS-dependent. If you want to move your applications to another machine
that has a different architecture/OS than your current machine, you should
use mysqldump.
By default, mysqldump will create a file full of SQL statements. You
can then transfer the file to the other machine and feed it as input to the
mysql client.
Try mysqldump --help to see what options are available.
If you are moving the data to a newer version of MySQL, you should use
mysqldump --opt with the newer version to get a fast, compact dump.
The easiest (although not the fastest) way to move a database between two machines is to run the following commands on the machine on which the database is located:
shell> mysqladmin -h 'other hostname' create db_name
shell> mysqldump --opt db_name \
| mysql -h 'other hostname' db_name
If you want to copy a database from a remote machine over a slow network, you can use:
shell> mysqladmin create db_name
shell> mysqldump -h 'other hostname' --opt --compress db_name \
| mysql db_name
You can also store the result in a file (compressed in this example):
shell> mysqldump --quick db_name | gzip > db_name.contents.gz
Transfer the file containing the database contents to the target machine and run these commands there:
shell> mysqladmin create db_name shell> gunzip < db_name.contents.gz | mysql db_name
You can also use mysqldump and mysqlimport to accomplish
the database transfer.
For big tables, this is much faster than simply using mysqldump.
In the commands shown below, PATH represents the full pathname
of a directory you use to store the output from mysqldump.
First, create the directory for the output files and dump the database:
shell> mkdir PATH shell> mysqldump --tab=PATH db_name
Then transfer the files in the PATH directory some corresponding
directory on the target machine and load the files into MySQL there:
shell> mysqladmin create db_name shell> cat PATH/*.sql | mysql db_name shell> mysqlimport db_name PATH/*.txt
Also, don't forget to copy the mysql database, since that's
where the privilege tables (user, db, host) are
stored. You may have to use the MySQL user root on the
new machine until you have the mysql database in place.
Finally (or immediately after you import the mysql database), execute
mysqladmin reload on the new machine so that the server reloads
the privileges information.
MySQL uses Unix time functions and has no problems with dates
until 2069; All 2-digit years are regarded to be in the range 1970-2069,
which means that if you store 01 in a year column, MySQL
treats it as 2001. In MySQL 3.22, the new YEAR column
type can store years 0 and 1901 to 2155 in 1 byte and display them using
2 or 4 digits.
The year 2000 is a problem only for old applications that have stored dates with 2 digits and manipulates the date in many different programs in with different functions. All MySQL date functions are stored in one file `sql/time.cc' and coded very carefully to be year 2000-safe.
Go to the first, previous, next, last section, table of contents.