How To Backup A Database On A Microsoft Powerpoint 3.5 (Mysqldump) On A Pcode (Mysql) On Your Pcode 3.3.5 On A Macbook Or Macbook (Powerpoint) On



Similar documents
Backing Up and Restoring Your MySQL Database From the command prompt

Backup and Restore MySQL Databases

MySQL Quick Start Guide

The Web Pro Miami, Inc. 615 Santander Ave, Unit C Coral Gables, FL T: info@thewebpro.com

Database Backup and Restore Mechanism. Presented by : Mary Meladath

XCloner Official User Manual

Automated CPanel Backup Script. for home directory backup, remote FTP backup and Amazon S3 backup

MySQL Quick Start Guide

Installing buzztouch Self Hosted

MySQL quick start guide

4PSA Total Backup User's Guide. for Plesk and newer versions

Livezilla How to Install on Shared Hosting By: Jon Manning

1. Product Information

Online Backup Client User Manual Linux

Backup/Restore MySQL Server

Using Internet or Windows Explorer to Upload Your Site

BackupAssist v6 quickstart guide

RecoveryVault Express Client User Manual

inforouter V8.0 Server Migration Guide.

Online Backup Client User Manual

Online Backup Client User Manual

How To Restore Your Data On A Backup By Mozy (Windows) On A Pc Or Macbook Or Macintosh (Windows 2) On Your Computer Or Mac) On An Pc Or Ipad (Windows 3) On Pc Or Pc Or Micro

Online Backup Linux Client User Manual

Online Backup Client User Manual

Installation Instructions

ShadowControl ShadowStream

StorageCraft ShadowStream User Guide StorageCraft Copyright Declaration

Introduction. Just So You Know... PCI Can Be Difficult

Online Backup Client User Manual Mac OS

Online Backup Client User Manual Mac OS

Web Hosting Control Panel Guide

BackupAssist v6 quickstart guide

Welcome to the QuickStart Guide

Installation / Backup \ Restore of a Coffalyser.Net server database using SQL management studio

SFTP Server User Login Instructions. Open Internet explorer and enter the following url:

