You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

411 lines
11 KiB

  1. '\" t
  2. .\" Title: \fBmysql_upgrade\fR
  3. .\" Author: [FIXME: author] [see http://docbook.sf.net/el/author]
  4. .\" Generator: DocBook XSL Stylesheets v1.75.2 <http://docbook.sf.net/>
  5. .\" Date: 04/06/2010
  6. .\" Manual: MySQL Database System
  7. .\" Source: MySQL 5.1
  8. .\" Language: English
  9. .\"
  10. .TH "\FBMYSQL_UPGRADE\FR" "1" "04/06/2010" "MySQL 5\&.1" "MySQL Database System"
  11. .\" -----------------------------------------------------------------
  12. .\" * set default formatting
  13. .\" -----------------------------------------------------------------
  14. .\" disable hyphenation
  15. .nh
  16. .\" disable justification (adjust text to left margin only)
  17. .ad l
  18. .\" -----------------------------------------------------------------
  19. .\" * MAIN CONTENT STARTS HERE *
  20. .\" -----------------------------------------------------------------
  21. .\" mysql_upgrade
  22. .\" upgrading MySQL
  23. .\" MySQL: upgrading
  24. .SH "NAME"
  25. mysql_upgrade \- check tables for MySQL upgrade
  26. .SH "SYNOPSIS"
  27. .HP \w'\fBmysql_upgrade\ [\fR\fB\fIoptions\fR\fR\fB]\fR\ 'u
  28. \fBmysql_upgrade [\fR\fB\fIoptions\fR\fR\fB]\fR
  29. .SH "DESCRIPTION"
  30. .PP
  31. \fBmysql_upgrade\fR
  32. examines all tables in all databases for incompatibilities with the current version of MySQL Server\&.
  33. \fBmysql_upgrade\fR
  34. also upgrades the system tables so that you can take advantage of new privileges or capabilities that might have been added\&.
  35. .PP
  36. \fBmysql_upgrade\fR
  37. should be executed each time you upgrade MySQL\&. It supersedes the older
  38. \fBmysql_fix_privilege_tables\fR
  39. script, which should no longer be used\&.
  40. .PP
  41. If a table is found to have a possible incompatibility,
  42. \fBmysql_upgrade\fR
  43. performs a table check\&. If any problems are found, a table repair is attempted\&. If the table cannot be repaired, see
  44. Section\ \&2.4.4, \(lqRebuilding or Repairing Tables or Indexes\(rq
  45. for manual table repair strategies\&.
  46. .if n \{\
  47. .sp
  48. .\}
  49. .RS 4
  50. .it 1 an-trap
  51. .nr an-no-space-flag 1
  52. .nr an-break-flag 1
  53. .br
  54. .ps +1
  55. \fBNote\fR
  56. .ps -1
  57. .br
  58. .PP
  59. On Windows Server 2008 and Windows Vista, you must run
  60. \fBmysql_upgrade\fR
  61. 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\&.
  62. .sp .5v
  63. .RE
  64. .if n \{\
  65. .sp
  66. .\}
  67. .RS 4
  68. .it 1 an-trap
  69. .nr an-no-space-flag 1
  70. .nr an-break-flag 1
  71. .br
  72. .ps +1
  73. \fBCaution\fR
  74. .ps -1
  75. .br
  76. .PP
  77. You should always back up your current MySQL installation
  78. \fIbefore\fR
  79. performing an upgrade\&. See
  80. Section\ \&6.2, \(lqDatabase Backup Methods\(rq\&.
  81. .PP
  82. Some upgrade incompatibilities may require special handling before you upgrade your MySQL installation and run
  83. \fBmysql_upgrade\fR\&. See
  84. Section\ \&2.4.1, \(lqUpgrading MySQL\(rq, for instructions on determining whether any such incompatibilities apply to your installation and how to handle them\&.
  85. .sp .5v
  86. .RE
  87. .PP
  88. To use
  89. \fBmysql_upgrade\fR, make sure that the server is running, and then invoke it like this:
  90. .sp
  91. .if n \{\
  92. .RS 4
  93. .\}
  94. .nf
  95. shell> \fBmysql_upgrade [\fR\fB\fIoptions\fR\fR\fB]\fR
  96. .fi
  97. .if n \{\
  98. .RE
  99. .\}
  100. .PP
  101. After running
  102. \fBmysql_upgrade\fR, stop the server and restart it so that any changes made to the system tables take effect\&.
  103. .PP
  104. \fBmysql_upgrade\fR
  105. executes the following commands to check and repair tables and to upgrade the system tables:
  106. .sp
  107. .if n \{\
  108. .RS 4
  109. .\}
  110. .nf
  111. mysqlcheck \-\-all\-databases \-\-check\-upgrade \-\-auto\-repair
  112. mysql < \fIfix_priv_tables\fR
  113. mysqlcheck \-\-all\-databases \-\-check\-upgrade \-\-fix\-db\-names \-\-fix\-table\-names
  114. .fi
  115. .if n \{\
  116. .RE
  117. .\}
  118. .PP
  119. Notes about the preceding commands:
  120. .sp
  121. .RS 4
  122. .ie n \{\
  123. \h'-04'\(bu\h'+03'\c
  124. .\}
  125. .el \{\
  126. .sp -1
  127. .IP \(bu 2.3
  128. .\}
  129. Because
  130. \fBmysql_upgrade\fR
  131. invokes
  132. \fBmysqlcheck\fR
  133. with the
  134. \fB\-\-all\-databases\fR
  135. 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\&.
  136. .RE
  137. .sp
  138. .RS 4
  139. .ie n \{\
  140. \h'-04'\(bu\h'+03'\c
  141. .\}
  142. .el \{\
  143. .sp -1
  144. .IP \(bu 2.3
  145. .\}
  146. For details about what checks the
  147. \fB\-\-check\-upgrade\fR
  148. option entails, see the description of the
  149. FOR UPGRADE
  150. option of the
  151. CHECK TABLE
  152. statement (see
  153. Section\ \&12.4.2.3, \(lqCHECK TABLE Syntax\(rq)\&.
  154. .RE
  155. .sp
  156. .RS 4
  157. .ie n \{\
  158. \h'-04'\(bu\h'+03'\c
  159. .\}
  160. .el \{\
  161. .sp -1
  162. .IP \(bu 2.3
  163. .\}
  164. \fIfix_priv_tables\fR
  165. represents a script generated internally by
  166. \fBmysql_upgrade\fR
  167. that contains SQL statements to upgrade the tables in the
  168. mysql
  169. database\&.
  170. .RE
  171. .sp
  172. .RS 4
  173. .ie n \{\
  174. \h'-04'\(bu\h'+03'\c
  175. .\}
  176. .el \{\
  177. .sp -1
  178. .IP \(bu 2.3
  179. .\}
  180. Prior to MySQL 5\&.1\&.31,
  181. \fBmysql_upgrade\fR
  182. does not run the second
  183. \fBmysqlcheck\fR
  184. command, which is necessary to re\-encode database or table names that contain nonalphanumeric characters\&. (They still appear after the upgrade with the
  185. #mysql50#
  186. prefix described in
  187. Section\ \&8.2.3, \(lqMapping of Identifiers to File Names\(rq\&.) If you have such database or table names, execute the second
  188. \fBmysqlcheck\fR
  189. command manually after executing
  190. \fBmysql_upgrade\fR\&.
  191. .RE
  192. .PP
  193. All checked and repaired tables are marked with the current MySQL version number\&. This ensures that next time you run
  194. \fBmysql_upgrade\fR
  195. with the same version of the server, it can tell whether there is any need to check or repair the table again\&.
  196. .\" mysql_upgrade_info file: mysql_upgrade
  197. .\" mysql_upgrade: mysql_upgrade_info file
  198. .PP
  199. \fBmysql_upgrade\fR
  200. also saves the MySQL version number in a file named
  201. mysql_upgrade_info
  202. 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
  203. \fB\-\-force\fR
  204. option\&.
  205. .PP
  206. If you install MySQL from RPM packages on Linux, you must install the server and client RPMs\&.
  207. \fBmysql_upgrade\fR
  208. is included in the server RPM but requires the client RPM because the latter includes
  209. \fBmysqlcheck\fR\&. (See
  210. Section\ \&2.6.1, \(lqInstalling MySQL from RPM Packages on Linux\(rq\&.)
  211. .PP
  212. In MySQL 5\&.1\&.7,
  213. \fBmysql_upgrade \fR
  214. was added as a shell script and worked only for Unix systems\&. As of MySQL 5\&.1\&.10,
  215. \fBmysql_upgrade\fR
  216. is an executable binary and is available on all systems\&.
  217. .PP
  218. \fBmysql_upgrade\fR
  219. supports the following options, which can be specified on the command line or in the
  220. [mysql_upgrade]
  221. and
  222. [client]
  223. option file groups\&. Other options are passed to
  224. \fBmysqlcheck\fR\&. For example, it might be necessary to specify the
  225. \fB\-\-password[=\fR\fB\fIpassword\fR\fR\fB]\fR
  226. option\&.
  227. \fBmysql_upgrade\fR
  228. also supports the options for processing option files described at
  229. Section\ \&4.2.3.3.1, \(lqCommand-Line Options that Affect Option-File Handling\(rq\&.
  230. .sp
  231. .RS 4
  232. .ie n \{\
  233. \h'-04'\(bu\h'+03'\c
  234. .\}
  235. .el \{\
  236. .sp -1
  237. .IP \(bu 2.3
  238. .\}
  239. .\" mysql_upgrade: help option
  240. .\" help option: mysql_upgrade
  241. \fB\-\-help\fR
  242. .sp
  243. Display a short help message and exit\&.
  244. .RE
  245. .sp
  246. .RS 4
  247. .ie n \{\
  248. \h'-04'\(bu\h'+03'\c
  249. .\}
  250. .el \{\
  251. .sp -1
  252. .IP \(bu 2.3
  253. .\}
  254. .\" mysql_upgrade: basedir option
  255. .\" basedir option: mysql_upgrade
  256. \fB\-\-basedir=\fR\fB\fIpath\fR\fR
  257. .sp
  258. The path to the MySQL installation directory\&. This option is accepted for backward compatibility but ignored\&.
  259. .RE
  260. .sp
  261. .RS 4
  262. .ie n \{\
  263. \h'-04'\(bu\h'+03'\c
  264. .\}
  265. .el \{\
  266. .sp -1
  267. .IP \(bu 2.3
  268. .\}
  269. .\" mysql_upgrade: datadir option
  270. .\" datadir option: mysql_upgrade
  271. \fB\-\-datadir=\fR\fB\fIpath\fR\fR
  272. .sp
  273. The path to the data directory\&. This option is accepted for backward compatibility but ignored\&.
  274. .RE
  275. .sp
  276. .RS 4
  277. .ie n \{\
  278. \h'-04'\(bu\h'+03'\c
  279. .\}
  280. .el \{\
  281. .sp -1
  282. .IP \(bu 2.3
  283. .\}
  284. .\" mysql_upgrade: debug-check option
  285. .\" debug-check option: mysql_upgrade
  286. \fB\-\-debug\-check\fR
  287. .sp
  288. Print some debugging information when the program exits\&. This option was added in MySQL 5\&.1\&.21\&.
  289. .RE
  290. .sp
  291. .RS 4
  292. .ie n \{\
  293. \h'-04'\(bu\h'+03'\c
  294. .\}
  295. .el \{\
  296. .sp -1
  297. .IP \(bu 2.3
  298. .\}
  299. .\" mysql_upgrade: debug-info option
  300. .\" debug-info option: mysql_upgrade
  301. \fB\-\-debug\-info\fR,
  302. \fB\-T\fR
  303. .sp
  304. Print debugging information and memory and CPU usage statistics when the program exits\&. This option was added in MySQL 5\&.1\&.21\&.
  305. .RE
  306. .sp
  307. .RS 4
  308. .ie n \{\
  309. \h'-04'\(bu\h'+03'\c
  310. .\}
  311. .el \{\
  312. .sp -1
  313. .IP \(bu 2.3
  314. .\}
  315. .\" mysql_upgrade: force option
  316. .\" force option: mysql_upgrade
  317. \fB\-\-force\fR
  318. .sp
  319. Ignore the
  320. mysql_upgrade_info
  321. file and force execution of
  322. \fBmysqlcheck\fR
  323. even if
  324. \fBmysql_upgrade\fR
  325. has already been executed for the current version of MySQL\&.
  326. .RE
  327. .sp
  328. .RS 4
  329. .ie n \{\
  330. \h'-04'\(bu\h'+03'\c
  331. .\}
  332. .el \{\
  333. .sp -1
  334. .IP \(bu 2.3
  335. .\}
  336. .\" mysql_upgrade: tmpdir option
  337. .\" tmpdir option: mysql_upgrade
  338. \fB\-\-tmpdir=\fR\fB\fIpath\fR\fR,
  339. \fB\-t \fR\fB\fIpath\fR\fR
  340. .sp
  341. The path name of the directory to use for creating temporary files\&. This option was added in MySQL 5\&.1\&.25\&.
  342. .RE
  343. .sp
  344. .RS 4
  345. .ie n \{\
  346. \h'-04'\(bu\h'+03'\c
  347. .\}
  348. .el \{\
  349. .sp -1
  350. .IP \(bu 2.3
  351. .\}
  352. .\" mysql_upgrade: user option
  353. .\" user option: mysql_upgrade
  354. \fB\-\-user=\fR\fB\fIuser_name\fR\fR,
  355. \fB\-u \fR\fB\fIuser_name\fR\fR
  356. .sp
  357. The MySQL user name to use when connecting to the server\&. The default user name is
  358. root\&.
  359. .RE
  360. .sp
  361. .RS 4
  362. .ie n \{\
  363. \h'-04'\(bu\h'+03'\c
  364. .\}
  365. .el \{\
  366. .sp -1
  367. .IP \(bu 2.3
  368. .\}
  369. .\" mysql_upgrade: verbose option
  370. .\" verbose option: mysql_upgrade
  371. \fB\-\-verbose\fR
  372. .sp
  373. Verbose mode\&. Print more information about what the program does\&.
  374. .RE
  375. .sp
  376. .RS 4
  377. .ie n \{\
  378. \h'-04'\(bu\h'+03'\c
  379. .\}
  380. .el \{\
  381. .sp -1
  382. .IP \(bu 2.3
  383. .\}
  384. .\" mysql_upgrade: write-binlog option
  385. .\" write-binlog option: mysql_upgrade
  386. \fB\-\-write\-binlog\fR
  387. .sp
  388. Cause binary logging to be enabled while
  389. \fBmysql_upgrade\fR
  390. runs\&. This is the default behavior; to disable binary logging during the upgrade, use the inverse of this option (that is, start the program with
  391. \fB\-\-skip\-write\-binlog\fR)\&.
  392. .sp
  393. This option was introduced in MySQL 5\&.1\&.40\&.
  394. .RE
  395. .SH "COPYRIGHT"
  396. .br
  397. .PP
  398. Copyright 2007-2008 MySQL AB, 2008-2010 Sun Microsystems, Inc.
  399. .PP
  400. 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.
  401. .PP
  402. 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.
  403. .PP
  404. 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-1301 USA or see http://www.gnu.org/licenses/.
  405. .sp
  406. .SH "SEE ALSO"
  407. For more information, please refer to the MySQL Reference Manual,
  408. which may already be installed locally and which is also available
  409. online at http://dev.mysql.com/doc/.
  410. .SH AUTHOR
  411. Sun Microsystems, Inc. (http://www.mysql.com/).