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

Mysqldump exports the entire database and recovers the method

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

Share

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

The following content mainly brings you mysqldump to export the entire database and restore methods, the knowledge mentioned, slightly different from books, are summed up by professional and technical personnel in the process of contact with users, with a certain experience sharing value, hoping to bring help to the majority of readers.

Export the entire database and restore

# mysqldump-uroot-p123456-B-A-- events-x | gzip > / opt/bak_$ (date +% F) .sql.gz

# ll / opt/bak_$ (date +% F) .sql.gz

Import the entire database

# cd / opt/

# gzip-d bak_2015-11-04.sql.gz

# mysql-uroot-p123456 / opt/bak_$ (date +% F). Sql.gz

1.2 decompress the database

# gzip-d bak_2016-05-06.sql.gz

1.3 Import the database

1) create an empty database

Mysql > create database bbs

2) Select the database

Mysql > use bbs

3) set database encoding

Mysql > set names utf8

4) Import data

Mysql > source / opt/bak_2016-05-06.sql

1.4 check the imported library file

Mysql > show databases

Mysql > use bbs

Mysql > show tables

Mysql > desc pre_bbsucenter_vars

Method 2:

2.1 Export a database

Mysql-u user name-p password database name

< 数据库名.sql # mysqldump -uroot -p123456 jzh >

/ opt/bakjzh_$ (date +% F) .sql

# mysqldump-uroot-p123456 oldboy > / opt/bakoldboy_$ (date +% F). Sql

2.2 check the exported database

# ll / opt/

-rw-r--r-- 1 root root 1753 May 6 15:13 bakjzh_2016-05-06.sql

-rw-r--r-- 1 root root 3022 May 6 15:15 bakoldboy_2016-05-06.sql

2.3 create an empty database

Mysql > create database jzh

Mysql > create database oldboy

2.4 Import data

# mysql-uroot-p123456 jzh use oldboy

Mysql > show tables

Mysql > desc student

For the above mysqldump export of the entire database and recovery methods, if you need to know more, you can continue to follow our industry promotion, if you need professional answers, you can contact the pre-sales and after-sales on the official website. I hope this article can bring you some knowledge updates.

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