2016-07-29 71 views
-1

我有一个从PHPMyAdmin的出口将不会重新导入一个问题。这与一个逃脱的单引号和一个 字符的组合有关。我把它归纳为以下:出口将不会导入

CREATE TABLE `test` (
    `id` int(11) NOT NULL, 
    `text` text NOT NULL, 
    `text2` text NOT NULL 
) ENGINE=MyISAM DEFAULT CHARSET=latin1; 

由于没有逃脱单引号,但有一个 :

INSERT INTO `test` (`id`, `text`, `text2`) VALUES (108, 'Whats new for local authorities?', ' '); 

工程确定

有了一个转义单引号,但没有 

INSERT INTO `test` (`id`, `text`, `text2`) VALUES (108, 'What\'s new for local authorities?', ''); 

WORKS OK

但既:

INSERT INTO `test` (`id`, `text`, `text2`) VALUES (108, 'What\'s new for local authorities?', ' '); 

与失败:

Static analysis: 

1 errors were found during analysis. 

Ending quote ' was expected. (near "" at position 100) 
SQL query: 

INSERT INTO `test` (`id`, `text`, `text2`) VALUES (108, 'What\'s new for local authorities?', '&nbsp 

MySQL said: Documentation 

#1064 - 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 ''&nbsp' at line 1 

这可能是我的无知,但我一直在出口国和进口大量的DB多年,没有任何问题。

任何帮助,感激地接受。

感谢

+0

导入数据的可能的复制[错误而导入大型.sql文件到MySQL(http://stackoverflow.com/questions/38583500/error -while-imported-large-sql-file-into-mysql) – e4c5

回答

0

尝试从mysql.exe

mysql -uuser -ppass dbName < file.sql 
+0

这工作正常....所以这是一个PHPMyAdmin/PHP的问题? –

+0

PHPMyAdmin有时不会导入它输出的相同数据。 – Michal

+0

PHPMyAdmin可以处理转义字符,即使以这种格式导出它们也是如此。 – MrX