Forums / Addon Admin Tools / Backup MySQL Database

Backup MySQL Database

Views: 87,442

Results 1 to 20 of 327
15 May 2006, 8:13 PM
#2
woodymon avatar

woodymon

Totally Zenned

Join Date:
Sep 2004
Posts:
2,309
Plugin Contributions:
1

Re: Backup MySQL Database

rued:

Is the Backup MySQL Database contibution working in v1.3,
Yes. .

15 May 2006, 9:01 PM
#4
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,515
Plugin Contributions:
176

Re: Backup MySQL Database

File Is Now In The Downloads Area

https://www.zen-cart.com/downloads.php?do=file&id=7

.
Zen Cart - putting the dream of business ownership within reach of anyone!
Donate to: DrByte directly or to the Zen Cart team as a whole

Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.

16 May 2006, 5:46 PM
#6
ts232 avatar

ts232

Zen Follower

Join Date:
May 2006
Posts:
167
Plugin Contributions:
0

Re: Backup MySQL Database

Thanks for posting this. I installed it, but when I attempt the backup I get the error:

Result code: 127
Error ERROR: Could not locate the MYSQLDUMP backup utility. BACKUP FAILED.
*

But mysqldump is right where it should be on my dreamhost linux host at /usr/bin/mysqldump . Any ideas what to try for a fix?

--
Author of Stock vs. Sales Report

16 May 2006, 7:24 PM
#7
woodymon avatar

woodymon

Totally Zenned

Join Date:
Sep 2004
Posts:
2,309
Plugin Contributions:
1

Re: Backup MySQL Database

ts232:

Result code: 127
Error ERROR: Could not locate the MYSQLDUMP backup utility. BACKUP FAILED.

But mysqldump is right where it should be on my dreamhost linux host at /usr/bin/mysqldump . Any ideas what to try for a fix?

You did not say... did you go thru the checklist in the readme? (see caveats & addendum).

Woody

16 May 2006, 7:54 PM
#8
ts232 avatar

ts232

Zen Follower

Join Date:
May 2006
Posts:
167
Plugin Contributions:
0

Re: Backup MySQL Database

Woodymon:

You did not say... did you go thru the checklist in the readme? (see caveats & addendum).

Woody

Yep, I went through the list. I don't know how to find out if the caveats are what is tripping me up. I just found out that my host has the mod_security apache module enabled by default. Perhaps that's screwing things up. I'm going to try disabling it temporarily and see if it works.

--
Author of Stock vs. Sales Report

16 May 2006, 9:08 PM
#9
ts232 avatar

ts232

Zen Follower

Join Date:
May 2006
Posts:
167
Plugin Contributions:
0

Re: Backup MySQL Database

ts232:

Yep, I went through the list. I don't know how to find out if the caveats are what is tripping me up. I just found out that my host has the mod_security apache module enabled by default. Perhaps that's screwing things up. I'm going to try disabling it temporarily and see if it works.

Nope that didn't fix it. For now I'm using mysqldump from the shell. Can't find any info about the mentioned security restrictions being implemented on my host. If anyone has any ideas I am all ears, otherwise I'll stick with the shell approach.

--
Author of Stock vs. Sales Report

16 May 2006, 11:08 PM
#11
woodymon avatar

woodymon

Totally Zenned

Join Date:
Sep 2004
Posts:
2,309
Plugin Contributions:
1

Re: Backup MySQL Database

ts232:

Nope that didn't fix it. For now I'm using mysqldump from the shell. Can't find any info about the mentioned security restrictions being implemented on my host. If anyone has any ideas I am all ears, otherwise I'll stick with the shell approach.

When you installed or upgraded Zen Cart the pre-flight check (install wizard) should have indicated some of this.

Go to Admin > Tools > Server Info to observe your server configuration [same as phpinfo()] and a little bit more info.

Woody

16 May 2006, 11:19 PM
#12
woodymon avatar

woodymon

Totally Zenned

Join Date:
Sep 2004
Posts:
2,309
Plugin Contributions:
1

Re: Backup MySQL Database

