0

Currently I am use Wamp server and PHP Platfrom and we want sql dump for my database; I am used below command for export/dump of MYSQL database.

1.mysql> mysqldump database1 > d:/database2.sql;
2.mysql> mysqldumo database1 > d:\database2.sql;

Both commands are showing below error on my local system and server.

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 'mysqldump database1 > d:/database2.sql' at line 1

Any one know, how can we resolve this issue?

Thanks.

v_kovit_v
  • 34
  • 6

3 Answers3

1

mysqldump is a program independent of the mysql program, you need to run it directly from your shell, not from inside the mysql program.

See this answer for more information: How to use MySQL dump from a remote machine

Community
  • 1
  • 1
duellsy
  • 8,497
  • 2
  • 36
  • 60
1

Command should be run from command prompt/Unix Shell.

Open Command Prompt Go to Path where you have installed MySQL in your System/Server. e.g.

  • You have installed MySQL at C:\mysql\ Then
  • Go to cd C:\mysql\bin Press for Windows
  • Go to cd /var/lib/mysql/bin ( May be different Path in Linux Machine/Server )

Then Type the Following Command to Run SQL Dump

For Windows

mysqldump --host=localhost -u root -p database1 > D:/database1.sql
mysqldump --host=localhost -u root -p database2 > D:/database2.sql

For Linux

mysqldump --host=localhost -u root -p database1 > /var/backup/database1.sql
mysqldump --host=localhost -u root -p database2 > /var/backup/database2.sql
Ashwin Parmar
  • 3,025
  • 3
  • 26
  • 42
0

Please go through URL, that will might help you

http://technologiessolution.blogspot.in/2013/09/export-and-import-mysql-database-in.html

This link will show how to Export and Import database with mysqldump.

Nikunj K.
  • 8,779
  • 4
  • 43
  • 53