Bug #28408 Scheduled backup writes zero-length file
Submitted: 14 May 2007 3:01 Modified: 12 Feb 2009 14:09
Reporter: Rob Lewis (Candidate Quality Contributor) Email Updates:
Status: Unsupported Impact on me:
None 
Category:MySQL Administrator Severity:S2 (Serious)
Version:1.2.11 OS:MacOS (Server 10.4.9)
Assigned to: CPU Architecture:Any
Tags: Backup, scheduled, zero-length

[14 May 2007 3:01] Rob Lewis
Description:
Running an immediate backup with Administrator works. But a scheduled backup always writes a zero-length file. 

The backup directory is defined as a share point in OS X Server, with read/write privileges for both me and the mysql group. But for some unknown reason, the zero-length backup file that gets written shows the mysql group having read-only privileges. 

I don't even know that this is the problem, or what to do about it if it is. The connection I'm using for the backup jobs logs in as root. 

Also, whenever I choose the "Schedule" button on the Backup page, the Target Directory and File Name Prefix fields are blank. They should have their current values filled in. 

How to repeat:
Using MySQL Administrator, schedule the backup of an entire schema. The backup file that is written has zero length and read-only privileges for the mysql group. 

Suggested fix:
1. Create a file with read/write privileges. 
2. Make sure the backup can be written and warn the user if not. 
3. (Separate issue). Fill in the Target Directory and File Name Prefix fields with their current values when the "Schedule" button is selected.
[14 May 2007 8:20] Sveta Smirnova
Thank you for the report.

I can not repeat it in myself environment.

Please provide output of `ls -lad dir_you_save_backup`, `crontab -l` and `id` SHELL commands
[15 May 2007 10:32] Sveta Smirnova
Thank you for the feedback.

I still can not repeat it. Also, new, 5.0.r12 version of MySQL GUI Tools has been released.

Please, try with this new version and if you can repeat:

1. Try to run command from the crontab task which makes backup.
2. Describe which share do you use. I ask, because I tested with smbfs (Samba) and backup has been created successfully.
[17 May 2007 0:31] Rob Lewis
Hello. I tried the new version of Administrator and it has the same behavior. Immediate backup works fine, scheduled backup writes a zero-length file. 

I'm afraid I don't understand your other suggestions: 

1. Try to run command from the crontab task which makes backup. (How do I do this, please?)

2. Describe which share do you use. I ask, because I tested with smbfs (Samba)
and backup has been created successfully. (I used OS X Server's Workgroup Manager to define a folder as a Share Point. This folder has read/write privileges for me, and for the mysql group. It is not on the boot volume. When the scheduled backup tries to run, it creates a backup file in this folder, but for some reason this backup file has read-only privileges for the mysql group. I don't know that this is the problem, but it seems odd. Anyway, in never gets past creating this zero-length file.)
[17 May 2007 6:26] Sveta Smirnova
Thank you for the feedback.

> 1. Try to run command from the crontab task which makes backup. (How do I do
> this, please?)

You have record in the output of crontab -l. As you provided it as hidden comment, I changed paths and names. When you run command, please, change paths back to values which you provided.

# added automatically by MySQL Administrator - do not edit SharedMedia
0 3 * * * "/Applications/MySQL Tools/MySQL
Administrator.app/Contents/Resources/mabackup" --directory="correct_path" --connection="Real_Name_Of_Connectiion" "Database"

Please, run command "/Applications/MySQL Tools/MySQL
Administrator.app/Contents/Resources/mabackup" --directory="correct_path" --connection="Real_Name_Of_Connectiion" "Database"
[17 May 2007 7:18] Sveta Smirnova
No feedback needed.

Verified as described.

Problem was name of connection: use apostrof sign tp repeat:

$"/Applications/MySQL Tools/MySQL Administrator.app/Contents/Resources/mabackup" --directory="/Users/apple/temp" --connection="tutti' frutti'" --prefix="foo_" "New Project"
Bus error

Workaround: rename connection from "tutti' frutti'" to "tutti-frutti"
[17 May 2007 22:00] Rob Lewis
That was a great suggestion, and I eagerly removed all spaces and punctuation from my connection name. Sadly, it didn't help. Exactly the same behavior as before. 

(Mabye you should document what characters are allowed in connection names, or, even better, fix it to accept any characters.) 

Some things I wonder about: 
--When I select the "Schedule" tab, the Target Directory field is always blank. Even though the program does write the zero-length file in the correct directory, it seems to me the current value should be displayed by the program.

--I have Advanced Options selected as follows: 
Backup Execution: Online with Binlog pos
Backup Selected Schema Completely: checked
Backup Type: SQL File (the only available option)
Include Comments: checked
I tried to check "Disable Foreign Keys", but with the new version of the program, it always unchecks it for me. 

I'll let you know what happens tonight when it's supposed to run.
[17 May 2007 22:08] Sveta Smirnova
Thank you for the correction, Rob.

Seems there are more then one cause here.

Please also send output of the command:

"/Applications/MySQL Tools/MySQL
Administrator.app/Contents/Resources/mabackup" --directory="correct_path"
--connection="Real_Name_Of_Connectiion" "Database"
[18 May 2007 0:17] Rob Lewis
Hello. The command produced this output:
Bus error

