mysqldump [OPTIONS] database [tables]
mysqldump [OPTIONS] --databases [OPTIONS] DB1 [DB2DB3...]
mysqldump [OPTIONS] --all-databases [OPTIONS]
mysqldump –u root –p test student >c:/student.sql
mysqldump –u root –p test mysql > c:/multidb.sql
mysqldump –u root –p –all-databases > c:/all.sql
MyISAM存储引擎的的表适用
大版本号相同数据库数据库文件格式相同
Linux下备份,perl脚本。
mysql –u root –p [dbname] < backup.sql
mysql –u root –p < all.sql
mysqldump –h host1 –u root –password=password1 –all-databases | mysql –hhost2 –u root –password=password2
mysqldump
1、工具,如MS SQLServer的数据库迁移工具
2、dump出sql语句,然后手工修改create语句
SELECT [列名] FROM table [WHERE语句]
INTO OUTFILE ‘目标文件’ [OPTION]
能根据条件导出数据
mysqldump –u root –pPassword –T 目标目录或文件dbname table [option];
--fields-terminated-by=...,
--fields-enclosed-by=...,
--fields-optionally-enclosed-by=...,
--fields-escaped-by=...,
--fields-terminated-by=...
导出的是txt + sql文件
mysql –u root –pPassword –e “sql”dbname > c:/sql.txt
mysql –u root –pPassword--xml | -X -e “sql”dbname >c:/sql.txt
mysql –u root –pPassword --html |-H -e “sql”dbname > c:/sql.txt
LOAD DATA[LOCAL] INFILE file INTO TABLE table [OPTION]
LOAD DATA INFILE C:/student.txt INTO TABLE student [OPTION]
mysqlimport –u root –pPassword [--LOCAL] dbname file [OPTION]