Forums / Addon Admin Tools / Backup MySQL Database

Backup MySQL Database

Views: 87,443

Results 241 to 260 of 327
2 Apr 2021, 9:44 PM
#241
nwce avatar

nwce

Zen Follower

Join Date:
Oct 2009
Posts:
444
Plugin Contributions:
0

Backup MySQL Database

After Importing the database through phpMyAdmin is says 1517 processed and that it is all OK, but still no information has been imported into my new database.

I then just for a shot in the dark tried using backup_mySQL plugin to backup the database just to see or confirm its size. I received this error:

Result code: 1
0 => '"mysqldump"' is not recognized as an internal or external command,
1 => operable program or batch file.
Failure: The database has NOT been saved.

Does this information help to solve my problem??

Thanks again for the help,

Jeff

2 Apr 2021, 10:30 PM
#242
drbyte avatar

drbyte

Sensei

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

Re: Backup MySQL Database

It's starting to really look like you can't run it in your current configuration.
IIRC the readme and/or the language file contain instructions on specifying the correct mysql binary/application for your computer. NOTE: If you change that to suit your local PC it will NOT match what's on your server.

Perhaps you should just do your backup with phpMyAdmin, and then take that backup and import it to the new database also using phpMyAdmin.

.
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.

2 Apr 2021, 10:48 PM
#243
nwce avatar

nwce

Zen Follower

Join Date:
Oct 2009
Posts:
444
Plugin Contributions:
0

Re: Backup MySQL Database

Ok Thank you for your reply Dr.Byte..... I will try this!

3 Apr 2021, 1:49 AM
#244
nwce avatar

nwce

Zen Follower

Join Date:
Oct 2009
Posts:
444
Plugin Contributions:
0

Re: Backup MySQL Database

I read in Wamp forums that other people used MariaDB instead of SQL for their DB to import into as they had problems with SQL.

I tried this and it worked. I used the same commands to import into MariaDB that I did into SQL and ran it in the console prompt window and it uploaded. When I looked at this database, it has all of the information in it.

Problem is I cannot get site to recognize the database is now in MariaDB even though I changed the port number to 3306 on MariaDB. Will keep working on it, but wondered why the database would upload into MariaDB and not SQL.....anyone else have this problem or know why??

Thanks,

Jeff

3 Apr 2021, 5:48 PM
#245
drbyte avatar

drbyte

Sensei

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

Re: Backup MySQL Database

NWCE:

but wondered why the database would upload into MariaDB and not SQL
MySQL has smaller/stricter limits in its default configuration than MariaDB does. That "might" be a reason, assuming you've added a lot of complex additional very long custom fields and custom indexes.

MOST IMPORTANT: Keep in mind that your local PC is NOT your live website, so ALWAYS assume that things on the live site might work differently than on your local PC. Whenever you put something on your live server test test test everything!

.
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.

3 Apr 2021, 6:05 PM
#246
nwce avatar

nwce

Zen Follower

Join Date:
Oct 2009
Posts:
444
Plugin Contributions:
0

Re: Backup MySQL Database

Hi Dr.Byte,

Thanks again for your reply....I appreciate it....and on a holiday weekend! I will look at editing the file limits in MySQL and see if this works.

As you mentioned.....I may need to just complete my customizations and then upload it under a different directory on my server to then test the database migration before going live.

Thanks once again,

Jeff

14 Jun 2021, 7:06 PM
#247
lat9 avatar

lat9

Administrator

Join Date:
Sep 2009
Location:
Stuart, FL
Posts:
14,119
Plugin Contributions:
56

Re: Backup MySQL Database

I'm in the process of updating a site that uses version

// $Id: backup_mysql.php revised 2012-07-07 $

... and updating to the most recent version:

// $Id: backup_mysql.php revised 2020-07-19 $