ts232:

Can't find any info about the mentioned security restrictions being implemented on my host.

Also I meant to mention that if you have any questions regarding security restrictions implemented by your host then by all means you should contact your hosting provider :wink2:

Woody

16 May 2006, 11:37 PM
#13
ts232 avatar

ts232

Zen Follower

Join Date:
May 2006
Posts:
167
Plugin Contributions:
0

Re: Backup MySQL Database

Woodymon:

When you installed or upgraded Zen Cart the pre-flight check (install wizard) should have indicated some of this.

Go to Admin > Tools > Server Info to observe your server configuration [same as phpinfo()] and a little bit more info.

Woody

Good tip, thanks for your help. Dreamhost has an install instructions for the wizard that informs us to just ignore the pre-flight check results. :blush: Here's what I pulled out from the Server Info that might be relevant (based on what the Caveats in the install were). The only mentioned caveat that I couldn't find info on was possible restrictions on exec(), so I will bug my host about that unless someone here knows a way to check that.

open_basedir no value no value
safe_mode Off Off
safe_mode_exec_dir no value no value
*

--
Author of Stock vs. Sales Report

17 May 2006, 5:25 AM
#14
woodymon avatar

woodymon

Totally Zenned

Join Date:
Sep 2004
Posts:
2,309
Plugin Contributions:
1

Re: Backup MySQL Database

ts232:

Dreamhost has an install instructions for the wizard that informs us to just ignore the pre-flight check results. :blush:

TS-

Since "Dreamhost" managed your Zen Cart installation you should be forward your questions on to them.

Myself I recommend storeowners avoid the canned script/one-click/Fantastico type installation service and instead install the "Zen Cart way" (via zc_install). With the zc_install step-by-step method you learn about all the configuration details required for installation, basic database configuration information, directory paths, server specifications and many other details you will need to know later to "upgrade" your cart and apply various modifications/customizations. And with such info at hand you will be able to answer many of your own questions that come up later and therefore won't need to rely on your host so much for support, and for that matter the Zen Cart forums. Also throughout the zc_install process you are pointed to webpages with much useful and easy to understand help documentation that is a MUST read. Especially security information!

With the canned script install process you miss all this and more.

"The pros and cons of hitchhiking" :wink2:

Woody

17 May 2006, 4:34 PM
#15
ts232 avatar

ts232

Zen Follower

Join Date:
May 2006
Posts:
167
Plugin Contributions:
0

Re: Backup MySQL Database

Woodymon:

TS-

Myself I recommend storeowners avoid the canned script/one-click/Fantastico type installation service and instead install the "Zen Cart way" (via zc_install). With the zc_install step-by-step method you learn about all the configuration details required for installation, basic database configuration information, directory paths, server specifications and many other details you will need to know later to "upgrade" your cart and apply various modifications/customizations. And with such info at hand you will be able to answer many of your own questions that come up later and therefore won't need to rely on your host so much for support, and for that matter the Zen Cart forums. Also throughout the zc_install process you are pointed to webpages with much useful and easy to understand help documentation that is a MUST read. Especially security information!

With the canned script install process you miss all this and more.

"The pros and cons of hitchhiking" :wink2:

Woody

Woody, your points are well taken. In defense of the one-click install however, it was a low cost way for me to check out zencart and realize what a great product it is compared to my creaking old oscommerce shop. Had it not been for the one-click I probably would not have taken the time to try installing yet another ecommerce system. ;)

--
Author of Stock vs. Sales Report

18 May 2006, 5:40 AM
#16
woodymon avatar

woodymon

Totally Zenned

Join Date:
Sep 2004
Posts:
2,309
Plugin Contributions:
1

Re: Backup MySQL Database

ts232:

Woody, your points are well taken. In defense of the one-click install however, it was a low cost way for me to check out zencart and realize what a great product it is compared to my creaking old oscommerce shop. Had it not been for the one-click I probably would not have taken the time to try installing yet another ecommerce system. ;)

