Ekspor Impor Database Localhost via CMD
pustakakoran Apr 24th, 2017 122 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
- Go to folder C:\wamp\bin\mysql\MYSQL_VERSION\bin
- Hit shift + right-click in that folder and select "Open command window here" from the menu that pops up.
- This will open a command window in the path you are already in, so C:\wamp\bin\mysql\MYSQL_VERSION\bin
- Enter any of the MySQL commands you like with any of the executables you find in that folder.
- To export:
- mysqldump -u db_user -pDB_PASSWORD db_name > /path/to/save/backup_file.sql
- To import:
- mysql -u db_user -p db_name < /path/to/save/backup_file.sql
- 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.
- 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.
- Follow the following steps.
- Run cmd command
- Type c: or d: on command prompt. This will be based on your WAMP server installations.
- Assuming you have installed wamp on C: drive.
- C:\>cd wamp
- C:\wamp>cd bin
- C:\wamp\bin>cd mysql
- C:\wamp\bin\mysql>cd mysql15.5.8
- C:\wamp\bin\mysql\mysql15.5.8>cd bin
- C:\wamp\bin\mysql\mysql15.5.8\bin>mysql.exe -u root
- Now you'll get mysql command prompt.
- ** 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.
- to export:
- mysqldump -u username -p databasename > filename.sql
- and to Import:
- mysql -u username -p databasename < filename.sql
RAW Paste Data