2
mysqldump mydatabase < /my/path/to/sqlfile.sql;

This is my command issued. What could be the cause of this syntax error, i'm pretty sure its correct.

I am trying to load an sql file to my database.

Digital Alchemist
  • 2,324
  • 1
  • 15
  • 17
Belmark Caday
  • 1,623
  • 3
  • 21
  • 29

3 Answers3

8

use

mysqldump -u username -p databasename > filename.sql

to export and

mysql -u username -p databasename < filename.sql

to import

Please refer: http://dev.mysql.com/doc/refman/5.6/en/mysqldump.html

Brad Larson
  • 170,088
  • 45
  • 397
  • 571
Sathish D
  • 4,854
  • 31
  • 44
2

Synatax of MySQL dump command is : mysqldump -u -p >

In your case if the username is root then : mysqldump -u root -p mydatabase > /my/path/to/sqlfile.sql;

PSSR
  • 471
  • 1
  • 10
  • 18
1

This might work out!

backup: # mysqldump -u root -p[root_password] [database_name] > dumpfilename.sql

restore:# mysql -u root -p[root_password] [database_name] < dumpfilename.sql

example

mysql -u root -ptmppassword databaseName < /tmp/fileName.sql
Digital Alchemist
  • 2,324
  • 1
  • 15
  • 17