mysqldump tool to quickly backup and restore Mysql database

mysqldump Tools to quickly backup and restore Mysql database

Use navicate export the database is too slow, so it is best directly on the server, enter the mysql installation directory, run cmd, using the mysqldumptool to export.

mysqldump A  MySQL built-in logical backup tool . Its principle is backed up by protocol connection to  MySQL the database, the data will need to be backed out of the query, the query out to convert the data into a corresponding insert statement, when we need to restore the data, as long as the implementation of these  insert statements, you can restore the corresponding data .

details as follows:

First, export the entire database

mysqldump -u username -p database name> name of the exported file
Example: mysqldump -u root -p sss> C : /Users/ThinkPad/Desktop/sqltest/sss.sql ( specific directory defined according to the actual situation)

root: connection name

sss: name of the database

------------------------------------------------------------------------------------------------------------------------------------------------------------------------

Second, import database

Premise: a database built in advance, otherwise you can not find a database error.

By source statement
is as follows:

mysql -u root-p

use sss;

set names utf8; # here is the root of your database character set to be introduced to a character set.

source C:/Users/ThinkPad/Desktop/sqltest/sss.sql;

carry out.

 

More Reference: https://www.cnblogs.com/markLogZhu/p/11398028.html

 

Published 38 original articles · won praise 3 · Views 1103

Guess you like

Origin blog.csdn.net/S_L__/article/details/104627476