Home >Database >Mysql Tutorial >mysql数据库的导入和导出_MySQL

mysql数据库的导入和导出_MySQL

WBOY
WBOYOriginal
2016-06-01 13:08:47999browse

导出数据库:

  1. 导出整个数据库结构和数据
    • mysqldump -h[ip] -u[user] -p[password] [database_name] > [table_name].sql;
  2. 导出单个数据表结构和数据
    • mysqldump -h[ip] -u[user] -p[password]  [database_name] [table_name] > [table_name].sql;
  3. 导出整个数据库结构(不包含数据)
    • mysqldump -h[ip] -u[user] -p[password] -d [database_name] > [table_name].sql;
  4. 导出单个数据表结构(不包含数据)
    • mysqldump -h[ip] -u[user] -p[password] -d [database_name]   [table_name] > [table_name].sql;
  5. 导出数据不导出结构 [如果出现锁表,加上--skip-lock-tables]
    • mysqldump -h[ip] -u[user] -p[password]   -t  [database_name]  [-w "pay_time>='2013-08-14 00:00:00'"]  > xxx.sql
导入数据:如数据库不存在,先创建数据库。若存在,执行source .../xxx.sql

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn