简体   繁体   中英

mysql sql file import dump with apostrophes

I have a SQL database dump which is 8mb and I am trying to import via the commandline with the below code:

mysql -uroot -p dbname < dbnamedump.sql

I only have one copy of this file and can not export it again from the database and I am getting the below errors:

ERROR 1064 (42000) at line 29675: 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 Dining Room', '-33.922318', '18.417137', '133 Bree Street', '', 'Cape Town', '' at line 5

I realise this is an issue with apostrophes but not sure how to work around this and get the data in, I would normally replace ' with \\'

Any thoughts please?

Thanks

John.

It looks like you have an embedded quote. One of your string values has a quote inside it. This guy:

's Dining Room

You need to double the quotes when generating the SQL.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM