Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

MySQL uses mysqldump backup and mysql command to restore

2025-04-02 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)06/01 Report--

The following mainly brings you MySQL using mysqldump backup and mysql command restore, I hope these contents can bring you practical use, this is also the main purpose of my editing MySQL using mysqldump backup and mysql command to restore this article. All right, don't talk too much nonsense, let's just read the following.

First, use mysqldump to back up 1. Backup database basic syntax mysqldump-u user-h host-p password dbname [tbname, [tbname...]] > filename.sql

Example:

C:\ > mysqldump-u root-p booksdb > c:\ backup\ booksdb_20110101.sqlEnter password: * * 2. Use mysqldump to back up a table in the database mysqldump-u user-p123-d booksDB books > c:\ backup\ books_20110101.sql

-u user specifies the user name

-p123 specify password

-d booksDB only backs up the table structure and does not back up data. Do not specify-d, that is, backup table structure also backup table data

-- skip-extended-insert exports multiple insert statements

3. Backing up multiple databases using mysqldump

If you back up multiple databases, you need to use the-- databases parameter in the following format

Mysqldump-u user-h host-p-- all-- databases > filename.sql

You do not need to specify a database name when using the-- all--databases parameter

For example, to back up all the databases in the CVM, enter the following statement:

Mysqldump-u root-p-- all--databases > c:\ backup\ alldbinMySQL.sql II, restore using the mysql command

For files that have been backed up that contain create and insert statements, you can import them into the database using the mysql command

Mysql-u user-p [dbname]

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Database

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report