Menu

Dipesh Majumdar

Blog and Paintings

Lessons learnt from "mysql golang rest api project"

Recently I was working on a mysql golang rest api project and these are some of the issues i faced....

1. couldn't get to use where clause in mysql statement inside a pod until i used the command this way - 

[dipesh.majumdar@demo ~]$ k -n api-test1-mysql exec mysql-5bbdb4b5d7-wmcxs -- bash -c 'mysql -u root -ppassword -e "select *  from opencommdb.people where uuid = \"a43d29fb-6b5f-11e9-b784-8adc4de39d81\""'
mysql: [Warning] Using a password on the command line interface can be insecure.
uuid    survived        passengerClass  name    sex     age     siblingsOrSpousesAboard parentsOrChildrenAboard fare
a43d29fb-6b5f-11e9-b784-8adc4de39d81    0       3       Mr. Raun Harris Braund  male    23      1       0       7.15
[dipesh.majumdar@demo ~]$

changing sql mode was a challenge inside container... lots of wrong stuff all over the place in internet..

the error that was bugging me was:

Error 1366: Incorrect integer value: '' for column 'survived' at row 1[GIN] 2019/04/30 - 17:00:01 | 200 |    1.068836ms |      10.132.0.6 | POST     /people

finally i could change sql mode like this

[dipesh.majumdar@demo src]$ k -n api-test1-mysql exec -it mysql-5bbdb4b5d7-wmcxs -- sh
# mysql -u root -ppassword -e "SET GLOBAL sql_mode = '';"
mysql: [Warning] Using a password on the command line interface can be insecure.

Go Back

Comment