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

NAME

6       mysql_upgrade - check and upgrade MySQL tables
7

SYNOPSIS

9       mysql_upgrade [options]
10

DESCRIPTION

12           Note
13           As of MySQL 8.0.16, the MySQL server performs the upgrade tasks
14           previously handled by mysql_upgrade (for details, see
15           Section 2.10.3, “What the MySQL Upgrade Process Upgrades”).
16           Consequently, mysql_upgrade is unneeded and is deprecated as of
17           that version; expect it to be removed in a future version of MySQL.
18           Because mysql_upgrade no longer performs upgrade tasks, it exits
19           with status 0 unconditionally.
20
21       Each time you upgrade MySQL, you should execute mysql_upgrade, which
22       looks for incompatibilities with the upgraded MySQL server:
23
24       •   It upgrades the system tables in the mysql schema so that you can
25           take advantage of new privileges or capabilities that might have
26           been added.
27
28       •   It upgrades the Performance Schema, INFORMATION_SCHEMA, and sys
29           schema.
30
31       •   It examines user schemas.
32
33       If mysql_upgrade finds that a table has a possible incompatibility, it
34       performs a table check and, if problems are found, attempts a table
35       repair. If the table cannot be repaired, see Section 2.10.13,
36       “Rebuilding or Repairing Tables or Indexes” for manual table repair
37       strategies.
38
39       mysql_upgrade communicates directly with the MySQL server, sending it
40       the SQL statements required to perform an upgrade.
41
42           Caution
43           You should always back up your current MySQL installation before
44           performing an upgrade. See Section 7.2, “Database Backup Methods”.
45
46           Some upgrade incompatibilities may require special handling before
47           upgrading your MySQL installation and running mysql_upgrade. See
48           Section 2.10, “Upgrading MySQL”, for instructions on determining
49           whether any such incompatibilities apply to your installation and
50           how to handle them.
51
52       Use mysql_upgrade like this:
53
54        1. Ensure that the server is running.
55
56        2. Invoke mysql_upgrade to upgrade the system tables in the mysql
57           schema and check and repair tables in other schemas:
58
59               mysql_upgrade [options]
60
61        3. Stop the server and restart it so that any system table changes
62           take effect.
63
64       If you have multiple MySQL server instances to upgrade, invoke
65       mysql_upgrade with connection parameters appropriate for connecting to
66       each of the desired servers. For example, with servers running on the
67       local host on parts 3306 through 3308, upgrade each of them by
68       connecting to the appropriate port:
69
70           mysql_upgrade --protocol=tcp -P 3306 [other_options]
71           mysql_upgrade --protocol=tcp -P 3307 [other_options]
72           mysql_upgrade --protocol=tcp -P 3308 [other_options]
73
74       For local host connections on Unix, the --protocol=tcp option forces a
75       connection using TCP/IP rather than the Unix socket file.
76
77       By default, mysql_upgrade runs as the MySQL root user. If the root
78       password is expired when you run mysql_upgrade, it displays a message
79       that your password is expired and that mysql_upgrade failed as a
80       result. To correct this, reset the root password to unexpire it and run
81       mysql_upgrade again. First, connect to the server as root:
82
83           $> mysql -u root -p
84           Enter password: ****  <- enter root password here
85
86       Reset the password using ALTER USER:
87
88           mysql> ALTER USER USER() IDENTIFIED BY 'root-password';
89
90       Then exit mysql and run mysql_upgrade again:
91
92           $> mysql_upgrade [options]
93
94
95           Note
96           If you run the server with the disabled_storage_engines system
97           variable set to disable certain storage engines (for example,
98           MyISAM), mysql_upgrade might fail with an error like this:
99
100               mysql_upgrade: [ERROR] 3161: Storage engine MyISAM is disabled
101               (Table creation is disallowed).
102
103           To handle this, restart the server with disabled_storage_engines
104           disabled. Then you should be able to run mysql_upgrade
105           successfully. After that, restart the server with
106           disabled_storage_engines set to its original value.
107
108       Unless invoked with the --upgrade-system-tables option, mysql_upgrade
109       processes all tables in all user schemas as necessary. Table checking
110       might take a long time to complete. Each table is locked and therefore
111       unavailable to other sessions while it is being processed. Check and
112       repair operations can be time-consuming, particularly for large tables.
113       Table checking uses the FOR UPGRADE option of the CHECK TABLE
114       statement. For details about what this option entails, see
115       Section 13.7.3.2, “CHECK TABLE Statement”.
116
117       mysql_upgrade marks all checked and repaired tables with the current
118       MySQL version number. This ensures that the next time you run
119       mysql_upgrade with the same version of the server, it can be determined
120       whether there is any need to check or repair a given table again.
121
122       mysql_upgrade saves the MySQL version number in a file named
123       mysql_upgrade_info in the data directory. This is used to quickly check
124       whether all tables have been checked for this release so that
125       table-checking can be skipped. To ignore this file and perform the
126       check regardless, use the --force option.
127
128           Note
129           The mysql_upgrade_info file is deprecated; expect it to be removed
130           in a future version of MySQL.
131
132       mysql_upgrade checks mysql.user system table rows and, for any row with
133       an empty plugin column, sets that column to 'mysql_native_password' if
134       the credentials use a hash format compatible with that plugin. Rows
135       with a pre-4.1 password hash must be upgraded manually.
136
137       mysql_upgrade does not upgrade the contents of the time zone tables or
138       help tables. For upgrade instructions, see Section 5.1.15, “MySQL
139       Server Time Zone Support”, and Section 5.1.17, “Server-Side Help
140       Support”.
141
142       Unless invoked with the --skip-sys-schema option, mysql_upgrade
143       installs the sys schema if it is not installed, and upgrades it to the
144       current version otherwise. An error occurs if a sys schema exists but
145       has no version view, on the assumption that its absence indicates a
146       user-created schema:
147
148           A sys schema exists with no sys.version view. If
149           you have a user created sys schema, this must be renamed for the
150           upgrade to succeed.
151
152       To upgrade in this case, remove or rename the existing sys schema
153       first.
154
155       mysql_upgrade supports the following options, which can be specified on
156       the command line or in the [mysql_upgrade] and [client] groups of an
157       option file. For information about option files used by MySQL programs,
158       see Section 4.2.2.2, “Using Option Files”.
159
160--help Display a short help message and exit.
161
162--bind-address=ip_address On a computer having multiple network
163           interfaces, use this option to select which interface to use for
164           connecting to the MySQL server.
165
166--character-sets-dir=dir_name The directory where character sets
167           are installed. See Section 10.15, “Character Set Configuration”.
168
169--compress, -C Compress all information sent between the client and
170           the server if possible. See Section 4.2.8, “Connection Compression
171           Control”.
172
173           As of MySQL 8.0.18, this option is deprecated. Expect it to be
174           removed in a future version of MySQL. See the section called
175           “Configuring Legacy Connection Compression”.
176
177--compression-algorithms=value The permitted compression algorithms
178           for connections to the server. The available algorithms are the
179           same as for the protocol_compression_algorithms system variable.
180           The default value is uncompressed.
181
182           For more information, see Section 4.2.8, “Connection Compression
183           Control”.
184
185           This option was added in MySQL 8.0.18.
186
187--debug[=debug_options], -# [debug_options] Write a debugging log.
188           A typical debug_options string is d:t:o,file_name. The default is
189           d:t:O,/tmp/mysql_upgrade.trace.
190
191--debug-check Print some debugging information when the program
192           exits.
193
194--debug-info, -T Print debugging information and memory and CPU
195           usage statistics when the program exits.
196
197--default-auth=plugin A hint about which client-side authentication
198           plugin to use. See Section 6.2.17, “Pluggable Authentication”.
199
200--default-character-set=charset_name Use charset_name as the
201           default character set. See Section 10.15, “Character Set
202           Configuration”.
203
204--defaults-extra-file=file_name Read this option file after the
205           global option file but (on Unix) before the user option file. If
206           the file does not exist or is otherwise inaccessible, an error
207           occurs. If file_name is not an absolute path name, it is
208           interpreted relative to the current directory.
209
210           For additional information about this and other option-file
211           options, see Section 4.2.2.3, “Command-Line Options that Affect
212           Option-File Handling”.
213
214--defaults-file=file_name Use only the given option file. If the
215           file does not exist or is otherwise inaccessible, an error occurs.
216           If file_name is not an absolute path name, it is interpreted
217           relative to the current directory.
218
219           For additional information about this and other option-file
220           options, see Section 4.2.2.3, “Command-Line Options that Affect
221           Option-File Handling”.
222
223--defaults-group-suffix=str Read not only the usual option groups,
224           but also groups with the usual names and a suffix of str. For
225           example, mysql_upgrade normally reads the [client] and
226           [mysql_upgrade] groups. If this option is given as
227           --defaults-group-suffix=_other, mysql_upgrade also reads the
228           [client_other] and [mysql_upgrade_other] groups.
229
230           For additional information about this and other option-file
231           options, see Section 4.2.2.3, “Command-Line Options that Affect
232           Option-File Handling”.
233
234--force Ignore the mysql_upgrade_info file and force execution even
235           if mysql_upgrade has already been executed for the current version
236           of MySQL.
237
238--get-server-public-key Request from the server the public key
239           required for RSA key pair-based password exchange. This option
240           applies to clients that authenticate with the caching_sha2_password
241           authentication plugin. For that plugin, the server does not send
242           the public key unless requested. This option is ignored for
243           accounts that do not authenticate with that plugin. It is also
244           ignored if RSA-based password exchange is not used, as is the case
245           when the client connects to the server using a secure connection.
246
247           If --server-public-key-path=file_name is given and specifies a
248           valid public key file, it takes precedence over
249           --get-server-public-key.
250
251           For information about the caching_sha2_password plugin, see
252           Section 6.4.1.2, “Caching SHA-2 Pluggable Authentication”.
253
254--host=host_name, -h host_name Connect to the MySQL server on the
255           given host.
256
257--login-path=name Read options from the named login path in the
258           .mylogin.cnf login path file. A “login path” is an option group
259           containing options that specify which MySQL server to connect to
260           and which account to authenticate as. To create or modify a login
261           path file, use the mysql_config_editor utility. See
262           mysql_config_editor(1).
263
264           For additional information about this and other option-file
265           options, see Section 4.2.2.3, “Command-Line Options that Affect
266           Option-File Handling”.
267
268--max-allowed-packet=value The maximum size of the buffer for
269           client/server communication. The default value is 24MB. The minimum
270           and maximum values are 4KB and 2GB.
271
272--net-buffer-length=value The initial size of the buffer for
273           client/server communication. The default value is 1MB − 1KB. The
274           minimum and maximum values are 4KB and 16MB.
275
276--no-defaults Do not read any option files. If program startup
277           fails due to reading unknown options from an option file,
278           --no-defaults can be used to prevent them from being read.
279
280           The exception is that the .mylogin.cnf file is read in all cases,
281           if it exists. This permits passwords to be specified in a safer way
282           than on the command line even when --no-defaults is used. To create
283           .mylogin.cnf, use the mysql_config_editor utility. See
284           mysql_config_editor(1).
285
286           For additional information about this and other option-file
287           options, see Section 4.2.2.3, “Command-Line Options that Affect
288           Option-File Handling”.
289
290--password[=password], -p[password] The password of the MySQL
291           account used for connecting to the server. The password value is
292           optional. If not given, mysql_upgrade prompts for one. If given,
293           there must be no space between --password= or -p and the password
294           following it. If no password option is specified, the default is to
295           send no password.
296
297           Specifying a password on the command line should be considered
298           insecure. To avoid giving the password on the command line, use an
299           option file. See Section 6.1.2.1, “End-User Guidelines for Password
300           Security”.
301
302           To explicitly specify that there is no password and that
303           mysql_upgrade should not prompt for one, use the --skip-password
304           option.
305
306--pipe, -W On Windows, connect to the server using a named pipe.
307           This option applies only if the server was started with the
308           named_pipe system variable enabled to support named-pipe
309           connections. In addition, the user making the connection must be a
310           member of the Windows group specified by the
311           named_pipe_full_access_group system variable.
312
313--plugin-dir=dir_name The directory in which to look for plugins.
314           Specify this option if the --default-auth option is used to specify
315           an authentication plugin but mysql_upgrade does not find it. See
316           Section 6.2.17, “Pluggable Authentication”.
317
318--port=port_num, -P port_num For TCP/IP connections, the port
319           number to use.
320
321--print-defaults Print the program name and all options that it
322           gets from option files.
323
324--protocol={TCP|SOCKET|PIPE|MEMORY} The transport protocol to use
325           for connecting to the server. It is useful when the other
326           connection parameters normally result in use of a protocol other
327           than the one you want. For details on the permissible values, see
328           Section 4.2.7, “Connection Transport Protocols”.
329
330--server-public-key-path=file_name The path name to a file in PEM
331           format containing a client-side copy of the public key required by
332           the server for RSA key pair-based password exchange. This option
333           applies to clients that authenticate with the sha256_password or
334           caching_sha2_password authentication plugin. This option is ignored
335           for accounts that do not authenticate with one of those plugins. It
336           is also ignored if RSA-based password exchange is not used, as is
337           the case when the client connects to the server using a secure
338           connection.
339
340           If --server-public-key-path=file_name is given and specifies a
341           valid public key file, it takes precedence over
342           --get-server-public-key.
343
344           For sha256_password, this option applies only if MySQL was built
345           using OpenSSL.
346
347           For information about the sha256_password and caching_sha2_password
348           plugins, see Section 6.4.1.3, “SHA-256 Pluggable Authentication”,
349           and Section 6.4.1.2, “Caching SHA-2 Pluggable Authentication”.
350
351--shared-memory-base-name=name On Windows, the shared-memory name
352           to use for connections made using shared memory to a local server.
353           The default value is MYSQL. The shared-memory name is
354           case-sensitive.
355
356           This option applies only if the server was started with the
357           shared_memory system variable enabled to support shared-memory
358           connections.
359
360--skip-sys-schema By default, mysql_upgrade installs the sys schema
361           if it is not installed, and upgrades it to the current version
362           otherwise. The --skip-sys-schema option suppresses this behavior.
363
364--socket=path, -S path For connections to localhost, the Unix
365           socket file to use, or, on Windows, the name of the named pipe to
366           use.
367
368           On Windows, this option applies only if the server was started with
369           the named_pipe system variable enabled to support named-pipe
370           connections. In addition, the user making the connection must be a
371           member of the Windows group specified by the
372           named_pipe_full_access_group system variable.
373
374--ssl* Options that begin with --ssl specify whether to connect to
375           the server using encryption and indicate where to find SSL keys and
376           certificates. See the section called “Command Options for Encrypted
377           Connections”.
378
379--ssl-fips-mode={OFF|ON|STRICT} Controls whether to enable FIPS
380           mode on the client side. The --ssl-fips-mode option differs from
381           other --ssl-xxx options in that it is not used to establish
382           encrypted connections, but rather to affect which cryptographic
383           operations to permit. See Section 6.8, “FIPS Support”.
384
385           These --ssl-fips-mode values are permitted:
386
387           •   OFF: Disable FIPS mode.
388
389           •   ON: Enable FIPS mode.
390
391           •   STRICT: Enable “strict” FIPS mode.
392
393
394               Note
395               If the OpenSSL FIPS Object Module is not available, the only
396               permitted value for --ssl-fips-mode is OFF. In this case,
397               setting --ssl-fips-mode to ON or STRICT causes the client to
398               produce a warning at startup and to operate in non-FIPS mode.
399           As of MySQL 8.0.34, this option is deprecated. Expect it to be
400           removed in a future version of MySQL.
401
402--tls-ciphersuites=ciphersuite_list The permissible ciphersuites
403           for encrypted connections that use TLSv1.3. The value is a list of
404           one or more colon-separated ciphersuite names. The ciphersuites
405           that can be named for this option depend on the SSL library used to
406           compile MySQL. For details, see Section 6.3.2, “Encrypted
407           Connection TLS Protocols and Ciphers”.
408
409           This option was added in MySQL 8.0.16.
410
411--tls-version=protocol_list The permissible TLS protocols for
412           encrypted connections. The value is a list of one or more
413           comma-separated protocol names. The protocols that can be named for
414           this option depend on the SSL library used to compile MySQL. For
415           details, see Section 6.3.2, “Encrypted Connection TLS Protocols and
416           Ciphers”.
417
418--upgrade-system-tables, -s Upgrade only the system tables in the
419           mysql schema, do not upgrade user schemas.
420
421--user=user_name, -u user_name The user name of the MySQL account
422           to use for connecting to the server. The default user name is root.
423
424--verbose Verbose mode. Print more information about what the
425           program does.
426
427--version-check, -k Check the version of the server to which
428           mysql_upgrade is connecting to verify that it is the same as the
429           version for which mysql_upgrade was built. If not, mysql_upgrade
430           exits. This option is enabled by default; to disable the check, use
431           --skip-version-check.
432
433--write-binlog By default, binary logging by mysql_upgrade is
434           disabled. Invoke the program with --write-binlog if you want its
435           actions to be written to the binary log.
436
437           When the server is running with global transaction identifiers
438           (GTIDs) enabled (gtid_mode=ON), do not enable binary logging by
439           mysql_upgrade.
440
441--zstd-compression-level=level The compression level to use for
442           connections to the server that use the zstd compression algorithm.
443           The permitted levels are from 1 to 22, with larger values
444           indicating increasing levels of compression. The default zstd
445           compression level is 3. The compression level setting has no effect
446           on connections that do not use zstd compression.
447
448           For more information, see Section 4.2.8, “Connection Compression
449           Control”.
450
451           This option was added in MySQL 8.0.18.
452
454       Copyright © 1997, 2023, Oracle and/or its affiliates.
455
456       This documentation is free software; you can redistribute it and/or
457       modify it only under the terms of the GNU General Public License as
458       published by the Free Software Foundation; version 2 of the License.
459
460       This documentation is distributed in the hope that it will be useful,
461       but WITHOUT ANY WARRANTY; without even the implied warranty of
462       MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
463       General Public License for more details.
464
465       You should have received a copy of the GNU General Public License along
466       with the program; if not, write to the Free Software Foundation, Inc.,
467       51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA or see
468       http://www.gnu.org/licenses/.
469
470

SEE ALSO

472       For more information, please refer to the MySQL Reference Manual, which
473       may already be installed locally and which is also available online at
474       http://dev.mysql.com/doc/.
475

AUTHOR

477       Oracle Corporation (http://dev.mysql.com/).
478
479
480
481MySQL 8.0                         08/31/2023                  MYSQL_UPGRADE(1)
Impressum