'\" t
.\"
.TH "\fBMARIADB-UPGRADE\fR" "1" "20 July 2020" "MariaDB 10.11" "MariaDB Database System"
.\" -----------------------------------------------------------------
.\" * set default formatting
.\" -----------------------------------------------------------------
.\" disable hyphenation
.nh
.\" disable justification (adjust text to left margin only)
.ad l
.\" -----------------------------------------------------------------
.\" * MAIN CONTENT STARTS HERE *
.\" -----------------------------------------------------------------
.\" mysql_upgrade
.\" upgrading MySQL
.\" MySQL: upgrading
.SH "NAME"
mariadb-upgrade \- check tables for MariaDB upgrade (mysql_upgrade is now a symlink to mariadb-upgrade)
.SH "SYNOPSIS"
.HP \w'\fBmysql_upgrade\ [\fR\fB\fIoptions\fR\fR\fB]\fR\ 'u
\fBmysql_upgrade [\fR\fB\fIoptions\fR\fR\fB]\fR
.SH "DESCRIPTION"
.PP
\fBmysql_upgrade\fR
examines all tables in all databases for incompatibilities with the current version of the MariaDB Server\&.
\fBmysql_upgrade\fR
also upgrades the system tables so that you can take advantage of new privileges or capabilities that might have been added\&.
.PP
\fBmysql_upgrade\fR
should be executed each time you upgrade MariaDB\&.
.PP
If a table is found to have a possible incompatibility,
\fBmysql_upgrade\fR
performs a table check\&. If any problems are found, a table repair is attempted\&.
.if n \{\
.sp
.\}
.RS 4
.it 1
.nr an-no-space-flag 1
.nr an-break-flag 1
.br
.ps +1
\fBNote\fR
.ps -1
.br
.PP
On Windows Server 2008 and Windows Vista, you must run
\fBmysql_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
.nr an-no-space-flag 1
.nr an-break-flag 1
.br
.ps +1
\fBCaution\fR
.ps -1
.br
.PP
You should always back up your current MariaDB installation
\fIbefore\fR
performing an upgrade\&.
.sp .5v
.RE
.PP
To use
\fBmysql_upgrade\fR, make sure that the server is running, and then invoke it like this:
.sp
.if n \{\
.RS 4
.\}
.nf
shell> \fBmysql_upgrade [\fR\fB\fIoptions\fR\fR\fB]\fR
.fi
.if n \{\
.RE
.\}
.PP
After running
\fBmysql_upgrade\fR, stop the server and restart it so that any changes made to the system tables take effect\&.
.PP
\fBmysql_upgrade\fR
executes the following commands to check and repair tables and to upgrade the system tables:
.sp
.if n \{\
.RS 4
.\}
.nf
mysqlcheck \-\-all\-databases \-\-check\-upgrade \-\-auto\-repair
mysql < \fIfix_priv_tables\fR
mysqlcheck \-\-all\-databases \-\-check\-upgrade \-\-fix\-db\-names \-\-fix\-table\-names
.fi
.if n \{\
.RE
.\}
.PP
Notes about the preceding commands:
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
Because
\fBmysql_upgrade\fR
invokes
\fBmysqlcheck\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\&.
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
\fIfix_priv_tables\fR
represents a script generated internally by
\fBmysql_upgrade\fR
that contains SQL statements to upgrade the tables in the
mysql
database\&.
.RE
.PP
All checked and repaired tables are marked with the current MariaDB version number\&. This ensures that next time you run
\fBmysql_upgrade\fR
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
\fBmysql_upgrade\fR
also saves the MariaDB 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\&.
.PP
For this reason, \fBmysql_upgrade\fR needs to be run as a user with write access to the data directory\&.
.PP
If you install MariaDB from RPM packages on Linux, you must install the server and client RPMs\&.
\fBmysql_upgrade\fR
is included in the server RPM but requires the client RPM because the latter includes
\fBmysqlcheck\fR\&.
.PP
.PP
\fBmysql_upgrade\fR
supports the following options, which can be specified on the command line or in the
[mysql_upgrade]
and
[client]
option file groups\&. Other options are passed to
\fBmysqlcheck\fR\&. For example, it might be necessary to specify the
\fB\-\-password[=\fR\fB\fIpassword\fR\fR\fB]\fR
option\&.
\fBmysql_upgrade\fR
also supports the options for processing option files\&.
.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
\fB\-\-help\fR,
\fB\-?\fR
.sp
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
\fB\-\-basedir=\fR\fB\fIpath\fR\fR
.sp
Old option 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: character-sets-dir option
.\" character-sets-dir option: mysql_upgrade
\fB\-\-character\-sets\-dir=\fR\fB\fIpath\fR\fR
.sp
Old option 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: check-if-upgrade-is-needed option
.\" check-if-upgrade-is-needed option: mysql_upgrade
\fB\-\-check\-if\-upgrade\-is\-needed\fR
.sp
Exit with a status code indicating if an upgrade is needed\&. Returns 0 if upgrade needed or current version couldn't be determined, 1 when no action required\&.
.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
\fB\-\-datadir=\fR\fB\fIpath\fR\fR
.sp
Old option 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 option
.\" debug option: mysql_upgrade
\fB\-\-debug=\fR\fB\fIpath\fR\fR,
\fB\-# \fIpath\fR\fR
.sp
For debug builds, output debug log\&.
.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
\fB\-\-debug\-check\fR
.sp
Print some debugging information when the program exits\&.
.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
\fB\-\-debug\-info\fR,
\fB\-T\fR
.sp
Print debugging information and memory and CPU usage statistics when the program exits\&.
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
.\" mysql_upgrade: default-character-set option
.\" default-character-set option: mysql_upgrade
\fB\-\-default\-character\-set=\fR\fB\fIname\fR\fR
.sp
Old option 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: force option
.\" force option: mysql_upgrade
\fB\-\-force\fR
.sp
Ignore the
mysql_upgrade_info
file and force execution of
\fBmysqlcheck\fR
even if
\fBmysql_upgrade\fR
has already been executed for the current version of MariaDB\&.
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
.\" mysql_upgrade: host option
.\" host option: mysql_upgrade
\fB\-\-host\fR
.sp
Connect to MariaDB on the given host\&.
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
.\" mysql_upgrade: password option
.\" password option: mysql_upgrade
\fB\-\-password[=\fR\fB\fIpassword\fR\fR\fB]\fR,
\fB\-p[\fR\fB\fIpassword\fR\fR\fB]\fR
.sp
The password to use when connecting to the server\&. If you use the short option form (\fB\-p\fR), you
\fIcannot\fR
have a space between the option and the password\&. If you omit the
\fIpassword\fR
value following the
\fB\-\-password\fR
or
\fB\-p\fR
option on the command line,
\fBmysql_upgrade\fR
prompts for one\&.
.sp
Specifying a password on the command line should be considered insecure\&. You can use an option file to avoid giving the password on the command line\&.
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
.\" mysql_upgrade: port option
.\" port option: mysql_upgrade
\fB\-\-port=\fR\fB\fIport_num\fR\fR,
\fB\-P \fR\fB\fIport_num\fR\fR
.sp
The TCP/IP port number to use for the connection\&.
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
.\" mysql_upgrade: protocol option
.\" protocol option: mysql_upgrade
\fB\-\-protocol={TCP|SOCKET|PIPE|MEMORY}\fR
.sp
The connection protocol to use for connecting to the server\&. It is useful when the other connection parameters normally would cause a protocol to be used other than the one you want\&.
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
.\" mysql_upgrade: silent option
.\" silent option: mysql_upgrade
\fB\-\-silent\fR
.sp
Print less information\&.
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
.\" mysql_upgrade: socket option
.\" socket option: mysql_upgrade
\fB\-\-socket=\fR\fB\fIpath\fR\fR,
\fB\-S \fR\fB\fIpath\fR\fR
.sp
For connections to
localhost, the Unix socket file to use, or, on Windows, the name of the named pipe to use\&.
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
.\" mysql_upgrade: SSL options
.\" SSL options: mysql_upgrade
\fB\-\-ssl\fR
.sp
Enable SSL for connection (automatically enabled with other flags). Disable with 
\fB\-\-skip-ssl\fR\&.
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
.\" mysql_upgrade: SSL CA option
.\" SSL CA option: mysql_upgrade
\fB\-\-ssl\-ca=\fIname\fR
.sp
CA file in PEM format (check OpenSSL docs, implies
\fB\-\-ssl\fR)\&.
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
.\" mysql_upgrade: SSL CA Path option
.\" SSL CA Path option: mysql_upgrade
\fB\-\-ssl\-capath=\fIname\fR
.sp
CA directory (check OpenSSL docs, implies
\fB\-\-ssl\fR)\&.
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
.\" mysql_upgrade: SSL Cert option
.\" SSL Cert option: mysql_upgrade
\fB\-\-ssl\-cert=\fIname\fR
.sp
X509 cert in PEM format (check OpenSSL docs, implies
\fB\-\-ssl\fR)\&.
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
.\" mysql_upgrade: SSL Cipher option
.\" SSL Cipher option: mysql_upgrade
\fB\-\-ssl\-cipher=\fIname\fR
.sp
SSL cipher to use (check OpenSSL docs, implies
\fB\-\-ssl\fR)\&.
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
.\" mysql_upgrade: SSL Key option
.\" SSL Key option: mysql_upgrade
\fB\-\-ssl\-key=\fIname\fR
.sp
X509 key in PEM format (check OpenSSL docs, implies
\fB\-\-ssl\fR)\&.
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
.\" mysql_upgrade: SSL Crl option
.\" SSL CRL option: mysql_upgrade
\fB\-\-ssl\-crl=\fIname\fR
.sp
Certificate revocation list (check OpenSSL docs, implies
\fB\-\-ssl\fR)\&.
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
.\" mysql_upgrade: SSL Crlpath option
.\" SSL Crlpath option: mysql_upgrade
\fB\-\-ssl\-crlpath=\fIname\fR
.sp
Certificate revocation list path (check OpenSSL docs, implies
\fB\-\-ssl\fR)\&.
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
.\" mysql_upgrade: SSL Verify Server Cert option
.\" SSL Verify Server Cert option: mysql_upgrade
\fB\-\-ssl\-verify\-server\-cert\fR
.sp
Verify server's "Common Name" in its cert against hostname used when connecting. This option is disabled by default\&.
.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
\fB\-\-tmpdir=\fR\fB\fIpath\fR\fR,
\fB\-t \fR\fB\fIpath\fR\fR
.sp
The path name of the directory to use for creating temporary files\&.
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
.\" mysql_upgrade: upgrade-system-tables option
.\" upgrade-system-tables option: mysql_upgrade
\fB\-\-upgrade\-system\-tables\fR\fR,
\fB\-s \fR
.sp
Only upgrade the system tables in the mysql database\&. Tables in other databases are not checked or touched\&.
.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
\fB\-\-user=\fR\fB\fIuser_name\fR\fR,
\fB\-u \fR\fB\fIuser_name\fR\fR
.sp
The MariaDB user name to use when connecting to the server and not using the current login\&.
.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
\fB\-\-verbose\fR
.sp
Display more output about the process\&. Using it twice will print connection 
arguments; using it 3 times will print out all CHECK, RENAME and ALTER TABLE 
commands used during the check phase; using it 4 times (added in MariaDB 10.0.14)
will also write out all mariadb-check commands used; using it 5 times will print all
the mariadb commands used and their results while running mysql_fix_privilege_tables script\&.
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
.\" mysql_upgrade: version option
.\" version option: mysql_upgrade
\fB\-\-version\fR,
\fB\-V\fR
.sp
Output version information and exit\&.
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
.\" mysql_upgrade: version-check option
.\" version-check option: mysql_upgrade
\fB\-\-version\-check\fR,
\fB\-k\fR
.sp
Run this program only if its 'server version' matches the version 
of the server to which it's connecting. Note: the 'server version' 
of the program is the version of the MariaDB server with which 
it was built/distributed. Defaults to on; use \fB\-\-skip\-version\-check\fR to disable\&.
.RE
.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
\fBmysql_upgrade\fR
runs\&.
.RE
.SH "COPYRIGHT"
.br
.PP
Copyright 2007-2008 MySQL AB, 2008-2010 Sun Microsystems, Inc., 2010-2020 MariaDB Foundation
.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
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-1335 USA or see http://www.gnu.org/licenses/.
.sp
.SH "SEE ALSO"
For more information, please refer to the MariaDB Documentation, available online at https://mariadb.com/docs/
.SH AUTHOR
MariaDB Foundation (http://www.mariadb.org/).