How To Install Storegrid Server On Linux On A Microsoft Ubuntu 7.5 (Amd64) Or Ubuntu (Amd86) (Amd77) (Orchestra) (For Ubuntu) (Permanent) (Powerpoint

Extending Remote Desktop for Large Installations. Distributed Package Installs

SQL Server Setup for Assistant/Pro applications Compliance Information Systems

SPHOL207: Database Snapshots with SharePoint 2013

HIPAA Compliance Use Case

Site Store Pro. INSTALLATION GUIDE WPCartPro Wordpress Plugin Version

Presented by: CSIR-KNOWGATE. KNOWGATE KNOWGATE Website: knowgate.niscair.res.in

SOA Software API Gateway Appliance 7.1.x Administration Guide

VeriCentre 3.0 Upgrade Pre-Installation and Post Installation Guidelines

MindGenius SharePoint Integration

Kollaborate Server Installation Guide!! 1. Kollaborate Server! Installation Guide!

OpenPro ERP Software Installation Guide Talbert Ave Suite 200 Fountain Valley, CA USA Phone Fax

How To Backup Your Computer With A Remote Drive Client On A Pc Or Macbook Or Macintosh (For Macintosh) On A Macbook (For Pc Or Ipa) On An Uniden (For Ipa Or Mac Macbook) On

We begin with a number of definitions, and follow through to the conclusion of the installation.

Central Administration User Guide

Using Microsoft Expression Web to Upload Your Site

MOODLE Installation on Windows Platform

SETTING UP AND RUNNING A WEB SITE ON YOUR LENOVO STORAGE DEVICE WORKING WITH WEB SERVER TOOLS

DigiVault Online Backup Manager. Microsoft SQL Server Backup/Restore Guide

Administering Jive for Outlook

mylittleadmin for MS SQL Server 2005 from a Webhosting Perspective Anthony Wilko President, Infuseweb LLC

Scala InfoChannel Content Manager 5 Backup and Restore Instructions

Git - Working with Remote Repositories

IIS, FTP Server and Windows

SPHOL205: Introduction to Backup & Restore in SharePoint Hands-On Lab. Lab Manual

Contents Release Notes System Requirements Administering Jive for Office

BackupAgent Management Console User Manual

NTT Web Hosting Service [User Manual]

How To Backup In Cisco Uk Central And Cisco Cusd (Cisco) Cusm (Custodian) (Cusd) (Uk) (Usd).Com) (Ucs) (Cyse

Figure 1: Restore Tab

Configuring the Server(s)

Project management integrated into Outlook

ProxiBlue Dynamic Category Products

TM Online Storage: StorageSync

equate Installation QUICK START GUIDE

FireBLAST Marketing Solution v2

MIGRATING TO AVALANCHE 5.0 WITH MS SQL SERVER

QUANTIFY INSTALLATION GUIDE

DiskPulse DISK CHANGE MONITOR

Expresso Quick Install

Upgrade your Software

DocAve Upgrade Guide. From Version 4.1 to 4.5

Migrating helpdesk to a new server

Backing Up TestTrack Native Project Databases

Content Management System

owncloud Configuration and Usage Guide

Configure Single Sign on Between Domino and WPS

TSM for Windows Installation Instructions: Download the latest TSM Client Using the following link:

Backing Up and Restoring the Database

Smartphone Pentest Framework v0.1. User Guide

ESET REMOTE ADMINISTRATOR. Migration guide

Drupal + Formulize. A Step-by-Step Guide to Integrating Drupal with XOOPS/ImpressCMS, and installing and using the Formulize module

Specops Command. Installation Guide

Fasthosts Internet Parallels Plesk 10 Manual

NovaBACKUP xsp Version 15.0 Upgrade Guide

How to Create a Delegated Administrator User Role / To create a Delegated Administrator user role Page 1

Setting Up Specify to use a Shared Workstation as a Database Server

Upgrading MySQL from 32-bit to 64-bit

Setting up VMware ESXi for 2X VirtualDesktopServer Manual

Modelling with R and MySQL. - Manual - Gesine Bökenkamp, Frauke Wiese, Clemens Wingenbach

Technote 20 Using MSIE to FTP into an AcquiSuite

Backup/Restore Microsoft SQL Server 7.0 / 2000 / 2005 / 2008

NovaBACKUP Remote Workforce Version 12.5 Cloud Restore

Transcription:

Backing Up and Restoring Your MySQL Database (2004-06-15) - Contributed by Vinu Thomas Do you need to change your web host or switch your database server? This is probably the only time when you really think of backing up your MySQL data. If you've got a website with a database or your custom database running for your applications, it is imperative that you make regular backups of the database. In this article, I will outline two easy ways of backing up and restoring databases in MySQL. The easiest way to backup your database would be to telnet to the your database server machine and use the mysqldump command to dump your whole database to a backup file. If you do not have telnet or shell access to your server, don't worry about it; I shall outline a method of doing so using the PHPMyAdmin web interface, which you can setup on any web server which executes PHP scripts. Playing with mysqldump If you have either a shell or telnet access to your database server, you can backup the database using mysqldump. By default, the output of the command will dump the contents of the database in SQL statements to your console. This output can then be piped or redirected to any location you want. If you plan to backup your database, you can pipe the output to a sql file, which will contain the SQL statements to recreate and populate the database tables when you wish to restore your database. There are more adventurous ways to use the output of mysqldump. A Simple Database Backup: You can use mysqldump to create a simple backup of your database using the following syntax. mysqldump -u [username] -p [password] [databasename] > [backupfile.sql] - [username] - this is your database username - [password] - this is the password for your database - [databasename] - the name of your database - [backupfile.sql] - the file to which the backup should be written. The resultant dump file will contain all the SQL statements needed to create the table and populate the table in a new database server. To backup your database 'Customers' with the username 'sadmin' and password 'pass21' to a file custback.sql, you would issue the command: mysqldump -u sadmin -p pass21 Customers > custback.sql You can also ask mysqldump to add a drop table command before every create command by using the option --add-droptable. This option is useful if you would like to create a backup file which can rewrite an existing database without having to delete the older database manually first. mysqldump --add-drop-table -u sadmin -p pass21 Customers > custback.sql Backing up only specified tables If you'd like restrict the backup to only certain tables of your database, you can also specify the tables you want to backup. Let's say that you want to backup only customer_master & customer_details from the Customers database, you do that by issuing

mysqldump --add-drop-table -u sadmin -p pass21 Customers customer_master customer_details> custback.sql So the syntax for the command to issue is: mysqldump -u [username] -p [password] [databasename] [table1 table2...] - [tables] - This is a list of tables to backup. Each table is separated by a space. {mospagebreak title=what about Multiple Databases?} If you are a database administrator who has to look after multiple databases, you'll need to back up more than one database at a time. Here's how you can backup multiple databases in one shot. If you want to specify the databases to backup, you can use the --databases parameter followed by the list of databases you would like to backup. Each database name has to be separated by at least one space when you type in the command. So if you have to backup 3 databases, let say Customers, Orders and Comments, you can issue the following command to back them up. Make sure the username you specify has permissions to access the databases you would like to backup. mysqldump -u root -p pass21 --databases Customers Orders Comments > multibackup.sql This is okay if you have a small set of databases you want to backup. Now how about backing up all the databases in the server? That's an easy one, just use the --all-databases parameter to backup all the databases in the server in one step. mysqldump --all-databases> alldatabases.sql Backing up only the Database Structure Most developers need to backup only the database structure to while they are developing their applications. You can backup only the database structure by telling mysqldump not to back up the data. You can do this by using the --no-data parameter when you call mysqldump. mysqldump --no-data --databases Customers Orders Comments > structurebackup.sql Compressing your Backup file on the Fly Backups of databases take up a lot of space. You can compress the output of mysqldump to save valuable space while you're backing up your databases. Since mysqldump sends its output to the console, we can pipe the output through gzip or bzip2 and send the compressed dump to the backup file. Here's how you would do that with bzip2 and gzip respectively. mysqldump --all-databases bzip2 -c >databasebackup.sql.bz2 mysqldump --all-databases gzip >databasebackup.sql.gz

A Shell Script for Automating Backups? You can automate the backup process by making a small shell script which will create a daily backup file. How do you get cron to back up your database without overwriting the older backup? You can use a tiny shell script to add the date to your backup file. An example of a shell script you could use is shown below. #!/bin/shdate=`date -I`mysqldump --all-databases gzip > /var/backup/backup-$date.sql.gz {mospagebreak title=easy Restore} Now that you've got backups of your database, let's learn how to restore your backup in case your database goes down. Here's how you can restore your backed up database using the mysql command. Restore using mysql If you have to re-build your database from scratch, you can easily restore the mysqldump file by using the mysql command. This method is usually used to recreate or rebuild the database from scratch. Here's how you would restore your custback.sql file to the Customers database. mysql -u sadmin -p pass21 Customers < custback.sql Easy isn't it? Here's the general format you would follow: mysql -u [username] -p [password] [database_to_restore] < [backupfile] Now how about those zipped files? You can restore your zipped backup files by first uncompressing its contents and then sending it to mysql. gunzip < custback.sql.sql.gz mysql -u sadmin -p pass21 Customers You can also combine two or more backup files to restore at the same time, using the cat command. Here's how you can do that. cat backup1.sql backup.sql mysql -u sadmin -p pass21 Moving Data Directly Between Databases How would you like to replicate your present database to a new location? When you are shifting web hosts or database servers, you can directly copy data to the new database without having to create a database backup on your machine and restoring the same on the new server. mysql allows you to connect to a remote database server to run sql commands. Using this feature, we can pipe the output from mysqldump and ask mysql to connect to the remote database server to populate the new database. Let's say we want to recreate the Customers database on a new database server located at 202.32.12.32, we can run the following set of commands to replicate the present database at

the new server. mysqldump -u sadmin -p pass21 Customers mysql --host=202.32.12.32 -C Customers {mospagebreak title=phpmyadmin} PHPMyAdmin is an easy to use web-interface to control MySQL databases. You can run this from any system which has a web server which runs PHP scripts. PHPMyAdmin also lets you administer multiple database servers using the same interface. If you don't have telnet or shell access to your database server, this is probably how you would be administering your databases. If you haven't used PHPMyAdmin, head over to http://www.phpmyadmin.net/ and download the latest version to experiment with. Configure PHPMyAdmin Before I go on to show you how you can back up and restore your databases using PHPMyAdmin, let me take a little while to show those who going to be first time users of PHPMyAdmin how to configure their installation. Once you've downloaded the latest version of PHPMyAdmin, copy the files from the installation source to your web server. Before you run the program, you'll have to edit a few lines in config.inc.php to get your installation to work properly. You can find this file in the root folder of the installation. Head over to the line which reads: $cfg['pmaabsoluteuri'] = ''; Change this to the web URL of the installation. Let's say you've copied the files to the directory 'phpmyadmin' under the URL 'http://dbserver.com', you should change the option to: $cfg['pmaabsoluteuri'] = 'http://dbserver.com/phpmyadmin/'; Here are some more options about your database server which you'll have to modify before you save the configuration file. Let's say you have to connect to your database server, which is residing at 202.32.12.2 and connects on port 432, with the username 'jester' and password 'freddy32', the options you have to change will look like this: $cfg['servers'][$i]['host'] = '202.32.12.2'; $cfg['servers'][$i]['port'] = '432'; $cfg['servers'][$i]['connect_type'] = 'tcp';$cfg['servers'][$i]['auth_type'] = 'config'; $cfg['servers'][$i]['user'] = 'jester';$cfg['servers'][$i]['password'] = 'freddy32'; Once you've got the correct setting for the database entered in these options, you can save your configuration file and head over to your PHPMyAdmin installation through your browser. {mospagebreak title=backing Up and Restoring Your Database with PHPMyAdmin} You can backup your database using PHPMyAdmin in just a few mouse clicks. First head over to your database by clicking the database name in the list on the left of the screen. Once you get to your database details, you should get a menu header for your database which looks like so: Click on Export. This will get you to a screen with the following options. From here it's just a matter of clicking the right options and the 'Go' Button to get your database dump. To save the

backup file on your computer, click on the Save as file option and the corresponding compression option to get the backup to download to your system. Restoring your Database via PHPMyAdmin Restoring your database is as easy as backing it up. If you would like to rewrite the backup over an existing database, click on the database name in the database list on the left, click all the check boxes next to the table names and select Drop in the With selected: drop down box. This will drop all existing table in the database. Then head over to the top menu bar and click on SQL. This will bring up a window where you can either type in SQL commands, or upload your SQL file. The window should look like this: Click on the Browse button, and select the sql backup file you wish to upload to the server. Once you've selected the file, click on 'Go'. This will upload the backup file to the server and execute the SQL commands in the backup and restore your database. Now that you know how easy it is to backup and restore your database, spend a few minutes everyday to backup your important data. You can even automate the backup process by using a task scheduler like cron.