Answer the question
In order to leave comments, you need to log in
How to make a copy of all mysql databases in separate files?
Hello. Tell me how to make copies of all databases in separate files with the names of these databases. How it's done through "Export" in phpmyadmin
On the Internet I found only how to make a common database or separately. I would like to somehow separately, but at the same time everything is in automatic mode
Answer the question
In order to leave comments, you need to log in
In automatic mode, this is done by writing a bash script. Get a list of databases -> cycle through the entire list and make a dump for each of them into a separate file with the appropriate name.
I don't quite understand what it means
On the Internet I found only how to make a common database or separately
I would like to do it separately
// на JAVE как то-так, думаю вполне понятно
public class Export{
public static void main(String []arg){
String tables[];
if(args.length==0)
tables =new Array(){"table1","table2","table3"};
else{
tables =new String[args.length];
System.copyarray(tables,0,args,0,args.length);
}
for( table : tables){
Process proc = Runtime.getRuntime().exec("cmd C:\MySql\bin>mysqldump -uПользователь -pПароль и bd_name "+table+" > file_"+table+".sql");
}
}}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question