在 Windows 上恢复 MySQL 转储时出现错误未知命令“\U”

T'l*_*ash 2 mysql mariadb mysqldump restore

我正在更新旧版本使用 MySQL 5.4.3 的软件,现在使用 MariaDB 10.2.11。因此,我使用该命令转储了旧数据:

mysqldump -uroot -p --no-create-info --skip-triggers --complete-insert theDBName -r C:\Users\myUserName\theDBName_data.dump
Run Code Online (Sandbox Code Playgroud)

然后我卸载了 MySQL 并用 MariaDB 替换了它。之后我创建了数据库并导入了新的数据结构(一些列已添加了默认值)。

恢复旧数据时出现问题:

mysql -uroot -p --default-character-set=utf8 theDBName
Enter password: ****************

MariaDB [theDBName]> SET names 'utf8';
MariaDB [theDBName]> SOURCE C:\Users\myUserName\theDBName_data.dump
ERROR: Unknown command '\U'.
ERROR: Unknown command '\a'
ERROR: Unknown command '\a'
ERROR: Failed to open file 'C:\Users\myUserName\theDBName_data.dump', error: 2
Run Code Online (Sandbox Code Playgroud)

使用该过程恢复完全相同的转储在 Linux 上运行良好,但不适用于 Windows。

谢谢你的帮助。

Ric*_*mes 6

MariaDB [theDBName]> 源 C:\Users\myUserName\theDBName_data.dump

以下任何一项都应该是正确的:

MariaDB [theDBName]> SOURCE C:\\Users\\myUserName\\theDBName_data.dump

MariaDB [theDBName]> SOURCE C:/Users/myUserName/theDBName_data.dump
Run Code Online (Sandbox Code Playgroud)