運行的mysqldump時,這是我的代碼:mysqldump的錯誤代碼6通過Java
String cmd = "\"C:\\Program Files\\MySQL\\MySQL Server 5.6\\bin\\mysqldump\" -h www.anonymizeddomain.com -u root -proot anon_thisdb > anon_thisdb.sql\"";
Process proc = Runtime.getRuntime().exec(cmd);
Print(cmd);
InputStream stdin = proc.getInputStream();
InputStreamReader isr = new InputStreamReader(stdin);
BufferedReader br = new BufferedReader(isr);
String line = null;
System.out.println("<OUTPUT>");
while ((line = br.readLine()) != null)
System.out.println(line);
System.out.println("</OUTPUT>");
int exitVal = proc.waitFor();
System.out.println("Process exitValue: " + exitVal);
退出,錯誤代碼爲6和IDK的原因。我從控制檯得到的輸出是這樣的:
<OUTPUT>
-- MySQL dump 10.13 Distrib 5.6.13, for Win64 (x86_64)
--
-- Host: www.anonymizeddomain.com Database: anon_thisdb
-- ------------------------------------------------------
-- Server version 5.5.32-cll-lve
/*!40101 SET @[email protected]@CHARACTER_SET_CLIENT */;
/*!40101 SET @[email protected]@CHARACTER_SET_RESULTS */;
/*!40101 SET @[email protected]@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8 */;
/*!40103 SET @[email protected]@TIME_ZONE */;
/*!40103 SET TIME_ZONE='+00:00' */;
/*!40014 SET @[email protected]@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
/*!40014 SET @[email protected]@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
/*!40101 SET @[email protected]@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
/*!40111 SET @[email protected]@SQL_NOTES, SQL_NOTES=0 */;
</OUTPUT>
Process exitValue: 6
什麼冰棒片我做錯了?
我把字符串中的轉義字符,所以我不會得到錯誤,但我得到的錯誤:\軟糖? :\
[mysqldump從java運行時返回代碼6的可能的重複,但相同的命令從命令行正常工作](http://stackoverflow.com/questions/15463990/mysqldump-returns-code-6-when-run -java-but-the-same-command-works-fine-fro) –