将MySQL表还原回数据库 [英] Restoring a MySQL table back to the database
问题描述
我无法从命令行将MySQL表还原回数据库.进行表备份与mysqldump一起使用.对数据库进行备份和还原也可以正常工作.我用过:
I have a trouble in restoring MySQL table back to the database from command line. Taking backup of a table is working with mysqldump.Taking backup and restoring of a database is also working properly. I have used:
mysql -uroot -p数据库名称表名称< path \ TableName.sql
mysql -uroot -p DatabaseName TableName < path\TableName.sql
预先感谢
推荐答案
嗯,我想我在这里看到了问题.
Ah, I think I see the problem here.
您的备份脚本看起来不错. tbl_name
可以作为可选的第二个参数正常工作.
Your backup script looks fine. tbl_name
works correctly as the optional 2nd argument.
要还原,您只需运行
mysql -uroot -p DatabaseName < path\TableName.sql
运行man mysql
会为您显示正确的参数和选项
Running man mysql
would have shown you the correct arguments and options
mysql [选项] db_name
mysql [options] db_name
由于您的备份脚本仅包含一个表,因此只有该表将被还原到您的数据库中.
As your backup script only contains one table, only that table will be restored into your database.
这篇关于将MySQL表还原回数据库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!