I have a MySQL Database on mt Windows computer. I need to take one database and copy it to another machine. The other machine also runs windows and has MySQL Database. The two machines cannot be connected through internet. What shall I do? How can that be done through USB-card?
问题:
回答1:
Make a export DB Mysqldump in a sql file and copy the sql file to USB card
and import
it into the other machine.Follow the steps it would help you to achieve it
To make mysql dump
for reference see here Sample:
mysqldump -u admin -p passwd DB_Name > file/path/filename.sql
import
the sql
file to the mysql DB
as
sample :
mysql > use DB_Name; mysql >source yourfile.sql
(or)
mysql -u USERNAME -p PASSWORD DATABASE-NAME < file/path/filename.sql
Correct me if 'm wrong
回答2:
The best way it dump your DB as SQL file. And then import on another machine.
mysqldump -uuser -i uutfile.sql -p db_name mysql -uuser -p < uutfile.sql
回答3:
Take the backup (sql dump) of the current database, and execute the backup in the other machine.
回答4:
Export the data with:
mysqldump db_name > backup-file.sql
Use the stick
Import the data with:
mysql -u username -p database < backup-file.sql
回答5:
The MySQL Workbench package has a backup and restore procedure built in to it. The database backup is really just a long SQL file that can be re-played into another database in order to replicate your original data. It can even schedule backups.
There is also the command-line tool mysqldump
that does the same thing but is not as easy to use. If you're doing this frequently you'll want to script it so you don't need to remember the specific command-line options:
mysqldump --single-transaction --quick --user=... --password=... database | gzip -9 > backup.sql.gz gunzip -dc backup.sql.gz | mysql --user=... --password=...