It is good practice to back up your data before installing any new version of software. Although MySQL works very hard to ensure a high level of quality, you should protect your data by making a backup.
To upgrade to 5.4 from any previous version, MySQL recommends that you dump your tables with mysqldump before upgrading and reload the dump file after upgrading.
If you perform a binary (in-place) upgrade without dumping and
reloading tables, you cannot upgrade directly from MySQL 4.1
to 5.4. This occurs due to an incompatible change
in the MyISAM
table index format in MySQL
5.0. Upgrade from MySQL 4.1 to 5.0 and repair all
MyISAM
tables (see
Section 2.12.4, “Rebuilding or Repairing Tables or Indexes”). Then upgrade from MySQL
5.0 to 5.4 and check and repair your tables.
In general, you should do the following when upgrading from MySQL 5.1 to 5.4:
Read all the items in the following sections to see whether any of them might affect your applications:
Section 2.12.1, “Upgrading MySQL”, has general update information.
The items in the change lists found later in this section enable you to identify upgrade issues that apply to your current MySQL installation.
The MySQL 5.4 change history describes significant new features you can use in 5.4 or that differ from those found in MySQL 5.1. Some of these changes may result in incompatibilities. See Section C.1, “Changes in Release 5.4.x (Development)”.
Note particularly any changes that are marked
Known issue or
Incompatible change. These
incompatibilities with earlier versions of MySQL may require
your attention before you upgrade. Our
aim is to avoid these changes, but occasionally they are
necessary to correct problems that would be worse than an
incompatibility between releases. If any upgrade issue
applicable to your installation involves an incompatibility
that requires special handling, follow the instructions
given in the incompatibility description. Often this will
involve dumping and reloading tables, or use of a statement
such as CHECK TABLE
or
REPAIR TABLE
.
For dump and reload instructions, see
Section 2.12.4, “Rebuilding or Repairing Tables or Indexes”. Any procedure that
involves REPAIR TABLE
with
the USE_FRM
option
must be done before upgrading. Use of
this statement with a version of MySQL different from the
one used to create the table (that is, using it after
upgrading) may damage the table. See
Section 12.4.2.6, “REPAIR TABLE
Syntax”.
Before upgrading to a new version of MySQL, Section 2.12.3, “Checking Whether Tables or Indexes Must Be Rebuilt”, to see whether changes to table formats or to character sets or collations were made between your current version of MySQL and the version to which you are upgrading. If so and these changes result in an incompatibility between MySQL versions, you will need to upgrade the affected tables using the instructions in Section 2.12.4, “Rebuilding or Repairing Tables or Indexes”.
After upgrading to a new version of MySQL, run mysql_upgrade (see Section 4.4.7, “mysql_upgrade — Check Tables for MySQL Upgrade”). This program checks your tables, and attempts to repair them if necessary. It also updates your grant tables to make sure that they have the current structure so that you can take advantage of any new capabilities. (Some releases of MySQL introduce changes to the structure of the grant tables to add new privileges or features.)
If you run MySQL Server on Windows, see Section 2.3.14, “Upgrading MySQL on Windows”.
If you use replication, see Section 16.4.3, “Upgrading a Replication Setup”, for information on upgrading your replication setup.
If your MySQL installation contains a large amount of data that
might take a long time to convert after an in-place upgrade, you
might find it useful to create a “dummy” database
instance for assessing what conversions might be needed and the
work involved to perform them. Make a copy of your MySQL
instance that contains a full copy of the
mysql
database, plus all other databases
without data. Run your upgrade procedure on this dummy instance
to see what actions might be needed so that you can better
evaluate the work involved when performing actual data
conversion on your original database instance.
MySQL Enterprise. MySQL Enterprise subscribers will find more information about upgrading in the Knowledge Base articles found at Upgrading. Access to the MySQL Knowledge Base collection of articles is one of the advantages of subscribing to MySQL Enterprise. For more information, see http://www.mysql.com/products/enterprise/advisors.html.
The following lists describe changes that may affect applications and that you should watch out for when upgrading from MySQL 5.1 to 5.4.
Configuration Changes:
Incompatible change: In
MySQL 5.4, the
innodb_file_io_threads
system variable has been removed and replaced with
innodb_read_io_threads
and
innodb_write_io_threads
. If
you upgrade from MySQL 5.1 to MySQL
5.4 and explicitly set
innodb_file_io_threads
at
server startup, you must change your configuration. Either
remove any reference to
innodb_file_io_threads
or
replace it with references to
innodb_read_io_threads
and
innodb_write_io_threads
.
Incompatible change: From
MySQL 5.4.0 through 5.4.3, several changes were made to the
default or minimum values of the
InnoDB
log file parameters,
innodb_log_files_in_group
and innodb_log_file_size
.
If you upgrade from MySQL 5.1 to 5.4.0 through
5.4.2, or from MySQL 5.4.0 through 5.4.2 to 5.4.3 or higher,
the server may fail to start due to these changes unless you
use the following instructions to discard the old
InnoDB
log files and create new
ones. (You need not discard and re-create the log
files if you upgrade from MySQL 5.1
to MySQL 5.4.3 or higher.)
To re-create the InnoDB
log
files, It is necessary to shut down your current server
cleanly so that no outstanding transaction information
remains in the log. The procedure to use depends on the
value of
innodb_fast_shutdown
used
in your current server:
If innodb_fast_shutdown
is not set to 2: Stop your current MySQL server and make
sure that it shuts down without errors (to ensure that
there is no information for outstanding transactions in
the log). Copy the old log files into a safe place in
case something went wrong during the shutdown and you
need them to recover the tablespace. Delete the old log
files and edit my.cnf
if necessary
to specify the desired log file configuration. Then
upgrade to MySQL 5.4 and start the new
server. mysqld sees that no
InnoDB
log files exist at
startup and creates new ones.
If innodb_fast_shutdown
is set to 2: Shut down your current server, set
innodb_fast_shutdown
to
1, and restart the server. The server should be allowed
to recover. Then you should shut down the server again
and follow the procedure described in the preceding item
to change InnoDB
log file
size. Set
innodb_fast_shutdown
back to 2 and start the MySQL 5.4 server.
Incompatible change: As of
MySQL 5.4.2, the InnoDB Plugin
is
included in MySQL 5.4 releases. It becomes the
built-in version of InnoDB
in MySQL
Server, replacing the version previously included as the
built-in InnoDB
engine. InnoDB
Plugin
is also available in MySQL
5.1 as of 5.1.38, but it is an optional
storage engine that must be enabled explicitly using two
server options:
[mysqld] ignore-builtin-innodb plugin-load=innodb=ha_innodb_plugin.so
If you were using InnoDB Plugin
in MySQL
5.1 by means of those options, you must remove
them after an upgrade to 5.4 or the server will
fail to start.
Server Changes:
Incompatible change: In
MySQL 5.4.2, options for loading plugins such as pluggable
storage engines were changed from boolean to tristate
format. The implementations overlap, but if you previously
used options of the form
--
or
plugin_name
=0--
,
you should instead use
plugin_name
=1--
or
plugin_name
=OFF--
,
respectively. For details, see
Section 5.1.3, “Server Options for Loading Plugins”.
plugin_name
=ON
SQL Changes:
Some keywords may be reserved in MySQL 5.4 that were not reserved in MySQL 5.1. See Section 8.3, “Reserved Words”.
User Comments
Add your own comment.