반응형
python에서 mysql 통신시 발생하는 에러 입니다.
mysql injection을 피하기 위해 %s을 사용할때 발생했는데요. 해결책은 콤마 입니다.
# error 발생
cmd = "select * from test where name = %s"
cursor.execute(cmd, (result))
cmd = "select * from test where name = %s"
# ,추가
cursor.execute(cmd, (result,))
'개발' 카테고리의 다른 글
[AWS] EC2 인스턴스 유형 변경 (0) | 2022.06.08 |
---|---|
[Python] pip3 install dotenv error (0) | 2022.06.07 |
[python] background process in python - (1) (0) | 2022.06.01 |
[Next.js] pm2로 next.js 배포하기 (1) | 2022.05.26 |
[Cookie] set-cookie not working (0) | 2022.04.29 |