2009-09-16 14:03:18 +02:00
'\" t
2009-05-25 11:59:47 +02:00
. \" Title: \fBmysql_upgrade\fR
2009-09-16 14:03:18 +02:00
. \" Author: [FIXME: author] [see http://docbook.sf.net/el/author]
. \" Generator: DocBook XSL Stylesheets v1.75.2 <http://docbook.sf.net/>
2010-04-28 15:06:11 +02:00
. \" Date: 04/06/2010
2009-05-25 11:59:47 +02:00
. \" Manual: MySQL Database System
. \" Source: MySQL 5.1
2009-09-16 14:03:18 +02:00
. \" Language: English
2009-05-25 11:59:47 +02:00
. \"
2010-04-28 15:06:11 +02:00
.TH "\FBMYSQL_UPGRADE\FR" "1" "04/06/2010" "MySQL 5\&.1" "MySQL Database System"
2009-09-16 14:03:18 +02:00
. \" -----------------------------------------------------------------
. \" * set default formatting
. \" -----------------------------------------------------------------
2009-05-25 11:59:47 +02:00
. \" disable hyphenation
.nh
. \" disable justification (adjust text to left margin only)
.ad l
2009-09-16 14:03:18 +02:00
. \" -----------------------------------------------------------------
. \" * MAIN CONTENT STARTS HERE *
. \" -----------------------------------------------------------------
. \" mysql_upgrade
. \" upgrading MySQL
. \" MySQL: upgrading
2009-05-25 11:59:47 +02:00
.SH "NAME"
mysql_upgrade \- check tables for MySQL upgrade
.SH "SYNOPSIS"
2009-09-16 14:03:18 +02:00
.HP \w '\fBmysql_upgrade\ [\fR\fB\fIoptions\fR\fR\fB]\fR\ 'u
2009-05-25 11:59:47 +02:00
\fB mysql_upgrade [\fR \fB \fI options\fR \fR \fB ]\fR
.SH "DESCRIPTION"
.PP
\fB mysql_upgrade\fR
2009-09-16 14:03:18 +02:00
examines all tables in all databases for incompatibilities with the current version of MySQL Server\& .
2009-05-25 11:59:47 +02:00
\fB mysql_upgrade\fR
2009-09-16 14:03:18 +02:00
also upgrades the system tables so that you can take advantage of new privileges or capabilities that might have been added\& .
2009-05-25 11:59:47 +02:00
.PP
\fB mysql_upgrade\fR
2009-09-16 14:03:18 +02:00
should be executed each time you upgrade MySQL\& . It supersedes the older
\fB mysql_fix_privilege_tables\fR
script, which should no longer be used\& .
2009-05-25 11:59:47 +02:00
.PP
2009-09-16 14:03:18 +02:00
If a table is found to have a possible incompatibility,
2009-05-25 11:59:47 +02:00
\fB mysql_upgrade\fR
2009-09-16 14:03:18 +02:00
performs a table check\& . If any problems are found, a table repair is attempted\& . If the table cannot be repaired, see
2009-12-01 08:24:05 +01:00
Section\ \& 2.4.4, \(lq Rebuilding or Repairing Tables or Indexes\(rq
2009-09-16 14:03:18 +02:00
for manual table repair strategies\& .
.if n \{ \
2009-05-25 11:59:47 +02:00
.sp
2009-09-16 14:03:18 +02:00
. \}
.RS 4
2009-05-25 11:59:47 +02:00
.it 1 an-trap
.nr an-no-space-flag 1
.nr an-break-flag 1
.br
2009-09-16 14:03:18 +02:00
.ps +1
2010-04-28 15:06:11 +02:00
\fB Note\fR
.ps -1
.br
.PP
On Windows Server 2008 and Windows Vista, you must run
\fB mysql_upgrade\fR
with administrator privileges\& . You can do this by running a Command Prompt as Administrator and running the command\& . Failure to do so may result in the upgrade failing to execute correctly\& .
.sp .5v
.RE
.if n \{ \
.sp
. \}
.RS 4
.it 1 an-trap
.nr an-no-space-flag 1
.nr an-break-flag 1
.br
.ps +1
2009-05-25 11:59:47 +02:00
\fB Caution\fR
2009-09-16 14:03:18 +02:00
.ps -1
.br
2009-05-25 11:59:47 +02:00
.PP
2009-09-16 14:03:18 +02:00
You should always back up your current MySQL installation
2009-05-25 11:59:47 +02:00
\fI before\fR
2009-09-16 14:03:18 +02:00
performing an upgrade\& . See
2010-04-28 15:06:11 +02:00
Section\ \& 6.2, \(lq Database Backup Methods\(rq \& .
2009-09-16 14:03:18 +02:00
.PP
Some upgrade incompatibilities may require special handling before you upgrade your MySQL installation and run
\fB mysql_upgrade\fR \& . See
2009-12-01 08:24:05 +01:00
Section\ \& 2.4.1, \(lq Upgrading MySQL\(rq , for instructions on determining whether any such incompatibilities apply to your installation and how to handle them\& .
2009-09-16 14:03:18 +02:00
.sp .5v
.RE
.PP
To use
\fB mysql_upgrade\fR , make sure that the server is running, and then invoke it like this:
.sp
.if n \{ \
.RS 4
. \}
.nf
shell> \fB mysql_upgrade [\fR \fB \fI options\fR \fR \fB ]\fR
.fi
.if n \{ \
.RE
. \}
.PP
After running
\fB mysql_upgrade\fR , stop the server and restart it so that any changes made to the system tables take effect\& .
2009-05-25 11:59:47 +02:00
.PP
\fB mysql_upgrade\fR
2009-09-16 14:03:18 +02:00
executes the following commands to check and repair tables and to upgrade the system tables:
2009-05-25 11:59:47 +02:00
.sp
2009-09-16 14:03:18 +02:00
.if n \{ \
.RS 4
. \}
2009-05-25 11:59:47 +02:00
.nf
2009-09-16 14:03:18 +02:00
mysqlcheck \- \- all\- databases \- \- check\- upgrade \- \- auto\- repair
mysql < \fI fix_priv_tables\fR
2009-05-25 11:59:47 +02:00
mysqlcheck \- \- all\- databases \- \- check\- upgrade \- \- fix\- db\- names \- \- fix\- table\- names
.fi
2009-09-16 14:03:18 +02:00
.if n \{ \
2009-05-25 11:59:47 +02:00
.RE
2009-09-16 14:03:18 +02:00
. \}
2009-05-25 11:59:47 +02:00
.PP
2009-09-16 14:03:18 +02:00
Notes about the preceding commands:
.sp
.RS 4
.ie n \{ \
\h '-04'\(bu \h '+03'\c
. \}
.el \{ \
.sp -1
.IP \(bu 2 .3
. \}
Because
\fB mysql_upgrade\fR
invokes
\fB mysqlcheck\fR
with the
\fB \- \- all\- databases\fR
option, it processes all tables in all databases, which might take a long time to complete\& . Each table is locked and therefore unavailable to other sessions while it is being processed\& . Check and repair operations can be time\- consuming, particularly for large tables\& .
.RE
.sp
.RS 4
.ie n \{ \
\h '-04'\(bu \h '+03'\c
. \}
.el \{ \
.sp -1
.IP \(bu 2 .3
. \}
For details about what checks the
\fB \- \- check\- upgrade\fR
option entails, see the description of the
FOR UPGRADE
option of the
CHECK TABLE
statement (see
2010-04-28 15:06:11 +02:00
Section\ \& 12.4.2.3, \(lq CHECK TABLE Syntax\(rq )\& .
2009-09-16 14:03:18 +02:00
.RE
.sp
.RS 4
.ie n \{ \
\h '-04'\(bu \h '+03'\c
. \}
.el \{ \
.sp -1
.IP \(bu 2 .3
. \}
\fI fix_priv_tables\fR
2010-04-28 15:06:11 +02:00
represents a script generated internally by
2009-05-25 11:59:47 +02:00
\fB mysql_upgrade\fR
2009-09-16 14:03:18 +02:00
that contains SQL statements to upgrade the tables in the
mysql
database\& .
.RE
.sp
.RS 4
.ie n \{ \
\h '-04'\(bu \h '+03'\c
. \}
.el \{ \
.sp -1
.IP \(bu 2 .3
. \}
Prior to MySQL 5\& .1\& .31,
\fB mysql_upgrade\fR
does not run the second
\fB mysqlcheck\fR
command, which is necessary to re\- encode database or table names that contain nonalphanumeric characters\& . (They still appear after the upgrade with the
2009-05-25 11:59:47 +02:00
#mysql50#
prefix described in
2009-09-16 14:03:18 +02:00
Section\ \& 8.2.3, \(lq Mapping of Identifiers to File Names\(rq \& .) If you have such database or table names, execute the second
\fB mysqlcheck\fR
command manually after executing
\fB mysql_upgrade\fR \& .
.RE
2009-05-25 11:59:47 +02:00
.PP
2009-09-16 14:03:18 +02:00
All checked and repaired tables are marked with the current MySQL version number\& . This ensures that next time you run
2009-05-25 11:59:47 +02:00
\fB mysql_upgrade\fR
2009-09-16 14:03:18 +02:00
with the same version of the server, it can tell whether there is any need to check or repair the table again\& .
. \" mysql_upgrade_info file: mysql_upgrade
. \" mysql_upgrade: mysql_upgrade_info file
.PP
2009-05-25 11:59:47 +02:00
\fB mysql_upgrade\fR
2009-09-16 14:03:18 +02:00
also saves the MySQL version number in a file named
mysql_upgrade_info
in the data directory\& . This is used to quickly check whether all tables have been checked for this release so that table\- checking can be skipped\& . To ignore this file and perform the check regardless, use the
\fB \- \- force\fR
option\& .
2009-05-25 11:59:47 +02:00
.PP
2009-09-16 14:03:18 +02:00
If you install MySQL from RPM packages on Linux, you must install the server and client RPMs\& .
2009-05-25 11:59:47 +02:00
\fB mysql_upgrade\fR
is included in the server RPM but requires the client RPM because the latter includes
2009-09-16 14:03:18 +02:00
\fB mysqlcheck\fR \& . (See
2009-12-01 08:24:05 +01:00
Section\ \& 2.6.1, \(lq Installing MySQL from RPM Packages on Linux\(rq \& .)
2009-05-25 11:59:47 +02:00
.PP
2009-09-16 14:03:18 +02:00
In MySQL 5\& .1\& .7,
\fB mysql_upgrade \fR
was added as a shell script and worked only for Unix systems\& . As of MySQL 5\& .1\& .10,
\fB mysql_upgrade\fR
is an executable binary and is available on all systems\& .
2009-05-25 11:59:47 +02:00
.PP
\fB mysql_upgrade\fR
2010-04-28 15:06:11 +02:00
supports the following options, which can be specified on the command line or in the
2009-05-25 11:59:47 +02:00
[mysql_upgrade]
2009-09-16 14:03:18 +02:00
and
[client]
2010-04-28 15:06:11 +02:00
option file groups\& . Other options are passed to
2009-09-16 14:03:18 +02:00
\fB mysqlcheck\fR \& . For example, it might be necessary to specify the
2009-05-25 11:59:47 +02:00
\fB \- \- password[=\fR \fB \fI password\fR \fR \fB ]\fR
2009-09-16 14:03:18 +02:00
option\& .
2010-04-28 15:06:11 +02:00
\fB mysql_upgrade\fR
also supports the options for processing option files described at
Section\ \& 4.2.3.3.1, \(lq Command-Line Options that Affect Option-File Handling\(rq \& .
2009-09-16 14:03:18 +02:00
.sp
.RS 4
.ie n \{ \
\h '-04'\(bu \h '+03'\c
. \}
.el \{ \
.sp -1
.IP \(bu 2 .3
. \}
. \" mysql_upgrade: help option
. \" help option: mysql_upgrade
2009-05-25 11:59:47 +02:00
\fB \- \- help\fR
.sp
2009-09-16 14:03:18 +02:00
Display a short help message and exit\& .
.RE
.sp
.RS 4
.ie n \{ \
\h '-04'\(bu \h '+03'\c
. \}
.el \{ \
.sp -1
.IP \(bu 2 .3
. \}
. \" mysql_upgrade: basedir option
. \" basedir option: mysql_upgrade
2009-05-25 11:59:47 +02:00
\fB \- \- basedir=\fR \fB \fI path\fR \fR
.sp
2009-09-16 14:03:18 +02:00
The path to the MySQL installation directory\& . This option is accepted for backward compatibility but ignored\& .
.RE
.sp
.RS 4
.ie n \{ \
\h '-04'\(bu \h '+03'\c
. \}
.el \{ \
.sp -1
.IP \(bu 2 .3
. \}
. \" mysql_upgrade: datadir option
. \" datadir option: mysql_upgrade
2009-05-25 11:59:47 +02:00
\fB \- \- datadir=\fR \fB \fI path\fR \fR
.sp
2009-09-16 14:03:18 +02:00
The path to the data directory\& . This option is accepted for backward compatibility but ignored\& .
.RE
.sp
.RS 4
.ie n \{ \
\h '-04'\(bu \h '+03'\c
. \}
.el \{ \
.sp -1
.IP \(bu 2 .3
. \}
. \" mysql_upgrade: debug-check option
. \" debug-check option: mysql_upgrade
2009-05-25 11:59:47 +02:00
\fB \- \- debug\- check\fR
.sp
2009-09-16 14:03:18 +02:00
Print some debugging information when the program exits\& . This option was added in MySQL 5\& .1\& .21\& .
.RE
.sp
.RS 4
.ie n \{ \
\h '-04'\(bu \h '+03'\c
. \}
.el \{ \
.sp -1
.IP \(bu 2 .3
. \}
. \" mysql_upgrade: debug-info option
. \" debug-info option: mysql_upgrade
2009-05-25 11:59:47 +02:00
\fB \- \- debug\- info\fR ,
\fB \- T\fR
.sp
2009-09-16 14:03:18 +02:00
Print debugging information and memory and CPU usage statistics when the program exits\& . This option was added in MySQL 5\& .1\& .21\& .
.RE
.sp
.RS 4
.ie n \{ \
\h '-04'\(bu \h '+03'\c
. \}
.el \{ \
.sp -1
.IP \(bu 2 .3
. \}
. \" mysql_upgrade: force option
. \" force option: mysql_upgrade
2009-05-25 11:59:47 +02:00
\fB \- \- force\fR
.sp
2009-09-16 14:03:18 +02:00
Ignore the
mysql_upgrade_info
file and force execution of
2009-05-25 11:59:47 +02:00
\fB mysqlcheck\fR
even if
\fB mysql_upgrade\fR
2009-09-16 14:03:18 +02:00
has already been executed for the current version of MySQL\& .
.RE
.sp
.RS 4
.ie n \{ \
\h '-04'\(bu \h '+03'\c
. \}
.el \{ \
.sp -1
.IP \(bu 2 .3
. \}
. \" mysql_upgrade: tmpdir option
. \" tmpdir option: mysql_upgrade
2009-05-25 11:59:47 +02:00
\fB \- \- tmpdir=\fR \fB \fI path\fR \fR ,
\fB \- t \fR \fB \fI path\fR \fR
.sp
2009-09-16 14:03:18 +02:00
The path name of the directory to use for creating temporary files\& . This option was added in MySQL 5\& .1\& .25\& .
.RE
.sp
.RS 4
.ie n \{ \
\h '-04'\(bu \h '+03'\c
. \}
.el \{ \
.sp -1
.IP \(bu 2 .3
. \}
. \" mysql_upgrade: user option
. \" user option: mysql_upgrade
2009-05-25 11:59:47 +02:00
\fB \- \- user=\fR \fB \fI user_name\fR \fR ,
\fB \- u \fR \fB \fI user_name\fR \fR
.sp
2009-09-16 14:03:18 +02:00
The MySQL user name to use when connecting to the server\& . The default user name is
root\& .
.RE
.sp
.RS 4
.ie n \{ \
\h '-04'\(bu \h '+03'\c
. \}
.el \{ \
.sp -1
.IP \(bu 2 .3
. \}
. \" mysql_upgrade: verbose option
. \" verbose option: mysql_upgrade
2009-05-25 11:59:47 +02:00
\fB \- \- verbose\fR
.sp
2009-09-16 14:03:18 +02:00
Verbose mode\& . Print more information about what the program does\& .
.RE
2009-12-01 08:24:05 +01:00
.sp
.RS 4
.ie n \{ \
\h '-04'\(bu \h '+03'\c
. \}
.el \{ \
.sp -1
.IP \(bu 2 .3
. \}
. \" mysql_upgrade: write-binlog option
. \" write-binlog option: mysql_upgrade
\fB \- \- write\- binlog\fR
.sp
Cause binary logging to be enabled while
\fB mysql_upgrade\fR
runs\& . This is the default behavior; to disable binary logging during the upgrade, use the inverse of this option (that is, start the program with
\fB \- \- skip\- write\- binlog\fR )\& .
.sp
This option was introduced in MySQL 5\& .1\& .40\& .
.RE
2009-05-25 11:59:47 +02:00
.SH "COPYRIGHT"
2009-09-16 14:03:18 +02:00
.br
2009-05-25 11:59:47 +02:00
.PP
2010-04-28 15:06:11 +02:00
Copyright 2007-2008 MySQL AB, 2008-2010 Sun Microsystems, Inc.
2009-05-25 11:59:47 +02:00
.PP
This documentation is free software; you can redistribute it and/or modify it only under the terms of the GNU General Public License as published by the Free Software Foundation; version 2 of the License.
.PP
This documentation is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
.PP
2009-09-16 14:03:18 +02:00
You should have received a copy of the GNU General Public License along with the program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA or see http://www.gnu.org/licenses/.
.sp
2009-05-25 11:59:47 +02:00
.SH "SEE ALSO"
For more information, please refer to the MySQL Reference Manual,
which may already be installed locally and which is also available
online at http://dev.mysql.com/doc/.
.SH AUTHOR
2009-09-16 14:03:18 +02:00
Sun Microsystems, Inc. (http://www.mysql.com/).