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

  • 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. – user1240 May 8 '12 at 3:45
  • What's your exact command that you are typing in? – Thomas Stringer May 8 '12 at 12:39
  • what kind of database? – kevinsky May 8 '12 at 13:43
  • Its a Mysql Database I am typing mysql -hIP -uroot -p DN_name < filename.sql – vinny May 8 '12 at 17:48
  • check that your sql command in script propertly ended with ";" or not – sharad vishe Apr 2 '13 at 13:21
3

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

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, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.