2016-07-29 66 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