Rabu, 03 Oktober 2012
MySQL - Membuat script bat untuk proses dump database MySQL
set @path_backup = 'D:\\backup\\';
set @sv_host = 'localhost';
set @sv_port = '3306';
set @sv_uname = 'root';
set @sv_pwd = 'upie';
select * into outfile 'D:\\script_batch_mysqldump.bat'
lines terminated by '\n'
from
(
select concat('mysqldump --host=',@sv_host,' --port=',@sv_port,' -u',@sv_uname,' -p',@sv_pwd,' --add-drop-table --max_allowed_packet=1GB --routines --triggers --quote-names -E --no-data ', db.schema_name ,' > ',@path_backup, 'structure_',db.schema_name,'.sql') as syntax from information_schema.schemata as db where db.schema_name not in ('information_schema','mysql','test')
union
select concat('mysqldump --host=',@sv_host,' --port=',@sv_port,' -u',@sv_uname,' -p',@sv_pwd,' --add-drop-table --extended-insert --hex-blob --max_allowed_packet=16GB --lock-tables --no-create-db --no-create-info --quote-names --order-by-primary --dump-date ',db.schema_name,' > ',@path_backup, 'data_', db.schema_name,'.sql') as syntax from information_schema.schemata as db where db.schema_name not in ('information_schema','mysql','test')
) as script;
Langganan:
Posting Komentar (Atom)
Tidak ada komentar:
Posting Komentar