Skip to content

ALTER PUBLICATION

Grammar Description

ALTER PUBLICATION Modify the publishing content.

Grammar Structure

ALTER PUBLICATION pubname
    [ACCOUNT
            { ALL
            | account_name, [, ... ]
            | ADD account_name, [, ... ]
            | DROP account_name, [, ... ]]
    [COMMENT 'string']
    [DATABASE database_name]

Syntax Explanation

  • pubname: an existing publishing name.
  • account_name: Get the instance name of the publish.
  • database_name: The name of the publishing library to be modified.

Example

create database t;
create publication pub3 database t account 018fb939_e13e_7941_90bb_2aa52796xxxx;
alter publication pub3 account add 018fb99a_7c5a_78cb_8ac8_68881c12xxxx;

mysql> show create publication pub3;
+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
| Publication | Create Publication |
+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
| pub3 | CREATE PUBLICATION pub3 DATABASE t ACCOUNT 018fb939_e13e_7941_90bb_2aa52796xxxx,018fb99a_7c5a_78cb_8ac8_68881c12xxxx |
+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
1 row in set (0.10 sec)

mysql> show publications;
+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
| publication | database | create_time | update_time | sub_account | comments |
+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
| pub3 | t | 2024-05-27 10:57:09 | 2024-05-27 10:57:40 | 018fb939_e13e_7941_90bb_2aa52796xxxx,018fb99a_7c5a_78cb_8ac8_68881c12xxxx | |
+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
1 row in set (0.18 sec)

alter publication pub3 comment "this is pubs";--Modify publication notes

mysql> show publications;
+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
| publication | database | create_time | update_time | sub_account | comments |
+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
| pub3 | t | 2024-05-27 10:57:09 | 2024-05-27 11:01:18 | 018fb939_e13e_7941_90bb_2aa52796xxxx,018fb99a_7c5a_78cb_8ac8_68881c12xxxx | this is pubs |
+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
1 row in set (0.23 sec)

create database new_pub3;
alter publication pub3 database new_pub3;--Modify publishing database

mysql> show publications;
+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
| publication | database | create_time | update_time | sub_account | comments |
+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
| pub3 | new_pub3 | 2024-05-27 10:57:09 | 2024-05-27 11:02:07 | 018fb939_e13e_7941_90bb_2aa52796xxxx,018fb99a_7c5a_78cb_8ac8_68881c12xxxx | this is pubs |
+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
1 row in set (0.08 sec)