Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8740809
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T11:11:49+00:00 2026-06-13T11:11:49+00:00

I have this line of php backing up my databases, work’s like a charm

  • 0

I have this line of php backing up my databases, work’s like a charm (Windows 7):

$exec_str = "{$real_path}Bin\mysqldump -h {$mysql_db_host} -u {$mysql_db_user} -p{$mysql_db_pasw} {$db_name} > {$backupdir}\\{$db_name}.sql";

But i would rather prefer to have the .sql files compressed with 7zip (as 7z)

This one will not work (path to 7za.exe is correct)
Instead it generates empty 7z files:

$exec_str = "{$real_path}Bin\mysqldump -h {$mysql_db_host} -u {$mysql_db_user} -p{$mysql_db_pasw} {$db_name} | {$real_path}7za a > {$backupdir}\\{$db_name}.sql.7z";

What am i doing wrong?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T11:11:50+00:00Added an answer on June 13, 2026 at 11:11 am

    I successfully used 7z to compress the output from mysqldump (Windows Server 2008 R2), but I used command line batch files and automated tasks instead. Also, I just used 7z.exe, not 7za.

    Note the following commands are executed from the Windows command terminal, i.e Start->Run->cmd

    I created a batch file for the automated task to run with the contents:

    mysqldump -u<mysqlUserName> -p<mysqlPassword> <schemaName>|7z.exe a -si<nameInZip> <zippedPathAndName.7z> 
    

    This creates a .7z file of the mysqldump. The [-si] switch specifies to take input from StdIn. The “nameInZip” is just what you want to appear in the zip file; I made mine “schemaName”.sql.

    NOTE: this assumes that the mysqldump and 7z executable directories are in the %PATH% Environment variable. Otherwise use the full path to the binaries, e.g. c:\program files\7-zip\7z.exe instead of just 7z.exe

    Then I created an automated task:

    schtasks /create /sc DAILY /tn <yourTaskName> /ru System /tr <pathToYourBatchFile> /st 20:45
    

    This creates an automated task that runs your batch file daily at 20:45. Note the “/ru System” switch which ensures that the command is run by SYSTEM and will run whether you’re logged on or not.

    See here for a good reference for schtasks command.

    Hope this helps!

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have one line in php file like this: <a class=hide-if-no-js onclick=findPosts.open( 'media[]','<?php echo
I have a line of php code that looks like this: echo <script>$('#edit_errors').html('<h3><em>Please Correct
I have this line: <?php the_date(' F j Y')?> this ends up with June
Say I have this line of code in the view. <?php echo CHtml::activeTextField($model,'start_time'); ?>
I have this common issue of 'new line' in php-csv which is making me
I have this line: $(#clients-edit-wrapper).height($(window).height()-150); I would like to apply that height function to
I have this line in my htaccess file: RewriteRule (.*) index.php This catches all
Example I have this line of code in PHP, and I want to pass
I have this line of code: <a href=# id=profilelink name=profilelink value=<?php echo $id./.$block_record;?> onClick=return
<a href=tags.php onclick=return popitup('tags.php')>tags</a> I have this line of code that runs the javascript

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.