hkguile
hkguile

Reputation: 4359

import a sql file using mysql command line tools

here is my command to import a sql file into mysql using command line

mysql -p eshop < c:\xampp\mysql\eshop.sql

But there is error message

Error:
Unknown command '\x'

Error:
Unknown command '\m'

Error:
Unknown command '\e'

Anyone knows what's wrong with the command?

Upvotes: 2

Views: 338

Answers (2)

PS Kumar
PS Kumar

Reputation: 2426

Try this, I think this may help you.

mysql -u username -p database_name < file.sql

check mysql Options. Don't use \ (slash) use / (slash) to mention the file path.

Upvotes: 1

avisheks
avisheks

Reputation: 1180

On Windows, the pathname separator character is ‘\’, but MySQL treats the backslash as the escape character in strings. To deal with this issue, write separators in Windows pathnames either as ‘/’ or as ‘\\’. To load a file named C:\mydata\data.txt, specify the filename as shown in either of the following statements:

mysql  <database_name> < ‘C:/mydata/data.txt’
mysql  <database_name> < ‘C:\\mydata\\data.txt’

Upvotes: 0

Related Questions