473,586 Members | 2,839 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

MySQL backup

I've got a feeling that I may have asked this before but I can't find the
answer if there was one offered so apologies for that...

I've written a little content management system and I want to give the user
the ability to back up their database. I've looked at the relevant pages in
PHPMyAdmin but I'm not any closer to an answer. I just want something very
simple where they click on a link and it displays a complete dump of the
tables and the inserts for them to copy and paste into a .txt file.

Any ideas please.

Andy

Jul 17 '05 #1
2 1547
In article <BD************ ***@redcatmedia .net>,
Andy Jacobs <oc*@redcatmedi a.net> wrote:
I've got a feeling that I may have asked this before but I can't find the
answer if there was one offered so apologies for that...

I've written a little content management system and I want to give the user
the ability to back up their database. I've looked at the relevant pages in
PHPMyAdmin but I'm not any closer to an answer. I just want something very
simple where they click on a link and it displays a complete dump of the
tables and the inserts for them to copy and paste into a .txt file.

Any ideas please.


man mysqldump

--
DeeDee, don't press that button! DeeDee! NO! Dee...

Jul 17 '05 #2
Andy Jacobs wrote:
... I want to give the user
the ability to back up their database.
...
I just want something very
simple where they click on a link and it displays a complete dump of the
tables and the inserts for them to copy and paste into a .txt file.


php$ cat dbbackup.php
<?php
$db = 'test';
$table = 'foo';
/* $table=''; // for all tables in the db */

echo '<pre>';
echo `mysqldump -uCENSORED -pCENSORED $db $table`;
// ^ ^
// These are BACKTICKS! They are not single quotes
echo '</pre>';
?>

php$ php dbbackup.php
<pre>-- MySQL dump 9.11
--
-- Host: localhost Database: test
-- ------------------------------------------------------
-- Server version 4.0.21-log

--
-- Table structure for table `foo`
--

CREATE TABLE `foo` (
`bar` datetime default NULL
) TYPE=MyISAM;

--
-- Dumping data for table `foo`
--

INSERT INTO `foo` VALUES ('2004-01-01 08:00:00');
INSERT INTO `foo` VALUES ('2004-02-01 08:00:00');
INSERT INTO `foo` VALUES ('2004-01-01 08:00:01');
INSERT INTO `foo` VALUES ('2004-02-01 08:00:01');

</pre>
php$
--
Mail sent to my "From:" address is publicly readable at http://www.dodgeit.com/
== ** ## !! !! ## ** ==
TEXT-ONLY mail to the complete "Reply-To:" address ("My Name" <my@address>) may
bypass the spam filter. I will answer all pertinent mails from a valid address.
Jul 17 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
15457
by: James | last post by:
HI, I'm looking for a script that will allow users/admins to have a one click backup solution for a MYSQL Database.. 'BACK DATABASE' button, click and its done... The a restore option, that shows all current backups, and restores the selected one with one click...
4
4416
by: Neil | last post by:
Hi, I hope this question isn't too far off topic....I'm almost at my wits end trying to figure this out. I have a Mysql database and I wish to automate the backup of the database because I don't wish to rely on the web host doing so. I am using the "dbsender.php" script, which is written for this exact purpose (available at...
1
1934
by: Konrad | last post by:
I have an internet portal based on MySql database and what I need is to make a database backup , after each actualization of data. I know how should PHP code look like but I have no idea how to create SQL command that will backup full database. I know that this group does't concern MySql directly but lots of PHP programmers have wide...
0
2259
by: Duane Winner | last post by:
Hello all - I'm having a small problem with the mysql startup script that ships with MySQL-3.23.56-1. I'm running on RedHat Linux. It works fine, but I have a backup server that runs a script that passes these commands remotely through ssh: (1) ssh dbsys-dc "sudo /etc/init.d/mysql stop" (2) ssh dbsys-dc "sudo tar
3
1619
by: John Smith | last post by:
Hi I am currently reviewing our backup procedures. Part of the issue has been finding the right fit. There are obviously backup products that provide mysql agents but unfortunately can not for fill our complete backup/disaster requirements. I have evaluated bakbone, arkeia, brightstor, veritas. I am currently looking at evault, commvault...
1
2819
by: Astra | last post by:
Hi All I understand that the basic principles to create a TCP/IP backup program for a remote MySQL DB are: a) Query/retrieve the schema. b) Query/retrieve each table and create inserts for each row of data.
4
12689
by: news | last post by:
Our production database in an exported textfil runs about 60 MB. Compressed that's about 9 MB. I'm trying to import the export into another machine running FC3 and mySQL 11.18, and it appears as though the file may be too big! When I try to do it via command line: mysql -u root --host=localhost printing < ./printing.txt It eventually...
0
1889
by: newman | last post by:
Dear all, I have mysql 4.1.11 on my current server, i need my database restore another server.. (another server mysql version is 4.1.11 same.) And now... I just created new my database to new server following command: CREATE DATABASE dbname DEFAULT CHARACTER SET latin5 COLLATE
6
1734
by: frank78 | last post by:
Hi everyone, I am having a little bit of trouble backing up some mySQL tables. I've been trying to adapt a script I found on the internet at http://blogs.linux.ie/xeer/2005/06/28/simple-mysql-backup/ . However, i have been having trouble (under bash) on getting it to work. I know my mysql account has full privileges to all account...
4
4059
by: Bootstrap Bill | last post by:
I'm looking for a PHP program to backup and restore a mysql database. I'm using Godaddy to host a forum. Their mysql control panel will only restore a database of two megabytes or less. My database is over 13 megabytes in size.
0
7908
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7836
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
8199
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
8336
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
1
7950
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
8212
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
1
5710
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
3835
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
1
2343
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.