Backing Up and Restoring Your MySQL Database From the command prompt



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

STIOffice Integration Installation, FAQ and Troubleshooting

Remote Desktop Tutorial. By: Virginia Ginny Morris

Implementing ifolder Server in the DMZ with ifolder Data inside the Firewall

Merchant Management System. New User Guide CARDSAVE

Setup O365 mailbox access on MACs

CSAT Account Management

FINRA Regulation Filing Application Batch Submissions

Spamguard SPAM Filter

Implementing SQL Manage Quick Guide

Excel Contact Reports

MedNetwork Systems Impulse Database Management

User Guide. Excel Data Management Pack (EDM-Pack) OnCommand Workflow Automation (WFA) Abstract PROFESSIONAL SERVICES. Date: December 2015

CLIENT PORTAL GUIDE SUMMARY

Connecting to

efusion Table of Contents

Creating automated reports using VBS AN 44

Access EEC s Web Applications... 2 View Messages from EEC... 3 Sign In as a Returning User... 3

SBClient and Microsoft Windows Terminal Server (Including Citrix Server)

CenterPoint Accounting for Agriculture Network (Domain) Installation Instructions

Webalo Pro Appliance Setup

o How AD Query Works o Installation Requirements o Inserting your License Key o Selecting and Changing your Search Domain

E-Biz Web Hosting Control Panel

Setup Instructions Glion Online

Ten Steps for an Easy Install of the eg Enterprise Suite

Access to the Ashworth College Online Library service is free and provided upon enrollment. To access ProQuest:

How To Install Fcus Service Management Software On A Pc Or Macbook

Helpdesk Support Tickets & Knowledgebase

INUVIKA OPEN VIRTUAL DESKTOP ENTERPRISE

Software Distribution

Exchanging Files Securely with Gerstco Using gpg4win Public Key Encryption

FOCUS Service Management Software Version 8.5 for CounterPoint Installation Instructions

BRILL s Editorial Manager (EM) Manual for Authors Table of Contents

FOCUS Service Management Software Version 8.5 for Passport Business Solutions Installation Instructions

990 e-postcard FAQ. Is there a charge to file form 990-N (e-postcard)? No, the e-postcard system is completely free.

1) Update the AccuBuild Program to the latest version Version or later.

Steps to fix the product is not properly fixed issue for international clients.

HOWTO: How to configure SSL VPN tunnel gateway (office) to gateway

Mobile Device Manager Admin Guide. Reports and Alerts

Archiving IVTVision Video (Linux)

Program Administrator s Guide to. Student Management

Service Desk Self Service Overview

Application Advisories for Data Integrator for Non- EDI location

SITE APPLICATIONS USER GUIDE:

Tipsheet: Sending Out Mass s in ApplyYourself

Telelink 6. Installation Manual

Deployment Overview (Installation):

A COMPLETE GUIDE TO ORACLE BI DISCOVERER END USER LAYER (EUL)

Setup PPD IT How-to Guides June 2010

Preparing to Deploy Reflection : A Guide for System Administrators. Version 14.1

BackupAssist SQL Add-on

Traffic monitoring on ProCurve switches with sflow and InMon Traffic Sentinel

Click here to open the library

Custom Portlets. an unbiased review of the greatest Practice CS feature ever. Andrew V. Gamet

Lab 12A Configuring Single Sign On Service

USF Remote Desktop Gateway

Deploy Your First Cloud Foundry App to Any Cloud Foundry Service Provider

USF Remote Desktop Gateway

KronoDesk Migration and Integration Guide Inflectra Corporation

Welcome to Microsoft Access Basics Tutorial

Dreamweaver MX Templates

Durango Merchant Services QuickBooks SyncPay

Firewall/Proxy Server Settings to Access Hosted Environment. For Access Control Method (also known as access lists and usually used on routers)

Understand Business Continuity

iphone Mobile Application Guide Version 2.2.2

How to put together a Workforce Development Fund (WDF) claim 2015/16

Your Outlook Mailbox can be accessed from any PC that is connected to the Internet.

Using Identity Finder. ITS Training Document

A Beginner s Guide to Building Virtual Web Servers

Valley Transcription Service I-Phone/I-Pod App User s Guide

