The server maintains tables in the mysql
database that store information for the
HELP statement (see
Section 13.8.3, “HELP Syntax”. These tables can be loaded manually as
described at Section 5.1.10, “Server-Side Help”.
Help table content is derived from the MySQL Reference Manual. There are versions of the manual specific to each MySQL release series, so help content is specific to each series as well. Normally, you load a version of help content that matches the server version. This has implications for replication. For example, you would load MySQL 5.6 help content into a MySQL 5.6 master server, but not necessarily replicate that content to a MySQL 5.7 slave server for which 5.7 help content is more appropriate.
This section describes how to manage help table content upgrades when your servers participate in replication. Server versions are one factor in this task. Another is that the help table structure may differ between the master and the slave.
Assume that help content is stored in a file named
fill_help_tables.sql. In MySQL
distributions, this file is located under the
share or share/mysql
directory, and the most recent version is always available for
download from http://dev.mysql.com/doc/index-other.html.
To upgrade help tables, using the following procedure.
Connection parameters are not shown for the
mysql commands discussed here; in all cases,
connect to the server using an account such as
root that has privileges for modifying tables
in the mysql database.
Upgrade your servers by running mysql_upgrade, first on the slaves and then on the master. This is the usual principle of upgrading slaves first.
Decide whether you want to replicate help table content from the master to its slaves. If not, load the content on the master and each slave individually. Otherwise, check for and resolve any incompatibilities between help table structure on the master and its slaves, then load the content into the master and let it replicate to the slaves.
More detail about these two methods of loading help table content follows.
Loading Help Table Content Without Replication to Slaves
To load help table content without replication, run this command
on the master and each slave individually, using a
fill_help_tables.sql file containing
content appropriate to the server version (enter the command on
one line):
mysql --init-command="SET sql_log_bin=0"
mysql < fill_help_tables.sql
Use the --init-command option on
each server, including the slaves, in case a slave also acts as
a master to other slaves in your replication topology. The
SET statement suppresses binary logging.
After the command has been run on each server to be upgraded,
you are done.
As of MySQL 5.7.5, the
fill_help_tables.sql file includes the
SET statement to cause the file contents
not to replicate. Thus, for 5.7.5 and higher, the command is
simpler:
mysql mysql < fill_help_tables.sql
Loading Help Table Content With Replication to Slaves
As mentioned previously,
fill_help_tables.sql in MySQL 5.7.5 and
up includes a SET statement to suppress
binary logging of the file contents. If you want to replicate
help table contents for MySQL 5.7.5 or later, you must edit
fill_help_tables.sql to remove the
SET statement. This should rarely be
desireable because help table contents are specific to the
version of the server into which they are loaded, which may
differ for master and slave.
If you do want to replicate help table content, check for help
table incompatibilities between your master and its slaves. The
url column in the
help_category and
help_topic tables was originally
CHAR(128), but is TEXT in
newer MySQL versions to accommodate longer URLs. To check help
table structure, use this statement:
SELECT TABLE_NAME, COLUMN_NAME, COLUMN_TYPE
FROM INFORMATION_SCHEMA.COLUMNS
WHERE TABLE_SCHEMA = 'mysql'
AND COLUMN_NAME = 'url';For tables with the old structure, the statement produces this result:
+---------------+-------------+-------------+
| TABLE_NAME | COLUMN_NAME | COLUMN_TYPE |
+---------------+-------------+-------------+
| help_category | url | char(128) |
| help_topic | url | char(128) |
+---------------+-------------+-------------+For tables with the new structure, the statement produces this result:
+---------------+-------------+-------------+
| TABLE_NAME | COLUMN_NAME | COLUMN_TYPE |
+---------------+-------------+-------------+
| help_category | url | text |
| help_topic | url | text |
+---------------+-------------+-------------+If the master and slave both have the old structure or both have the new structure, they are compatible and you can replicate help table content by executing this command on the master:
mysql mysql < fill_help_tables.sqlThe table content will load into the master, then replicate to the slaves.
If the master and slave have incompatible help tables (one server has the old structure and the other has the new), you have a choice between not replicating help table content after all, or making the table structures compatible so that you can replicate the content.
If you decide not to replicate the content after all, upgrade the master and slaves individually using mysql with the
--init-commandoption, as described previously.If instead you decide to make the table structures compatible, upgrade the tables on the server that has the old structure. Suppose that your master server has the old table structure. Upgrade its tables to the new structure manually by executing these statements (binary logging is disabled here to prevent replication of the changes to the slaves, which already have the new structure):
SET sql_log_bin=0; ALTER TABLE mysql.help_category ALTER COLUMN url TEXT; ALTER TABLE mysql.help_topic ALTER COLUMN url TEXT;Then run this command on the master:
mysql mysql < fill_help_tables.sqlThe table content will load into the master, then replicate to the slaves.