无法使用 MariaDB 控制台进行备份

Can't backup with MariaDB Console

我正在尝试备份数据库。我在 windows 10 打开 MariaDB 客户端控制台,输入 root 密码,然后输入:

MariaDB [(none)]> mysqldump database_name > backup.sql;

它returns这个错误:

ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'mysqldump database_name > backup.sql' at line 1

我做错了什么?

尝试使用

mysqldump -u root -p database_name > file.sql

在登录数据库之前(新 CLI window)。执行此命令后您将必须输入 root 密码

您应该能够在任何 CLI 中 运行 此命令,例如 CMD.exe 或 Git Bash - 取决于您在计算机上安装东西的方式。希望对您有所帮助