This page provides help in using WIT.com to carry out the responsibilities listed in the Desk Aid Titled Staffing Specialists

How do I clear my web browser's cache, cookies, and history?

Blue Link Solutions Terminal Server Configuration How to Install Blue Link Solutions in a Terminal Server Environment

OUTLOOK All About Archives

:: ADMIN HELP AT A GLANCE Contents

Employee Self Service (ESS) Quick Reference Guide ESS User

Level 3 SM Ready-Access User Guide

AvePoint Privacy Impact Assessment 1

Best Practice - Pentaho BA for High Availability

Configuring BMC AREA LDAP Using AD domain credentials for the BMC Windows User Tool

TECHNICAL BULLETIN. Title: Remote Access Via Internet Date: 12/21/2011 Version: 1.1 Product: Hikvision DVR Action Required: Information Only

AP Capstone Digital Portfolio - Teacher User Guide

Title: How Do You Handle Exchange Mailboxes for Employees Who Are No Longer With the Company

NEC CLOUD STORAGE. User Guide. Version: R03.1

UCDHS PeopleSoft HRMS 8.8 External Applicants User Guide. External Applicants User Guide

Using McAllister Payment Solutions and Updating to AVImark version

Getting started with Android

Regions File Transmission

Interaction Manager OFT 605 (Part1)

MaaS360 Cloud Extender

Getting Started Guide

TaskCentre v4.5 File Transfer (FTP) Tool White Paper

DIRECT DATA EXPORT (DDE) USER GUIDE

Transcription:

Backing Up and Restring Yur MySQL Database Frm the cmmand prmpt In this article, it will utline tw easy ways f backing up and restring databases in MySQL. The easiest way t backup yur database wuld be t telnet t the yur database server machine and use the mysqldump cmmand t dump yur whle database t a backup file. If yu d nt have telnet r shell access t yur server, dn't wrry abut it; I shall utline a methd f ding s using the PHPMyAdmin web interface, which yu can setup n any web server which executes PHP scripts. Playing with mysqldump If yu have either a shell r telnet access t yur database server, yu can backup the database using mysqldump. By default, the utput f the cmmand will dump the cntents f the database in SQL statements t yur cnsle. This utput can then be piped r redirected t any lcatin yu want. If yu plan t backup yur database, yu can pipe the utput t a sql file, which will cntain the SQL statements t recreate and ppulate the database tables when yu wish t restre yur database. There are mre adventurus ways t use the utput f mysqldump. A Simple Database Backup: Yu can use mysqldump t create a simple backup f yur database using the fllwing syntax. mysqldump -u [username] -p [passwrd] [databasename] > [backupfile.sql] [username] - this is yur database username [passwrd] - this is the passwrd fr yur database [databasename] - the name f yur database [backupfile.sql] - the file t which the backup shuld be written. The resultant dump file will cntain all the SQL statements needed t create the table and ppulate the table in a new database server. T backup yur database 'Custmers' with the username 'sadmin' and passwrd 'pass21' t a file custback.sql, yu wuld issue the cmmand: mysqldump -u sadmin -p pass21 Custmers > custback.sql Yu can als ask mysqldump t add a drp table cmmand befre every create cmmand by using the ptin --add-drp-table. This ptin is useful if yu wuld like t create a backup file which can rewrite an existing database withut having t delete the lder database manually first. mysqldump --add-drp-table -u sadmin -p pass21 Custmers > custback.sql Backing up nly specified tables If yu'd like restrict the backup t nly certain tables f yur database, yu can als specify the tables yu want t backup. Let's say that yu want t backup nly custmer_master & custmer_details frm the Custmers database, yu d that by issuing

