Gapchoos
Gapchoos

Reputation: 1422

How to backup and restore in MySQL 5.2?

This is the command I used:

mysql> mysql -u root -p -h HOST sample < mysqldump.sql;

But I encountered an error as follows:

ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'mysql -u root -p -h HOST sample < mysqldump.sql' at line 1

Hope you can help me out?

Upvotes: 1

Views: 313

Answers (3)

Omesh
Omesh

Reputation: 29121

Open mysql terminal or konsole and then go to the directory where mysqldump.sql file is present. try:

shell> cd /file_path/;
shell> ls -al mysqldump.sql;

It should display your file. Also you dont need to specify HOST if you are logged on to the same server.

shell> mysql -u root -p sample < mysqldump.sql;

Upvotes: 1

triclosan
triclosan

Reputation: 5724

from client you can run \. mysqldump.sql but i think first variant is preferable.

Upvotes: -1

JJJ
JJJ

Reputation: 33153

That's the command you should give in the command line, not in MySQL itself.

Upvotes: 2

Related Questions