且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

通过Java以编程方式导入(mysql)数据库转储

更新时间:2023-01-11 18:32:19

你可以开始一个新的进程从java和执行此命令,如果你有访问mysql可执行文件,无论你在哪里运行导入。类似这样:

You could start a new process from java and execute this command if you have access to the mysql executable wherever you are running the import. Something like this:

Runtime rt = Runtime.getRuntime();
Process pr = rt.exec("mysql -p -h ServerName DbName < dump.sql");