导入WordPress数据库文件

时间:2017-03-18 17:36:58

标签: mysql wordpress phpmyadmin

我正在尝试将我的wordpress网站移动到新服务器。我使用phpMyAdmin

将旧数据库导出到.zip .sql文件

当我尝试在新服务器上导入数据库文件时,出现此错误:

  

错误   SQL查询:

     

INSERT INTO wp_options VALUES(186159,'_ transnsient_wc_var_prices_575','{“f9e544f77b7eac7add281ef28ca5559f”:{“price”:{“6508”:“180.00”,“6507”:“180.00”,“6506”: “180.00”, “6505”: “180.00”, “6509”: “180.00”, “6510”: “180.00”, “6514”: “180.00”, “6513”: “180.00”, “6512”:“180.00 ”, “6511”: “180.00”, “6504”: “180.00”, “6503”: “180.00”, “6497”: “180.00”, “6496”: “180.00”, “6495”: “180.00”, “6494”: “180.00”, “6498”: “180.00”, “6499”: “180.00”, “6502”: “180.00”, “6501”: “180.00”, “6500”: “180.00”,“6515 “:” 180.00" , “6516”: “180.00”, “6531”: “180.00”, “6530”: “180.00”, “6529”: “180.00”, “6528”: “180.00”, “6532”: “180.00”, “6533”: “180.00”, “6537”: “180.00”, “6536”: “180.00”, “6535”: “180.00”, “6534”: “180.00”, “6527”:“180.00 ”, “6526”: “180.00”, “6520”: “180.00”, “6519”: “180.00”, “6518”: “180.00”, “6517”: “180.00”, “6521”: “180.00”, “6522”: “180.00”, “6525”: “180.00”, “6524”: “180.00”, “6523”: “180.00”, “6493”: “180.00”, “6492”: “180.00”,“6463 “:” 180.00" , “6462”: “180.00”, “6461”: “180.00”, “6460”: “180.00”, “6464”: “180.00”, “6465”: “180.00”, “6469”: “180.00”, “6468”: “180.00”, “6467”: “180.00”,[... ]

     

MySQL说:文档

     

1064 - 您的SQL语法出错;查看与您的MySQL服务器版本对应的手册,以便在“{”f9e544f77b7eac7add281ef28ca5559f“附近使用正确的语法:{”price“:{”6508“:”180.00“,”6507“:”180.00“,”'在线1

之前我已导出并导入了许多WordPress网站,但从未发生过这种情况。 WordPress网站正在使用WooCommerce。

可以采取哪些措施来解决这个问题?

1 个答案:

答案 0 :(得分:1)

这看起来像一个转义问题,所以你应该转义文件中的双引号。

尝试将其添加为最后一个值:

REPLACE(@Data.pluginText, '"', '\"')

所以你的文件应该是这样的:

INSERT INTO wp_options VALUES (186159, '_transient_wc_var_prices_575', '{"f9e544f77b7eac7add281ef28ca5559f":{"price":{"6508":"180.00","6507":"180.00","6506":"180.00","6505":"180.00","6509":"180.00","6510":"180.00","6514":"180.00","6513":"180.00","6512":"180.00","6511":"180.00","6504":"180.00","6503":"180.00","6497":"180.00","6496":"180.00","6495":"180.00","6494":"180.00","6498":"180.00","6499":"180.00","6502":"180.00","6501":"180.00","6500":"180.00","6515":"180.00","6516":"180.00","6531":"180.00","6530":"180.00","6529":"180.00","6528":"180.00","6532":"180.00","6533":"180.00","6537":"180.00","6536":"180.00","6535":"180.00","6534":"180.00","6527":"180.00","6526":"180.00","6520":"180.00","6519":"180.00","6518":"180.00","6517":"180.00","6521":"180.00","6522":"180.00","6525":"180.00","6524":"180.00","6523":"180.00","6493":"180.00","6492":"180.00","6463":"180.00","6462":"180.00","6461":"180.00","6460":"180.00","6464":"180.00","6465":"180.00","6469":"180.00","6468":"180.00","6467":"180.00", REPLACE(@Data.pluginText, '"', '\"') );