Also, it wrote a zero-length file in the backup directory! 

"Bus error" sounds like a hardware problem, but:
1. I don't have any other problems using this drive, and 
2. How can the backup work fine in immediate mode?
[18 May 2007 7:50] Sveta Smirnova
Hello Rob,

"Bus error" on Mac can means different erorrs such as "Segmentation fault". No hardware problem usually.

Please paste as private comment exact command you run to I can try in myself environment and find if we have here only character set porblem or file access problem also.
[18 May 2007 9:26] Sveta Smirnova
Thank you for the feedback.

Please use exact line from crontab -l output: use quotes. As --connection="RealNameOfConnection"

Also please check if you have at least 1 table scheduled for backup in the project.
[18 May 2007 9:27] Sveta Smirnova
Second cause of described behavior: if no tables checked to backup in the project, but the project is scheduled, "Bus error" occurs.
[8 Jun 2007 12:05] Sveta Smirnova
Thank you for the feedback.

Problem seems to be directory name: MySQL Administrator wrote in you case directory "/Volumes/foo\ bar" instead of "/Volumes/foo bar". But I can not repeat this error with current version 1.2.12. Please upgrade, try again last test and say us result.
[8 Jul 2007 23:00] Bugs System
No feedback was provided for this bug for over a month, so it is
being suspended automatically. If you are able to provide the
information that was originally requested, please do so and change
the status of the bug back to "Open".
[9 Jul 2007 7:36] Sveta Smirnova
As no feedback has been provided, setted as "Verified"

To repeat follow instructions from comments "[17 May 9:18] Sveta Smirnova" and "[18 May 11:27] Sveta Smirnova"
[25 Sep 2007 1:37] Stuart Parker
I am also experiencing this issue, sometimes the output file is empty, sometimes it has some header information. The Start Backup button works - the scheduled backup doesn't. 

Version info
MYSQL administrator : 5.0r12. I
Operating System: OSX 10.4.10
MSYQL version : MySQL 5.0.21-standard-log via TCP/IP
MySQL Client Version 5.1.8

Here are the details
stuart$ sudo crontab -l -u stuart
# added automatically by MySQL Administrator - do not edit FullBackup
12 11 * * * "/Applications/MySQL Tools/MySQL Administrator.app/Contents/Resources/mabackup" --directory="/Backups/DatabaseBackups/Mysql" --connection="backup" --prefix="FULL_" "FullBackup"

which looks correct, but I'm not sure if there should be anything else there for it to work correctly.

This is what I get in the backup file if it writes something, - this file was 4KB in size. A full backup (by clicking the Start Backup button) is 2.4MB

-- MySQL Administrator dump 1.4
--
-- ------------------------------------------------------
-- Server version	5.0.21-standard-log

/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8 */;

/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
[15 Jan 2008 6:03] Sveta Smirnova
Bug #33554 was marked duplicate of this one.
[25 Feb 2008 17:26] m m
What is the status of this bug?
[2 May 2008 13:23] Paul Willis
I also have this problem, my situation is pretty well summed up by Stuart Parker [25 Sep 2007 3:37]
 
A manual start provides a full complete backup. The automated one just produces a 1k file.

I'm using...

MySQL Administrator version 1.2.12 running on OS X 10.4.11 Server.
Connecting to MySQL 5.0.45 running on Mac OS X 10.4.11 Server also tried with 5.0.36sp1 Enterprise also running on Mac OS X 10.4.11 Server.
[25 May 2008 10:56] Paul Willis
This bug is also present on Max OS X Server 10.4.11
[23 Jun 2008 17:06] Michael Houlberg
I was having this same exact problem.  On Mac OS X 10.5.3 it would only save a 4K header file and no actual database backup.  I changed the preference option in MySQL Administrator to save the connection password.  When I had it set to save in keychain, the backup fails.  When set to save as "obscured" the backup works correctly.
[26 Jun 2008 11:28] Paul Willis
Hey Michael that's brilliant...

I switched the password to 'obscured' from 'keychain' and last night my backups all worked properly.

Thank you very much. I no longer have to do this manually everyday while waiting for MySQL to fix this bug.
[5 Feb 2009 16:25] Aaron Hollman
Just FYI....

I also was having an issue where my scheduled backups would only be 4KB instead of the megs they would normally be. 

My issue involved the Connection Name in the Schedule tab. While I was logged in as one connection, the connection I had set in the Connection Name no longer existed. This is why I could run immediate backups that worked, but the scheduled backups would not.

I would suggest to anyone who may be reading this to verify that the connection name has the ability to connect to the database.
[12 Feb 2009 14:09] Susanne Ebrecht
Many thanks for writing a bug report.
We are on the way to implement the whole functionality of MySQL Administrator into MySQL Workbench.
Unfortunately you are using an unsupported platform.

For more details about supported platforms please read here:

http://www.mysql.com/support/supportedplatforms/tools.html
[7 Oct 2009 6:24] hemant yadav
i am having the problem when try to scheduled backup daily i have configured everything. but i am not getting any backup file after the time of backup schedule.

Please help me....
Hemant Yadav
Software Engineer
http://www.smilemd.com