我正在尝试使用以下命令在 Windows Powershell 中导入 dumpfile.sql:
mysql -u root -p --database=database < Backup.sql
但我收到以下错误:
At <script-path>:1 char:34
+ mysql -u root -p --database=database < Backup.sql
+ ~
The '<' operator is reserved for future use..
+ CategoryInfo : ParserError: (:) [], ParentContainsErrorRecordException
+ FullyQualifiedErrorId : RedirectionNotSupported
如果我试图逃避“<"
mysql -u root -p --database=database ^< Backup.sql
我只得到所有选项的列表。
可能是由于更新Windows 11而出现问题。
您是否尝试将备份文件通过管道传输到
mysql
exe,如下所示:
Get-Content 'Backup.sql' | mysql.exe -u root -p --database=database
另一种选择是使用 powershell 中的
cmd
运行它
& cmd /c "mysql.exe -u root -p --database=database < backup.sql"