1MYSQL_UPGRADE(1)             MySQL Database System            MYSQL_UPGRADE(1)
2
3
4

NAME

6       mysql_upgrade - check tables for MySQL upgrade
7

SYNOPSIS

9       mysql_upgrade [options]
10

DESCRIPTION

12       mysql_upgrade examines all tables in all databases for
13       incompatibilities with the current version of MySQL Server.
14       mysql_upgrade also upgrades the system tables so that you can take
15       advantage of new privileges or capabilities that might have been added.
16
17       mysql_upgrade should be executed each time you upgrade MySQL. It
18       supersedes the older mysql_fix_privilege_tables script, which should no
19       longer be used.
20
21       If a table is found to have a possible incompatibility, mysql_upgrade
22       performs a table check. If any problems are found, a table repair is
23       attempted. If the table cannot be repaired, see Section 2.4.4,
24       “Rebuilding or Repairing Tables or Indexes” for manual table repair
25       strategies.
26
27           Note
28           On Windows Server 2008 and Windows Vista, you must run
29           mysql_upgrade with administrator privileges. You can do this by
30           running a Command Prompt as Administrator and running the command.
31           Failure to do so may result in the upgrade failing to execute
32           correctly.
33
34           Caution
35           You should always back up your current MySQL installation before
36           performing an upgrade. See Section 6.2, “Database Backup Methods”.
37
38           Some upgrade incompatibilities may require special handling before
39           you upgrade your MySQL installation and run mysql_upgrade. See
40           Section 2.4.1, “Upgrading MySQL”, for instructions on determining
41           whether any such incompatibilities apply to your installation and
42           how to handle them.
43
44       To use mysql_upgrade, make sure that the server is running, and then
45       invoke it like this:
46
47           shell> mysql_upgrade [options]
48
49       After running mysql_upgrade, stop the server and restart it so that any
50       changes made to the system tables take effect.
51
52       mysql_upgrade executes the following commands to check and repair
53       tables and to upgrade the system tables:
54
55           mysqlcheck --all-databases --check-upgrade --auto-repair
56           mysql < fix_priv_tables
57           mysqlcheck --all-databases --check-upgrade --fix-db-names --fix-table-names
58
59       Notes about the preceding commands:
60
61       ·   Because mysql_upgrade invokes mysqlcheck with the --all-databases
62           option, it processes all tables in all databases, which might take
63           a long time to complete. Each table is locked and therefore
64           unavailable to other sessions while it is being processed. Check
65           and repair operations can be time-consuming, particularly for large
66           tables.
67
68       ·   For details about what checks the --check-upgrade option entails,
69           see the description of the FOR UPGRADE option of the CHECK TABLE
70           statement (see Section 12.4.2.3, “CHECK TABLE Syntax”).
71
72       ·   fix_priv_tables represents a script generated internally by
73           mysql_upgrade that contains SQL statements to upgrade the tables in
74           the mysql database.
75
76       ·   Prior to MySQL 5.1.31, mysql_upgrade does not run the second
77           mysqlcheck command, which is necessary to re-encode database or
78           table names that contain nonalphanumeric characters. (They still
79           appear after the upgrade with the #mysql50# prefix described in
80           Section 8.2.3, “Mapping of Identifiers to File Names”.) If you have
81           such database or table names, execute the second mysqlcheck command
82           manually after executing mysql_upgrade.
83
84       All checked and repaired tables are marked with the current MySQL
85       version number. This ensures that next time you run mysql_upgrade with
86       the same version of the server, it can tell whether there is any need
87       to check or repair the table again.
88
89       mysql_upgrade also saves the MySQL version number in a file named
90       mysql_upgrade_info in the data directory. This is used to quickly check
91       whether all tables have been checked for this release so that
92       table-checking can be skipped. To ignore this file and perform the
93       check regardless, use the --force option.
94
95       If you install MySQL from RPM packages on Linux, you must install the
96       server and client RPMs.  mysql_upgrade is included in the server RPM
97       but requires the client RPM because the latter includes mysqlcheck.
98       (See Section 2.6.1, “Installing MySQL from RPM Packages on Linux”.)
99
100       In MySQL 5.1.7, mysql_upgrade was added as a shell script and worked
101       only for Unix systems. As of MySQL 5.1.10, mysql_upgrade is an
102       executable binary and is available on all systems.
103
104       mysql_upgrade supports the following options, which can be specified on
105       the command line or in the [mysql_upgrade] and [client] option file
106       groups. Other options are passed to mysqlcheck. For example, it might
107       be necessary to specify the --password[=password] option.
108       mysql_upgrade also supports the options for processing option files
109       described at Section 4.2.3.3.1, “Command-Line Options that Affect
110       Option-File Handling”.
111
112       ·   --help
113
114           Display a short help message and exit.
115
116       ·   --basedir=path
117
118           The path to the MySQL installation directory. This option is
119           accepted for backward compatibility but ignored.
120
121       ·   --datadir=path
122
123           The path to the data directory. This option is accepted for
124           backward compatibility but ignored.
125
126       ·   --debug-check
127
128           Print some debugging information when the program exits. This
129           option was added in MySQL 5.1.21.
130
131       ·   --debug-info, -T
132
133           Print debugging information and memory and CPU usage statistics
134           when the program exits. This option was added in MySQL 5.1.21.
135
136       ·   --force
137
138           Ignore the mysql_upgrade_info file and force execution of
139           mysqlcheck even if mysql_upgrade has already been executed for the
140           current version of MySQL.
141
142       ·   --tmpdir=path, -t path
143
144           The path name of the directory to use for creating temporary files.
145           This option was added in MySQL 5.1.25.
146
147       ·   --user=user_name, -u user_name
148
149           The MySQL user name to use when connecting to the server. The
150           default user name is root.
151
152       ·   --verbose
153
154           Verbose mode. Print more information about what the program does.
155
156       ·   --write-binlog
157
158           Cause binary logging to be enabled while mysql_upgrade runs. This
159           is the default behavior; to disable binary logging during the
160           upgrade, use the inverse of this option (that is, start the program
161           with --skip-write-binlog).
162
163           This option was introduced in MySQL 5.1.40.
164
166       Copyright 2007-2008 MySQL AB, 2008-2010 Sun Microsystems, Inc.
167
168       This documentation is free software; you can redistribute it and/or
169       modify it only under the terms of the GNU General Public License as
170       published by the Free Software Foundation; version 2 of the License.
171
172       This documentation is distributed in the hope that it will be useful,
173       but WITHOUT ANY WARRANTY; without even the implied warranty of
174       MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
175       General Public License for more details.
176
177       You should have received a copy of the GNU General Public License along
178       with the program; if not, write to the Free Software Foundation, Inc.,
179       51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA or see
180       http://www.gnu.org/licenses/.
181
182

SEE ALSO

184       For more information, please refer to the MySQL Reference Manual, which
185       may already be installed locally and which is also available online at
186       http://dev.mysql.com/doc/.
187

AUTHOR

189       Sun Microsystems, Inc. (http://www.mysql.com/).
190
191
192
193MySQL 5.1                         04/06/2010                  MYSQL_UPGRADE(1)
Impressum