# 6.1.3 Ensure That the ‘Local_infile’ Database Flag for a Cloud SQL MySQL Instance Is Set to ‘Off’ (Automated)

- Source: https://support.icompaas.com/support/solutions/articles/62000233031-6-1-3-ensure-that-the-local-infile-database-flag-for-a-cloud-sql-mysql-instance-is-set-to-off-au
- Section: [Solutions](https://support.icompaas.com/support/solutions) › [GCP Benchmarks](https://support.icompaas.com/support/solutions/62000112667) › [GCP Knowledge Bases](https://support.icompaas.com/support/solutions/folders/62000169178)
- Last updated: 2026-05-29
- Publisher: iCompaas, Inc. (https://www.icompaas.com)

Profile Applicability:

-   Level 1

Description:

The local\_infile database flag controls whether the server permits local data loading using the LOAD DATA LOCAL statement. It is recommended to set this flag to OFF for Cloud SQL MySQL instances to prevent potential security vulnerabilities.

Rationale:

The local\_infile flag allows client applications to upload local data files to the server using LOAD DATA LOCAL statements. However, this functionality can introduce security risks, as malicious users could exploit this feature to access unauthorized data. Disabling the local\_infile flag mitigates this risk by preventing the server from accepting local data loading requests from clients.

Impact:

Disabling the local\_infile flag restricts clients from loading local data files into the server using LOAD DATA LOCAL statements. This might impact applications that rely on this feature.

Default Value:

By default, the local\_infile flag is set to ON.

Audit Steps:

#### From Google Cloud Console:

1.  Navigate to the [Cloud SQL Instances](https://console.cloud.google.com/sql/instances) page.
    

                                      ![](https://support.icompaas.com/assets/kb/eaac3eb91cbbe2f4.png)

2.  Select a MySQL instance to view its Overview page.
    

            ![](https://support.icompaas.com/assets/kb/6e42dfd06d8e0f1e.png)

3.  Under the Database Flags section, verify that the local\_infile flag is listed and set to OFF.
    

          ![](https://support.icompaas.com/assets/kb/fd384287bc48082e.png)

#### From Google Cloud CLI:

List all Cloud SQL database instances:

gcloud sql instances list

Verify that the local\_infile flag is set to OFF for each MySQL instance:

gcloud sql instances describe <INSTANCE\_NAME> --format=json | jq '.settings.databaseFlags\[\] | select(.name=="local\_infile")|.value'

The output should display: "off"

  
Remediation Steps:  
From Google Cloud Console:

1.  Go to the [Cloud SQL Instances](https://console.cloud.google.com/sql/instances) page.
    

                            ![](https://support.icompaas.com/assets/kb/66ea362bf0a98e1e.png)

2.  Select the MySQL instance where the flag needs to be updated.
    

            ![](https://support.icompaas.com/assets/kb/7b062088fd07ed15.png)

3.  Click Edit.
    

         ![](https://support.icompaas.com/assets/kb/3f6b5df45cb39918.png)

4.  Scroll to the Flags section and click Add a Database Flag.
    

                          ![](https://support.icompaas.com/assets/kb/b9ca8af9e5aba30d.png)

5.  From the dropdown menu, select the local\_infile flag and set its value to OFF.
    

                        ![](https://support.icompaas.com/assets/kb/2e3f3effd608fe5e.png)

6.  Save the changes.
    

                                              ![](https://support.icompaas.com/assets/kb/3d4114b4681cee37.png)

7.  Verify the updated flag under the Flags section on the instance's Overview page.
    

                    ![](https://support.icompaas.com/assets/kb/31521ae2f3d6ca54.png)

#### From Google Cloud CLI:

List all Cloud SQL instances:

gcloud sql instances list

Set the local\_infile flag to OFF:

gcloud sql instances patch <INSTANCE\_NAME> --database-flags local\_infile=off

1.  Note: This command overwrites all existing database flags. To retain existing flags, include them in the command.
    

### Backout Plan:

Re-enable the local\_infile flag (if needed): To revert the change, run the following command:

  gcloud sql instances patch \[INSTANCE\_NAME\] --database-flags local\_infile=on

Verify the flag configuration again

  gcloud sql instances describe \[INSTANCE\_NAME\] --format=json |       jq '.settings.databaseFlags\[\] | select(.name=="local\_infile")|.value'

Notify stakeholders:

-   Inform the relevant teams about the backout process and any impact on the system or applications relying on local file loading

Review the audit logs to confirm changes:

      gcloud logging read     "protoPayload.methodName='google.cloud.sql.v1beta4.SqlInstancesPatch'"

References:

1.  [Google Cloud SQL - Database Flags](https://cloud.google.com/sql/docs/mysql/flags)
    
2.  [MySQL Documentation -](https://dev.mysql.com/doc/refman/5.7/en/server-system-variables.html#sysvar_local_infile) [local\_infile](https://dev.mysql.com/doc/refman/5.7/en/server-system-variables.html#sysvar_local_infile)
    
3.  [MySQL Documentation -](https://dev.mysql.com/doc/refman/5.7/en/load-data-local.html) [LOAD DATA LOCAL](https://dev.mysql.com/doc/refman/5.7/en/load-data-local.html)
    

Additional Information:

-   Configuring the local\_infile flag will restart the Cloud SQL instance, which may cause temporary unavailability.
    
-   Some database flag changes may affect instance stability and remove the instance from the Cloud SQL SLA. For more details, refer to the [Operational Guidelines](https://cloud.google.com/sql/docs/mysql/flags).
    

CIS Controls:

<table style="border:none;border-collapse:collapse"><tbody><tr style="height:39.25pt;font-family:&quot;Helvetica Neue&quot;;font-size:14px"><td style="padding:5pt;overflow:hidden;overflow-wrap:break-word;font-family:&quot;Helvetica Neue&quot;;font-size:14px"><p dir="ltr" style="line-height:1.38;text-align:justify;margin-bottom:0pt;font-family:&quot;Helvetica Neue&quot;;font-size:14px"><span style="font-size:14px"><span style="color:rgb(0, 0, 0)"><span style="font-family:Helvetica Neue"><span style="font-family:&quot;Helvetica Neue&quot;"><span style="font-weight:700;font-family:&quot;Helvetica Neue&quot;">Control</span></span></span></span></span></p></td><td style="padding:5pt;overflow:hidden;overflow-wrap:break-word;font-family:&quot;Helvetica Neue&quot;;font-size:14px"><p dir="ltr" style="line-height:1.38;text-align:justify;margin-bottom:0pt;font-family:&quot;Helvetica Neue&quot;;font-size:14px"><span style="font-size:14px"><span style="color:rgb(0, 0, 0)"><span style="font-family:Helvetica Neue"><span style="font-family:&quot;Helvetica Neue&quot;"><span style="font-weight:700;font-family:&quot;Helvetica Neue&quot;">Description</span></span></span></span></span></p></td><td style="padding:5pt;overflow:hidden;overflow-wrap:break-word;font-family:&quot;Helvetica Neue&quot;;font-size:14px"><p dir="ltr" style="line-height:1.38;text-align:justify;margin-bottom:0pt;font-family:&quot;Helvetica Neue&quot;;font-size:14px"><span style="font-size:14px"><span style="color:rgb(0, 0, 0)"><span style="font-family:Helvetica Neue"><span style="font-family:&quot;Helvetica Neue&quot;"><span style="font-weight:700;font-family:&quot;Helvetica Neue&quot;">IG 1</span></span></span></span></span></p></td><td style="padding:5pt;overflow:hidden;overflow-wrap:break-word;font-family:&quot;Helvetica Neue&quot;;font-size:14px"><p dir="ltr" style="line-height:1.38;text-align:justify;margin-bottom:0pt;font-family:&quot;Helvetica Neue&quot;;font-size:14px"><span style="font-size:14px"><span style="color:rgb(0, 0, 0)"><span style="font-family:Helvetica Neue"><span style="font-family:&quot;Helvetica Neue&quot;"><span style="font-weight:700;font-family:&quot;Helvetica Neue&quot;">IG 2</span></span></span></span></span></p></td><td style="padding:5pt;overflow:hidden;overflow-wrap:break-word;font-family:&quot;Helvetica Neue&quot;;font-size:14px"><p dir="ltr" style="line-height:1.38;text-align:justify;margin-bottom:0pt;font-family:&quot;Helvetica Neue&quot;;font-size:14px"><span style="font-size:14px"><span style="color:rgb(0, 0, 0)"><span style="font-family:Helvetica Neue"><span style="font-family:&quot;Helvetica Neue&quot;"><span style="font-weight:700;font-family:&quot;Helvetica Neue&quot;">IG 3</span></span></span></span></span></p></td></tr><tr style="height:67.75pt"><td style="padding:5pt;overflow:hidden;overflow-wrap:break-word;font-family:&quot;Helvetica Neue&quot;;font-size:14px"><p dir="ltr" style="line-height:1.38;margin-bottom:0pt;font-family:&quot;Helvetica Neue&quot;;text-align:left;font-size:14px"><span style="font-size:14px"><span style="color:rgb(0, 0, 0)"><span style="font-family:Helvetica Neue"><span style="font-family:&quot;Helvetica Neue&quot;"><span style="font-family:&quot;Helvetica Neue&quot;">16.7 Use Standard Hardening Configuration Templates for Application Infrastructure</span></span></span></span></span></p></td><td style="padding:5pt;overflow:hidden;overflow-wrap:break-word;font-family:&quot;Helvetica Neue&quot;;font-size:14px"><p dir="ltr" style="line-height:1.38;margin-bottom:0pt;font-family:&quot;Helvetica Neue&quot;;text-align:left;font-size:14px"><span style="font-size:14px"><strong><span style="color:rgb(0, 0, 0)"><span style="font-family:Helvetica Neue"><span style="font-family:&quot;Helvetica Neue&quot;"><span style="font-weight:400;font-family:&quot;Helvetica Neue&quot;">Apply standard hardening templates for components such as databases, web servers, cloud containers, and PaaS components to maintain secure configurations.</span></span></span></span></strong></span></p></td><td style="padding:5pt;overflow:hidden;overflow-wrap:break-word;font-family:&quot;Helvetica Neue&quot;;font-size:14px"><p dir="ltr" style="line-height:1.38;margin-bottom:0pt;font-family:&quot;Helvetica Neue&quot;;text-align:left;font-size:14px"><span style="font-size:14px"><strong><span style="color:rgb(0, 0, 0)"><span style="font-family:Helvetica Neue"><span style="font-family:&quot;Helvetica Neue&quot;"><span style="font-weight:400;font-family:&quot;Helvetica Neue&quot;">✅</span></span></span></span></strong></span></p></td><td style="padding:5pt;overflow:hidden;overflow-wrap:break-word;font-family:&quot;Helvetica Neue&quot;;font-size:14px"><p dir="ltr" style="line-height:1.38;margin-bottom:0pt;font-family:&quot;Helvetica Neue&quot;;text-align:justify;font-size:14px"><span style="font-size:14px"><strong><span style="color:rgb(0, 0, 0)"><span style="font-family:Helvetica Neue"><span style="font-family:&quot;Helvetica Neue&quot;"><span style="font-weight:400;font-family:&quot;Helvetica Neue&quot;">✅</span></span></span></span></strong></span></p></td><td style="padding:5pt;overflow:hidden;overflow-wrap:break-word"><div style="text-align:justify"><span style="font-size:14px"><strong><span style="color:rgb(0, 0, 0)"><span style="font-family:&quot;Helvetica Neue&quot;"><br></span></span></strong></span></div></td></tr></tbody></table>

## Related compliance guidance

- [SOC 2 compliance: a practical implementation guide for cloud-native SaaS teams](https://support.icompaas.com/compliance/soc-2-trust-services-criteria): Configuration checks like this one are the technical half of a SOC 2 / ISO 27001 programme — the guide shows where they fit, what else an auditor expects, and how to evidence them.
- [ISO/IEC 27001:2022 compliance: a practical implementation guide](https://support.icompaas.com/compliance/iso-27001-2022): ISO 27001 Annex A.8 (technological controls) is where cloud hardening evidence lands; the guide shows how to run the ISMS around it.
