All Products
Search
Document Center

ApsaraDB for OceanBase:Create a database user

Last Updated:Jun 12, 2023

Before you use the data transmission service for data migration or synchronization, you must first create a dedicated database user for the data migration or synchronization task in the source and destination data sources.

Create the __oceanbase_inner_drc_user user

If you want to migrate data from a table without a primary key, create a user and grant privileges to the user as needed before the migration.

  • When you migrate data from a MySQL tenant of OceanBase Database, create the __oceanbase_inner_drc_user user.

    • Create a user

      create  user __oceanbase_inner_drc_user identified by '<password>';
    • Grant privileges

      grant select on *.* to __oceanbase_inner_drc_user;
  • When you migrate data from an Oracle tenant of OceanBase Database, create the __OCEANBASE_INNER_DRC_USER user.

    • Create a user

      create user '__OCEANBASE_INNER_DRC_USER'@'%' IDENTIFIED BY '<password>';
    • Grant privileges

      OceanBase Database version

      Statement for granting privileges

      Versions earlier than V2.2.77

      grant create session to __OCEANBASE_INNER_DRC_USER;
      grant select on *.* to __OCEANBASE_INNER_DRC_USER;

      V2.2.77 and later versions

      grant create session to __OCEANBASE_INNER_DRC_USER;
      grant select any dictionary to __OCEANBASE_INNER_DRC_USER;

      You can grant the SELECT privilege on database tables to be migrated in either of the following ways:

      // Grant system privileges.
      grant select any table to __OCEANBASE_INNER_DRC_USER;
      // Grant privileges on specific database table objects.
      grant select on {schema}.{table} to __OCEANBASE_INNER_DRC_USER;

Create a MySQL database user

  1. Log on to the MySQL database.

  2. Create a user in the MySQL database for data migration or synchronization.

    CREATE USER '<username>'@'<host_name>' IDENTIFIED BY '<password>';

    Parameter

    Description

    username

    The account to be created.

    host_name

    The host from which the account is allowed to log on to the database. To allow the account to log on to the database from any host, set this parameter to a percent sign (%).

    password

    The password of the account.

  3. Use the GRANT statement to grant privileges to the created database user. For more information, see User privileges.

Create an Oracle database user

  1. Log on to the Oracle database.

  2. Create a user in the Oracle database for data migration or synchronization.

    CREATE USER <username> IDENTIFIED BY "<password>";
  3. Use the GRANT statement to grant privileges to the created database user. For more information, see User privileges.

Create an OceanBase Database user

  1. Log on to the OceanBase database as the system administrator.

  2. Create a user in the OceanBase database for data migration or synchronization.

    CREATE USER '<username>' IDENTIFIED BY '<password>';
  3. Use the GRANT statement to grant privileges to the created database user. For more information, see User privileges.

Create a TiDB database user

  1. Log on to the TiDB database.

  2. Create a user in the TiDB database for data migration or synchronization.

    CREATE USER '<username>'@'<host_name>' IDENTIFIED BY '<password>';

    Parameter

    Description

    username

    The account to be created.

    host_name

    The host from which the account is allowed to log on to the database. To allow the account to log on to the database from any host, set this parameter to a percent sign (%).

    password

    The password of the account.

  3. Use the GRANT statement to grant privileges to the created database user. For more information, see User privileges.