Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

google-cloud-sql - max_allowed_packet

I was moving a database to using Google Cloud SQL which previously had a max_allowed_packet of 20M.

Currently the Google Cloud SQL default for max_allowed_packet is 1M.

Is there any way to increase this variable to 20M? I have already tried the following:

set global max_allowed_packet = 20971520;

Which returns:

Error Code: 1621. SESSION variable 'max_allowed_packet' is read-only. Use SET GLOBAL to assign the value

and then:

set global max_allowed_packet = 20971520;

This returns the error:

Error Code: 1227. Access denied; you need (at least one of) the SUPER privilege(s) for this operation

Thank you in advance for your help!

like image 383
user3166328 Avatar asked Jan 06 '14 17:01

user3166328


People also ask

What is flag in SQL database?

You use database flags for many operations, including adjusting SQL Server parameters, adjusting options, and configuring and tuning an instance. When you set, remove, or modify a flag for a database instance, the database might be restarted. The flag value is then persisted for the instance until you remove it.

What is Cloudsql in GCP?

Cloud SQL is a fully-managed database service that helps you set up, maintain, manage, and administer your relational databases on Google Cloud Platform. You can use Cloud SQL with MySQL, PostgreSQL, or SQL Server.

What are GCP flags?

For all commands in the gcloud CLI, users can specify a number of global flags to modify command behavior. The --account , --project , and --configuration flags allow you to override the current defaults for your environment.


2 Answers

To change your max_allowed_packet on Google Cloud SQL, go to the overview of your instance on the cloud console, click on edit and look for the MySQL Flags section at the bottom of the page. max_allowed_packet is one of the flags you can set there. Set the value you want, and save/confirm.

like image 136
reallife Avatar answered Oct 03 '22 17:10

reallife


You can now set it yourself by editing the instance in Developer Console.

All the settable flags are documented here: https://cloud.google.com/sql/docs/mysql-flags

like image 37
Lee Avatar answered Oct 03 '22 17:10

Lee