PDA

View Full Version : MySQL database backup problems... result #2?


Shockt
1-18-05, 03:51 PM
I am currently using a combination of B&T's scripts. One that runs a cron job every day that calls a PHP script to backup a database. The PHP script works correctly when executed through a browser (sends me an email with the filesize of the backup and the backup is stored in a directory). The cron job also works correctly, executing the PHP script and mailing me the result. Though, the problem I am having is the backup does not complete when executed by the cron job. A file with the name the backup uses is created but nothing is stored in it. Using the following returns $result = 2.

system( "/usr/local/bin/mysqldump --opt --no-create-db --user=$dbuser --password=$dbpswd --host=$host $mysqldb > $filename",$result);

All the variables are correct as the backup works perfectly when executed in a browser.. I am not sure what the cron job is doing to screw it up..

Shockt
1-18-05, 07:08 PM
Still havent found a solution =\

Shockt
1-19-05, 10:56 AM
Did the same thing this morning... anyone having this problem?

B&T
1-19-05, 12:29 PM
What is in the variable $filename? The problem has to be there. Directory persmissions . . . something. The only thing different about the cron execution is that when you run the script it is running as you. When Cron runs it is not. So permissions are the likely cause the more I think about this.

Shockt
1-19-05, 06:19 PM
$filename="/www/s/shocktnet/htdocs/isigpets_dbbackup/backup_$day.sql";

The location of the directory will most likely change when I get this working properly. I CHMODed the directory to '777' and will let the cron run through it again and see if the problem is fixed. Though I do not think the permissions is what is creating the error as the backup_x.sql is being created but no information is put into it.

Shockt
1-19-05, 07:21 PM
Changing the permissions of the directory to '777' did not work. I am still getting the result = 2.

B&T
1-19-05, 07:50 PM
777 would not be right anyway. should be 755. OK, I forgot the file is created but empty. I am also still stumped on this one. I will continue to think about it. What is unique to you and cron. Maybe your server? As far as I know you are the only one to have this issue.

I also still cannot find the answer as to what the result code 2 means. Hmmm . . .

Shockt
1-19-05, 08:23 PM
How do I find out which server I am on?

B&T
1-19-05, 08:29 PM
You can look in OPS or use the domain resolution tool on my Tips & Scripts page.

Shockt
1-19-05, 09:11 PM
I looked thought both OPS and your website and saw nothing on it. Unless it is easily overlooked, I did not see it under any of the tabs.

alphadesk
1-19-05, 09:23 PM
Shockt

You're on ... www16.powweb.com

OPS won't show what server and when load balancing kicks back in it will just show what "cluster" your pages will be served from.

B&T
1-19-05, 09:32 PM
I don't have access to any packages on 16, so I cannot tell you if there is something unique going on there or not.

Shockt
1-19-05, 09:44 PM
Alright. Maybe I will wait in line for the Live Chat again. Thanks for your attempts!

WATRD
1-19-05, 09:55 PM
Did the same thing this morning... anyone having this problem?

I believe I am seeing the same thing.

I have three scripts, different only in username, password and database. I can run all three manually but when triggered by cron, one works and two fail with the following;

"/usr/local/bin/mysqldump: Got error: 1251: Client does not support authentication protocol requested by server; consider upgrading MySQL client when trying to connect"

The ones that fail run and create a 0k file. The one that runs creates a proper backup file.

All three scripts are in the same directory and are permissioned the same (644)

I have run windiff's of the file and the only differences are as mentioned above. The usernames and passwords are correct, as witnessed by the fact that I can run the scripts manually.

Did you have any luck getting a resolution to your problem?

Shockt
1-20-05, 07:07 PM
I contacted an employee through LiveChat and he escalated a support ticket I submitted so I will be expecting a response soon.

WATRD
1-20-05, 07:35 PM
Excellent. Please post back if you get a resolution. We are debugging the same thing over on this thread; http://forum.powweb.com/showthread.php?t=20022

Just out of curiosity, does your password have characters other than letters and numbers in it?

WATRD
1-21-05, 01:21 AM
Please see this thread;

http://forum.powweb.com/showthread.php?p=268747

We think we have found the problem, an old version of MySQL dump on one of the machines. Details are in the thread and I have opened a ticket with the hope that they will updated the version and the problem will go away :)

Shockt
1-21-05, 05:10 PM
Just out of curiosity, does your password have characters other than letters and numbers in it?
Nope.. its only numbers and letters.

Hopefully PowWeb will find a solution soon..

WATRD
1-21-05, 05:40 PM
As near as I can tell, the solution is for them to update version of MySQLDump on the server to match the newer version on other boxes. My ticket is still open and has changed hands, so hopefully they will update it and we can be done with this.

Shockt
1-23-05, 01:16 AM
I got a reply saying they had upgraded MySQL or something and fixed the problem.. but after testing the cron again, it still returned the same result.

WATRD
1-23-05, 10:53 AM
My ticket remains open.

artemide
1-25-05, 03:40 AM
I think I have the same problem. I'm trying to run a restore and it gives me $result = 2. I'm on mysql06. Here's the thread, any help is appreciated:
http://forum.powweb.com/showthread.php?t=46244&goto=newpost

WATRD
1-29-05, 10:30 AM
The error I was seeing has been resolved and my backup scripts run without any problems now, both via http:// and via cron.

See the thread at; http://forum.powweb.com/showthread.php?p=271106#post271106 for details.

Shockt
1-30-05, 01:18 AM
I got an email today from the script I have running with the information I have been looking for so it is working perfectly. Thanks PowWeb!

cyberCrank
1-30-05, 11:52 AM
ditto -- some of ours having cron job problems started working again night before last (28th-29th)

The Linguist
2-25-05, 10:09 AM
I'm having the same problem getting this script to back up my database. I get error code 2 when using cron. When I called the script in my browser, no message displayed but the database was backeup however the filesize was zero...

How can I resolve this problem?

B&T
2-25-05, 11:48 AM
I see WATRD got to the solution here:
http://forum.powweb.com/showthread.php?p=271106#post271106
look at that post and up a few more from there.

You will need PowWeb to fix this. Maybe you can get more info from WATRD, or his history on getting this resolved. If he does not post here, PM him.