Guerrilla Guerrilla - 2 months ago 6x
MySQL Question

Can't backup with MariaDB Console

I am trying to take a backup of a database. I open up the MariaDB client console on windows 10, enter root password and then enter this:

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

It returns this error:

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

What did I do wrong?


Try using

mysqldump -u root -p database_name > file.sql

before logging to database (new CLI window) - as seen in Documentation example. You will have to enter root password after this command

You should be able to run this command in any CLI, like CMD.exe or Git Bash - depending on the way you installed things on your machine. I hope this helps