The issue that I'm having is that I'm receiving a 1045 (access denied) when attempting to perform a backup with the latest version, but the database properly 'backs up' using the older version (albeit without gzip compression, even though I've ticked that checkbox). I'm not sure what additional information might be needed to aid in this issue's resolution, but here goes.

The (test) site's running in a sub-directory off the main site, e.g. https://www.example.com/test. As I'm trying to get the majority of the plugins updated prior to the Zen Cart upgrade, that test site's currently running zc155e on PHP v5.6.40 with MySQL 5.7.23-23 (NO_AUTO_CREATE_USER, NO_ENGINE_SUBSTITUTION).

There's no /admin/includes/local/configure.php file that could be messing with the configuration and I'm not seeing any major change in the processing that "should" affect the outcome.

14 Jun 2021, 9:18 PM
#248
drbyte avatar

drbyte

Sensei

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

Re: Backup MySQL Database

Interestingly, the "1.5d" update in 2018 specifically aimed to resolve the "1045 access denied" issue, by escaping the pass word credential with escapeshellcmd(). I suppose you could try removing that to see if it makes any difference.
Does the db pass word happen to include single or double quotation marks in it?

The escapeshellcmd() function escapes certain characters, as outlined in https://www.php.net/manual/en/function.escapeshellcmd.php

As for gzip, if the gzip binary isn't found then the compression doesn't occur. Hopefully it just fails silently and doesn't actually send a failure message that's getting conflated with the actual backup action.

.
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.

15 Jun 2021, 11:39 AM
#249
lat9 avatar

lat9

Administrator

Join Date:
Sep 2009
Location:
Stuart, FL
Posts:
14,119
Plugin Contributions:
56

Re: Backup MySQL Database

The database password contains these special characters: _ = &

20 Jun 2021, 2:23 PM
#250
g2ktcf avatar

g2ktcf

Totally Zenned

Join Date:
Feb 2011
Location:
Lumberton, TX
Posts:
636
Plugin Contributions:
0

Re: Backup MySQL Database

I am testing a site very similar to lat9 https://www.example.com/test. I am getting this error.

0 => mysqldump: Got error: 1045: "Access denied for user '************User'@'localhost' (using password: YES)" when trying to connect

20 Jun 2021, 5:19 PM
#251
lat9 avatar

lat9

Administrator

Join Date:
Sep 2009
Location:
Stuart, FL
Posts:
14,119
Plugin Contributions:
56

Re: Backup MySQL Database

g2ktcf:

I am testing a site very similar to lat9 https://www.example.com/test. I am getting this error.

0 => mysqldump: Got error: 1045: "Access denied for user '************User'@'localhost' (using password: YES)" when trying to connect
Does your site's database password also include any "special" characters?

20 Jun 2021, 7:14 PM
#252
g2ktcf avatar

g2ktcf

Totally Zenned

Join Date:
Feb 2011
Location:
Lumberton, TX
Posts:
636
Plugin Contributions:
0

Re: Backup MySQL Database

I saw your issues with special characters (there are three). I have plans to change that and see if that works.

27 Jun 2021, 3:07 PM
#253
g2ktcf avatar

g2ktcf

Totally Zenned

Join Date:
Feb 2011
Location:
Lumberton, TX
Posts:
636
Plugin Contributions:
0

Re: Backup MySQL Database

After removing all special characters, this works just fine.

8 Nov 2021, 10:03 PM
#254
carlwhat avatar

carlwhat

zennedOut

Join Date:
Nov 2005
Location:
los angeles
Posts:
2,974
Plugin Contributions:
8

Re: Backup MySQL Database

lat9:

Does your site's database password also include any "special" characters?

speaking of special characters.....

if your admin directory has any special characters, it seems that the following change is necessary (for backing up... around line 133):

//from
$dump_params .= ' "--result-file=' . DIR_FS_BACKUP . $backup_file . '"';
//to
$dump_params .= ' "--result-file=' . escapeshellcmd(DIR_FS_BACKUP) . $backup_file . '"';

it may be worth wild to change all instances of DIR_FS_BACKUP to $backup_directory and define said var at the beginning of the script as such:

$backup_directory = escapeshellcmd(DIR_FS_BACKUP);

but alas, i do not have the time or inclination at this moment for further testing.

author of square Webpay, now with Apple Pay and Google Pay.
mXworks
donations: venmo or paypal accepted.
premium consistent excellent support. available for hire.

27 Apr 2022, 11:28 AM
#255
torvista avatar

torvista

Totally Zenned

Join Date:
Aug 2007
Location:
Gijón, Asturias, Spain
Posts:
2,876
Plugin Contributions:
7

Re: Backup MySQL Database

Since I have modified this to death over the years, I've set up a new repository based on this plugins history to be able to add in changes at some point.

So please add this link to the plugin page for reporting issues:

https://github.com/torvista/Zen_Cart-Backup_MYSQL_Plugin

Steve
github.com/torvista: BackupMySQL, Structured Data, Multiple Copy-Move-Delete, Google reCaptcha, Image Checker, Spanish Language Pack and more...

6 Jun 2023, 10:10 AM
#256
torvista avatar

torvista

Totally Zenned

Join Date:
Aug 2007
Location:
Gijón, Asturias, Spain
Posts:
2,876
Plugin Contributions:
7

Re: Backup MySQL Database

When doing a backup->Download without storing on server, I note that

  • a dumpfile is created, ok
  • a download window opens, ok
  • the download occurs, ok
  • another dumpfile is created, NOT ok.

After the header-exit, it seems to be re-running the same page using action backupnow, but despite my efforts I can't stop it.
Consequently every time I take a backup snapshot from the hosting for local use, it leaves behind 300Mb of debris which I need to delete manually.

(In my modified version of this plugin, the original dumpfile is unlinked after download, but still, a new one is created as per the plugin version)

Steve
github.com/torvista: BackupMySQL, Structured Data, Multiple Copy-Move-Delete, Google reCaptcha, Image Checker, Spanish Language Pack and more...

6 Jun 2023, 1:15 PM
#257
lat9 avatar

lat9

Administrator

Join Date:
Sep 2009
Location:
Stuart, FL
Posts:
14,119
Plugin Contributions:
56

Re: Backup MySQL Database

torvista:

Since I have modified this to death over the years, I've set up a new repository based on this plugins history to be able to add in changes at some point.

So please add this link to the plugin page for reporting issues:

https://github.com/torvista/Zen_Cart-Backup_MYSQL_Plugin

All finished.

6 Jun 2023, 1:44 PM
#258
torvista avatar

torvista

Totally Zenned

Join Date:
Aug 2007
Location:
Gijón, Asturias, Spain
Posts:
2,876
Plugin Contributions:
7

Re: Backup MySQL Database

Damn...now I suppose I'll have to do something with it!
Given the absence of comments here and there, looks like it is rarely used...I use it constantly.

Steve
github.com/torvista: BackupMySQL, Structured Data, Multiple Copy-Move-Delete, Google reCaptcha, Image Checker, Spanish Language Pack and more...

6 Jun 2023, 11:58 PM
#259
swguy avatar

swguy

Administrator

Join Date:
Feb 2006
Location:
Tampa Bay, Florida
Posts:
10,733
Plugin Contributions:
56

Re: Backup MySQL Database

Thanks folks.

Also note that since some hosters are allergic to this script, so you may have to resort to another option for building a backup.
You can use cPanel backup or backup via phpMyAdmin as noted in the documentation.

https://docs.zen-cart.com/user/running/backup/#step-2-backup-your-database

That Software Guy. My Store: Zen Cart Support
Available for hire - See my ad in Services
Plugin Moderator, Documentation Curator, Chief Cook and Bottle-Washer.
Do you benefit from Zen Cart? Then please support the project.

7 Jun 2023, 10:10 AM
#260
torvista avatar

torvista

Totally Zenned

Join Date:
Aug 2007
Location:
Gijón, Asturias, Spain
Posts:
2,876
Plugin Contributions:
7

Re: Backup MySQL Database

I suppose the problem is in the use of exec.

I'd also point out my use case is I don't use this for production backups, that's a separate automated process.
I use this as a dev tool, to get a copy of production db for use locally, usually to test imports first, or to test install scripts/do repeated restores: much easier to in the admin than elsewhere. Invaluable in that respect.

Steve
github.com/torvista: BackupMySQL, Structured Data, Multiple Copy-Move-Delete, Google reCaptcha, Image Checker, Spanish Language Pack and more...