我正在从一个从多个文件读取数据的shell脚本中执行insert
查询。有些要插入的数据包含'
文本和MySQL一直给错误如何在MySQL中插入特殊字符?
ERROR 1064 (42000) at line 1: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 's Development & Empowerment, Youth Affairs
','
Himachal Pradesh ' at line 1
这是实际的文字:Women's Development & Empowerment, Youth Affairs
。
这个线程可以帮助您提供:逃离MYSQL命令行通过Bash脚本](http://stackoverflow.com/questions/4383135/escaping-mysql-command-lines-via-bash-scripting) – jujule 2011-01-26 10:17:48
它更好,如果你逃脱'字符比'\。它是因为某些db ex:sqllite显示\ escape字符的错误。你可以写:“妇女的发展与赋权,青年事务”。 – YROjha 2017-09-15 07:25:44