TS- I certainly understand and no defense needed. That is why closed with: "The pros and cons of hitchhiking". Or I could have said "there is no free lunch". In other words there are "opportunity costs" to ALL choices we make (inlcuding a cost to not making a choice).

Woody

18 May 2006, 9:00 PM
#17
rotozuk avatar

rotozuk

New Zenner

Join Date:
Apr 2006
Posts:
27
Plugin Contributions:
0

Re: Backup MySQL Database

ts232:

Good tip, thanks for your help. Dreamhost has an install instructions for the wizard that informs us to just ignore the pre-flight check results. :blush: Here's what I pulled out from the Server Info that might be relevant (based on what the Caveats in the install were). The only mentioned caveat that I couldn't find info on was possible restrictions on exec(), so I will bug my host about that unless someone here knows a way to check that.

open_basedir no value no value
safe_mode Off Off
safe_mode_exec_dir no value no value
*

Please keep me posted on anything you find as I'm also on Dreamhost and would like to get the backup command working. Just an easier cleaner method then doing it manually.

-Wayne

2 Jun 2006, 5:51 PM
#18
ts232 avatar

ts232

Zen Follower

Join Date:
May 2006
Posts:
167
Plugin Contributions:
0

Re: Backup MySQL Database

I turned on the debug mode and am poking around with it now. Here's the debug trace on the problem. The mysqldump and mysql execs are in place on the (linux) server where my zencart install resides (takspeed.com), but I am guessing the problem lies on the sql server mysql.takspeed.com . I don't seem to have shell access to that server (using dreamhost) to check on that. Any ideas for where to look beyond this?

Checking Path: /usr/bin/
Warning 
Warning COMMAND FILES SELECTED:
Warning mysqlexe="/usr/bin/mysql"
Warning mysqldumpexe="/usr/bin/mysqldump"

Warning COMMAND: "/usr/bin/mysqldump" "--host=mysql.takspeed.com" "--user=xxxxxx" "--password=xxxxxx" --opt --complete-insert "--result-file=/home/takspeed/takspeed.com/shop/tsadmin/backups/db_zentakspeed-20060602104016.sql" zentakspeed 2>&1
Warning Result code: 127
Error valueA:
Error valueB:
Error ERROR: Could not locate the MYSQLDUMP backup utility. BACKUP FAILED.

--
Author of Stock vs. Sales Report

2 Jun 2006, 5:55 PM
#19
ts232 avatar

ts232

Zen Follower

Join Date:
May 2006
Posts:
167
Plugin Contributions:
0

Re: Backup MySQL Database

Here is the fragment of code where the error is tripped, the result of 127 branch is where it is happening:

if (file_exists(DIR_FS_BACKUP . $backup_file) && ($dump_results == '0' || $dump_results=='')) { // display success message noting that MYSQLDUMP was used
          $messageStack->add_session('<a href="' . ((ENABLE_SSL_ADMIN == 'true') ? DIR_WS_HTTPS_ADMIN : DIR_WS_ADMIN) . 'backups/' . $backup_file . '">' . SUCCESS_DATABASE_SAVED . '</a>', 'success');
        } elseif ($dump_results=='127') {
          $messageStack->add_session(FAILURE_DATABASE_NOT_SAVED_UTIL_NOT_FOUND, 'error');
        } else {
          $messageStack->add_session(FAILURE_DATABASE_NOT_SAVED, 'error');
        }

--
Author of Stock vs. Sales Report

2 Jun 2006, 6:03 PM
#20
ts232 avatar

ts232

Zen Follower

Join Date:
May 2006
Posts:
167
Plugin Contributions:
0

Re: Backup MySQL Database

Hmmm... so when I extract the mysqldump command from the php script and run it from the command line it works fine (see below). So the problem must lie in the script wrapper. I'm not a php expert, any ideas?

/usr/bin/mysqldump --host=mysql.takspeed.com --user=xxxxxx --password=xxxx --opt --complete-insert --result-file=/home/takspeed/takspeed.com/shop/tsadmin/backups/db_zentakspeed-20060602104016.sql zentakspeed 

--
Author of Stock vs. Sales Report