System Status
Buy Now
  • Email & Apps
  • Office 365
Login
  • MyRackspace Portal
  • Cloud Control Panel
  • Rackspace Webmail Login
  • Cloud Office Control Panel
  • Support Home
  • How-To
  • Developer Documentation
  •  Blogs 
    • Expert Insights Tech Blog
    • Rackspace Blog
    • Solve: Thought Leadership

Support Network

End-to-End Multicloud Solutions.   Solving Together.â„¢   Learn more at Rackspace.com

How–To Home

Cloud Servers

  • Introduction
  • FAQ
  • All Articles

Import a MySQL Database

Last updated on:  2020-04-02

Authored by:  James Andrade


Before you import a MySQL® backup, you can create a .my.cnf file with the root credentials. This file enables you to avoid having to input the password when you restore the databases and also helps if you want to create a cron job script to backup MySQL daily.

Store your MySQL root password in /root/.my.cnf, as shown in the following example, and use chmod 600 to set appropriate permisssions for the file.

[client]
user=root
password=yourmysqlrootpassword

Restore commands

Use the following command to restore a single database:

$ mysql [database_name] < /path/to/backup/backupfile.sql

Use the following command to restore all databases. The tables need to exist, or backup needs to contain CREATE TABLE statements:

$ mysql < /path/to/backup/alldatabases.sql

Share this information:

©2020 Rackspace US, Inc.

Except where otherwise noted, content on this site is licensed under a Creative Commons Attribution-NonCommercial-NoDerivs 3.0 Unported License

See license specifics and DISCLAIMER

About Rackspace
  • About
  • Customer Stories
  • Events
  • Programs
Blogs
  • The Rackspace Blog
  • Expert Insights Tech Blog
  • Solve: Thought Leadership
  • News
  • Contact Information
  • Legal
  • Careers
Site Information
  • Style Guide for Technical Content
  • Trademarks
  • Privacy Statement
  • Website Terms
Support Network
  • Support Network Home
  • Rackspace How-To
  • API Documentation
  • Developer Center
  • ©2020 Rackspace US, Inc.