views:

407

answers:

2

How to export / import database in mysql through comman line,

mysql system config ,

WAMPSERVER server installed .

OS WINDOWS

The advise for my local host , not an live hosting...

Thanks

A: 

use mysqldump -u username -p databasename > filename.sql to export and mysql -u username -p databasename < filename.sql to import

matei
This is the first time am doing the export using sql, Tell my my sql can place any where , that is my file may in desktop or d drive , or is there any particular location i have past my sql file
Bharanikumar
![alt text][1] [1]: http://img19.imageshack.us/img19/6106/mysqlcmdprob.jpg
Bharanikumar
plz look this screenshot
Bharanikumar
you can place your file anywhere as long as you have your mysql bin folder in your PATH. the alternative is to call the mysql and mysqldump executables using the full path to them (e.g F:\wamp\bin\mysql\mysql5.1.36\bin\mysql and F:\wamp\bin\mysql\mysql5.1.36\bin\mysqldump) . In your screenshot the problem is that you didn't supply the username and password when starting the mysql program (you supply it with: mysql -u USERNAME -p <enter> and then type your password)
matei
A: 

To backup:

mysqldump -u user -p DATABASE > backup.sql

To import:

mysql -u user -p DATABASE < backup.sql

Francisco Soto