1MYSQL_UPGRADE(1) MariaDB Database System MYSQL_UPGRADE(1)
2
3
4
6 mysql_upgrade - check tables for MariaDB upgrade
7
9 mysql_upgrade [options]
10
12 mysql_upgrade examines all tables in all databases for
13 incompatibilities with the current version of the MariaDB 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 MariaDB.
18
19 If a table is found to have a possible incompatibility, mysql_upgrade
20 performs a table check. If any problems are found, a table repair is
21 attempted.
22
23 Note
24 On Windows Server 2008 and Windows Vista, you must run
25 mysql_upgrade with administrator privileges. You can do this by
26 running a Command Prompt as Administrator and running the command.
27 Failure to do so may result in the upgrade failing to execute
28 correctly.
29
30 Caution
31 You should always back up your current MariaDB installation before
32 performing an upgrade.
33
34 To use mysql_upgrade, make sure that the server is running, and then
35 invoke it like this:
36
37 shell> mysql_upgrade [options]
38
39 After running mysql_upgrade, stop the server and restart it so that any
40 changes made to the system tables take effect.
41
42 mysql_upgrade executes the following commands to check and repair
43 tables and to upgrade the system tables:
44
45 mysqlcheck --all-databases --check-upgrade --auto-repair
46 mysql < fix_priv_tables
47 mysqlcheck --all-databases --check-upgrade --fix-db-names --fix-table-names
48
49 Notes about the preceding commands:
50
51 • Because mysql_upgrade invokes mysqlcheck with the --all-databases
52 option, it processes all tables in all databases, which might take
53 a long time to complete. Each table is locked and therefore
54 unavailable to other sessions while it is being processed. Check
55 and repair operations can be time-consuming, particularly for large
56 tables.
57
58 • For details about what checks the --check-upgrade option entails,
59 see the description of the FOR UPGRADE option of the CHECK TABLE
60 statement.
61
62 • fix_priv_tables represents a script generated internally by
63 mysql_upgrade that contains SQL statements to upgrade the tables in
64 the mysql database.
65
66 All checked and repaired tables are marked with the current MariaDB
67 version number. This ensures that next time you run mysql_upgrade with
68 the same version of the server, it can tell whether there is any need
69 to check or repair the table again.
70
71 mysql_upgrade also saves the MariaDB version number in a file named
72 mysql_upgrade_info in the data directory. This is used to quickly check
73 whether all tables have been checked for this release so that
74 table-checking can be skipped. To ignore this file and perform the
75 check regardless, use the --force option.
76
77 For this reason, mysql_upgrade needs to be run as a user with write
78 access to the data directory.
79
80 If you install MariaDB from RPM packages on Linux, you must install the
81 server and client RPMs. mysql_upgrade is included in the server RPM
82 but requires the client RPM because the latter includes mysqlcheck.
83
84 mysql_upgrade supports the following options, which can be specified on
85 the command line or in the [mysql_upgrade] and [client] option file
86 groups. Other options are passed to mysqlcheck. For example, it might
87 be necessary to specify the --password[=password] option.
88 mysql_upgrade also supports the options for processing option files.
89
90 • --help, -?
91
92 Display a short help message and exit.
93
94 • --basedir=path
95
96 Old option accepted for backward compatibility but ignored.
97
98 • --character-sets-dir=path
99
100 Old option accepted for backward compatibility but ignored.
101
102 • --check-if-upgrade-is-needed
103
104 Exit with a status code indicating if an upgrade is needed. Returns
105 0 if upgrade needed or current version couldn't be determined, 1
106 when no action required.
107
108 • --datadir=path
109
110 Old option accepted for backward compatibility but ignored.
111
112 • --debug=path, -# path
113
114 For debug builds, output debug log.
115
116 • --debug-check
117
118 Print some debugging information when the program exits.
119
120 • --debug-info, -T
121
122 Print debugging information and memory and CPU usage statistics
123 when the program exits.
124
125 • --default-character-set=name
126
127 Old option accepted for backward compatibility but ignored.
128
129 • --force
130
131 Ignore the mysql_upgrade_info file and force execution of
132 mysqlcheck even if mysql_upgrade has already been executed for the
133 current version of MariaDB.
134
135 • --host
136
137 Connect to MariaDB on the given host.
138
139 • --password[=password], -p[password]
140
141 The password to use when connecting to the server. If you use the
142 short option form (-p), you cannot have a space between the option
143 and the password. If you omit the password value following the
144 --password or -p option on the command line, mysql_upgrade prompts
145 for one.
146
147 Specifying a password on the command line should be considered
148 insecure. You can use an option file to avoid giving the password
149 on the command line.
150
151 • --port=port_num, -P port_num
152
153 The TCP/IP port number to use for the connection.
154
155 • --protocol={TCP|SOCKET|PIPE|MEMORY}
156
157 The connection protocol to use for connecting to the server. It is
158 useful when the other connection parameters normally would cause a
159 protocol to be used other than the one you want.
160
161 • --silent
162
163 Print less information.
164
165 • --socket=path, -S path
166
167 For connections to localhost, the Unix socket file to use, or, on
168 Windows, the name of the named pipe to use.
169
170 • --ssl
171
172 Enable SSL for connection (automatically enabled with other flags).
173 Disable with --skip-ssl.
174
175 • --ssl-ca=name
176
177 CA file in PEM format (check OpenSSL docs, implies --ssl).
178
179 • --ssl-capath=name
180
181 CA directory (check OpenSSL docs, implies --ssl).
182
183 • --ssl-cert=name
184
185 X509 cert in PEM format (check OpenSSL docs, implies --ssl).
186
187 • --ssl-cipher=name
188
189 SSL cipher to use (check OpenSSL docs, implies --ssl).
190
191 • --ssl-key=name
192
193 X509 key in PEM format (check OpenSSL docs, implies --ssl).
194
195 • --ssl-crl=name
196
197 Certificate revocation list (check OpenSSL docs, implies --ssl).
198
199 • --ssl-crlpath=name
200
201 Certificate revocation list path (check OpenSSL docs, implies
202 --ssl).
203
204 • --ssl-verify-server-cert
205
206 Verify server's "Common Name" in its cert against hostname used
207 when connecting. This option is disabled by default.
208
209 • --tmpdir=path, -t path
210
211 The path name of the directory to use for creating temporary files.
212
213 • --upgrade-system-tables, -s
214
215 Only upgrade the system tables in the mysql database. Tables in
216 other databases are not checked or touched.
217
218 • --user=user_name, -u user_name
219
220 The MariaDB user name to use when connecting to the server and not
221 using the current login.
222
223 • --verbose
224
225 Display more output about the process. Using it twice will print
226 connection arguments; using it 3 times will print out all CHECK,
227 RENAME and ALTER TABLE commands used during the check phase; using
228 it 4 times (added in MariaDB 10.0.14) will also write out all
229 mysqlcheck commands used.
230
231 • --version, -V
232
233 Output version information and exit.
234
235 • --version-check, -k
236
237 Run this program only if its 'server version' matches the version
238 of the server to which it's connecting. Note: the 'server version'
239 of the program is the version of the MariaDB server with which it
240 was built/distributed. Defaults to on; use --skip-version-check to
241 disable.
242
243 • --write-binlog
244
245 Cause binary logging to be enabled while mysql_upgrade runs.
246
248 Copyright 2007-2008 MySQL AB, 2008-2010 Sun Microsystems, Inc.,
249 2010-2019 MariaDB Foundation
250
251 This documentation is free software; you can redistribute it and/or
252 modify it only under the terms of the GNU General Public License as
253 published by the Free Software Foundation; version 2 of the License.
254
255 This documentation is distributed in the hope that it will be useful,
256 but WITHOUT ANY WARRANTY; without even the implied warranty of
257 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
258 General Public License for more details.
259
260 You should have received a copy of the GNU General Public License along
261 with the program; if not, write to the Free Software Foundation, Inc.,
262 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA or see
263 http://www.gnu.org/licenses/.
264
265
267 For more information, please refer to the MariaDB Knowledge Base,
268 available online at https://mariadb.com/kb/
269
271 MariaDB Foundation (http://www.mariadb.org/).
272
273
274
275MariaDB 10.5 20 July 2020 MYSQL_UPGRADE(1)