Home  >  Article  >  Database  >  mysql_upgrade - Check and upgrade MySQL tables

mysql_upgrade - Check and upgrade MySQL tables

WBOY
WBOYforward
2023-08-26 18:57:151197browse

mysql_upgrade - 检查并升级 MySQL 表

Let us understand mysql_upgrade program −

Usage

  • Every time MySQL is upgraded, the user should execute mysql_upgrade, that looks for incompatibilities with the upgraded MySQL server.

  • It upgrades the system tables in the mysql schema so that the user can take advantage of new privileges or capabilities that could have been added after the upgrade.

  • It basically upgrades the Performance Schema and sys schema.

  • It also examines user schemas.

  • If mysql_upgrade finds that a table has a possible incompatibility, it performs a table check and, if some problems are found, attempts a table repair operation

The mysql_upgrade can be used as shown below −

  • Ensure that the server is currently running.

  • Invoke mysql_upgrade to upgrade the system tables in the mysql schema.

Check and repair tables in other schemas using the below command −

shell> mysql_upgrade [options]

停止服务器并重新启动,以便使任何系统表更改生效。

如果有多个需要升级的MySQL服务器实例,则可以使用适合连接到每个所需服务器的连接参数来调用mysql_upgrade。让我们以一个例子来说明 -

通过连接到适当的端口,升级本地主机上运行的端口为3306到3308的每个服务器。可以使用以下命令来完成这个操作 -

shell> mysql_upgrade --protocol=tcp -P 3306 [other_options]
shell> mysql_upgrade --protocol=tcp -P 3307 [other_options]
shell> mysql_upgrade --protocol=tcp -P 3308 [other_options]

对于Unix上的本地主机连接,--protocol=tcp选项将强制使用TCP/IP连接,而不是Unix套接字文件。

The above is the detailed content of mysql_upgrade - Check and upgrade MySQL tables. For more information, please follow other related articles on the PHP Chinese website!

Statement:
This article is reproduced at:tutorialspoint.com. If there is any infringement, please contact admin@php.cn delete