命令行导出和导入数据库 How to export and import MySQL database using command line Interface...

本文介绍了如何使用命令行界面导出和导入MySQL数据库。包括使用Putty或终端导航到指定目录,通过mysqldump命令导出数据库,以及通过mysql命令与source指令将.sql文件导入到MySQL数据库管理系统中。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

导出  :
To export MySQL database, open putty on Windows or Terminal in either MAC or Linux OS, Go to the directory where you want this file to be stored using following command,
cd /home/myfiles/
 
Then use below command to export a databse,
mysqldump --database --user=root --password your_db_name > export_into_db.sql
 
You will be asked about root password after this command. For windows users who are executing this on their localhost, your password is empty if you ave not set it up. Please direct enter without typing anything.
Now you will get a file named export_into_db.sql in the same directory as you are.
 
导入 :
To import a .sql file you need to log into your mysql DBMS first.
Typein : mysql -u root -p and enter. It will ask you your root user’s password.
First select the database and then use following command to import the file,
mysql>use my_new_db;
mysql>source /home/myfiles/export_into_db.sql
 
Press enter and your import will start.
Enjoy…
Please feel free to post comments if you have any issues.
 
 

原文:http://www.ultechspot.com/mysql/how-export-and-import-mysql-database-using-command-line-interface

转自:命令行导出和导入数据库 How to export and import MySQL database using command line Interface

 

 

 

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值