1MYSQL_UPGRADE(1) MySQL Database System MYSQL_UPGRADE(1)
2
3
4
6 mysql_upgrade - check tables for MySQL upgrade
7
9 mysql_upgrade [options]
10
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 mysql_upgrade finds that a table has a possible incompatibility, it
22 performs a table check and, if problems are found, attempts a table
23 repair. If the table cannot be repaired, see Section 2.13.4,
24 “Rebuilding or Repairing Tables or Indexes” for manual table repair
25 strategies.
26
27 Note
28 On Windows Server 2008, Vista, and newer, 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.13.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.5.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 does not upgrade the contents of the help tables. For
105 upgrade instructions, see Section 5.1.8, “Server-Side Help”.
106
107 mysql_upgrade supports the following options, which can be specified on
108 the command line or in the [mysql_upgrade] and [client] groups of an
109 option file. Other options are passed to mysqlcheck. For example, it
110 might be necessary to specify the --password[=password] option.
111 mysql_upgrade also supports the options for processing option files
112 described at Section 4.2.3.3.1, “Command-Line Options that Affect
113 Option-File Handling”.
114
115 · --help
116
117 Display a short help message and exit.
118
119 · --basedir=path
120
121 The path to the MySQL installation directory. This option is
122 accepted for backward compatibility but ignored.
123
124 · --datadir=path
125
126 The path to the data directory. This option is accepted for
127 backward compatibility but ignored.
128
129 · --debug-check
130
131 Print some debugging information when the program exits. This
132 option was added in MySQL 5.1.21.
133
134 · --debug-info, -T
135
136 Print debugging information and memory and CPU usage statistics
137 when the program exits. This option was added in MySQL 5.1.21.
138
139 · --force
140
141 Ignore the mysql_upgrade_info file and force execution of
142 mysqlcheck even if mysql_upgrade has already been executed for the
143 current version of MySQL.
144
145 · --tmpdir=path, -t path
146
147 The path name of the directory to use for creating temporary files.
148 This option was added in MySQL 5.1.25.
149
150 · --user=user_name, -u user_name
151
152 The MySQL user name to use when connecting to the server. The
153 default user name is root.
154
155 · --verbose
156
157 Verbose mode. Print more information about what the program does.
158
159 · --write-binlog
160
161 Cause binary logging to be enabled while mysql_upgrade runs. This
162 is the default behavior; to disable binary logging during the
163 upgrade, use the inverse of this option (that is, start the program
164 with --skip-write-binlog).
165
166 This option was introduced in MySQL 5.1.40.
167
169 Copyright © 1997, 2011, Oracle and/or its affiliates. All rights
170 reserved.
171
172 This documentation is free software; you can redistribute it and/or
173 modify it only under the terms of the GNU General Public License as
174 published by the Free Software Foundation; version 2 of the License.
175
176 This documentation is distributed in the hope that it will be useful,
177 but WITHOUT ANY WARRANTY; without even the implied warranty of
178 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
179 General Public License for more details.
180
181 You should have received a copy of the GNU General Public License along
182 with the program; if not, write to the Free Software Foundation, Inc.,
183 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA or see
184 http://www.gnu.org/licenses/.
185
186
188 For more information, please refer to the MySQL Reference Manual, which
189 may already be installed locally and which is also available online at
190 http://dev.mysql.com/doc/.
191
193 Oracle Corporation (http://dev.mysql.com/).
194
195
196
197MySQL 5.1 10/26/2011 MYSQL_UPGRADE(1)