Copying MySQL Database to another machine

前端 未结 5 1768
予麋鹿
予麋鹿 2020-12-19 19:10

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

相关标签:
5条回答
  • 2020-12-19 19:42

    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
    
    0 讨论(0)
  • 2020-12-19 19:50

    Take the backup (sql dump) of the current database, and execute the backup in the other machine.

    0 讨论(0)
  • 2020-12-19 19:53
    1. Export the data with:

      mysqldump db_name > backup-file.sql

    2. Use the stick

    3. Import the data with:

      mysql -u username -p database < backup-file.sql

    0 讨论(0)
  • 2020-12-19 20:00

    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=... 
    
    0 讨论(0)
  • 2020-12-19 20:03

    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

    0 讨论(0)
提交回复
热议问题