[英]How to create Batch file to execute sql script
I'm in the last step to create an installation of a java swing application with inno setup. 我正在使用inno setup创建一个java swing应用程序的安装的最后一步。 In this installation I call a batch file that get the installation of mysql .
在这个安装中,我调用一个批处理文件来获取mysql的安装。 My problem is that I want to call a sql script from a batch file, that's what I do but it's doesn't work:
我的问题是我想从批处理文件中调用一个sql脚本,这就是我所做的,但它不起作用:
@echo off
C:\Program Files\MySQL\MySQL Server 5.1\bin\mysql -u root -p password < dbase.sql;
( * 'dbase.sql ' in this script a create the database with tables). (* 'dbase.sql '在此脚本中用表创建数据库)。 *
*
and here I execute that batch file in inno setup: 在这里我在inno设置中执行该批处理文件:
[Run]
Filename: "C:\Documents and Settings\esolutions\Mes documents\dumps\install.bat"; Flags: shellexec waituntilterminated
So when I install the program. 所以当我安装程序时。 I run mysql command line and I find that the script is not executed (no database created)
我运行mysql命令行,发现脚本没有执行(没有创建数据库)
You have to omit the space after -p too. 你也必须在-p之后省略空格。
@echo off
"C:\Program Files\MySQL\MySQL Server 5.1\bin\mysql" -u root -ppassword < dbase.sql;
Change your script as below 更改您的脚本如下
@echo off
"C:\Program Files\MySQL\MySQL Server 5.1\bin\mysql" -u root -p password < dbase.sql;
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.