Mysql mysqldump工具导入导出

1. 数据库导出

只导出数据库结构:
mysqldump -h localhost -u root -p -d hly > hly.bak

导出数据库结构及内容:
mysqldump -h localhost -u root -p hly > hly.bak

导出全部数据库:
mysqldump -h localhost -u root -p --all_databases -C >all_database.sql

导出单个表:
mysqldump -h localhost -u root -p hly  duck_cust> duck_cust.bak


--add-drop-database Add a DROP DATABASE before each create.
--add-drop-table    Add a DROP TABLE before each create.
                      (Defaults to on; use --skip-add-drop-table to disable.)
--add-drop-trigger  Add a DROP TRIGGER before each create.
--add-locks         Add locks around INSERT statements.


2. 导入数据:

create database hlybbb;
show databases;
use hlybbb;
show tables;
source /dbfile/mysqldmp/hly.bak
show tables;
 

你可能感兴趣的:(Mysql)