Advertisement
pusatdata

Ekspor Impor Database Localhost via CMD

Apr 24th, 2017
187
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.61 KB | None | 0 0
  1. Go to folder C:\wamp\bin\mysql\MYSQL_VERSION\bin
  2.  
  3. Hit shift + right-click in that folder and select "Open command window here" from the menu that pops up.
  4.  
  5. This will open a command window in the path you are already in, so C:\wamp\bin\mysql\MYSQL_VERSION\bin
  6.  
  7. Enter any of the MySQL commands you like with any of the executables you find in that folder.
  8.  
  9. To export:
  10.  
  11. mysqldump -u db_user -pDB_PASSWORD db_name > /path/to/save/backup_file.sql
  12. To import:
  13.  
  14. mysql -u db_user -p db_name < /path/to/save/backup_file.sql
  15. The user has a password (DB_PASSWORD) and that needs to be directly behind -p without a space. Beware like this the password can be seen by other programs.
  16.  
  17. If you do not specify a password in the command directly after the -p flag and just use the db_name you will be asked to put in the password interactively every time you run the command.
  18.  
  19. =========================================
  20.  
  21. Follow the following steps.
  22.  
  23. Run cmd command
  24. Type c: or d: on command prompt. This will be based on your WAMP server installations.
  25. Assuming you have installed wamp on C: drive.
  26. C:\>cd wamp
  27. C:\wamp>cd bin
  28. C:\wamp\bin>cd mysql
  29. C:\wamp\bin\mysql>cd mysql15.5.8
  30. C:\wamp\bin\mysql\mysql15.5.8>cd bin
  31. C:\wamp\bin\mysql\mysql15.5.8\bin>mysql.exe -u root
  32. Now you'll get mysql command prompt.
  33.  
  34. ** Note Here My MySql version ins 15.5.8 it may change based on your wamp installation. Now you can follow the answer by @Matei. I'm pasting his answer here. Hope this will help you.
  35.  
  36. to export:
  37.  
  38. mysqldump -u username -p databasename > filename.sql
  39. and to Import:
  40.  
  41. mysql -u username -p databasename < filename.sql
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement