0

I am new to database and have just started to learn MYSQL. I have downloaded a sql file called rating.sql and would like to import it to the MYSQL database installed on the local machine. The operation system is Windows 7. The path for the sql file is:

"E:\rating.sql".

I am using the following commands in the MySQL Command Line Client

mysql>use database_name;
mysql>source E:\rating.sql;

The system gives the following error message:

ERROR 1049 <42000>: Unknown database 'ating.sql'

It is definitely something related to the path. Can anyone explain how this error is generated?Thanks

3
  • 1
    You need to escape the \ Commented Feb 22, 2014 at 21:17
  • @SudiptaChatterjee - show how to do it.... Commented Feb 22, 2014 at 21:18
  • @NigelNquande I am using Eclipse and has connected MySQL DB to Eclipse using a connector. I am doing all query in the Eclipse environment. Is this normal in industry or everybody in Industry uses the MySQL Workbench? Commented Feb 22, 2014 at 21:35

2 Answers 2

3

You have use \ and this is an escape character (omits the immediate following character. So to fix this you can use \ instead.

mysql>resour E:\\rating.sql;
Sign up to request clarification or add additional context in comments.

2 Comments

@NigelNquande my level is not high enough to allow me to do that. It requires level 15 and I am only 11.
No, that's to give rep. To accept the answer just click the tick not the arrows.
1

Mysql recognises \r as an escape for a carriage return character.

To make it simpler, could you rename your file to something beginning with another letter...mustn't be b n r t or z...

1 Comment

Renaming the file isn't the right solution, to my mind. Escaping the path separator is a better solution.

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.