Backup and restoration of MySQL Databases and tables, and backup of mysql Databases

Source: Internet
Author: User

Backup and restoration of MySQL Databases and tables, and backup of mysql Databases
Backup

Export all database table Structures

mysqldump -uroot -ppassword -d dbname > db.sql

Export a table structure in the database

mysqldump -uroot -ppassword -d dbname tablename > db.sql

Export all database table structures and Data

mysqldump -uroot -ppassword dbname > db.sql

Export the structure and data of a table in the database

mysqldump -uroot -ppassword dbname tablename > db.sql

Export some data

-- Where = "condition" mysqldump-uroot-ppassword dbname tablename-w "condition"> db. SQL

-W or-where must be enclosed by double quotation marks.

Note:
Exporting data is not required-d

The following error may occur:

Mysqldump: Got error 1044: Access denied for use 'zndw' @ 'localhost' to database 'scilibrary 'when doing LOCK TABLES

This error occurs because the user does notlock tablesPermission.

Solution
(1) Assign the userlock tablesPermission
(2) Add--skip-lock-tables, Such

mysqldump -uroot -ppassword dbname --skip-lock-tables > db.sql
Import
source xxx.sql

(1) The statement cannot be followed by a semicolon;
(2) The user must have insert and other permissions.

Copyright Disclaimer: This article is an original article by the blogger and cannot be reproduced without the permission of the blogger.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.