Note
This variable is available starting with V2.2.77.
Description
secure_file_priv specifies the accessible path for importing or exporting data to or from a file.
Note
The log/alert directory is in the allowlist of the system tenant. You can skip checking the secure_file_priv variable when accessing this directory.
Notice
Due to security reasons, only a client that connects to OceanBase Database through a local Unix socket can execute an SQL statement to modify this global variable.
Privilege requirements
Query variables
The
systenant and all user tenants can execute theSHOW VARIABLESstatement or query theSYS.TENANT_VIRTUAL_GLOBAL_VARIABLEview (Oracle mode) or theinformation_schema.GLOBAL_VARIABLESview (MySQL mode) to view the value of a global system variable.Modify variables
Global level
The
systenant can directly modify the value of a global system variable.A MySQL user tenant must have the
SUPERorALTER SYSTEMprivilege to modify the value of a global system variable.An Oracle user tenant must have the
ALTER SYSTEMprivilege to modify the value of a global system variable.
Attributes
| Attribute | Description |
|---|---|
| Type | Varchar |
| Default value | "" indicates an empty string.
NoteStarting from V4.2.1, the default value is changed from |
| Value range |
NoteStarting from V4.2.0, the values |
| Scope | Global |
| Modifiable | Yes. You can execute the SET statement to modify the value. |
| Nullable | Yes |
Usage
You can connect to OceanBase Database only through a local Unix socket.
obclient -S /home/admin/oceanbase/run/sql.sock -u******@obtenant -p******
If the current user is not the same as the user that started the OBServer node, the current user does not have the sql.sock file. You can run the following command to connect to OceanBase Database.
sudo -u <user of observer> obclient -S /home/admin/oceanbase/run/sql.sock -u******@obtenant -p******
The parameters are described as follows:
- -S: specifies the path of the Unix socket file of the local OBServer node. The Unix socket file is located in the installation directory of the local OBServer node, and the default path is
/home/admin/oceanbase/run/sql.sock. - -u: specifies the tenant account. The format is
username@tenant name.
When you connect to OceanBase Database through a Unix socket, you can only connect to the local OBServer node. You must also ensure that the resources of the tenant are distributed on the local OBServer node. If the resources of the tenant are not distributed on the local OBServer node, you cannot connect to the tenant through the local OBServer node.
Examples
Set the accessible path for importing or exporting data to or from a file to "".
obclient> SET GLOBAL secure_file_priv = "";