2013-04-17 81 views
0

我有一個大的數據庫轉儲(290mb)。當我從cli使用導入時,一切都好!從bash腳本導入Mysql的錯誤

mysql -u root -piddqd whitestore_com < whitestore_com.sql 

當我使用相同的命令從bash腳本,如:

./build.sh 

這裏是我得到:

?   (\?) Synonym for `help'. 
clear  (\c) Clear the current input statement. 
connect (\r) Reconnect to the server. Optional arguments are db and host. 
delimiter (\d) Set statement delimiter. 
edit  (\e) Edit command with $EDITOR. 
ego  (\G) Send command to mysql server, display result vertically. 
exit  (\q) Exit mysql. Same as quit. 
go  (\g) Send command to mysql server. 
help  (\h) Display this help. 
nopager (\n) Disable pager, print to stdout. 
notee  (\t) Don't write into outfile. 
pager  (\P) Set PAGER [to_pager]. Print the query results via PAGER. 
print  (\p) Print current command. 
prompt (\R) Change your mysql prompt. 
quit  (\q) Quit mysql. 
rehash (\#) Rebuild completion hash. 
source (\.) Execute an SQL script file. Takes a file name as an argument. 
status (\s) Get status information from the server. 
system (\!) Execute a system shell command. 
tee  (\T) Set outfile [to_outfile]. Append everything into given outfile. 
use  (\u) Use another database. Takes database name as argument. 
charset (\C) Switch to another charset. Might be needed for processing binlog with multi-byte charsets. 
warnings (\W) Show warnings after every statement. 
nowarning (\w) Don't show warnings after every statement. 
ERROR 1064 (42000) at line 1: You have an error in your SQL syntax; 
check the manual that  corresponds to your MySQL server version for the right syntax 
to use near 'mysql Ver 14.14 Distrib 5.1.66, for debian-linux-gnu (x86_64) 
using readline 6.' at line 1 

我不知道爲什麼我得到這個錯誤,沒有例如「mysql Ver 14.14 Distrib 5.1.66」,用於使用readline 6的轉儲文件 中的debian-linux-gnu(x86_64)。「

回答

0

嘗試在文本編輯器中打開whitestore_com.sql並檢查前幾行。

它看起來應該註釋掉.sql文件開頭的一些文本。

它打開了mysql連接,但是從whitestore_com.sql得到的命令不是有效的SQL語句。

+0

正如我所說的在sql文件中沒有像'mysql Ver ...'這樣的文本。 – kirugan

+0

該命令是相同的,不同之處 - 我如何調用它 – kirugan