babbaggeii
babbaggeii

Reputation: 7737

Can't export mysql database

I've tried this:

mysqldump -u username -p database_name > dump.sql;

and

mysqldump -u username -ppassword database_name > dump.sql; 

But all I get is this error:

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 -u username -p database_name > dump.sql' at line 1

I've confirmed that the database exists, andCan anyone point me towards what's going on or how to troubleshoot it?

Upvotes: 1

Views: 2144

Answers (3)

Raza Hussain
Raza Hussain

Reputation: 762

Use this one

mysqldump --single-transaction -u root -p db > db.sql

Upvotes: 0

duffymo
duffymo

Reputation: 308763

My glasses might need adjustment, but I think you need two dashes on those command line arguments:

http://dev.mysql.com/doc/refman/5.1/en/mysqldump.html

Upvotes: 0

Ed Heal
Ed Heal

Reputation: 59997

mysqldump is a command line interface and not a part of SQL. Run the command from bash (or similar).

Upvotes: 4

Related Questions