Skip to content

lucas-TagDev/dump-sql-plesk

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 

Repository files navigation

DUMP ALL DATABASES SQL PLESK WINDOWS

This script allows you to dump all databases managed by your Plesk on Windows.

The script consists of two commands, the first being:

Command: plesk db "SELECT name FROM data_bases;"

This command will allow you to list all databases created in your Plesk.
Command output:

+--------------+
| name         |
+--------------+
| database_01  |  
| database_02  |  
+--------------+

Save the output in a .txt file (e.g., list.txt) and remove any special characters, including whitespaces, using a text editor. Remove the characters +, -, | as well.

Once done, save the file, leaving only the database names.

The second command performs the Plesk dump using mysqldump, which comes pre-installed with Plesk. You will need the MySQL or MariaDB admin password for your Plesk.

Command: C:> "%plesk_dir%"MySQL\bin\mysqldump -uadmin -p -P3306 client_base > client_base.sql

Note: The MySQL or MariaDB admin password will be requested during the command's execution. If the password is unknown, it can be safely changed in Tools & Settings > Database Servers > localhost (default for MySQL or MariaDB) on port 3306.

After running this command, the desired database will be dumped.

With this in mind, if you have many databases, the script in this repository will do all the hard work for you. 😉

Edit script .ps1 to your information:

# Configurações
$BackupDir = "C:\backup_bancos"
$MySQLUser = "admin"
$MySQLPassword = ""
$MySQLPort = 3306
$MySQLPath = "C:\Program Files (x86)\Plesk\MySQL\bin"
$FilePath = "lista.txt"
$WaitSeconds = 10

About

Dump all plesk SQL databases for Windows

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published