我的代码是这样的:
public static void load() {
String root = "root";
String pass = "root";
String filepath = "E:\\MySQl\\yehuoneng.sql";
String stmt1 = "cmd /c"+" mysqladmin -u " + root + " -p" + pass+ " create yy";
String stmt2 = " cmd /c mysql -u " + root + " -p " + pass + " tt < "+ filepath;
try {
Runtime.getRuntime().exec(stmt1);
Runtime.getRuntime().exec(stmt2);
System.out.println("数据已从 " + filepath + " 导入到数据库中");
} catch (IOException e) {
e.printStackTrace();
}
}
然后中main方法里调用load方法,没有报错,mysql中没有新建的数据库,并且我自己建了数据库yy然后进行调用该方法也没有任何数据,请问高手,这是怎么回事?哪里出了问题?我在网上也查了很久,也没查出原因
public static void load() {
String root = "root";
String pass = "root";
String filepath = "E:\\MySQl\\yehuoneng.sql";
String stmt1 = "cmd /c"+" mysqladmin -u " + root + " -p" + pass+ " create yy";
String stmt2 = " cmd /c mysql -u " + root + " -p " + pass + " tt < "+ filepath;
try {
Runtime.getRuntime().exec(stmt1);
Runtime.getRuntime().exec(stmt2);
System.out.println("数据已从 " + filepath + " 导入到数据库中");
} catch (IOException e) {
e.printStackTrace();
}
}
然后中main方法里调用load方法,没有报错,mysql中没有新建的数据库,并且我自己建了数据库yy然后进行调用该方法也没有任何数据,请问高手,这是怎么回事?哪里出了问题?我在网上也查了很久,也没查出原因
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货