Page 1 of 2

Mysql Dump 1.2 released

Posted: Fri Sep 01, 2006 8:22 am
by mahjong
Mysql Dump 1.2, with automated locator of MySQL binaries
  • Backup with 'myslqldump'
  • Restore with 'mysql'
  • Backups can be erased
  • GUI with Tango icons
  • Help message on first run
  • Beautified source code
  • Greatly improved locator
  • Help messages on install
  • Stable on CMSMS 1.0
NEW:
  • Takes into account the database prefix set in CMSMS's config file. (thanks to Der Rudi)
    Useful if CMSMS tables coexists with other tables in the same database.
  • Configuration switches hardcoded in MysqlDump.module.php
Mysql Dump is an interface for the 'mysqldump' backup tool. It can be used to dump the CMSMS database for backup or for transferring the data to another server (not necessarily a MySQL server).

In other words, it allows you to dump the contents of your CMSMS database into a text file, and restore from such a file. This text file can be easily saved locally or sent to remote server.

THIS MODULE IS VERY POWERFUL. PLEASE TEST IN A SAFE ENVIRONMENT AND MAKE BACKUPS OF YOUR ALL DATABASES *BEFORE* LEARNING HOW TO USE MYSQL DUMP.

Re: Mysql Dump 1.2 released

Posted: Fri Sep 01, 2006 8:48 am
by mahjong
Discussion about Mysql Dump 1.2 began there.

Re: Mysql Dump 1.2 released

Posted: Wed Sep 06, 2006 7:58 pm
by Oliver
Hi mahjong,

Mysql Dump 1.1 beta runs perfectly on my 1.0-beta6 test install. A very usefull tool - thank you very much!

I have a somewhat related question -  allthough I do not expect this feature from Mysql Dump itself:

Can somebody advise me on a script (bash, perl, php, python) that I could link to a cron table and would allow to restore the database of CMSmadesimple every hour or so on a demo site where I can provide users a sandbox to play around? I suspect mahjong to be the perfect expert on that question  ;)

Thanks a lot

Oliver

Re: Mysql Dump 1.2 released

Posted: Fri Sep 08, 2006 6:32 pm
by mahjong
  • Do a restore with the Mysql Dump module to have an idea what the restore command should look like
  • Copy the mysql command and replace ###### with your username/password
  • Add it to the cron table (crontab) preceded with 01 * * * * , which will execute the command hourly (on the 01 minute of each hour)
For instance,

Code: Select all

$ crontab -e

Code: Select all

01 * * * * mysql --user=username --password=yourpassword --default-character-set=latin1 cms < reset_demo.sql

Re: Mysql Dump 1.2 released

Posted: Sun Sep 10, 2006 8:50 pm
by Oliver
Thanks mahjong that's easier than I'd have expected, its working fine. Is there an equally easy way to automatically clear the cash?

Re: Mysql Dump 1.2 released

Posted: Sun Sep 10, 2006 10:09 pm
by mahjong
Is there an equally easy way to automatically clear the cash?
Yes, send me all your money.  :P

cash = argent comptant
cache = mémoire tampon

Seriously, use the thr rm command with the -f switch

Re: Mysql Dump 1.2 released

Posted: Mon Sep 11, 2006 7:24 pm
by Oliver
Yes, send me all your money. 
Taking into account that there are currently no more than 85 cents of cash in my pocket this might be a formidable option  ;)

Concerning the rm command - I'm not familiar with CMSmadesimple's caching- (nor its cashing...) mechanism: which directory would I have to apply it to?

Re: Mysql Dump 1.2 released

Posted: Tue Sep 12, 2006 3:21 am
by mahjong
tmp/cache
tmp/templates_c(ache)

Re: Mysql Dump 1.2 released

Posted: Tue Sep 12, 2006 11:27 am
by Der Rudi
According to php manual:

Note: mysql_real_escape_string() does not escape % and _. These are wildcards in MySQL if combined with LIKE, GRANT, or REVOKE.

So, in my case (as I am using '_' in table names) the code needs a bit tweaking:

replace

Code: Select all

$tb_prfx = mysql_real_escape_string($config['db_prefix']); 


with

Code: Select all

$tb_prfx = mysql_real_escape_string($config['db_prefix']); 
$tb_prfx = str_replace("_", "\_", $tb_prfx); //escape special character '_'

Re: Mysql Dump 1.2 released

Posted: Wed Sep 13, 2006 5:44 am
by mahjong
Thanks.

Better make it :

Code: Select all

$tb_prfx = addcslashes(mysql_real_escape_string($config['db_prefix']), "%_");
I'll release the patch as soon as I have free time.

Re: Mysql Dump 1.2 released

Posted: Wed Sep 13, 2006 3:03 pm
by MichaelK
Warning:  system() has been disabled for security reasons in /home/****/public_html/modules/MysqlDump/MysqlDump.module.php on line 442

Warning:  system() has been disabled for security reasons in /home/michael/domains/****/public_html/modules/MysqlDump/MysqlDump.module.php on line 443
-- WARNING : Please, check permissions of files and folders :
--      chmod 777 admin/backups
--      chmod 777 modules/MysqlDump
--      chmod 666 modules/MysqlDump/dump-verbose.txt


I get this error.
When I look at my server dump-verbose.txt is not 666 but 600. I can't manually edit this to 666.
Is this maybe the problem of my problem?

Re: Mysql Dump 1.2 released

Posted: Thu Sep 14, 2006 5:34 am
by mahjong
Warning:  system() has been disabled for security reasons
On your server, the administrator doesn't allow the use of system commands triggered by PHP. Therefore, you cannot use Mysql Dump. There is nothing you can do. You'll have to find another way to back up your database. Maybe, phpMyAdmin. Ask your administrator.

Re: Mysql Dump 1.2 released

Posted: Thu Sep 14, 2006 7:12 am
by Piratos
Get my Class PiDatabase from my website.

There are 3 functions you can easy rewrite as a cmsms module

1. Backup
2. restore
3. Optimize



Backup and Restore are fully compatble with PhpMyAdmin (you can make Backup with the class function  and Restore with PhpMyAdmin, or make Backup with Phpmyadmin and restore with the function or you can backup and restore with the function itself).

No need of Mysqldump or systemprograms.

Re: Mysql Dump 1.2 released

Posted: Thu Sep 14, 2006 8:25 am
by mahjong
Piratos wrote:Get my Class PiDatabase from my website.
Thank you for your contribution. I'll will be integrated into the next generation of Mysql Dump.

Re: Mysql Dump 1.2 released

Posted: Tue Oct 31, 2006 7:40 pm
by websherpa
Problem accessing database.

On my system we use a separate host name to access the database (and CMSMADESIMPLE accommodates this nicely), but when I try to use MySQL Dump (which I would love to), it can't find the database because it tries to connect to it on localhost instead.  Any ideas for how to moduify it to tease the location out of CMSMS?  or other (polite) suggestions? :-)

thank you.