转贴:Mysql 数据导入(import)/导出(export)- mysqldump命令

原文来自:http://www.clockwatchers.com/mysql_dump.html


MySQL Tutorial - Import or Export A Database

This tutorial section deals with mysqldump which is a tool to import and export MySQL databases.

It can be used to back up a database or to move database information from one server to another.

1. Export A MySQL Database

This example shows you how to export a database. It is a good idea to export your data often as a backup.


# mysqldump -u username -ppassword database_name > FILE.sql

 

Replace usernamepassword and database_name with your MySQL username, password and database name.

File FILE.sql now holds a backup of your database, download it to your computer.

2. Import A MySQL Database

Here, we import a database. Use this to restore data from a backup or to import from another MySQL server.

Start by uploading the FILE.sql file to the server where you will be running this command.


# mysql -u username -ppassword database_name < FILE.sql

Replace the parts in red with your own information.

This powerful, easy to use command has many uses. Let's say you wanted to switch web hosting providers.

Simply export your data on the old provider's server and import it on your account with the new host.

 

 

 

###########################################################

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值