Copying MySQL InnoDB Files

I know that copying mySQL InnoDB files (frm, etc.) is causing problems. But what if I copy the entire MSYSQL directory as is? bin, data, docs, etc. they will work? I believe this should work. I'm right?

I do not think MySQL does anything outside the MySQL folder unless explicitly installed.

For those who wonder why I need this, I create intranet applications, and I usually do a simple 1 click on WINDOWS BASED INSTALLERS for these things. This means preparing state, WAMP / XAMPP SERVER configurations, configurations and everything on a dummy machine, and then a snapshot.

+4
source share
3 answers

From the command line, backup to SQL file:

mysqldump -u username -p -lock-tables DB1> database-backup.sql

for multiple databases

mysqldump -u username -p -lock-tables --databases DB1 DB2 DB3 ...> database-backup.sql

for all databases

mysqldump -u username -p -lock-tables -all-databases> database-backup.sql

use of "-lock-tables" to prevent access to the database when flushing.

To import the database:

mysql -u username -p DB1 <backup.sql databases

for multiple databases:

mysql -u username -p <database backup.sql

+5
source

Yes, you can back up the database using this approach, but you need to stop the server before doing this, or the risk of inconsistent data. If you only have a MyISAM table, you can usually FLUSH TABLES WITH READ LOCK using FLUSH TABLES WITH READ LOCK , copy the directory, and UNLOCK TABLES .

See http://dev.mysql.com/doc/mysql-backup-excerpt/5.0/en/backup-methods.html for details.

+6
source

For InnoDB tables, there is one log file inside the mysql -> data folder. Copy the log file "ibdata1" inside your data folder, the newly installed Phpmyadmin will also display innodb tables. Otherwise, only MyISAM tables will be displayed.

But you need to be careful in one case, if you already have the ibdata1 file in your current data folder, replacing the ibdata1 file from the backup may cause problems with the current InnoDB tables, but if you install your backup database on a newly installed Xampp / Wamp, it will work.

+1
source

All Articles