-1

I tried to connect from local to the mysql attached to compute Engine. I simply use jdbc driver in java to connect with that. And the error says

com.mysql.cj.jdbc.exceptions.PacketTooBigException: Packet for query is too large (4,739,923 > 65,535). You can change this value on the server by setting the 'max_allowed_packet' variable.

Therefore, I tried to login in phpmyadmin to set up the max allowed packet in mysql, but it doesn't work.

It seems that the setting should be in the computer engine or so. I'm quite new to Google Cloud Platform and can't find any place to set it up.

I also tried gcloud command line but can't find anything as well.

Can anyone give some detailed direction? very appreciated.

Jofre
  • 3,718
  • 1
  • 23
  • 31

1 Answers1

0

I guess your instance is a Linux VM, you may have a look on Connecting to Linux VMs.

In the Cloud Console you should go to Compute Engine > VM Instances page:

Click SSH button as seen in the picture below. SSH button

And then proceed to change the "max_allowed_packet" as seen in this similar post or Mysql official's documentation about Packet too large.

Pit
  • 736
  • 3
  • 17
  • I successfully enter into the mysql in VM. Use gcloud shell "gcloud beta compute ssh --zone "REGION" "VMNAME" --project "PROJECT_ID" and "my -u root -p" – shes6006 Jun 10 '21 at 11:57
  • And it says "| max_allowed_packet | 1073741824 |". and as I go with "set global max_allowed_packet=2048000;" it says "Query OK, 0 rows affected (0.00 sec)" seems to be failed. BUT, still, the max allowed packet is already bigger than the claimed '4,739,923'. What seems to be the problem? Is it the setting in my local mysql? – shes6006 Jun 10 '21 at 12:03