evening_g
evening_g

Reputation: 173

Make a backup of a MariaDB database

I want to make a backup of a db in mariaDB, I've used the following statements but any work.

mysqldump -u root -p -databases messages > dbdescargada.sql
mysqldump -u root -p messages > dbdescargada.sql
mysqldump -u root messages > clients.sql
mysqldump --user='root' --add-locks messages messages > copia.sql
mysqldump --user='root' --add-locks messages messages > copia.sql

But all showed the same error:

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 'statement' at line 1

enter image description here

I really need to do this backup cause I need to make important changes to the tables structures, I'm using Xampp for Linux, Ubuntu 20.04 I know I can do it from localhost/phpmyadmin but I need also a code option

Upvotes: 1

Views: 999

Answers (2)

nbk
nbk

Reputation: 49373

The parameter is --databases

Your images suggests that you run the shell command in the mysqlshell that is wrong, yoz must run it in a normal command window bash msdods...

Please check the parameters

mysqldump -u root -p --databases messages > dbdescargada.sql

Upvotes: 1

Gordan Bobić
Gordan Bobić

Reputation: 1858

You have 2 problems:

1) You are running it from mysql CLI. mysqldump is a shell command, not a mysql command.

2) Lose the - in -> redirect to file - there is no minus before >

Upvotes: 2

Related Questions