mysql export/import database - Notes

mysql export/import database

Use the mysqldump utility to create a backup of you database.

  1. Open up a Windows command prompt.
    • Click Start -> Run
    • Enter “cmd” into the dialog box and click the “OK” button.
  2. Change the directory to the following to access the mysqldump utility.
    • cd C:\Program Files\MySQL\MySQL Server 5.5\bin
  3. Create a dump of your current mysql database or table (do not include the bracket symbols [ ] in your commands).
    • Run the mysqldump.exe program using the following arguments:
    • mysqldump.exe –e –u[username] -p[password] -h[hostname] [database name] > C:\[filename].sql
  4. If you supplied all the arguments properly, the program will connect to your current mysql server and create a dump of your whole database in the directory you specified in your C:\ directory. There is no message that will indicate the dump has been completed, the text cursor will simply move to the next line.

import database

mysql -u username -p -h localhost DATA-BASE-NAME < data.sql

mysql export/import database