Book Image

CentOS 7 Server Deployment Cookbook

By : Timothy Boronczyk, IRAKLI NADAREISHVILI
Book Image

CentOS 7 Server Deployment Cookbook

By: Timothy Boronczyk, IRAKLI NADAREISHVILI

Overview of this book

CentOS is derived from Red Hat Enterprise Linux (RHEL) sources and is widely used as a Linux server. This book will help you to better configure and manage Linux servers in varying scenarios and business requirements. Starting with installing CentOS, this book will walk you through the networking aspects of CentOS. You will then learn how to manage users and their permissions, software installs, disks, filesystems, and so on. You’ll then see how to secure connection to remotely access a desktop and work with databases. Toward the end, you will find out how to manage DNS, e-mails, web servers, and more. You will also learn to detect threats by monitoring network intrusion. Finally, the book will cover virtualization techniques that will help you make the most of CentOS.
Table of Contents (18 chapters)
CentOS 7 Server Deployment Cookbook
Credits
About the Author
About the Reviewer
www.PacktPub.com
Preface

Backing up and restoring a MySQL database


This recipe shows you how to back up your MySQL databases using mysqldump. The utility connects to the MySQL server, queries the structure of the database and its data, and outputs the data in the form of SQL statements. The backup can then be used to restore the database or populate a new database with the data.

Getting ready

This recipe requires a running MySQL server and access to either MySQL's root user or another user with the necessary privileges to perform the backup.

How to do it...

Follow these steps to make a backup of a MySQL database:

  1. Connect to the MySQL database you want to back up:

    mysql -u root -p packt
    
  2. Execute a FLUSH TABLES statement to set the database's tables read-only:

    FLUSH TABLES WITH READ LOCK;
    
  3. Open a second terminal, leaving the first one active with the mysql client still running.

  4. In the new terminal, use mysqldump to export the table definitions and data:

    mysqldump -u root -p packt > backup.sql
    
  5. Return to the first terminal...