Thursday, July 18, 2013

[MySQL][tutorial] MySQL export sql file with command line on Windows (with pictures)

If you are using command but not phpMyAdmin to control your database, in windows.
there is a method for you to export your database by sql command.

 Firstly you need open the windows'command prompt (cmd.exe)
1) Click Windows Start menu
2) search cmd.exe and run it.

 

Then it would appear the command prompt,


And then copy the sql statement below and change the text in red to your text:

mysqldump -u username -p databaseName > filename.sql
For my case, my command is :

mysqldump -u root -p myswe > dump.sql


After input the command, it would ask you the password to assess mysql database.
And then it would be save automatically to the directory where you run command .

For my case,
my SQL is place here : C:\Users\Xenia


1 comment :

  1. 我通常在 Linux 上 dump,在 Linux 或 Cygwin 上,可以用 pip,即 | ,直接壓縮或加密埋,e.g. mysqldump -u root -p myswe | xz -9 > dump.sql.xz
    當中 xz 可換成 gzip、bzip2 等

    ReplyDelete