1

I am trying to import a .sql file in to my local database. whenever i type the command to import the file, I get an error ERROR at line 1: Unknown command '\S'.

This is the first line of the sql file update product set aka = 'Trojan.gen,Backdoor.Win32.Agent.bisn' where id = 156701

5
  • The file must be in ASCII format. Also, SQL is pretty bad at telling you where the line actually ends, so look in the file for a \S string. Commented May 8, 2012 at 3:45
  • What's your exact command that you are typing in? Commented May 8, 2012 at 12:39
  • what kind of database? Commented May 8, 2012 at 13:43
  • Its a Mysql Database I am typing mysql -hIP -uroot -p DN_name < filename.sql Commented May 8, 2012 at 17:48
  • check that your sql command in script propertly ended with ";" or not Commented Apr 2, 2013 at 13:21

2 Answers 2

5

Since you have an ASCII file, the script could be giving problems because it is came from a Windows machine and you are attempting to load it into mysql on a Linux machine.

You may want to try one of two things:

  • Using the mysql client in Windows, load the data remotely.
  • Use sql client in raw mode in one of two ways
    • mysql -hIP -r -uroot -p DN_name < filename.sql
    • mysql -hIP -B -uroot -p DN_name < filename.sql
1
  • 1
    ERROR 2005 (HY000): Unknown MySQL server host 'IP' Commented Jun 19, 2015 at 22:06
2

I think you need to use path/to/file.sql instead of path\to\file.sql

and "database < path/to/file.sql" didn't work for me for some reason - I had to use "use database;" and "source path/to/file.sql;".

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.