mysqldump --add-drp-table -u sadmin -p pass21 Custmers custmer_master custmer_details> custback.sql S the syntax fr the cmmand t issue is: mysqldump -u [username] -p [passwrd] [databasename] [table1 table2...] [tables] - This is a list f tables t backup. Each table is separated by a space. mysqldump -u rt -p pass21 --databases Custmers Orders Cmments > multibackup.sql This is kay if yu have a small set f databases yu want t backup. Nw hw abut backing up all the databases in the server? That's an easy ne, just use the --all-databases parameter t backup all the databases in the server in ne step. mysqldump --all-databases> alldatabases.sql Backing up nly the Database Structure Mst develpers need t backup nly the database structure t while they are develping their applicatins. Yu can backup nly the database structure by telling mysqldump nt t back up the data. Yu can d this by using the --n-data parameter when yu call mysqldump. mysqldump --n-data --databases Custmers Orders Cmments > structurebackup.sql Cmpressing yur Backup file n the Fly Backups f databases take up a lt f space. Yu can cmpress the utput f mysqldump t save valuable space while yu're backing up yur databases. Since mysqldump sends its utput t the cnsle, we can pipe the utput thrugh gzip r bzip2 and send the cmpressed dump t the backup file. Here's hw yu wuld d that with bzip2 and gzip respectively. mysqldump --all-databases bzip2 -c >databasebackup.sql.bz2 mysqldump --all-databases gzip >databasebackup.sql.gz A Shell Script fr Autmating Backups? Yu can autmate the backup prcess by making a small shell script which will create a daily backup file. Hw d yu get crn t back up yur database withut verwriting the lder backup? Yu can use a tiny shell script t add the date t yur backup file. An example f a shell script yu culd use is shwn belw. #!/bin/sh date=`date -I` mysqldump --all-databases gzip > /var/backup/backup-$date.sql.gz

Restre using mysql If yu have t re-build yur database frm scratch, yu can easily restre the mysqldump file by using the mysql cmmand. This methd is usually used t recreate r rebuild the database frm scratch. Here's hw yu wuld restre yur custback.sql file t the Custmers database. mysql -u sadmin -p pass21 Custmers < custback.sql Easy isn't it? Here's the general frmat yu wuld fllw: mysql -u [username] -p [passwrd] [database_t_restre] < [backupfile] Nw hw abut thse zipped files? Yu can restre yur zipped backup files by first uncmpressing its cntents and then sending it t mysql. gunzip < custback.sql.sql.gz mysql -u sadmin -p pass21 Custmers Yu can als cmbine tw r mre backup files t restre at the same time, using the cat cmmand. Here's hw yu can d that. cat backup1.sql backup.sql mysql -u sadmin -p pass21 Mving Data Directly Between Databases Hw wuld yu like t replicate yur present database t a new lcatin? When yu are shifting web hsts r database servers, yu can directly cpy data t the new database withut having t create a database backup n yur machine and restring the same n the new server. mysql allws yu t cnnect t a remte database server t run sql cmmands. Using this feature, we can pipe the utput frm mysqldump and ask mysql t cnnect t the remte database server t ppulate the new database. Let's say we want t recreate the Custmers database n a new database server lcated at 202.32.12.32, we can run the fllwing set f cmmands t replicate the present database at the new server. mysqldump -u sadmin -p pass21 Custmers mysql --hst=202.32.12.32 -C Custmers

Backing Up and Restring Yur MySQL Database - Backing Up and Restring Yur Database with PHPMyAdmin Yu can backup yur database using PHPMyAdmin in just a few muse clicks. First head ver t yur database by clicking the database name in the list n the left f the screen. Once yu get t yur database details, yu shuld get a menu header fr yur database which lks like s: Click n Exprt. This will get yu t a screen with the fllwing ptins. Frm here it's just a matter f clicking the right ptins and the 'G' Buttn t get yur database dump. T save the backup file n yur cmputer, click n the Save as file ptin and the crrespnding cmpressin ptin t get the backup t dwnlad t yur system. Restring yur Database via PHPMyAdmin Restring yur database is as easy as backing it up. If yu wuld like t rewrite the backup ver an existing database, click n the database name in the database list n the left, click all the check bxes next t the table names and select Drp in the With selected: drp dwn bx.

This will drp all existing table in the database. Then head ver t the tp menu bar and click n SQL. This will bring up a windw where yu can either type in SQL cmmands, r uplad yur SQL file. The windw shuld lk like this: Click n the Brwse buttn, and select the sql backup file yu wish t uplad t the server. Once yu've selected the file, click n 'G'. This will uplad the backup file t the server and execute the SQL cmmands in the backup and restre yur database. Nw that yu knw hw easy it is t backup and restre yur database, spend a few minutes everyday t backup yur imprtant data. Yu can even autmate the backup prcess by using a task scheduler like crn.