-1

I would like to know how to dump all databases into a folder. I'm using a Linux/Debian Afer connecting on the server with root access I make

$ mysql -u admin -p

To connect on mysql.

Then which commands are to extract all databases created in my Plesk Panel?

Khaled
  • 35,688
  • 8
  • 69
  • 98
Seik
  • 73
  • 1
  • 6

4 Answers4

6

You can use the mysqldump command

mysqldump -u user -p --all-databases >file.sql

and a quick hack at a script which does much the same but puts the databases in individual files

#!/bin/bash

echo "show databases;" | mysql -u root --password='Password' | while read databa
sename
do
    echo dumping $databasename
    mysqldump -u root --password='Password' "$databasename" >"$databasename.sql"

done
user9517
  • 114,104
  • 20
  • 206
  • 289
3

If you have SSH access, you can the command:

mysqldump -u root -p --all-databases > /path/to/outfile

Then, you can download the generated file.

Khaled
  • 35,688
  • 8
  • 69
  • 98
2

While connected with SSH, you can issue the following commands.

To dump all your MySQL databases:

mysqldump --user=<user> --password=<pwd> -A > /PATH/TO/DUMPFILE.SQL

If you want to dump specific databases:

mysqldump --user=<user> --password=<pwd> --databases DB_NAME1 DB_NAME2 DB_NAME3 > /PATH/TO/DUMPFILE.SQL

It's really that simple :)

Jonathan Rioux
  • 1,878
  • 6
  • 33
  • 57
1

Then which commands are to extract all databases created in my Plesk Panel?

What's plesk got to do with it?

Just ssh on and run mysqldump, writing the output to a directory you can read via ssh/ftp/http and download the files.

symcbean
  • 19,931
  • 1
  • 29
  • 49