2.10 Upgrading MySQL
As a general rule, we recommend that when upgrading from one release
series to another, you should go to the next series rather than
skipping a series. For example, if you currently are running MySQL 3.23
and wish to upgrade to a newer series, upgrade to MySQL 4.0 rather than
to 4.1 or 5.0.
The following items form a checklist of things you should do whenever
you perform an upgrade:
* Read the upgrading section for the release series to which you are
upgrading. Read the change notes as well. These provide
information about new features you can use. For example, before
upgrading from MySQL 4.1 to 5.0, read the 5.0 upgrading section
( Upgrading-from-4.1) and read the 5.0 change notes (
* Before you do an upgrade, back up your databases.
* If you are running MySQL Server on Windows, see Windows
* An upgrade may involve changes to the grant tables that are stored
in the `mysql' database. Occasionally new columns or tables are
added to support new features. To take advantage of these
features, be sure that your grant tables are up to date. The
upgrade procedure is described in Upgrading-grant-tables.
* If you are using replication, see Replication Upgrade for
information on upgrading your replication setup.
* If you install a MySQL-Max distribution that includes a server
named `mysqld-max', then upgrade later to a non-Max version of
MySQL, `mysqld_safe' will still attempt to run the old `mysqld-max'
server. If you perform such an upgrade, you should manually
remove the old `mysqld-max' server to ensure that `mysqld_safe'
runs the new `mysqld' server.
You can always move the MySQL format files and data files between
different versions on the same architecture as long as you stay within
versions for the same release series of MySQL. The current production
release series is 4.1. If you change the character set when running
MySQL, you must run `myisamchk -r -q --set-character-set=CHARSET' on
all `MyISAM' tables. Otherwise, your indexes may not be ordered
correctly, because changing the character set may also change the sort
Normally you can upgrade MySQL to a newer MySQL version without having
to do any changes to your tables. Please confirm if the upgrade notes
to the particular version you are upgrading to tells you anything about
this. If there would be any incompatibilities you can use `mysqldump'
to dump your tables before upgrading. After upgrading, reload the dump
file using `mysql' or `mysqlimport' to re-create your tables.
If you are cautious about using new versions, you can always rename
your old `mysqld' before installing a newer one. For example, if you
are using MySQL 4.0.18 and want to upgrade to 4.1.1, rename your
current server from `mysqld' to `mysqld-4.0.18'. If your new `mysqld'
then does something unexpected, you can simply shut it down and restart
with your old `mysqld'.
If, after an upgrade, you experience problems with recompiled client
programs, such as `Commands out of sync' or unexpected core dumps, you
probably have used old header or library files when compiling your
programs. In this case, you should check the date for your `mysql.h'
file and `libmysqlclient.a' library to verify that they are from the new
MySQL distribution. If not, recompile your programs with the new
headers and libraries.
If problems occur, such as that the new `mysqld' server doesn't want to
start or that you can't connect without a password, verify that you
don't have some old `my.cnf' file from your previous installation. You
can check this with the `--print-defaults' option (for example, `mysqld
--print-defaults'). If this displays anything other than the program
name, you have an active `my.cnf' file that affects server or client
It is a good idea to rebuild and reinstall the Perl `DBD::mysql' module
whenever you install a new release of MySQL. The same applies to other
MySQL interfaces as well, such as the PHP `mysql' extension and the
Python `MySQLdb' module.
* Upgrading-from-4.1 Upgrading from Version 4.1 to 5.0
* Upgrading-from-4.0 Upgrading from Version 4.0 to 4.1
* Upgrading-from-3.23 Upgrading from Version 3.23 to 4.0
* Upgrading-from-3.22 Upgrading from Version 3.22 to 3.23
* Upgrading-from-3.21 Upgrading from Version 3.21 to 3.22
* Upgrading-from-3.20 Upgrading from Version 3.20 to 3.21
* Upgrading-grant-tables Upgrading the Grant Tables
* Upgrading-to-arch Copying MySQL Databases to Another Machine
automatically generated byinfo2html