2

Im trying to import a dumpfile.sql in the Windows Powershell with:

mysql -u root -p --database=database < Backup.sql

but i get the following error:

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

If i try to escape the "<"

mysql -u root -p --database=database ^< Backup.sql

I only get a list of all options.

Maybe the problem arose due to the update to Windows 11.

mklement0
  • 382,024
  • 64
  • 607
  • 775
  • Please try to post error message in English. As an aside: `^` only serves as the escape character in `cmd.exe`, not in PowerShell (where it is `\``, the so-called backtick). – mklement0 Jan 09 '22 at 22:16

1 Answers1

2

Did you tried to pipie the backup file to the mysql exe like this:

get-content 'Backup.sql' | mysql.exe -u root -p --database=database

another option to run it using cmd from the powershell

& cmd /c "mysql.exe -u root -p --database=database < backup.sql"
Mahmoud Moawad
  • 697
  • 7
  • 14