0

Basically, I am trying to import a csv file into a table in Google Cloud SQL database.. The query, I used to create a table is:

CREATE TABLE Mobike(
 orderid INT(30), 
 bikeid INT(30), 
 userid INT(30), 
 start_time DATETIME, 
 start_location_x FLOAT(30,30), 
 start_location_y FLOAT(30,30),               
 end_time DATETIME, 
 end_location_x FLOAT(30,30), 
 end_location_y FLOAT(30,30), 
 track TEXT(65000)); 

Like Table, CSV file also contains the same columns having same data Types. Kindly, help me how I can solve this problem especially when I am doing it on Google cloud shell?? And how can I remove this error??

shishir
  • 851
  • 3
  • 11
  • 27
Saad
  • 1
  • 1
  • Could you specify what is your shell command like? – Evandro Silva Oct 10 '17 at 22:16
  • @EvandroSilva It was a simple command of "Select * from Mobike".. I just wanted to view the data, which i imported from csv file to my table named 'Mobike'..But, it's giving the above mentioned error.. – Saad Oct 11 '17 at 05:17
  • Please, have a look at this answer: https://stackoverflow.com/questions/35922910/mysqldump-error-2020-got-packet-bigger-than-max-allowed-packet-bytes-when-du – Evandro Silva Oct 11 '17 at 22:55
  • Hey Evandro.. I don't know about that 'dumpfile.sql' and where to run your suggested command (mysqldump --max_allowed_packet=512M -u root -p database > dumpfile.sql) on shell... Kindly, give me some explanation that if i am using 'MYSQL' on cloud shell, how can i run this query there?? If u can tell me some steps to do this, it would be appreciable.. :) – Saad Oct 12 '17 at 05:37
  • [The `max_allowed_packet` default value is 4MB](https://dev.mysql.com/doc/refman/5.7/en/server-system-variables.html#sysvar_max_allowed_packet), maybe your query is returning more than that? Try connecting setting this flag to a higher value, as [described here](https://dev.mysql.com/doc/refman/5.7/en/server-system-variables.html), the GCE also has a way of altering the `mysql` flags, [check this link for more info](https://cloud.google.com/sql/docs/mysql/flags), hope it helps. – Evandro Silva Oct 13 '17 at 13:17
  • I got your point and i have altered the mysql flag using your given link.. I have defined the maximum value to 'max_allowed_packet' in the flag.. But, still it's giving the same error, when i run my query(Select * from Table) on cloud shell.. – Saad Oct 15 '17 at 05:39

0 Answers0