如何在MySQL中使用命令行导入SQL文件?

生来就可爱ヽ(ⅴ<●) 提交于 2021-02-16 08:54:44

问题:

I have a .sql file with an export from phpMyAdmin . 我有一个.sql文件,从phpMyAdmin导出。 I want to import it into a different server using the command line. 我想使用命令行将其导入到其他服务器中。

I have a Windows Server 2008 R2 installation. 我有Windows Server 2008 R2安装。 I placed the .sql file on the C drive , and I tried this command 我将.sql文件放在C驱动器上 ,并尝试了此命令

database_name < file.sql

It is not working. 它不起作用。 I get syntax errors. 我收到语法错误。

  • How can I import this file without a problem? 如何顺利导入该文件?
  • Do I need to create a database first? 我需要先创建一个数据库吗?

解决方案:

参考一: https://stackoom.com/question/1C7nV/如何在MySQL中使用命令行导入SQL文件
参考二: https://oldbug.net/q/1C7nV/How-do-I-import-an-SQL-file-using-the-command-line-in-MySQL
标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!