Note
- For OceanBase Database V4.3.x, this variable was introduced in OceanBase Database V4.3.2.
- For OceanBase Database V4.2.x, this variable was introduced in OceanBase Database V4.2.3.
Description
MySQL 5.7 and 8.0 behave differently in some scenarios. For example, REPLACE('abd','',null) returns different results in MySQL 5.7 and 8.0. ob_compatibility_control specifies whether to be compatible with MySQL 5.7 or MySQL 8.0 in the event of a product behavior conflict when you create a tenant. This variable cannot be modified after the tenant is created. In either mode, you can use the superset of MySQL 5.7/8.0 features that have no behavior conflicts.
Applicability
This variable is applicable to only OceanBase Database in MySQL mode.
Privilege requirements
Query variables
In the
systenant or a user tenant, you can execute theSHOW VARIABLESstatement to query the variable at the global level or query theinformation_schema.GLOBAL_VARIABLESview (in MySQL mode) for the variable at the global level.Modify variables
After a tenant is created, you cannot modify the value of this variable by executing an SQL statement.
Attributes
Attribute |
Description |
|---|---|
| Type | ENUM |
| Default value | MYSQL5.7 |
| Value range | MYSQL5.7 and MYSQL8.0 |
| Effective scope | Global |
| Modifiable | No. You can set the variable when you create a tenant. After the tenant is created, you cannot modify the variable by executing the SET or ALTER SESSION SET statement. |
Considerations
When you upgrade a tenant without this variable to a version with this variable, this variable is set to
MYSQL5.7by default. When you create a tenant, you can specify a value for this variable.If the OceanBase Database version specified by
ob_compatibility_versionis earlier than V4.2.3, existing MySQL 8.0-based features are compatible with MySQL 8.0 regardless of the value ofob_compatibility_control.
Examples
Set the compatible MySQL version to MySQL 5.7 when you create a tenant.
obclient> create tenant tenant_m57 zone_list=('z1'),primary_zone='z1',resource_pool_list=('pool1') set ob_compatibility_mode='mysql',ob_compatibility_control='MYSQL5.7',ob_tcp_invited_nodes='%';
