Using Livecode to dump backup mySql database
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller
Using Livecode to dump backup mySql database
Hi all,
I would like my users to be able to backup data from my mySql database and store the backup in a specific location. The location is the easy part but I am wondering what the best way is to backup every table, each with it's own filename. I guess this would require iterating through all the tables in a database?
Thanks for the help.
N
I would like my users to be able to backup data from my mySql database and store the backup in a specific location. The location is the easy part but I am wondering what the best way is to backup every table, each with it's own filename. I guess this would require iterating through all the tables in a database?
Thanks for the help.
N
-
- Posts: 32
- Joined: Sun Jun 22, 2014 2:37 am
Re: Using Livecode to dump backup mySql database
I would think this would best be done through your MySQL administrator tools rather than writing a separate program. If you want to use LC I'm sure you could execute the same commands from LC to execute a backup.
Re: Using Livecode to dump backup mySql database
It seems a bit long winded so I thought that I could embed some PHP scripts to do the work for me.. I will look into it. Unfortunately, my users would not be able to use PhpMyadmin tools which is why I would need them to use LC. Click a button, choose a folder and press go and the script does the rest.
Re: Using Livecode to dump backup mySql database
Creating the backup directly on the server would allow you to use the very powerfull mysqldump command, with a solution mixing bash shell and PHP/Livecode Server.nicoloose wrote:It seems a bit long winded so I thought that I could embed some PHP scripts to do the work for me.. I will look into it. Unfortunately, my users would not be able to use PhpMyadmin tools which is why I would need them to use LC. Click a button, choose a folder and press go and the script does the rest.
-write a script in PHP (or LiveCode Server)
-this script would be called by your client (through basic URL www.test.com/dobackup.php)
-this script uses a bash shell script (with mysqldump) to create the backup on the fly
-the client can then download the backup (with regular Livecode : put url... into...)
Here is an example (for Postgresql)
Code: Select all
#!/bin/bash
echo "lets erase the previous backup"
set -e
rm '/home/xxx/backup/mydb.sql'
echo "lets dump the database"
sudo -u postgres pg_dump demo -C > /home/xxx/backup/mydb.sql
echo "END"
-you could add a cron task (in order to create automatically the backup on the server)
-use some kind of encryption (for the backup file), some of identification (the client would have to identify himself before to be able to create the backup and/or download the file) etc.
Re: Using Livecode to dump backup mySql database
Many thanks for those two suggestions. I will be testing them both but I think a cron task is actually best. No user input is more reliable.
Re: Using Livecode to dump backup mySql database
Probably here you find all best MySQL backup strategies: http://dev.mysql.com/doc/refman/5.1/en/ ... thods.html
Livecode Wiki: http://livecode.wikia.com
My blog: https://livecode-blogger.blogspot.com
To post code use this: http://tinyurl.com/ogp6d5w
My blog: https://livecode-blogger.blogspot.com
To post code use this: http://tinyurl.com/ogp6d5w