mysql - 从 PHPMyAdmin 导出不会导入

标签 mysql phpmyadmin

我遇到一个问题,从 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?', '');

工作正常

但是两者都有:

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

这可能是我的无知,但多年来我一直在导出和导入大型数据库,没有出现任何问题。

任何帮助,感激不尽。

谢谢

最佳答案

尝试从mysql.exe导入数据

mysql -uuser -ppass dbName < file.sql

关于mysql - 从 PHPMyAdmin 导出不会导入,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38659171/

相关文章:

mysql - 如何用go连接mysql?

mysql - 在控制台中从 Spring JPA 查询与原始 SQL 获取不同的结果

php - 无法连接到 phpMyAdmin

mysql - 无法在 XAMPP phpmyadmin 中编辑 MySQL 表 - 行中没有编辑/更改/插入/删除按钮

PHP session 不存储/保存 - php-fpm/nginx/phpmyadmin/centos6

php - PDO准备函数问题

php - 如果 key 不存在则发送 null

javascript - Node.js mysql 查询返回空数组

mysql - 使用 "Join"的选择查询忽略 where 子句

php - 如何允许连接到 MariaDB?